Socket
Socket
Sign inDemoInstall

gitmoji-cli

Package Overview
Dependencies
Maintainers
1
Versions
118
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.2.2 to 8.2.3

2

lib/cli.js

@@ -87,5 +87,5 @@ #!/usr/bin/env node

[FLAGS.REMOVE]: () => commands.removeHook(),
[FLAGS.SEARCH]: () => cli.input.map(input => commands.search(input)),
[FLAGS.SEARCH]: options => commands.search(options),
[FLAGS.UPDATE]: () => commands.update()
};
findGitmojiCommand(cli, options);
import inquirer from 'inquirer';
import configurationVault from "../../utils/configurationVault/index.js";
import getEmojis from "../../utils/getEmojis.js";

@@ -12,3 +13,3 @@ import COMMIT_MODES from "../../constants/commit.js";

...answers,
title: capitalizeTitle(answers.title)
title: configurationVault.getCapitalizeTitle() ? capitalizeTitle(answers.title) : answers.title
};

@@ -15,0 +16,0 @@ if (options.mode === COMMIT_MODES.HOOK) {

@@ -37,3 +37,3 @@ import inquirer from 'inquirer';

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

@@ -40,0 +40,0 @@ ...(title ? {

import { execa } from 'execa';
import fs from 'fs';
import chalk from 'chalk';

@@ -4,0 +3,0 @@ import isHookCreated from "../../../utils/isHookCreated.js";

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

configurationVault.setMessagePrompt(answers[CONFIG.MESSAGE_PROMPT]);
configurationVault.setCapitalizeTitle(answers[CONFIG.CAPITALIZE_TITLE]);
configurationVault.setGitmojisUrl(answers[CONFIG.GITMOJIS_URL]);

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

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

}, {
name: CONFIG.CAPITALIZE_TITLE,
message: 'Capitalize title',
type: 'confirm',
default: configurationVault.getCapitalizeTitle()
}, {
name: CONFIG.GITMOJIS_URL,

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

import filterGitmojis from "../../utils/filterGitmojis.js";
import getEmojis from "../../utils/getEmojis.js";
import printEmojis from "../../utils/printEmojis.js";
const search = query => {
return getEmojis().then(gitmojis => filterGitmojis(query, gitmojis)).then(gitmojisFiltered => printEmojis(gitmojisFiltered)).catch(err => console.error(err));
const search = options => {
return getEmojis().then(gitmojis => {
if (!options.query) {
return printEmojis(gitmojis);
}
for (const query of options.query) {
printEmojis(filterGitmojis(query, gitmojis));
}
}).catch(err => console.error(err));
};
export default search;

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

GITMOJIS_URL: 'gitmojisUrl',
MESSAGE_PROMPT: 'messagePrompt'
MESSAGE_PROMPT: 'messagePrompt',
CAPITALIZE_TITLE: 'capitalizeTitle'
};

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

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

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

@@ -33,2 +34,6 @@ };

},
[CONFIG.CAPITALIZE_TITLE]: {
type: 'boolean',
default: DEFAULT_CONFIGURATION[CONFIG.CAPITALIZE_TITLE]
},
[CONFIG.GITMOJIS_URL]: {

@@ -35,0 +40,0 @@ type: 'string',

@@ -1,2 +0,2 @@

import { CONFIG, EMOJI_COMMIT_FORMATS } from "../../constants/configuration.js";
import { CONFIG } from "../../constants/configuration.js";
import getConfiguration from "./getConfiguration.js";

@@ -16,2 +16,5 @@ const configuration = getConfiguration();

};
const setCapitalizeTitle = capitalizeTitle => {
configuration.set(CONFIG.CAPITALIZE_TITLE, capitalizeTitle);
};
const setGitmojisUrl = gitmojisUrl => {

@@ -32,2 +35,5 @@ configuration.set(CONFIG.GITMOJIS_URL, gitmojisUrl);

};
const getCapitalizeTitle = () => {
return configuration.get(CONFIG.CAPITALIZE_TITLE);
};
const getGitmojisUrl = () => {

@@ -41,2 +47,3 @@ return configuration.get(CONFIG.GITMOJIS_URL);

getMessagePrompt,
getCapitalizeTitle,
getGitmojisUrl,

@@ -47,3 +54,4 @@ setAutoAdd,

setMessagePrompt,
setCapitalizeTitle,
setGitmojisUrl
};

@@ -6,11 +6,26 @@ import COMMIT_MODES from "../constants/commit.js";

};
const getOptionsForCommand = (command, flags) => {
const commandsWithOptions = [FLAGS.COMMIT, FLAGS.HOOK];
if (commandsWithOptions.includes(command)) {
return {
message: flags['message'],
mode: command === FLAGS.HOOK ? COMMIT_MODES.HOOK : COMMIT_MODES.CLIENT,
scope: flags['scope'],
title: flags['title']
};
const determineCommand = (flags, input, options) => {
const command = Object.keys(flags).map(flag => flags[flag] && flag).find(flag => options[flag]);
return command ? {
type: 'flag',
command
} : {
type: 'command',
command: input[0]
};
};
const getOptionsForCommand = (command, flags, input, type) => {
switch (command) {
case FLAGS.COMMIT:
case FLAGS.HOOK:
return {
message: flags['message'],
mode: command === FLAGS.HOOK ? COMMIT_MODES.HOOK : COMMIT_MODES.CLIENT,
scope: flags['scope'],
title: flags['title']
};
case FLAGS.SEARCH:
return {
query: type === 'command' ? input.slice(1) : input
};
}

@@ -20,10 +35,12 @@ return null;

const findGitmojiCommand = (cli, options) => {
const flags = cli.flags;
const command = Object.keys(flags).map(flag => flags[flag] && flag).find(flag => options[flag]) || cli.input[0];
const {
command,
type
} = determineCommand(cli.flags, cli.input, options);
if (!command || !isSupportedCommand(command, options)) {
return cli.showHelp();
}
const commandOptions = getOptionsForCommand(command, flags);
const commandOptions = getOptionsForCommand(command, cli.flags, cli.input, type);
return options[command] ? options[command](commandOptions) : cli.showHelp();
};
export default findGitmojiCommand;

@@ -1,2 +0,1 @@

import chalk from 'chalk';
import fetch from 'node-fetch';

@@ -3,0 +2,0 @@ import ora from 'ora';

{
"name": "gitmoji-cli",
"version": "8.2.2",
"version": "8.2.3",
"type": "module",

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

"flow": "flow",
"lint": "prettier --check src/**/*.js",
"lint": "eslint ./src && prettier --check src/**/*.js",
"package": "pkg . --output ./bin/gitmoji --targets latest-linux-x64,latest-macos-x64,latest-win-x64",

@@ -52,3 +52,3 @@ "prepare": "husky install",

"fuse.js": "6.6.2",
"inquirer": "^9.2.2",
"inquirer": "^9.2.3",
"inquirer-autocomplete-prompt": "^3.0.0",

@@ -73,3 +73,7 @@ "meow": "^11.0.0",

"codecov": "3.8.3",
"flow-bin": "^0.205.1",
"eslint": "8.40.0",
"eslint-plugin-ft-flow": "2.0.3",
"eslint-plugin-immutable": "1.0.0",
"flow-bin": "^0.206.0",
"hermes-eslint": "0.11.1",
"husky": "8.0.3",

@@ -82,3 +86,3 @@ "jest": "29.5.0",

"prettier": "2.8.8",
"turbo": "^1.9.3"
"turbo": "^1.9.4"
},

@@ -112,6 +116,33 @@ "jest": {

},
"eslintConfig": {
"parser": "hermes-eslint",
"plugins": [
"ft-flow",
"immutable"
],
"env": {
"es2021": true,
"node": true
},
"extends": [
"eslint:recommended"
],
"overrides": [],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
"no-var": "error",
"no-undef": "error",
"no-param-reassign": "error"
},
"globals": {
"jest": true,
"$Values": "readonly"
}
},
"lint-staged": {
"src/**/*.js": [
"prettier --write",
"git add"
"prettier --write"
]

@@ -118,0 +149,0 @@ },

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

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

@@ -166,2 +167,3 @@ }

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

@@ -168,0 +170,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