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 # Gcommit-cli
Git CLI Assistant is a command-line application (CLI) that facilitates the management of changes in Git repositories. 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. This tool provides an intuitive interface for performing common Git actions efficiently.
@ -27,7 +27,7 @@ Install the CLI globally
## Usage ## Usage
In your console, just type: In your console, just type:
```bash ```bash
:~$ gcommit-cli :~$ gcommit
``` ```
## Contribution ## 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. 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. This project is licensed under the MIT License. For more details, see the LICENSE file.
## Screenshots ## 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/user-attachments/assets/4b5ec074-3ce3-401e-9579-4fe54a053261)
![image](https://github.com/MrDiro/gcommit-cli/assets/77121383/7fbf4a29-5058-4f5a-befe-299e6b50a0cc)

View File

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

View File

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