fix: commit versioning

This commit is contained in:
MrDiro 2024-07-14 16:51:48 -05:00
parent faebaa970a
commit 0028a86806
4 changed files with 18 additions and 19 deletions

View File

@ -1,4 +1,4 @@
![image](https://github.com/MrDiro/gcommit-cli/assets/77121383/dd1ebba7-f2c3-4db0-ae5f-7f936473a189)
![image](https://github.com/user-attachments/assets/250d8e8d-d641-41fb-a9a4-96bd79bf1bd5)
# 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
![image](https://github.com/MrDiro/gcommit-cli/assets/77121383/d190898c-4ed8-4e2e-8173-f500699f4238)
![image](https://github.com/user-attachments/assets/417c17d6-4156-46f9-9def-1a00ca388227)
![image](https://github.com/MrDiro/gcommit-cli/assets/77121383/427ee8bf-8d62-4440-9a2b-025d78578fbe)
![image](https://github.com/MrDiro/gcommit-cli/assets/77121383/7fbf4a29-5058-4f5a-befe-299e6b50a0cc)
![image](https://github.com/user-attachments/assets/4b5ec074-3ce3-401e-9579-4fe54a053261)

View File

@ -11,6 +11,7 @@ esbuild.build({
target: ['es2022'],
tsconfig: 'tsconfig.json',
logLevel: 'debug',
minify: true,
format: 'cjs',
plugins: [
esbuildPluginClean({ patterns: 'dist/*' }),

View File

@ -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",

View File

@ -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
*~