Skip to content

Commit

Permalink
Merge pull request #68 from groupon/changelog-refactor
Browse files Browse the repository at this point in the history
feat: changelog improvements
  • Loading branch information
aaarichter authored Nov 7, 2020
2 parents 9bb6d64 + d188cbd commit abbb4f9
Show file tree
Hide file tree
Showing 9 changed files with 953 additions and 497 deletions.
46 changes: 35 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,20 +126,42 @@ Hook | Description
`prepare` | Called when the release is about to be prepared. This is before updating files such as
package.json, CHANGELOG.md and pushing a commit. It provides a reference to the **next version** number
via the environment variable **NLM_NEXT_VERSION**.
```ts
interface NlmOptions {
acceptInvalidCommits?: boolean;
changelog: {
omit?: string[],
verbose?: boolean
};
deprecated?: boolean;
emoji?: {
skip?: boolean
set?: {[type: string]: string}
};
license?: {
files?: string[],
exclude?: string[]
}
}
```

* `license.files`: List of files and/or directories to add license headers to.
* `license.exclude`: List of files to exclude that would otherwise be included. `nlm` will always exclude
* `license`:
* `files`: List of files and/or directories to add license headers to.
* `exclude`: List of files to exclude that would otherwise be included. `nlm` will always exclude
anything in `node_modules`.
* `acceptInvalidCommits`: Accept commit messages even if they can't be parsed.
It's highly discouraged to use this option.
In this mode any commit with an invalid commit message will be treated as "semver-major".
* `deprecated`: String (may be empty) describing reason this package has been
deprecated. To deprecate a package, set it to a descriptive reason.
To "un-deprecate" a package, set it to an empty string (can then be later deleted).
* `changelog`:
* `omit`: Array of types, which will be omitted from the changelog.
* `verbose`: Display PR's commits. Default: `false`
* `emoji`:
Configure changelog emoji setting logic
* `emoji.skip`: deactivates emoji in changelog. Default: `null`
* `emoji.set`: Custom emojis map, which will overwrite the default one
* `skip`: deactivates emoji in changelog. Default: `null`
* `set`: Custom emojis map, which will overwrite the default one

Example for
```json5
Expand All @@ -157,18 +179,20 @@ Example for
The default emojis for the commit types are:
```json5
{
"feat": "✨",
"breaking": "💥",
"feat": "🚀",
"fix": "🐛",
"perf": "⚡",
"refactor": "📦️",
"chore": "♻️",
"build": "👷",
"revert": "↩️",
"docs": "📝",
"style": "🎨",
"test": "✅",
"ci": "💚",
"breaking": "💥" // this emoji will be set before the "Breaking Change" section
"style": "💅",
// internal types
"deps": "🔼", // will be set when dependencies are found in PR commit subject
"internal": "🏡", // will be set for types: "chore", "build", "test", "ci" or commits without type
}
```

Expand Down
4 changes: 3 additions & 1 deletion lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,7 @@ if (argv.version) {
// eslint-disable-next-line import/no-dynamic-require
const pkg = require(packageJsonFile);

command(cwd, pkg, { ...argv, ...pkg.nlm }).catch(prettyPrintErrorAndExit);
command(cwd, pkg, { ...argv, ...pkg.nlm, nlmOptions: { ...pkg.nlm } }).catch(
prettyPrintErrorAndExit
);
}
4 changes: 2 additions & 2 deletions lib/commands/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ function verify(cwd, pkg, options) {
const { releaseType } = options;
const nextUpdate =
releaseType !== 'none'
? `${pkg.version} -> ${semver.inc(pkg.version, releaseType)}`
? `(${pkg.version} -> ${semver.inc(pkg.version, releaseType)})`
: '';
console.log('[nlm] Changes are %j (%s)', releaseType, nextUpdate);
console.log('[nlm] Changes are %j %s', releaseType, nextUpdate);
}

const verifyTasks = [
Expand Down
Loading

0 comments on commit abbb4f9

Please sign in to comment.