fix: commit versioning
This commit is contained in:
parent
faebaa970a
commit
0028a86806
10
README.md
10
README.md
@ -1,4 +1,4 @@
|
||||

|
||||

|
||||
# Gcommit-cli
|
||||
Git CLI Assistant is a command-line application (CLI) that facilitates the management of changes in Git repositories.
|
||||
This tool provides an intuitive interface for performing common Git actions efficiently.
|
||||
@ -27,7 +27,7 @@ Install the CLI globally
|
||||
## Usage
|
||||
In your console, just type:
|
||||
```bash
|
||||
:~$ gcommit-cli
|
||||
:~$ gcommit
|
||||
```
|
||||
## Contribution
|
||||
Contributions are welcome! If you find any bugs or have suggestions to improve this application, feel free to open an issue or send a pull request.
|
||||
@ -36,8 +36,6 @@ Contributions are welcome! If you find any bugs or have suggestions to improve t
|
||||
This project is licensed under the MIT License. For more details, see the LICENSE file.
|
||||
|
||||
## Screenshots
|
||||

|
||||

|
||||
|
||||

|
||||
|
||||

|
||||

|
@ -11,6 +11,7 @@ esbuild.build({
|
||||
target: ['es2022'],
|
||||
tsconfig: 'tsconfig.json',
|
||||
logLevel: 'debug',
|
||||
minify: true,
|
||||
format: 'cjs',
|
||||
plugins: [
|
||||
esbuildPluginClean({ patterns: 'dist/*' }),
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gcommit-cli",
|
||||
"version": "1.0.0",
|
||||
"version": "0.0.1",
|
||||
"description": "Git CLI Assistant is a command-line application (CLI)",
|
||||
"author": {
|
||||
"name": "cdairo22",
|
||||
@ -9,7 +9,7 @@
|
||||
"main": "dist/main.bundle.js",
|
||||
"type": "commonjs",
|
||||
"bin": {
|
||||
"gcommit-cli": "node ./dist/main.bundle.js"
|
||||
"gcommit": "node ./dist/main.bundle.js"
|
||||
},
|
||||
"preferGlobal": true,
|
||||
"engines": {
|
||||
@ -17,7 +17,7 @@
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/MrDiro/gcommit-cli.git"
|
||||
"url": "https://github.com/MrDiro/GCommit-CLI.git"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node dist/main.bundle.js",
|
||||
|
@ -6,6 +6,7 @@ import { printTable } from 'console-table-printer';
|
||||
import versionConfig from './version.config.json';
|
||||
import { AppService } from "./app.service";
|
||||
import { Component } from "modilitejs";
|
||||
import path from 'node:path';
|
||||
import { $ } from 'execa';
|
||||
import wait from 'wait';
|
||||
import ora from 'ora';
|
||||
@ -104,7 +105,7 @@ export class AppComponent {
|
||||
}
|
||||
|
||||
private async createGitRepository() {
|
||||
const pkgFile = './package.json';
|
||||
const pkgFile = 'package.json';
|
||||
|
||||
try {
|
||||
this.spinner.start('Analyzing repository ...');
|
||||
@ -132,22 +133,21 @@ export class AppComponent {
|
||||
this.spinner.start(bold('Creating git repository ...'));
|
||||
await wait(600);
|
||||
|
||||
if (!existsSync(pkgFile)) {
|
||||
await $`npm init --init-version ${['0.0.0']} -y`;
|
||||
if (!existsSync(path.resolve(process.cwd(), pkgFile))) {
|
||||
await $`npm init --init-version ${['0.0.1']} -y`;
|
||||
}
|
||||
else {
|
||||
await $`npm version ${['0.0.0']} --allow-same-version`;
|
||||
await $`npm version ${['0.0.1']} --allow-same-version`;
|
||||
}
|
||||
|
||||
const pkg = JSON.parse(
|
||||
readFileSync(pkgFile).toString()
|
||||
readFileSync(path.resolve(process.cwd(), pkgFile)).toString()
|
||||
);
|
||||
|
||||
this.createGitIgnoreFile();
|
||||
await $`git init -b ${[branchName]}`;
|
||||
await $`git add .`;
|
||||
await $`git commit -m ${[`"chore: first commit"`]} -m ${[`"First commit for the project ${pkg['name']}"`]}`
|
||||
await $`npm version ${['minor']}`;
|
||||
await $`git commit -m ${[`"chore: first commit (v0.0.1)"`]} -m ${[`"First commit for the project ${pkg['name']}"`]}`
|
||||
|
||||
this.spinner.succeed('Repository created.');
|
||||
|
||||
@ -173,10 +173,10 @@ export class AppComponent {
|
||||
}
|
||||
|
||||
private createGitIgnoreFile() {
|
||||
const file = './gitignore';
|
||||
const file = '.gitignore';
|
||||
|
||||
if (!existsSync(file)) {
|
||||
writeFileSync(file, `
|
||||
if (!existsSync(path.resolve(process.cwd(), file))) {
|
||||
writeFileSync(path.resolve(process.cwd(), file), `
|
||||
# Backup files created by text editors
|
||||
*~
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user