Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: changelog improvements #68

Merged
merged 9 commits into from
Nov 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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