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 7.0.2 to 7.0.3

2

lib/commands/commit/guard.js

@@ -5,7 +5,5 @@ import chalk from 'chalk';

};
const title = title => !title ? errors.title : true;
export default {
title
};

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

import prompts from "./prompts.js";
const promptAndCommit = options => getEmojis().then(gitmojis => prompts(gitmojis, options)).then(questions => {

@@ -15,3 +14,2 @@ inquirer.prompt(questions).then(answers => {

});
const commit = options => {

@@ -22,6 +20,4 @@ if (options.mode === COMMIT_MODES.HOOK) {

}
return promptAndCommit(options);
};
export default commit;

@@ -6,3 +6,2 @@ import { execa } from 'execa';

import configurationVault from "../../../utils/configurationVault/index.js";
const withClient = async answers => {

@@ -12,7 +11,5 @@ try {

const title = `${answers.gitmoji} ${scope}${answers.title}`;
if (await isHookCreated()) {
return console.log(chalk.red("\nError: Seems that you're trying to commit with the cli " + 'but you have the hook created.\nIf you want to use the `gitmoji -c` ' + 'command you have to remove the hook with the command `gitmoji -r`. \n' + 'The hook must be used only when you want to commit with the instruction `git commit`\n'));
}
if (configurationVault.getAutoAdd()) await execa('git', ['add', '.']);

@@ -27,3 +24,2 @@ await execa('git', ['commit', '-m', title, '-m', answers.message], {

};
export default withClient;

7

lib/commands/commit/withHook/index.js
import { execa } from 'execa';
import fs from 'fs';
const withHook = answers => {

@@ -17,3 +16,2 @@ try {

};
export const registerHookInterruptionHandler = () => {

@@ -43,11 +41,10 @@ // Allow to interrupt the hook without cancelling the commit

const commitMessageSource = process.argv[COMMIT_MESSAGE_SOURCE];
if (commitMessageSource && (commitMessageSource.startsWith('commit') || commitMessageSource.startsWith('merge'))) {
process.exit(0);
}
resolve();
}); // I avoid Promise.all to avoid race condition in future cancel callbacks
});
// I avoid Promise.all to avoid race condition in future cancel callbacks
export const cancelIfNeeded = () => cancelIfAmending().then(cancelIfRebasing);
export default withHook;

@@ -6,7 +6,5 @@ import chalk from 'chalk';

};
const url = url => isURL(url) ? true : errors.url;
export default {
url
};

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

import configurationVault from "../../utils/configurationVault/index.js";
const config = () => {

@@ -15,3 +14,2 @@ inquirer.prompt(configurationPrompts()).then(answers => {

};
export default config;

@@ -5,6 +5,4 @@ import fs from 'fs';

import HOOK from "../hook.js";
const createHook = async () => {
const spinner = ora('Creating the gitmoji commit hook').start();
try {

@@ -20,3 +18,2 @@ const hookFile = await getAbsoluteHooksPath(HOOK.FILENAME);

};
export default createHook;

@@ -5,6 +5,4 @@ import fs from 'fs';

import HOOK from "../hook.js";
const removeHook = async () => {
const spinner = ora('Creating the gitmoji commit hook').start();
try {

@@ -18,3 +16,2 @@ const hookFile = await getAbsoluteHooksPath(HOOK.FILENAME);

};
export default removeHook;
import getEmojis from "../../utils/getEmojis.js";
import printEmojis from "../../utils/printEmojis.js";
const list = () => getEmojis().then(gitmojis => printEmojis(gitmojis));
export default list;
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));
};
export default search;
import getEmojis from "../../utils/getEmojis.js";
import printEmojis from "../../utils/printEmojis.js";
const update = () => getEmojis(true).then(gitmojis => printEmojis(gitmojis));
export default update;

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

});
const getFile = path => {

@@ -39,3 +38,2 @@ try {

};
const getConfiguration = () => {

@@ -45,14 +43,10 @@ const loadConfig = () => {

const configurationFile = `${cwd()}/.gitmojirc.json`;
if (pathExistsSync(packageJson) && getFile(packageJson)?.gitmoji) {
return getFile(packageJson)?.gitmoji;
}
if (pathExistsSync(configurationFile) && getFile(configurationFile)) {
return getFile(configurationFile);
}
return LOCAL_CONFIGURATION.store;
};
return {

@@ -67,3 +61,2 @@ get: key => {

};
export default getConfiguration;
import { CONFIG, EMOJI_COMMIT_FORMATS } from "../../constants/configuration.js";
import getConfiguration from "./getConfiguration.js";
const configuration = getConfiguration();
const setAutoAdd = autoAdd => {
configuration.set(CONFIG.AUTO_ADD, autoAdd);
};
const setEmojiFormat = emojiFormat => {
configuration.set(CONFIG.EMOJI_FORMAT, emojiFormat);
};
const setScopePrompt = scopePrompt => {
configuration.set(CONFIG.SCOPE_PROMPT, scopePrompt);
};
const setGitmojisUrl = gitmojisUrl => {
configuration.set(CONFIG.GITMOJIS_URL, gitmojisUrl);
};
const getAutoAdd = () => {
return configuration.get(CONFIG.AUTO_ADD);
};
const getEmojiFormat = () => {
return configuration.get(CONFIG.EMOJI_FORMAT);
};
const getScopePrompt = () => {
return configuration.get(CONFIG.SCOPE_PROMPT);
};
const getGitmojisUrl = () => {
return configuration.get(CONFIG.GITMOJIS_URL);
};
export default {

@@ -38,0 +29,0 @@ getAutoAdd,

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

export const CACHE_PATH = path.join(os.homedir(), GITMOJI_CACHE.FOLDER, GITMOJI_CACHE.FILE);
const createEmojis = emojis => {

@@ -16,6 +15,4 @@ if (!pathExistsSync(path.dirname(CACHE_PATH))) {

}
fs.writeFileSync(CACHE_PATH, JSON.stringify(emojis));
};
const getEmojis = () => {

@@ -28,5 +25,3 @@ try {

};
const isAvailable = () => pathExistsSync(CACHE_PATH);
export default {

@@ -33,0 +28,0 @@ createEmojis,

@@ -12,3 +12,2 @@ import Fuse from 'fuse.js';

};
const filterGitmojis = (input, gitmojis) => {

@@ -18,3 +17,2 @@ const fuse = new Fuse(gitmojis, options);

};
export default filterGitmojis;
import COMMIT_MODES from "../constants/commit.js";
import FLAGS from "../constants/flags.js";
const getOptionsForCommand = (command, flags) => {
const commandsWithOptions = [FLAGS.COMMIT, FLAGS.HOOK];
if (commandsWithOptions.includes(command)) {

@@ -15,6 +13,4 @@ return {

}
return null;
};
const findGitmojiCommand = (cli, options) => {

@@ -26,3 +22,2 @@ const flags = cli.flags;

};
export default findGitmojiCommand;
import { execa } from 'execa';
import path from 'path';
const getAbsoluteHooksPath = async hookName => {

@@ -17,3 +16,2 @@ try {

};
export default getAbsoluteHooksPath;

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

const COMMIT_MESSAGE_LINE_INDEX = 2;
const getDefaultCommitContent = options => {

@@ -15,3 +14,2 @@ /*

const commitFilePath = process.argv[COMMIT_FILE_PATH_INDEX];
if (options.mode === COMMIT_MODES.CLIENT || !fs.existsSync(commitFilePath)) {

@@ -24,3 +22,2 @@ return {

}
const commitFileContent = fs.readFileSync(commitFilePath).toString().split('\n');

@@ -33,3 +30,2 @@ return {

};
export default getDefaultCommitContent;

@@ -7,3 +7,2 @@ import chalk from 'chalk';

import configurationVault from "./configurationVault/index.js";
const getEmojis = async (skipCache = false) => {

@@ -13,3 +12,2 @@ const emojisFromCache = cache.getEmojis();

const spinner = ora('Fetching gitmojis').start();
try {

@@ -20,3 +18,2 @@ const response = await fetch(configurationVault.getGitmojisUrl(), buildFetchOptions());

cache.createEmojis(emojis);
if (emojis.length === emojisFromCache.length) {

@@ -26,3 +23,2 @@ spinner.info('Gitmojis already up to date');

}
spinner.succeed('Gitmojis fetched successfully, these are the new emojis:');

@@ -35,3 +31,2 @@ return emojis.filter(emoji => !emojisFromCache.includes(emoji));

};
export default getEmojis;
import fs from 'fs';
import HOOK from "../commands/hook/hook.js";
import getAbsoluteHooksPath from "./getAbsoluteHooksPath.js";
const isHookCreated = async () => {
try {
const hookFile = await getAbsoluteHooksPath(HOOK.FILENAME);
if (fs.existsSync(hookFile)) {

@@ -14,3 +12,2 @@ return fs.readFileSync(hookFile, {

}
return false;

@@ -21,3 +18,2 @@ } catch (error) {

};
export default isHookCreated;
import chalk from 'chalk';
const printEmojis = gitmojis => {

@@ -8,3 +7,2 @@ return gitmojis.forEach(gitmoji => {

};
export default printEmojis;
{
"name": "gitmoji-cli",
"version": "7.0.2",
"version": "7.0.3",
"type": "module",

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

"prepublishOnly": "yarn run lint && yarn run flow && yarn run test",
"test": "jest"
"test": "FORCE_COLOR=1 jest"
},

@@ -54,3 +54,3 @@ "repository": {

"inquirer-autocomplete-prompt": "^3.0.0",
"meow": "^10.1.3",
"meow": "^11.0.0",
"node-fetch": "^3.2.10",

@@ -65,5 +65,5 @@ "ora": "^6.1.2",

"@babel/cli": "7.19.3",
"@babel/core": "7.19.3",
"@babel/core": "7.20.5",
"@babel/plugin-syntax-import-assertions": "^7.18.6",
"@babel/preset-env": "7.19.3",
"@babel/preset-env": "7.20.2",
"@babel/preset-flow": "7.18.6",

@@ -74,10 +74,11 @@ "babel-plugin-module-extension-resolver": "^1.0.0-rc.2",

"codecov": "3.8.3",
"flow-bin": "^0.188.1",
"husky": "8.0.1",
"jest": "29.1.2",
"flow-bin": "^0.195.1",
"husky": "8.0.2",
"jest": "29.3.1",
"jest-fetch-mock": "3.0.3",
"jest-mock-process": "2.0.0",
"lint-staged": "13.0.3",
"lint-staged": "13.1.0",
"pkg": "5.8.0",
"prettier": "2.7.1"
"prettier": "2.8.1",
"turbo": "^1.6.1"
},

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

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