Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gitmoji-cli

Package Overview
Dependencies
Maintainers
1
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gitmoji-cli - npm Package Compare versions

Comparing version 8.1.1 to 8.2.0

10

lib/cli.js

@@ -16,3 +16,3 @@ #!/usr/bin/env node

Usage
$ gitmoji
$ gitmoji [option] [command]
Options

@@ -27,2 +27,10 @@ --${FLAGS.COMMIT}, -c Interactively commit using the prompts

--${FLAGS.VERSION}, -v Print gitmoji-cli installed version
Commands
commit Interactively commit using the prompts
config Setup gitmoji-cli preferences.
init Initialize gitmoji as a commit hook
list List all the available gitmojis
remove Remove a previously initialized commit hook
search Search gitmojis
update Sync emoji list with the repo
Examples

@@ -29,0 +37,0 @@ $ gitmoji -l

@@ -7,6 +7,13 @@ import inquirer from 'inquirer';

import prompts from "./prompts.js";
export const capitalizeTitle = title => title.charAt(0).toUpperCase() + title.slice(1);
const promptAndCommit = options => getEmojis().then(gitmojis => prompts(gitmojis, options)).then(questions => {
inquirer.prompt(questions).then(answers => {
if (options.mode === COMMIT_MODES.HOOK) return withHook(answers);
return withClient(answers);
const transformedAnswers = {
...answers,
title: capitalizeTitle(answers.title)
};
if (options.mode === COMMIT_MODES.HOOK) {
return withHook(transformedAnswers);
}
return withClient(transformedAnswers);
});

@@ -13,0 +20,0 @@ });

7

lib/commands/commit/prompts.js

@@ -6,2 +6,3 @@ import inquirer from 'inquirer';

import getDefaultCommitContent from "../../utils/getDefaultCommitContent.js";
import { capitalizeTitle } from "./index.js";
import guard from "./guard.js";

@@ -37,3 +38,3 @@ const TITLE_MAX_LENGTH_COUNT = 48;

transformer: input => {
return `[${(title || input).length}/${TITLE_MAX_LENGTH_COUNT}]: ${input}`;
return `[${(title || input).length}/${TITLE_MAX_LENGTH_COUNT}]: ${capitalizeTitle(input)}`;
},

@@ -43,3 +44,3 @@ ...(title ? {

} : {})
}, {
}, ...(configurationVault.getMessagePrompt() ? [{
name: 'message',

@@ -50,3 +51,3 @@ message: 'Enter the commit message:',

} : {})
}];
}] : [])];
});

@@ -10,2 +10,3 @@ import inquirer from 'inquirer';

configurationVault.setScopePrompt(answers[CONFIG.SCOPE_PROMPT]);
configurationVault.setMessagePrompt(answers[CONFIG.MESSAGE_PROMPT]);
configurationVault.setGitmojisUrl(answers[CONFIG.GITMOJIS_URL]);

@@ -12,0 +13,0 @@ });

@@ -27,2 +27,7 @@ import configurationVault from "../../utils/configurationVault/index.js";

}, {
name: CONFIG.MESSAGE_PROMPT,
message: 'Enable message prompt',
type: 'confirm',
default: configurationVault.getMessagePrompt()
}, {
name: CONFIG.GITMOJIS_URL,

@@ -29,0 +34,0 @@ message: 'Set gitmojis api url',

@@ -5,3 +5,4 @@ export const CONFIG = {

SCOPE_PROMPT: 'scopePrompt',
GITMOJIS_URL: 'gitmojisUrl'
GITMOJIS_URL: 'gitmojisUrl',
MESSAGE_PROMPT: 'messagePrompt'
};

@@ -8,0 +9,0 @@ export const EMOJI_COMMIT_FORMATS = {

@@ -10,2 +10,3 @@ import Conf from 'conf';

[CONFIG.SCOPE_PROMPT]: false,
[CONFIG.MESSAGE_PROMPT]: true,
[CONFIG.GITMOJIS_URL]: 'https://gitmoji.dev/api/gitmojis'

@@ -17,13 +18,21 @@ };

[CONFIG.AUTO_ADD]: {
type: 'boolean'
type: 'boolean',
default: DEFAULT_CONFIGURATION[CONFIG.AUTO_ADD]
},
[CONFIG.EMOJI_FORMAT]: {
enum: Object.values(EMOJI_COMMIT_FORMATS)
enum: Object.values(EMOJI_COMMIT_FORMATS),
default: DEFAULT_CONFIGURATION[CONFIG.EMOJI_FORMAT]
},
[CONFIG.SCOPE_PROMPT]: {
type: 'boolean'
type: 'boolean',
default: DEFAULT_CONFIGURATION[CONFIG.SCOPE_PROMPT]
},
[CONFIG.MESSAGE_PROMPT]: {
type: 'boolean',
default: DEFAULT_CONFIGURATION[CONFIG.MESSAGE_PROMPT]
},
[CONFIG.GITMOJIS_URL]: {
type: 'string',
format: 'url'
format: 'url',
default: DEFAULT_CONFIGURATION[CONFIG.GITMOJIS_URL]
}

@@ -55,3 +64,3 @@ }

