Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
572 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
|
||
# Created by https://www.gitignore.io/api/macos,windows,linux,node | ||
|
||
### Linux ### | ||
*~ | ||
|
||
# temporary files which can be created if a process still has a handle open of a deleted file | ||
.fuse_hidden* | ||
|
||
# KDE directory preferences | ||
.directory | ||
|
||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
|
||
# .nfs files are created when an open file is removed but is still being accessed | ||
.nfs* | ||
|
||
### macOS ### | ||
*.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
### Node ### | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Typescript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
|
||
### Windows ### | ||
# Windows thumbnail cache files | ||
Thumbs.db | ||
ehthumbs.db | ||
ehthumbs_vista.db | ||
|
||
# Folder config file | ||
Desktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msm | ||
*.msp | ||
|
||
# Windows shortcuts | ||
*.lnk | ||
|
||
# End of https://www.gitignore.io/api/macos,windows,linux,node | ||
|
||
package-lock.json | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package-lock=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
language: node_js | ||
services: | ||
- docker | ||
notifications: | ||
email: false | ||
node_js: | ||
- 9 | ||
- 8 | ||
|
||
# Trigger a push build on master and greenkeeper branches + PRs build on every branches | ||
# Avoid double build on PRs (See https://github.com/travis-ci/travis-ci/issues/1147) | ||
branches: | ||
only: | ||
- master | ||
- /^greenkeeper.*$/ | ||
|
||
# Retry install on fail to avoid failing a build on network/disk/external errors | ||
install: | ||
- travis_retry npm install | ||
|
||
script: | ||
- npm run test | ||
|
||
after_success: | ||
- npm run codecov | ||
- npm run semantic-release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--install.no-lockfile true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2017 Contributors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,56 @@ | ||
# changelog | ||
Set of semantic-release plugins for creating or updating a changelog file | ||
# @semantic-release/changelog | ||
|
||
Set of [semantic-release](https://github.com/semantic-release/semantic-release) plugins for creating or updating a changelog file. | ||
|
||
[![Travis](https://img.shields.io/travis/semantic-release/changelog.svg)](https://travis-ci.org/semantic-release/changelog) | ||
[![Codecov](https://img.shields.io/codecov/c/github/semantic-release/changelog.svg)](https://codecov.io/gh/semantic-release/changelog) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/semantic-release/changelog.svg)](https://greenkeeper.io/) | ||
|
||
## verifyConditions | ||
|
||
Verify the `changelogFile` option configuration. | ||
|
||
## publish | ||
|
||
Create or update the changelog file in the local project repository. | ||
|
||
## Configuration | ||
|
||
### Options | ||
|
||
| Options | Description | Default | | ||
|-----------------|-----------------------------|----------------| | ||
| `changelogFile` | File path of the changelog. | `CHANGELOG.md` | | ||
|
||
### Usage | ||
|
||
Options can be set within the plugin definition in the `semantic-release` configuration file: | ||
|
||
```json | ||
{ | ||
"release": { | ||
"publish": [ | ||
{ | ||
"path": "@semantic-release/changelog", | ||
"changelogFile": "docs/changelog.md", | ||
}, | ||
"@semantic-release/git" | ||
] | ||
} | ||
} | ||
``` | ||
|
||
**It's recommended to use this plugin with the [git](https://github.com/semantic-release/git) plugin, so the changelog file will be committed to the Git repository and available on subsequent builds in order to be updated.** | ||
|
||
**When using with the [npm](https://github.com/semantic-release/npm) plugin and/or the [git](https://github.com/semantic-release/git) plugin the `changelog` plugin must be called first in order to create or update the changelog file, so it can be included in the npm package and committed to the Git repository.** | ||
|
||
To use with the [npm](https://github.com/semantic-release/npm), [git](https://github.com/semantic-release/git) and [condition-travis](https://github.com/semantic-release/condition-travis) plugins: | ||
|
||
```json | ||
{ | ||
"release": { | ||
"verifyConditions": ["@semantic-release/condition-travis", "@semantic-release/changelog", "@semantic-release/npm", "@semantic-release/git"], | ||
"publish": ["@semantic-release/changelog", "@semantic-release/npm", "@semantic-release/git"] | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const {castArray} = require('lodash'); | ||
const verifyChangelog = require('./lib/verify'); | ||
const publishChangelog = require('./lib/publish'); | ||
|
||
let verified; | ||
|
||
async function verifyConditions(pluginConfig, {options}) { | ||
// If the Changelog publish plugin is used and has `changelogFile` configured, validate them now in order to prevent any release if the configuration is wrong | ||
if (options.publish) { | ||
const publishPlugin = castArray(options.publish).find( | ||
config => config.path && config.path === '@semantic-release/changelog' | ||
); | ||
if (publishPlugin && publishPlugin.changelogFile) { | ||
pluginConfig.changelogFile = publishPlugin.changelogFile; | ||
} | ||
} | ||
await verifyChangelog(pluginConfig); | ||
verified = true; | ||
} | ||
|
||
async function publish(pluginConfig, {nextRelease: {notes}, logger}) { | ||
if (!verified) { | ||
await verifyChangelog(pluginConfig); | ||
verified = true; | ||
} | ||
await publishChangelog(pluginConfig, notes, logger); | ||
} | ||
|
||
module.exports = {verifyConditions, publish}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const {readFile, writeFile, ensureFile} = require('fs-extra'); | ||
const resolveConfig = require('./resolve-config'); | ||
|
||
module.exports = async (pluginConfig, notes, logger) => { | ||
const {changelogFile} = resolveConfig(pluginConfig); | ||
|
||
if (notes) { | ||
await ensureFile(changelogFile); | ||
const currentFile = (await readFile(changelogFile)).toString().trim(); | ||
|
||
if (currentFile) { | ||
logger.log('Update %s', changelogFile); | ||
} else { | ||
logger.log('Create %s', changelogFile); | ||
} | ||
await writeFile(changelogFile, `${notes.trim()}\n${currentFile ? `\n${currentFile}\n` : ''}`); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const {isUndefined} = require('lodash'); | ||
|
||
module.exports = ({changelogFile}) => ({ | ||
changelogFile: isUndefined(changelogFile) ? 'CHANGELOG.md' : changelogFile, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const {isString, isUndefined} = require('lodash'); | ||
const SemanticReleaseError = require('@semantic-release/error'); | ||
const resolveConfig = require('./resolve-config'); | ||
|
||
module.exports = pluginConfig => { | ||
const {changelogFile} = resolveConfig(pluginConfig); | ||
|
||
if (!isUndefined(changelogFile) && !(isString(changelogFile) && changelogFile.trim())) { | ||
throw new SemanticReleaseError( | ||
'The "changelogFile" options, if defined, must be a non empty String.', | ||
'EINVALIDCHANGELOGFILE' | ||
); | ||
} | ||
}; |
Oops, something went wrong.