-
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.
Merge pull request #13 from ize-302/develop
Develop
- Loading branch information
Showing
12 changed files
with
128 additions
and
174 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 |
---|---|---|
|
@@ -85,7 +85,7 @@ press ENTER | |
bun run build | ||
|
||
# Run command | ||
./dist/cli.js gitmo cm | ||
node ./dist/cli.js gitmo cm | ||
``` | ||
|
||
--- | ||
|
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 |
---|---|---|
@@ -1,36 +1,37 @@ | ||
{ | ||
"$schema": "https://biomejs.dev/schemas/1.9.0/schema.json", | ||
"vcs": { | ||
"enabled": false, | ||
"clientKind": "git", | ||
"useIgnoreFile": false | ||
}, | ||
"files": { | ||
"ignoreUnknown": false, | ||
"ignore": [] | ||
}, | ||
"formatter": { | ||
"enabled": true, | ||
"indentStyle": "tab", | ||
"indentWidth": 2 | ||
}, | ||
"organizeImports": { | ||
"enabled": true | ||
}, | ||
"linter": { | ||
"enabled": true, | ||
"rules": { | ||
"recommended": true | ||
} | ||
}, | ||
"json": { | ||
"formatter": { | ||
"trailingCommas": "none" | ||
} | ||
}, | ||
"javascript": { | ||
"formatter": { | ||
"quoteStyle": "double" | ||
} | ||
} | ||
"$schema": "https://biomejs.dev/schemas/1.9.0/schema.json", | ||
"vcs": { | ||
"enabled": false, | ||
"clientKind": "git", | ||
"useIgnoreFile": false | ||
}, | ||
"files": { | ||
"ignoreUnknown": false, | ||
"ignore": [] | ||
}, | ||
"formatter": { | ||
"enabled": true, | ||
"indentStyle": "tab", | ||
"indentWidth": 2, | ||
"lineWidth": 120 | ||
}, | ||
"organizeImports": { | ||
"enabled": true | ||
}, | ||
"linter": { | ||
"enabled": true, | ||
"rules": { | ||
"recommended": true | ||
} | ||
}, | ||
"json": { | ||
"formatter": { | ||
"trailingCommas": "none" | ||
} | ||
}, | ||
"javascript": { | ||
"formatter": { | ||
"quoteStyle": "double" | ||
} | ||
} | ||
} |
File renamed without changes.
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env node | ||
import { init } from "./gitmo.js"; | ||
import gitmo from "./gitmo.js"; | ||
|
||
init(); | ||
gitmo(); |
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,17 @@ | ||
import prompts from "prompts"; | ||
import onCancel from "@/utils/onCancel.js"; | ||
|
||
const commitMessagePrompt = async (originalMessage?: string) => { | ||
const commitMessageResponse = await prompts( | ||
{ | ||
type: "text", | ||
name: "commitMessage", | ||
message: "commit message", | ||
initial: originalMessage, | ||
}, | ||
{ onCancel }, | ||
); | ||
return commitMessageResponse; | ||
}; | ||
|
||
export default commitMessagePrompt; |
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 |
---|---|---|
@@ -1,22 +1,16 @@ | ||
import shell from "shelljs"; | ||
|
||
// check if there is exisiting staged commit | ||
const hasStagedChanges = () => { | ||
// check if there are staged changes | ||
const gitStatus = shell.exec("git status --porcelain", { | ||
silent: true, | ||
}).stdout; | ||
// Parse the status output | ||
const stagedChanges = gitStatus | ||
.split("\n") | ||
.filter((line) => line.startsWith("A ") || line.startsWith("M ")); | ||
const stagedChanges = gitStatus.split("\n").filter((line) => /^[AM] /.test(line)); | ||
|
||
if (stagedChanges.length === 0) { | ||
console.log( | ||
"You have no changes staged for commit. Please stage you commit before continuing!", | ||
); | ||
} else { | ||
return true; | ||
console.log("You have no changes staged for commit. Please stage you commit before continuing!"); | ||
return false; | ||
} | ||
return true; | ||
}; | ||
|
||
export default hasStagedChanges; |
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
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,24 @@ | ||
import emojisData from "@/emojis-data.json"; | ||
import optionsPrompt from "@/utils/optionsPrompt.js"; | ||
import commitMessagePrompt from "@/utils/commitMessagePrompt.js"; | ||
|
||
// this adds appropriate emoji to message | ||
const transformMessage = async (originalMessage: string) => { | ||
const prefixes = ["feat", "fix", "docs", "style", "refactor", "perf", "test", "ci", "build", "chore", "revert"]; | ||
const getMatchedPrefix = prefixes.find((prefix) => originalMessage.startsWith(prefix)); | ||
if (getMatchedPrefix) { | ||
const findMatchedEmoji = emojisData.find((item) => item.name === getMatchedPrefix); | ||
return `${originalMessage} ${findMatchedEmoji?.emoji}`; | ||
} | ||
// ("Not a conventional commit. Pick an option to continue"); | ||
const optionsPromptResponse = await optionsPrompt(); | ||
if (optionsPromptResponse.choice === "yes") { | ||
return originalMessage; | ||
} | ||
if (optionsPromptResponse.choice === "correction") { | ||
const response = await commitMessagePrompt(originalMessage); | ||
return await transformMessage(response.commitMessage); | ||
} | ||
}; | ||
|
||
export default transformMessage; |
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 |
---|---|---|
@@ -1,19 +1,19 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es6", | ||
"module": "node16", | ||
"moduleResolution": "node16", | ||
"baseUrl": "./", | ||
"paths": { | ||
"@/*": ["./src/*"] | ||
}, | ||
"resolveJsonModule": true, | ||
"allowJs": true, | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"skipLibCheck": true, | ||
"noEmit": true, | ||
"outDir": "dist" | ||
} | ||
"compilerOptions": { | ||
"target": "es6", | ||
"module": "node16", | ||
"moduleResolution": "node16", | ||
"baseUrl": "./", | ||
"paths": { | ||
"@/*": ["src/*"] | ||
}, | ||
"resolveJsonModule": true, | ||
"allowJs": true, | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"skipLibCheck": true, | ||
"noEmit": true, | ||
"outDir": "dist" | ||
} | ||
} |