Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

Commit

Permalink
experiment: ⚗ change from --gitmoji to --theme
Browse files Browse the repository at this point in the history
Also test `experiment` in release notes generator
  • Loading branch information
JeromeFitz committed Feb 28, 2021
1 parent ec57636 commit 68b68cc
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .git-cz.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"disableEmoji": false,
"format": "{type}{scope}: {emoji}{subject}",
"gitmoji": false
"theme": "default"
}
2 changes: 1 addition & 1 deletion .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

yarn pretty-quick --staged
exec < /dev/tty
node ./lib/cli.js --hook --gitmoji || true
node ./lib/cli.js --hook --theme gitmoji || true
6 changes: 4 additions & 2 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ const main = async () => {
options.format = cliOptions.format;
}

if (cliOptions.gitmoji) {
options.gitmoji = cliOptions.gitmoji;
if (cliOptions.theme) {
options.theme = cliOptions.theme;
} else {
options.theme = 'default';
}

state = createState(options);
Expand Down
4 changes: 2 additions & 2 deletions lib/createState.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ const createState = (config = {}) => {
root,
};

// @note could be changed to swtich if more default configs
if (state.config.gitmoji) {
// @todo _switch_ this up
if (state.config.theme && state.config.theme === 'gitmoji') {
// eslint-disable-next-line global-require
const {list, types} = require('./getGitmoji');
state.config.breakingChangePrefix = '💥️ ';
Expand Down
4 changes: 2 additions & 2 deletions lib/defaults.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const disableEmoji = false;
const format = '{type}{scope}: {emoji}{subject}';
const gitmoji = false;
const theme = 'default';

const types = {
chore: {
Expand Down Expand Up @@ -87,11 +87,11 @@ module.exports = {
closedIssuePrefix: '✅ ',
disableEmoji,
format,
gitmoji,
list,
maxMessageLength: 64,
minMessageLength: 3,
questions,
scopes,
theme,
types,
};
16 changes: 8 additions & 8 deletions lib/parseArgs.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const helpScreen = `
-v, --version print version info and exit
--disable-emoji don't add emoji to commit title
--format custom formatting options for subject
--gitmoji enable custom gitmoji override
--theme custm them override (default|gitmoji)
--non-interactive run git-cz in non-interactive mode
non-interactive mode options:
Expand All @@ -35,7 +35,7 @@ const parseArgs = () => {
hook,
'disable-emoji': disableEmoji,
format,
gitmoji,
theme,
'non-interactive': nonInteractive,
body,
breaking,
Expand All @@ -58,20 +58,20 @@ const parseArgs = () => {
'version',
'help',
'disable-emoji',
'gitmoji',
'non-interactive',
'hook',
'dry-run',
],
string: [
'format',
'type',
'subject',
'scope',
'body',
'breaking',
'format',
'issues',
'learna',
'scope',
'subject',
'theme',
'type',
],
});

Expand All @@ -89,10 +89,10 @@ const parseArgs = () => {
disableEmoji,
dryRun,
format,
gitmoji,
help,
hook,
nonInteractive,
theme,
version,
};

Expand Down

0 comments on commit 68b68cc

Please sign in to comment.