const configuration = typeof resolvedConfiguration === 'object' && Object.keys(resolvedConfiguration).length ? resolvedConfiguration : DEFAULT_CONFIGURATION;
return configuration[key];
return configuration[key] ?? DEFAULT_CONFIGURATION[key];
},

@@ -58,0 +67,0 @@ set: (key, value) => LOCAL_CONFIGURATION.set(key, value)

@@ -13,2 +13,5 @@ import { CONFIG, EMOJI_COMMIT_FORMATS } from "../../constants/configuration.js";

};
const setMessagePrompt = messagePrompt => {
configuration.set(CONFIG.MESSAGE_PROMPT, messagePrompt);
};
const setGitmojisUrl = gitmojisUrl => {

@@ -26,2 +29,5 @@ configuration.set(CONFIG.GITMOJIS_URL, gitmojisUrl);

};
const getMessagePrompt = () => {
return configuration.get(CONFIG.MESSAGE_PROMPT);
};
const getGitmojisUrl = () => {

@@ -34,2 +40,3 @@ return configuration.get(CONFIG.GITMOJIS_URL);

getScopePrompt,
getMessagePrompt,
getGitmojisUrl,

@@ -39,3 +46,4 @@ setAutoAdd,

setScopePrompt,
setMessagePrompt,
setGitmojisUrl
};
import COMMIT_MODES from "../constants/commit.js";
import FLAGS from "../constants/flags.js";
const isSupportedCommand = (command, options) => {
return Object.keys(options).includes(command);
};
const getOptionsForCommand = (command, flags) => {

@@ -17,6 +20,9 @@ const commandsWithOptions = [FLAGS.COMMIT, FLAGS.HOOK];

const flags = cli.flags;
const commandFlag = Object.keys(flags).map(flag => flags[flag] && flag).find(flag => options[flag]);
const commandOptions = getOptionsForCommand(commandFlag, flags);
return options[commandFlag] ? options[commandFlag](commandOptions) : cli.showHelp();
const command = Object.keys(flags).map(flag => flags[flag] && flag).find(flag => options[flag]) || cli.input[0];
if (!command || !isSupportedCommand(command, options)) {
return cli.showHelp();
}
const commandOptions = getOptionsForCommand(command, flags);
return options[command] ? options[command](commandOptions) : cli.showHelp();
};
export default findGitmojiCommand;
{
"name": "gitmoji-cli",
"version": "8.1.1",
"version": "8.2.0",
"type": "module",

@@ -51,3 +51,3 @@ "description": "A gitmoji client for using emojis on commit messages.",

"fuse.js": "6.6.2",
"inquirer": "^9.1.5",
"inquirer": "^9.2.0",
"inquirer-autocomplete-prompt": "^3.0.0",

@@ -63,6 +63,6 @@ "meow": "^11.0.0",

"devDependencies": {
"@babel/cli": "7.21.0",
"@babel/core": "7.21.4",
"@babel/cli": "7.21.5",
"@babel/core": "7.21.5",
"@babel/plugin-syntax-import-assertions": "^7.18.6",
"@babel/preset-env": "7.21.4",
"@babel/preset-env": "7.21.5",
"@babel/preset-flow": "7.21.4",

@@ -73,3 +73,3 @@ "babel-plugin-module-extension-resolver": "^1.0.0-rc.2",

"codecov": "3.8.3",
"flow-bin": "^0.203.1",
"flow-bin": "^0.205.0",
"husky": "8.0.3",

@@ -79,6 +79,6 @@ "jest": "29.5.0",

"jest-mock-process": "2.0.0",
"lint-staged": "13.2.1",
"lint-staged": "13.2.2",
"pkg": "5.8.1",
"prettier": "2.8.7",
"turbo": "^1.8.8"
"prettier": "2.8.8",
"turbo": "^1.9.3"
},

@@ -85,0 +85,0 @@ "jest": {

@@ -150,2 +150,3 @@ # gitmoji-cli

"scopePrompt": false,
"messagePrompt": false,
"gitmojisUrl": "https://gitmoji.dev/api/gitmojis"

@@ -163,2 +164,3 @@ }

"scopePrompt": false,
"messagePrompt": false,
"gitmojisUrl": "https://gitmoji.dev/api/gitmojis"

@@ -165,0 +167,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc