Skip to content

Commit

Permalink
🎉 Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ize-302 committed Sep 13, 2024
0 parents commit 801fc72
Show file tree
Hide file tree
Showing 14 changed files with 418 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/actions/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release

on:
push:
branches:
- main

permissions:
contents: write
issues: write
pull-requests: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
- id: setup-bun
name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- run: bun install
- run: bun run build
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
*.log
node_modules/
dist/
bin/

# VS Code settings
.vscode/
5 changes: 5 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"branches": [
"main"
]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Adavize Hassan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# gitmo

> A cli tool that adds appropriate emoji to your commit messages based on conventional commits specification
## About

This cli was built as a simpler alternative to [gitmoji-cli](https://github.com/carloscuesta/gitmoji-cli). There is no step to pick an emoji, we simply determine the appropriate emoji to use based on your commit message and include it in your message

## Install

### npm

```bash
npm i -g gitmo
```

## Usage

```bash
gitmo --help
```

```
An cli tool that adds appropriate emoji
to your commit message based on conventional commits specification
Usage
$ gitmo [option] [command]
Options
--commit, -c Add commit using the gitmo
--version, -v Print current installed version
--update, -u Update gitmo cli
Examples
$ gitmo -c
```

## How to commit

```bash
# Note: This should be done after staging your changes
gitmo -c
```

You get this prompt:

```
? commit message › ENTER COMMIT MESSAGE HERE
```

---

### Resources used

- [Conventional commit types](https://github.com/pvdlg/conventional-commit-types)
- [gitmoji-cli](https://github.com/carloscuesta/gitmoji-cli)
7 changes: 7 additions & 0 deletions build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
await Bun.build({
target: 'node',
entrypoints: ['./src/cli.ts'],
outdir: './dist',
minify: true,
external: ['shelljs'],
})
Binary file added bun.lockb
Binary file not shown.
8 changes: 8 additions & 0 deletions jsonconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}
50 changes: 50 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "gitmo",
"version": "1.0.0",
"description": "An cli tool that adds appropriate emoji to your commit message based on conventional commits specification",
"bin": {
"gitmo": "dist/cli.js"
},
"type": "module",
"scripts": {
"build": "bun run build.mjs",
"prepublishOnly": "bun run build",
"clean": "rm -rf dist"
},
"engines": {
"node": ">=18"
},
"files": [
"dist"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/ize-302/gitmo.git"
},
"keywords": [
"emoji",
"conventional commit"
],
"author": {
"name": "ize-302",
"email": "[email protected]",
"url": "https://ize-302.dev"
},
"bugs": {
"url": "https://github.com/ize-302/gitmo/issues"
},
"homepage": "https://github.com/ize-302/gitmo",
"dependencies": {
"meow": "^13.2.0",
"prompts": "^2.4.2",
"shelljs": "^0.8.5"
},
"devDependencies": {
"@types/bun": "latest",
"@types/prompts": "^2.4.9",
"@types/shelljs": "^0.8.15",
"typescript": "^5.6.2"
},
"module": "index.ts"
}
28 changes: 28 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env node
import meow from "meow";
import FLAGS from "@/constants/flags.js";
import { handleCommand } from "@/utils/handleCommand.js";

const cli = meow(
`
Usage
$ gitmo [option] [command]
Options
--${FLAGS.COMMIT}, -c Add commit using the gitmo
--${FLAGS.VERSION}, -v Print current installed version
--${FLAGS.UPDATE}, -u Update gitmo cli
Examples
$ gitmo -c
`,
{
importMeta: import.meta,
flags: {
[FLAGS.COMMIT]: { type: "boolean", shortFlag: "c" },
[FLAGS.HELP]: { type: "boolean", shortFlag: "h" },
[FLAGS.UPDATE]: { type: "boolean", shortFlag: "u" },
[FLAGS.VERSION]: { type: "boolean", shortFlag: "v" },
},
}
);

handleCommand(cli);
57 changes: 57 additions & 0 deletions src/commit-types.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[
{
"name": "feat",
"emoji": "",
"description": "A new feature"
},
{
"name": "fix",
"emoji": "🐛",
"description": "A bug Fix"
},
{
"name": "docs",
"emoji": "📚",
"description": "Documentation only changes"
},
{
"name": "style",
"emoji": "💄",
"description": "Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)"
},
{
"name": "refactor",
"emoji": "📦",
"description": "A code change that neither fixes a bug nor adds a feature"
},
{
"name": "perf",
"emoji": "🚀",
"description": "A code change that improves performance"
},
{
"name": "test",
"emoji": "🚨",
"description": "Adding missing tests or correcting existing tests"
},
{
"name": "ci",
"emoji": "⚙️",
"description": "Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)"
},
{
"name": "build",
"emoji": "🛠",
"description": "Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)"
},
{
"name": "chore",
"emoji": "♻️",
"description": "Other changes that don't modify src or test files"
},
{
"name": "revert",
"emoji": "🗑",
"description": "Reverts a previous commit"
}
]
8 changes: 8 additions & 0 deletions src/constants/flags.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const FLAGS = Object.freeze({
COMMIT: 'commit',
HELP: 'help',
UPDATE: 'update',
VERSION: 'version',
})

export default FLAGS
Loading

0 comments on commit 801fc72

Please sign in to comment.