v1.4.0
This is a summary of the differences between v1.4.0 and v1.3.0.
Commits
Show commits
| SHA | Author | Committed | Message |
|---|---|---|---|
f5764f2 |
2017-9-19 | allow overwriting of existing releases | |
4cae3f0 |
2017-9-19 | 1.4.0 |
Changed files
Show changed files
README.md
@@ -15,7 +15,7 @@ npm install --save-dev create-github-release
## CLI
\`\`\`
-create-github-release [--config=<configPath>] [--preview=true] <tag1> [<tag2>...]
+create-github-release [--config=<configPath>] [--preview=true] [--overwrite=true] <tag1> [<tag2>...]
\`\`\`
The CLI tool requires you to define a configuration file in your repository. By default, it will look for a file in your repository root called \`github-release.config.js\`.
@@ -24,6 +24,8 @@ You may also specify a different path by using the \`--config\` option.
If you provide the \`--preview=true\` option, the release notes will be echoed to stdout instead of saved.
+If you provide the \`--overwrite=true\` option, it is equivalent to setting \`overwrite\` to true (see [Configuration](#configuration)).
+
### Configuration
The configuration file must export an object, which can have the following properties:
@@ -38,6 +40,7 @@ The configuration file must export an object, which can have the following prope
| \`render\` | function | A function to manually render the release notes, instead of using Mustache. | [\`Mustache.render\`](https://github.com/janl/mustache.js) |
| \`showDiff\` | function | A function that accepts a file object and determines whether the diff should be rendered in the template. | \`() => true\` |
| \`apiOptions\` | object | Additional options to provide the [\`node-github\`](https://github.com/mikedeboer/node-github) constructor. | \`{}\` |
+| \`overwrite\` | boolean | If true, will overwrite existing GitHub release notes, if any. By default, the script fails if notes already exist. | \`false\` |
### Example
github-release.config.js
@@ -14,4 +14,5 @@ module.exports = {
const ext = path.extname(filename)
return lines <= MAX_LINES_TO_SHOW && (!ext || EXTS_TO_SHOW.includes(ext))
},
+ overwrite: true,
}package-lock.json
@@ -1,6 +1,6 @@
{
"name": "create-github-release",
- "version": "1.3.0",
+ "version": "1.4.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -2740,6 +2740,11 @@
"resolved": "https://registry.npmjs.org/lodash.foreach/-/lodash.foreach-4.5.0.tgz",
"integrity": "sha1-Gmo16s5AEoDH8G3d7DUWWrJ+PlM="
},
+ "lodash.get": {
+ "version": "4.4.2",
+ "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
+ "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk="
+ },
"lodash.isobject": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-3.0.2.tgz",package.json
@@ -1,6 +1,6 @@
{
"name": "create-github-release",
- "version": "1.3.0",
+ "version": "1.4.0",
"description": "Tool for generating GitHub releases after publishing a module.",
"keywords": [
"github",
@@ -54,6 +54,7 @@
"es6-promisify": "^5.0.0",
"github": "^11.0.0",
"lodash.foreach": "^4.5.0",
+ "lodash.get": "^4.4.2",
"lodash.isobject": "^3.0.2",
"minimist": "^1.2.0",
"mustache": "^2.3.0",src/cli.js
@@ -5,13 +5,15 @@ import parseArgs from 'minimist'
import cosmiconfig from 'cosmiconfig'
import createRelease, { NO_PREVIOUS_RELEASE } from './index'
+const isTruthy = value =>
+ Boolean(value && !['false', '0', 'off', 'no'].includes(value.toLowerCase()))
+
const run = async () => {
const [, , ...argv] = process.argv
const args = parseArgs(argv)
const configPath = args.config ? path.resolve(args.config) : null
- const preview = Boolean(
- args.preview && !['false', '0', 'off', 'no'].includes(args.preview.toLowerCase())
- )
+ const preview = isTruthy(args.preview)
+ const overwrite = isTruthy(args.overwrite)
const tags = args._
if (tags.length === 0) {
throw new Error('No tags provided')
@@ -39,7 +41,12 @@ const run = async () => {
return await Promise.all(
tags.map(async tag => {
try {
- const result = await createRelease({ ...config, preview, tag })
+ const result = await createRelease({
+ ...config,
+ preview,
+ overwrite: overwrite || config.overwrite,
+ tag,
+ })
console.log(preview ? result : \`Release ${tag} published at ${result}\`)
} catch (err) {
if (err === NO_PREVIOUS_RELEASE) {src/index.js
Inline diff not displayed. View the whole file