Socket
Socket
Sign inDemoInstall

standard-version

Package Overview
Dependencies
Maintainers
4
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

standard-version - npm Package Compare versions

Comparing version 7.0.0 to 7.0.1

lib/configuration.js

12

CHANGELOG.md

@@ -5,2 +5,14 @@ # Changelog

### [7.0.1](https://github.com/conventional-changelog/standard-version/compare/v7.0.0...v7.0.1) (2019-11-07)
### Bug Fixes
* **deps:** update dependency conventional-changelog to v3.1.12 ([#463](https://github.com/conventional-changelog/standard-version/issues/463)) ([f04161a](https://github.com/conventional-changelog/standard-version/commit/f04161ae624705e68f9018d563e9f3c09ccf6f30))
* **deps:** update dependency conventional-changelog-config-spec to v2.1.0 ([#442](https://github.com/conventional-changelog/standard-version/issues/442)) ([a2c5747](https://github.com/conventional-changelog/standard-version/commit/a2c574735ac5a165a190661b7735ea284bdc7dda))
* **deps:** update dependency conventional-recommended-bump to v6.0.2 ([#462](https://github.com/conventional-changelog/standard-version/issues/462)) ([84bb581](https://github.com/conventional-changelog/standard-version/commit/84bb581209b50357761cbec45bb8253f6a182801))
* **deps:** update dependency stringify-package to v1.0.1 ([#459](https://github.com/conventional-changelog/standard-version/issues/459)) ([e06a835](https://github.com/conventional-changelog/standard-version/commit/e06a835c8296a92f4fa7c07f98057d765c1a91e5))
* **deps:** update dependency yargs to v14 ([#440](https://github.com/conventional-changelog/standard-version/issues/440)) ([fe37e73](https://github.com/conventional-changelog/standard-version/commit/fe37e7390760d8d16d1b94ca58d8123e292c46a8))
* **deps:** update dependency yargs to v14.2.0 ([#461](https://github.com/conventional-changelog/standard-version/issues/461)) ([fb21851](https://github.com/conventional-changelog/standard-version/commit/fb2185107a90ba4b9dc7c9c1d873ed1283706ac1))
## [7.0.0](https://github.com/conventional-changelog/standard-version/compare/v6.0.1...v7.0.0) (2019-07-30)

@@ -7,0 +19,0 @@

12

command.js

@@ -1,8 +0,4 @@

const findUp = require('find-up')
const spec = require('conventional-changelog-config-spec')
const { getConfiguration } = require('./lib/configuration')
const defaults = require('./defaults')
const { readFileSync } = require('fs')
const configPath = findUp.sync(['.versionrc', '.versionrc.json'])
const config = configPath ? JSON.parse(readFileSync(configPath)) : {}
const spec = require('conventional-changelog-config-spec')
const { START_OF_LAST_RELEASE_PATTERN } = require('./lib/lifecycles/changelog')

@@ -84,3 +80,3 @@

default: defaults.gitTagFallback,
describe: `fallback to git tags for version, if no meta-information file is found (e.g., package.json)`
describe: 'fallback to git tags for version, if no meta-information file is found (e.g., package.json)'
})

@@ -114,3 +110,3 @@ .option('path', {

.pkgConf('standard-version')
.config(config)
.config(getConfiguration())
.wrap(97)

@@ -117,0 +113,0 @@ .check((args) => {

@@ -30,5 +30,5 @@ const bump = require('./lib/lifecycles/bump')

if (pkg) return
let pkgPath = path.resolve(process.cwd(), filename)
const pkgPath = path.resolve(process.cwd(), filename)
try {
let data = fs.readFileSync(pkgPath, 'utf8')
const data = fs.readFileSync(pkgPath, 'utf8')
pkg = JSON.parse(data)

@@ -38,4 +38,4 @@ } catch (err) {}

let newVersion
let defaults = require('./defaults')
let args = Object.assign({}, defaults, argv)
const defaults = require('./defaults')
const args = Object.assign({}, defaults, argv)

@@ -42,0 +42,0 @@ return Promise.resolve()

@@ -35,3 +35,3 @@ 'use strict'

if (!args.firstRelease) {
let releaseType = getReleaseType(args.prerelease, release.releaseType, version)
const releaseType = getReleaseType(args.prerelease, release.releaseType, version)
newVersion = semver.valid(releaseType) || semver.inc(version, releaseType, args.prerelease)

@@ -105,3 +105,3 @@ updateConfigs(args, newVersion)

let TypeList = ['major', 'minor', 'patch'].reverse()
const TypeList = ['major', 'minor', 'patch'].reverse()

@@ -115,3 +115,3 @@ /**

function getCurrentActiveType (version) {
let typelist = TypeList
const typelist = TypeList
for (let i = 0; i < typelist.length; i++) {

@@ -170,11 +170,11 @@ if (semver[typelist[i]](version)) {

Bump.pkgFiles.concat(Bump.lockFiles).forEach(function (filename) {
let configPath = path.resolve(process.cwd(), filename)
const configPath = path.resolve(process.cwd(), filename)
try {
if (dotgit.ignore(configPath)) return
let stat = fs.lstatSync(configPath)
const stat = fs.lstatSync(configPath)
if (stat.isFile()) {
let data = fs.readFileSync(configPath, 'utf8')
let indent = detectIndent(data).indent
let newline = detectNewline(data)
let config = JSON.parse(data)
const data = fs.readFileSync(configPath, 'utf8')
const indent = detectIndent(data).indent
const newline = detectNewline(data)
const config = JSON.parse(data)
checkpoint(args, 'bumping version in ' + filename + ' from %s to %s', [config.version, newVersion])

@@ -181,0 +181,0 @@ config.version = newVersion

@@ -32,3 +32,3 @@ const accessSync = require('fs-access').sync

let oldContent = args.dryRun ? '' : fs.readFileSync(args.infile, 'utf-8')
let oldContentStart = oldContent.search(START_OF_LAST_RELEASE_PATTERN)
const oldContentStart = oldContent.search(START_OF_LAST_RELEASE_PATTERN)
// find the position of the last release and remove header:

@@ -40,3 +40,3 @@ if (oldContentStart !== -1) {

const context = { version: newVersion }
let changelogStream = conventionalChangelog({
const changelogStream = conventionalChangelog({
debug: args.verbose && console.info.bind(console, 'conventional-changelog'),

@@ -43,0 +43,0 @@ preset: presetLoader(args),

@@ -23,3 +23,3 @@ const bump = require('../lifecycles/bump')

let paths = []
let verify = args.verify === false || args.n ? '--no-verify ' : ''
const verify = args.verify === false || args.n ? '--no-verify ' : ''
let toAdd = ''

@@ -26,0 +26,0 @@

@@ -8,3 +8,3 @@ const chalk = require('chalk')

if (!hooks[hookName]) return Promise.resolve()
let command = hooks[hookName] + ' --new-version="' + newVersion + '"'
const command = hooks[hookName] + ' --new-version="' + newVersion + '"'
checkpoint(args, 'Running lifecycle hook "%s"', [hookName])

@@ -11,0 +11,0 @@ checkpoint(args, '- hook command: "%s"', [command], chalk.blue(figures.info))

@@ -9,3 +9,3 @@ const chalk = require('chalk')

if (!scripts || !scripts[hookName]) return Promise.resolve()
let command = scripts[hookName]
const command = scripts[hookName]
checkpoint(args, 'Running lifecycle script "%s"', [hookName])

@@ -12,0 +12,0 @@ checkpoint(args, '- execute command: "%s"', [command], chalk.blue(figures.info))

{
"name": "standard-version",
"version": "7.0.0",
"version": "7.0.1",
"description": "replacement for `npm version` with automatic CHANGELOG generation",

@@ -42,5 +42,5 @@ "bin": "bin/cli.js",

"chalk": "2.4.2",
"conventional-changelog": "3.1.9",
"conventional-changelog-config-spec": "2.0.0",
"conventional-recommended-bump": "6.0.0",
"conventional-changelog": "3.1.12",
"conventional-changelog-config-spec": "2.1.0",
"conventional-recommended-bump": "6.0.2",
"detect-indent": "6.0.0",

@@ -54,14 +54,14 @@ "detect-newline": "3.0.0",

"semver": "6.3.0",
"stringify-package": "1.0.0",
"yargs": "13.3.0"
"stringify-package": "1.0.1",
"yargs": "14.2.0"
},
"devDependencies": {
"chai": "4.2.0",
"coveralls": "3.0.5",
"eslint": "6.1.0",
"eslint-config-standard": "12.0.0",
"coveralls": "3.0.7",
"eslint": "6.2.2",
"eslint-config-standard": "14.1.0",
"eslint-plugin-import": "2.18.2",
"eslint-plugin-node": "9.1.0",
"eslint-plugin-node": "9.2.0",
"eslint-plugin-promise": "4.2.1",
"eslint-plugin-standard": "4.0.0",
"eslint-plugin-standard": "4.0.1",
"mocha": "6.2.0",

@@ -68,0 +68,0 @@ "mock-git": "2.0.0",

@@ -74,7 +74,9 @@ # Standard Version

your project is JavaScript).
1. Creating a `.versionrc` or `.versionrc.json`.
2. Creating a `.versionrc`, `.versionrc.json` or `.versionrc.js`.
- If you are using a `.versionrc.js` your default export must be a configuration object, or a function returning a configuration object.
Any of the command line paramters accepted by `standard-version` can instead
Any of the command line parameters accepted by `standard-version` can instead
be provided via configuration. Please refer to the [conventional-changelog-config-spec](https://github.com/conventional-changelog/conventional-changelog-config-spec/) for details on available configuration options.
### Customizing CHANGELOG Generation

@@ -81,0 +83,0 @@

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

let cliPath = path.resolve(__dirname, './bin/cli.js')
const cliPath = path.resolve(__dirname, './bin/cli.js')

@@ -47,3 +47,3 @@ function branch (branch) {

option = option || {}
let pkg = Object.assign(option, { version: version })
const pkg = Object.assign(option, { version: version })
fs.writeFileSync('package.json', JSON.stringify(pkg), 'utf-8')

@@ -54,3 +54,3 @@ }

option = option || {}
let bower = Object.assign(option, { version: version })
const bower = Object.assign(option, { version: version })
fs.writeFileSync('bower.json', JSON.stringify(bower), 'utf-8')

@@ -61,3 +61,3 @@ }

option = option || {}
let manifest = Object.assign(option, { version: version })
const manifest = Object.assign(option, { version: version })
fs.writeFileSync('manifest.json', JSON.stringify(manifest), 'utf-8')

@@ -68,3 +68,3 @@ }

option = option || {}
let shrinkwrap = Object.assign(option, { version: version })
const shrinkwrap = Object.assign(option, { version: version })
fs.writeFileSync('npm-shrinkwrap.json', JSON.stringify(shrinkwrap), 'utf-8')

@@ -75,3 +75,3 @@ }

option = option || {}
let pkgLock = Object.assign(option, { version: version })
const pkgLock = Object.assign(option, { version: version })
fs.writeFileSync('package-lock.json', JSON.stringify(pkgLock), 'utf-8')

@@ -141,3 +141,3 @@ }

let content = fs.readFileSync('CHANGELOG.md', 'utf-8')
const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
content.should.match(/patch release/)

@@ -154,3 +154,3 @@ content.should.not.match(/first commit/)

let content = fs.readFileSync('CHANGELOG.md', 'utf-8')
const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
content.should.match(/patch release/)

@@ -189,3 +189,3 @@ content.should.match(/first commit/)

execCli().code.should.equal(0)
let content = fs.readFileSync('CHANGELOG.md', 'utf-8')
const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
content.should.match(/1\.0\.1/)

@@ -235,4 +235,4 @@ content.should.not.match(/legacy header format/)

let content = fs.readFileSync('CHANGELOG.md', 'utf-8')
let status = shell.exec('git status --porcelain') // see http://unix.stackexchange.com/questions/155046/determine-if-git-working-directory-is-clean-from-a-script
const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
const status = shell.exec('git status --porcelain') // see http://unix.stackexchange.com/questions/155046/determine-if-git-working-directory-is-clean-from-a-script

@@ -250,3 +250,3 @@ status.should.equal('')

execCli('--changelogHeader="# Pork Chop Log"').code.should.equal(0)
let content = fs.readFileSync('CHANGELOG.md', 'utf-8')
const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
content.should.match(/# Pork Chop Log/)

@@ -269,3 +269,3 @@ })

let captured = shell.cat('gitcapture.log').stdout.split('\n').map(function (line) {
const captured = shell.cat('gitcapture.log').stdout.split('\n').map(function (line) {
return line ? JSON.parse(line) : line

@@ -284,3 +284,3 @@ })

.then(function (unmock) {
let result = execCli()
const result = execCli()
result.code.should.equal(1)

@@ -297,3 +297,3 @@ result.stderr.should.match(/commit yourself/)

.then(function (unmock) {
let result = execCli()
const result = execCli()
result.code.should.equal(1)

@@ -310,3 +310,3 @@ result.stderr.should.match(/addition is hard/)

.then(function (unmock) {
let result = execCli()
const result = execCli()
result.code.should.equal(1)

@@ -325,3 +325,3 @@ result.stderr.should.match(/tag, you're it/)

let result = execCli()
const result = execCli()
result.code.should.equal(1)

@@ -340,4 +340,4 @@ result.stderr.should.match(/haha, kidding, this is just a warning/)

'standard-version': {
'scripts': {
'prerelease': 'node scripts/prerelease'
scripts: {
prerelease: 'node scripts/prerelease'
}

@@ -350,3 +350,3 @@ }

commit('feat: first commit')
let result = execCli('--patch')
const result = execCli('--patch')
result.code.should.equal(0)

@@ -359,4 +359,4 @@ result.stderr.should.match(/prerelease ran/)

'standard-version': {
'scripts': {
'prerelease': 'node scripts/prerelease && exit 1'
scripts: {
prerelease: 'node scripts/prerelease && exit 1'
}

@@ -369,3 +369,3 @@ }

commit('feat: first commit')
let result = execCli('--patch')
const result = execCli('--patch')
result.code.should.equal(1)

@@ -380,4 +380,4 @@ result.stderr.should.match(/prerelease ran/)

'standard-version': {
'scripts': {
'prebump': 'node scripts/prebump'
scripts: {
prebump: 'node scripts/prebump'
}

@@ -390,3 +390,3 @@ }

commit('feat: first commit')
let result = execCli('--patch')
const result = execCli('--patch')
result.stdout.should.match(/9\.9\.9/)

@@ -401,4 +401,4 @@ result.code.should.equal(0)

'standard-version': {
'scripts': {
'postbump': 'node scripts/postbump'
scripts: {
postbump: 'node scripts/postbump'
}

@@ -411,3 +411,3 @@ }

commit('feat: first commit')
let result = execCli('--patch')
const result = execCli('--patch')
result.code.should.equal(0)

@@ -420,4 +420,4 @@ result.stderr.should.match(/postbump ran/)

'standard-version': {
'scripts': {
'postbump': 'node scripts/postbump'
scripts: {
postbump: 'node scripts/postbump'
}

@@ -430,3 +430,3 @@ }

commit('feat: first commit')
let result = execCli('--patch')
const result = execCli('--patch')
result.code.should.equal(1)

@@ -440,4 +440,4 @@ result.stderr.should.match(/postbump-failure/)

fs.writeFileSync('.versionrc.json', JSON.stringify({
'scripts': {
'precommit': 'node scripts/precommit'
scripts: {
precommit: 'node scripts/precommit'
}

@@ -449,3 +449,3 @@ }), 'utf-8')

commit('feat: first commit')
let result = execCli()
const result = execCli()
result.code.should.equal(0)

@@ -458,4 +458,4 @@ result.stderr.should.match(/precommit ran/)

'standard-version': {
'scripts': {
'precommit': 'node scripts/precommit'
scripts: {
precommit: 'node scripts/precommit'
}

@@ -468,3 +468,3 @@ }

commit('feat: first commit')
let result = execCli('--patch')
const result = execCli('--patch')
result.code.should.equal(0)

@@ -477,4 +477,4 @@ result.stderr.should.match(/precommit ran/)

'standard-version': {
'scripts': {
'precommit': 'node scripts/precommit'
scripts: {
precommit: 'node scripts/precommit'
}

@@ -487,3 +487,3 @@ }

commit('feat: first commit')
let result = execCli('--patch')
const result = execCli('--patch')
result.code.should.equal(1)

@@ -496,4 +496,4 @@ result.stderr.should.match(/precommit-failure/)

'standard-version': {
'scripts': {
'precommit': 'node scripts/precommit'
scripts: {
precommit: 'node scripts/precommit'
}

@@ -506,3 +506,3 @@ }

commit('feat: first commit')
let result = execCli('--patch')
const result = execCli('--patch')
result.code.should.equal(0)

@@ -562,7 +562,7 @@ shell.exec('git log --oneline -n1').should.match(/delivers #222/)

describe('release-types', function () {
let regularTypes = ['major', 'minor', 'patch']
const regularTypes = ['major', 'minor', 'patch']
regularTypes.forEach(function (type) {
it('creates a ' + type + ' release', function () {
let originVer = '1.0.0'
const originVer = '1.0.0'
writePackageJson(originVer)

@@ -575,3 +575,3 @@ fs.writeFileSync('CHANGELOG.md', 'legacy header format<a name="1.0.0">\n', 'utf-8')

.then(function () {
let version = {
const version = {
major: semver.major(originVer),

@@ -592,3 +592,3 @@ minor: semver.minor(originVer),

it('creates a pre' + type + ' release', function () {
let originVer = '1.0.0'
const originVer = '1.0.0'
writePackageJson(originVer)

@@ -601,3 +601,3 @@ fs.writeFileSync('CHANGELOG.md', 'legacy header format<a name="1.0.0">\n', 'utf-8')

.then(function () {
let version = {
const version = {
major: semver.major(originVer),

@@ -618,3 +618,3 @@ minor: semver.minor(originVer),

it('releases as v100.0.0', function () {
let originVer = '1.0.0'
const originVer = '1.0.0'
writePackageJson(originVer)

@@ -632,3 +632,3 @@ fs.writeFileSync('CHANGELOG.md', 'legacy header format<a name="1.0.0">\n', 'utf-8')

it('releases as 200.0.0-amazing', function () {
let originVer = '1.0.0'
const originVer = '1.0.0'
writePackageJson(originVer)

@@ -699,3 +699,3 @@ fs.writeFileSync('CHANGELOG.md', 'legacy header format<a name="1.0.0">\n', 'utf-8')

let content = fs.readFileSync('CHANGELOG.md', 'utf-8')
const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
content.should.match(/this is my fairly long commit message which is testing whether or not we allow for long commit messages/)

@@ -720,3 +720,3 @@ })

let pkgJson = fs.readFileSync('package.json', 'utf-8')
const pkgJson = fs.readFileSync('package.json', 'utf-8')
pkgJson.should.equal(['{', ' "version": "1.0.1"', '}', ''].join('\n'))

@@ -726,8 +726,8 @@ })

it('preserves indentation of tabs in package.json', function () {
let indentation = '\t'
let newPkgJson = ['{', indentation + '"version": "1.0.0"', '}', ''].join('\n')
const indentation = '\t'
const newPkgJson = ['{', indentation + '"version": "1.0.0"', '}', ''].join('\n')
fs.writeFileSync('package.json', newPkgJson, 'utf-8')
execCli().code.should.equal(0)
let pkgJson = fs.readFileSync('package.json', 'utf-8')
const pkgJson = fs.readFileSync('package.json', 'utf-8')
pkgJson.should.equal(['{', indentation + '"version": "1.0.1"', '}', ''].join('\n'))

@@ -737,8 +737,8 @@ })

it('preserves indentation of spaces in package.json', function () {
let indentation = ' '
let newPkgJson = ['{', indentation + '"version": "1.0.0"', '}', ''].join('\n')
const indentation = ' '
const newPkgJson = ['{', indentation + '"version": "1.0.0"', '}', ''].join('\n')
fs.writeFileSync('package.json', newPkgJson, 'utf-8')
execCli().code.should.equal(0)
let pkgJson = fs.readFileSync('package.json', 'utf-8')
const pkgJson = fs.readFileSync('package.json', 'utf-8')
pkgJson.should.equal(['{', indentation + '"version": "1.0.1"', '}', ''].join('\n'))

@@ -748,7 +748,7 @@ })

it('preserves line feed in package.json', function () {
let newPkgJson = ['{', ' "version": "1.0.0"', '}', ''].join('\n')
const newPkgJson = ['{', ' "version": "1.0.0"', '}', ''].join('\n')
fs.writeFileSync('package.json', newPkgJson, 'utf-8')
execCli().code.should.equal(0)
let pkgJson = fs.readFileSync('package.json', 'utf-8')
const pkgJson = fs.readFileSync('package.json', 'utf-8')
pkgJson.should.equal(['{', ' "version": "1.0.1"', '}', ''].join('\n'))

@@ -758,7 +758,7 @@ })

it('preserves carriage return + line feed in package.json', function () {
let newPkgJson = ['{', ' "version": "1.0.0"', '}', ''].join('\r\n')
const newPkgJson = ['{', ' "version": "1.0.0"', '}', ''].join('\r\n')
fs.writeFileSync('package.json', newPkgJson, 'utf-8')
execCli().code.should.equal(0)
let pkgJson = fs.readFileSync('package.json', 'utf-8')
const pkgJson = fs.readFileSync('package.json', 'utf-8')
pkgJson.should.equal(['{', ' "version": "1.0.1"', '}', ''].join('\r\n'))

@@ -777,3 +777,3 @@ })

it('does not print output when the --silent flag is passed', function () {
let result = execCli('--silent')
const result = execCli('--silent')
result.code.should.equal(0)

@@ -787,3 +787,3 @@ result.stdout.should.equal('')

let result = execCli()
const result = execCli()
result.code.should.equal(0)

@@ -806,3 +806,3 @@ result.stdout.should.not.match(/npm publish/)

it('includes merge commits', function () {
let branchName = 'new-feature'
const branchName = 'new-feature'
commit('feat: first commit')

@@ -818,6 +818,6 @@ shell.exec('git tag -a v1.0.0 -m "my awesome first release"')

let content = fs.readFileSync('CHANGELOG.md', 'utf-8')
const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
content.should.match(/new feature from branch/)
let pkgJson = fs.readFileSync('package.json', 'utf-8')
const pkgJson = fs.readFileSync('package.json', 'utf-8')
pkgJson.should.equal(['{', ' "version": "1.1.0"', '}', ''].join('\n'))

@@ -834,3 +834,3 @@ })

commit('feat: first commit')
let result = execCli()
const result = execCli()
result.code.should.equal(1)

@@ -848,3 +848,3 @@ result.stderr.should.match(/scripts must be an object/)

commit('feat: first commit')
let result = execCli()
const result = execCli()
result.code.should.equal(1)

@@ -889,3 +889,3 @@ result.stderr.should.match(/skip must be an object/)

mockery.registerMock('conventional-changelog', function () {
let readable = new stream.Readable({ objectMode: true })
const readable = new stream.Readable({ objectMode: true })
readable._read = function () {

@@ -1029,3 +1029,3 @@ }

it('allows bump and changelog generation to be skipped', function () {
let changelogContent = 'legacy header format<a name="1.0.0">\n'
const changelogContent = 'legacy header format<a name="1.0.0">\n'
writePackageJson('1.0.0')

@@ -1038,3 +1038,3 @@ fs.writeFileSync('CHANGELOG.md', changelogContent, 'utf-8')

getPackageVersion().should.equal('1.0.0')
let content = fs.readFileSync('CHANGELOG.md', 'utf-8')
const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
content.should.equal(changelogContent)

@@ -1045,3 +1045,3 @@ })

it('allows the commit phase to be skipped', function () {
let changelogContent = 'legacy header format<a name="1.0.0">\n'
const changelogContent = 'legacy header format<a name="1.0.0">\n'
writePackageJson('1.0.0')

@@ -1054,3 +1054,3 @@ fs.writeFileSync('CHANGELOG.md', changelogContent, 'utf-8')

getPackageVersion().should.equal('1.1.0')
let content = fs.readFileSync('CHANGELOG.md', 'utf-8')
const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
content.should.match(/new feature from branch/)

@@ -1159,2 +1159,50 @@ // check last commit message

it('evaluates a config-function from .versionrc.js', function () {
// write configuration that overrides default issue
// URL format.
fs.writeFileSync(
'.versionrc.js',
`module.exports = function() {
return {
issueUrlFormat: 'http://www.versionrc.js/function/{{id}}'
}
}`,
'utf-8'
)
commit('feat: another commit addresses issue #1')
execCli()
// CHANGELOG should have the new issue URL format.
const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
content.should.include('http://www.versionrc.js/function/1')
})
it('evaluates a config-object from .versionrc.js', function () {
// write configuration that overrides default issue
// URL format.
fs.writeFileSync(
'.versionrc.js',
`module.exports = {
issueUrlFormat: 'http://www.versionrc.js/object/{{id}}'
}`,
'utf-8'
)
commit('feat: another commit addresses issue #1')
execCli()
// CHANGELOG should have the new issue URL format.
const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
content.should.include('http://www.versionrc.js/object/1')
})
it('throws an error when a non-object is returned from .versionrc.js', function () {
// write configuration that overrides default issue
// URL format.
fs.writeFileSync(
'.versionrc.js',
'module.exports = 3',
'utf-8'
)
commit('feat: another commit addresses issue #1')
execCli().code.should.equal(1)
})
it('.versionrc : releaseCommitMessageFormat', function () {

@@ -1177,2 +1225,23 @@ // write configuration that overrides default issue

it('.versionrc : issuePrefixes', function () {
// write configuration that overrides default issuePrefixes
// and reference prefix in issue URL format.
fs.writeFileSync('.versionrc', JSON.stringify({
issueUrlFormat: 'http://www.foo.com/{{prefix}}{{id}}',
issuePrefixes: ['ABC-']
}), 'utf-8')
commit('feat: another commit addresses issue ABC-1')
execCli()
// CHANGELOG should have the new issue URL format.
const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
content.should.include('http://www.foo.com/ABC-1')
})
it('--issuePrefixes and --issueUrlFormat', function () {
commit('feat: another commit addresses issue ABC-1')
execCli('--issuePrefixes="ABC-" --issueUrlFormat="http://www.foo.com/{{prefix}}{{id}}"')
const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
content.should.include('http://www.foo.com/ABC-1')
})
it('[LEGACY] supports --message (and single %s replacement)', function () {

@@ -1179,0 +1248,0 @@ commit('feat: another commit addresses issue #1')

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc