Socket
Socket
Sign inDemoInstall

standard-version

Package Overview
Dependencies
8
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.2 to 2.2.0

16

CHANGELOG.md

@@ -5,2 +5,18 @@ # Change Log

<a name="2.2.0"></a>
# [2.2.0](https://github.com/conventional-changelog/standard-version/compare/v2.1.2...v2.2.0) (2016-05-01)
### Bug Fixes
* format the annotated tag message ([#28](https://github.com/conventional-changelog/standard-version/issues/28))([8f02736](https://github.com/conventional-changelog/standard-version/commit/8f02736))
* upgraded dependencies, switched back to angular format (fixes [#27](https://github.com/conventional-changelog/standard-version/issues/27)), pinned shelljs to version that works with nyc ([#30](https://github.com/conventional-changelog/standard-version/issues/30))([3f51e94](https://github.com/conventional-changelog/standard-version/commit/3f51e94)), closes [#27](https://github.com/conventional-changelog/standard-version/issues/27) [(#30](https://github.com/(/issues/30)
### Features
* add --sign flag to sign git commit and tag ([#29](https://github.com/conventional-changelog/standard-version/issues/29))([de758bc](https://github.com/conventional-changelog/standard-version/commit/de758bc))
<a name="2.1.2"></a>

@@ -7,0 +23,0 @@ ## [2.1.2](https://github.com/conventional-changelog/standard-version/compare/v2.1.1...v2.1.2) (2016-04-11)

19

index.js

@@ -27,2 +27,9 @@ #!/usr/bin/env node

})
.option('sign', {
alias: 's',
describe: 'Should the git commit and tag be signed?',
type: 'boolean',
default: false,
global: true
})
.help()

@@ -80,3 +87,3 @@ .alias('help', 'h')

var changelogStream = conventionalChangelog({
preset: 'standard',
preset: 'angular',
outputUnreleased: true,

@@ -111,3 +118,3 @@ pkg: {

checkpoint(msg, args)
exec('git add package.json ' + argv.infile + ';git commit package.json ' + argv.infile + ' -m "' + formatCommitMessage(argv.message, newVersion) + '"', function (err, stdout, stderr) {
exec('git add package.json ' + argv.infile + ';git commit ' + (argv.sign ? '-S ' : '') + 'package.json ' + argv.infile + ' -m "' + formatCommitMessage(argv.message, newVersion) + '"', function (err, stdout, stderr) {
var errMessage = null

@@ -129,4 +136,10 @@ if (err) errMessage = err.message

function tag (newVersion, argv) {
var tagOption
if (argv.sign) {
tagOption = '-s '
} else {
tagOption = '-a '
}
checkpoint('tagging release %s', [newVersion])
exec('git tag -a v' + newVersion + ' -m "' + argv.message + '"', function (err, stdout, stderr) {
exec('git tag ' + tagOption + 'v' + newVersion + ' -m "' + formatCommitMessage(argv.message, newVersion) + '"', function (err, stdout, stderr) {
var errMessage = null

@@ -133,0 +146,0 @@ if (err) errMessage = err.message

15

package.json
{
"name": "standard-version",
"version": "2.1.2",
"version": "2.2.0",
"description": "replacement for `npm version` with automatic CHANGELOG generation",

@@ -22,3 +22,4 @@ "bin": "index.js",

"version",
"angular"
"angular",
"standard"
],

@@ -34,8 +35,8 @@ "author": "Ben Coe <ben@npmjs.com>",

"conventional-changelog": "^1.1.0",
"conventional-changelog-standard": "^1.2.1",
"conventional-recommended-bump": "^0.2.0",
"conventional-changelog-angular": "^1.1.0",
"conventional-recommended-bump": "^0.2.1",
"figures": "^1.5.0",
"fs-access": "^1.0.0",
"semver": "^5.1.0",
"yargs": "^4.3.2"
"yargs": "^4.6.0"
},

@@ -46,6 +47,6 @@ "devDependencies": {

"mocha": "^2.4.5",
"nyc": "^6.2.1",
"shelljs": "^0.6.0",
"nyc": "^6.4.1",
"shelljs": "0.6.0",
"standard": "^6.0.8"
}
}

@@ -10,4 +10,4 @@ # Standard Version

Automatic release and CHANGELOG management, using GitHub's new squash button and
the workflow outlined in [conventional-changelog-standard](https://github.com/bcoe/conventional-changelog-standard/blob/master/convention.md).
Automatic versioning and CHANGELOG management, using GitHub's new squash button and
the [recommended workflow](https://github.com/conventional-changelog/conventional-changelog-cli#recommended-workflow) for `conventional-changelog`.

@@ -19,28 +19,24 @@ _how it works:_

3. when you're ready to release to npm:
1. checkout `master`.
2. run `standard-version`.
3. `git push --tags; git push origin master; npm publish`.
1. `git checkout master; git pull origin master`
2. run `standard-version`
3. `git push --follow-tags origin master; npm publish`
`standard-version` does the following:
1. bumps the version in package.json (based on your commit history).
2. uses [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) to update _CHANGELOG.md._
3. commits _package.json_ and _CHANGELOG.md_.
4. tags a new release.
1. bumps the version in _package.json_ (based on your commit history)
2. uses [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) to update _CHANGELOG.md_
3. commits _package.json_ and _CHANGELOG.md_
4. tags a new release
## Initial CHANGELOG.md Generation
When you're generating your changelog for the first time, simply do:
`standard-version --first-release`
## Installation
`npm i standard-version -g`
### As `npm run` script
_Or, add it as a development dependency like so:_
Install and add to `devDependencies`:
`npm i standard-version --save-dev`
```
npm i --save-dev standard-version
```
_And add this to your _package.json:_
Add an [`npm run` script](https://docs.npmjs.com/cli/run-script) to your _package.json_:

@@ -55,2 +51,59 @@ ```json

Now you can use `npm run release` in place of `npm version`.
This has the benefit of making your repo/package more portable, so that other developers can cut releases without having to globally install `standard-version` on their machine.
### As global bin
Install globally (add to your `PATH`):
```
npm i -g standard-version
```
Now you can use `standard-version` in place of `npm version`.
This has the benefit of allowing you to use `standard-version` on any repo/package without adding a dev dependency to each one.
## Usage
### First Release
To generate your changelog for your first release, simply do:
```sh
# npm run script
npm run release -- --first-release
# or global bin
standard-version --first-release
```
This will tag a release **without bumping the version in package.json**.
When ready, push the git tag and `npm publish` your first release. \o/
### Cut a Release
If you typically use `npm version` to cut a new release, do this instead:
```sh
# npm run script
npm run release
# or global bin
standard-version
```
As long as your git commit messages are conventional and accurate, you no longer need to specify the semver type - and you get CHANGELOG generation for free! \o/
After you cut a release, you can push the new git tag and `npm publish` (or `npm publish --tag next`) when you're ready.
### CLI Help
```sh
# npm run script
npm run release -- --help
# or global bin
standard-version --help
```
## Commit Message Convention, at a Glance

@@ -61,3 +114,3 @@

```sh
-m "fix(parsing): fixed a bug in our parser"
git commit -a -m "fix(parsing): fixed a bug in our parser"
```

@@ -99,4 +152,26 @@

## FAQ
### How is `standard-version` different from `semantic-release`?
[`semantic-release`](https://github.com/semantic-release/semantic-release) is a fully automated library/system for versioning, changelog generation, git tagging, and publishing to the npm registry.
`standard-version` is different because it handles the versioning, changelog generation, and git tagging for you **without** automatic pushing (to GitHub) or publishing (to an npm registry). Use of `standard-version` only affects your local git repo - it doesn't affect remote resources at all. After you run `standard-version`, you still have to ability to review things and correct mistakes if you want to.
They are both based on the same foundation of structured commit messages (using [Angular format](https://github.com/bcoe/conventional-changelog-standard/blob/master/convention.md)), but `standard-version` is a good choice for folks who are not yet comfortable letting publishes go out automatically. In this way, you can view `standard-version` as an incremental step to adopting `semantic-release`.
We think they are both fantastic tools, and we encourage folks to use `semantic-release` instead of `standard-version` if it makes sense for them.
### Should I always squash commits when merging PRs?
The instructions to squash commits when merging pull requests assumes that **one PR equals, at most, one feature or fix**.
If you have multiple features or fixes landing in a single PR and each commit uses a structured message, then you can do a standard merge when accepting the PR. This will preserve the commit history from your branch after the merge.
Although this will allow each commit to be included as separate entries in your CHANGELOG, the entries will **not** be able to reference the PR that pulled the changes in because the preserved commit messages do not include the PR number.
For this reason, we recommend keeping the scope of each PR to one general feature or fix. In practice, this allows you to use unstructured commit messages when committing each little change and then squash them into a single commit with a structured message (referencing the PR number) once they have been reviewed and accepted.
## License
ISC

@@ -60,3 +60,3 @@ /* global describe it beforeEach afterEach */

content.should.match(/first commit/)
shell.exec('git tag').output.should.match(/1\.0\.1/)
shell.exec('git tag').stdout.should.match(/1\.0\.1/)
})

@@ -83,2 +83,16 @@ })

it('respects the --sign option', function () {
fs.writeFileSync('package.json', JSON.stringify({
version: '1.0.0'
}), 'utf-8')
commit('feat: first commit')
// this should fail without a GPG key
var result = shell.exec(cliPath + ' --sign')
result.code.should.equal(1)
result.stdout.should.match(/gpg\: signing failed\: secret key not available/)
result.stdout.should.match(/error\: gpg failed to sign the data/)
})
it('handles commit messages longer than 80 characters', function () {

@@ -98,2 +112,19 @@ fs.writeFileSync('package.json', JSON.stringify({

})
it('formats the commit and tag messages appropriately', function () {
fs.writeFileSync('package.json', JSON.stringify({
version: '1.0.0'
}), 'utf-8')
commit('feat: first commit')
shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
commit('feat: new feature!')
shell.exec(cliPath).code.should.equal(0)
// check last commit message
shell.exec('git log --oneline -n1').stdout.should.match(/chore\(release\)\: 1\.1\.0/)
// check annotated tag message
shell.exec('git tag -l -n1 v1.1.0').stdout.should.match(/chore\(release\)\: 1\.1\.0/)
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc