-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎉 init: an opinionated git commit messages helper
- Loading branch information
0 parents
commit 718bd3e
Showing
9 changed files
with
2,535 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": "@antfu", | ||
"ignorePatterns": [ | ||
"lib/" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Create Tag on Version Update | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'package.json' | ||
|
||
jobs: | ||
create-tag: | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' | ||
|
||
- name: Check for version update | ||
id: check-version | ||
run: | | ||
CURRENT_VERSION=v$(node -p "require('./package.json').version") | ||
PREVIOUS_VERSION=$(git describe --tags $(git rev-list --tags --max-count=1) 2>/dev/null || v0.0.0) | ||
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT | ||
echo "previous_version=$PREVIOUS_VERSION" >> $GITHUB_OUTPUT | ||
echo "Current version is $CURRENT_VERSION" | ||
echo "Previous version is $PREVIOUS_VERSION" | ||
- name: Create tag if version updated | ||
if: ${{ steps.check-version.outputs.current_version != steps.check-version.outputs.previous_version }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
echo "Creating tag for version ${{ steps.check-version.outputs.current_version }}" | ||
git tag ${{ steps.check-version.outputs.current_version }} | ||
git push origin ${{ steps.check-version.outputs.current_version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
lib | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
# gitcm | ||
|
||
`gitcm` is an opinionated git commits message helper. | ||
|
||
## Installation | ||
|
||
```bash | ||
npm install -g gitcm | ||
``` | ||
|
||
## Usage | ||
|
||
For example, you can use the following command: | ||
|
||
```bash | ||
gitcm init "init commit" | ||
``` | ||
|
||
Which will execute the following command: | ||
|
||
```bash | ||
git commit -m ":tada: init: init commit" | ||
``` | ||
|
||
## More Examples | ||
|
||
We provide an interactive cli tool. | ||
|
||
```bash | ||
$ gitcm | ||
✔ What is the commit type? (required) | ||
feat | ||
|
||
✔ What is the commit scope? (optional) | ||
Enter commit scope | ||
|
||
✔ What is the commit for? (required) | ||
test | ||
|
||
✔ Are you sure to execute this command? (git commit -m ":sparkles: feat: test") | ||
Yes | ||
``` | ||
|
||
You can also set the type, scope and body with command-line arguments: | ||
|
||
```bash | ||
# git commit -m ":sparkles: feat(test): test commit" | ||
$ gitcm feat test "test commit" | ||
|
||
# git commit -m ":sparkles: feat: test commit" | ||
$ gitcm feat "test commit" | ||
``` | ||
|
||
You can find help with the following command: | ||
|
||
```bash | ||
gitcm --help | ||
``` | ||
|
||
## Configuration | ||
|
||
When you use this command for the first time, it writes the configuration in `~/.config/gitcm/config.json`. | ||
|
||
The default configuration is as follows: | ||
|
||
```json | ||
{ | ||
"showIcon": true, | ||
"verbose": false, | ||
"data": { | ||
"feat": { | ||
"display": "feat", | ||
"emoji": ":sparkles:" | ||
}, | ||
"chore": { | ||
"display": "chore", | ||
"emoji": ":wrench:" | ||
}, | ||
"refactor": { | ||
"display": "refactor", | ||
"emoji": ":hammer:" | ||
}, | ||
"fix": { | ||
"display": "fix", | ||
"emoji": ":bug:" | ||
}, | ||
"hotfix": { | ||
"display": "hotfix", | ||
"emoji": ":ambulance:" | ||
}, | ||
"docs": { | ||
"display": "docs", | ||
"emoji": ":books:" | ||
}, | ||
"i18n": { | ||
"display": "i18n", | ||
"emoji": ":globe_with_meridians:" | ||
}, | ||
"build": { | ||
"display": "build", | ||
"emoji": ":building_construction:" | ||
}, | ||
"version": { | ||
"display": "version", | ||
"emoji": ":bookmark:" | ||
}, | ||
"test": { | ||
"display": "test", | ||
"emoji": ":rotating_light:" | ||
}, | ||
"ci": { | ||
"display": "ci", | ||
"emoji": ":construction_worker:" | ||
}, | ||
"cd": { | ||
"display": "cd", | ||
"emoji": ":construction_worker:" | ||
}, | ||
"workflow": { | ||
"display": "workflow", | ||
"emoji": ":construction_worker:" | ||
}, | ||
"wip": { | ||
"display": "wip", | ||
"emoji": ":construction_worker:" | ||
}, | ||
"init": { | ||
"display": "init", | ||
"emoji": ":tada:" | ||
}, | ||
"style": { | ||
"display": "style", | ||
"emoji": ":art:" | ||
}, | ||
"docker": { | ||
"display": "docker", | ||
"emoji": ":whale:" | ||
}, | ||
"revert": { | ||
"display": "revert", | ||
"emoji": ":rewind:" | ||
}, | ||
"config": { | ||
"display": "config", | ||
"emoji": ":wrench:" | ||
}, | ||
"release": { | ||
"display": "release", | ||
"emoji": ":bookmark:" | ||
}, | ||
"tag": { | ||
"display": "tag", | ||
"emoji": ":bookmark:" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
You can change the configuration by editing this file. | ||
|
||
## License | ||
|
||
MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "gitcm", | ||
"version": "0.1.0", | ||
"description": "An opinionated git commits message helper.", | ||
"bin": { | ||
"gitcm": "lib/index.js" | ||
}, | ||
"scripts": { | ||
"dev": "ts-node src/index.ts", | ||
"build": "tsc", | ||
"publish": "pnpm run build && pnpm publish" | ||
}, | ||
"keywords": ["git", "commit", "message", "cli"], | ||
"author": "", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@antfu/eslint-config": "^0.41.0", | ||
"@types/node": "^20.5.9", | ||
"commander": "^11.0.0", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.2.2" | ||
}, | ||
"dependencies": { | ||
"consola": "^3.2.3" | ||
} | ||
} |
Oops, something went wrong.