Merge pull request #38 from boennemann/feat-verify-version-placeholder
Not publishing placeholder versions
This commit is contained in:
commit
db39c796a6
@ -31,7 +31,14 @@ var npmArgv = process.env.npm_config_argv ?
|
|||||||
|
|
||||||
if (~argv._.indexOf('pre')) {
|
if (~argv._.indexOf('pre')) {
|
||||||
// see src/restart.js
|
// see src/restart.js
|
||||||
if (npmArgv['semantic-release-rerun']) process.exit(0)
|
if (npmArgv['semantic-release-rerun']) {
|
||||||
|
if (!/semantically-released/.test(process.env.npm_package_version)) process.exit(0)
|
||||||
|
|
||||||
|
console.log('There is something wrong with your setup, as a placeholder version is about to be released.')
|
||||||
|
console.log('Please verify that your setup is correct.')
|
||||||
|
console.log('If you think this is a problem with semantic-release please open an issue.')
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
// the `prepublish` hook is also executed when the package is installed
|
// the `prepublish` hook is also executed when the package is installed
|
||||||
// in this case we abort the command and do nothing.
|
// in this case we abort the command and do nothing.
|
||||||
if (
|
if (
|
||||||
|
@ -4,16 +4,15 @@ var efh = require('error-first-handler')
|
|||||||
var nixt = require('nixt')
|
var nixt = require('nixt')
|
||||||
|
|
||||||
module.exports = function (test, createModule) {
|
module.exports = function (test, createModule) {
|
||||||
|
test('verify', function (t) {
|
||||||
createModule({
|
createModule({
|
||||||
repository: {},
|
repository: {},
|
||||||
scripts: {
|
scripts: {
|
||||||
prepublish: 'semantic-release pre --no-token'
|
prepublish: 'semantic-release pre --no-token'
|
||||||
}
|
}
|
||||||
}, efh()(function (name, cwd) {
|
}, efh()(function (name, cwd) {
|
||||||
test('verify', function (t) {
|
|
||||||
t.test('verify package and options before publishing', function (t) {
|
t.test('verify package and options before publishing', function (t) {
|
||||||
t.plan(1)
|
t.plan(1)
|
||||||
|
|
||||||
nixt()
|
nixt()
|
||||||
.cwd(cwd)
|
.cwd(cwd)
|
||||||
.env('CI', true)
|
.env('CI', true)
|
||||||
@ -29,6 +28,23 @@ module.exports = function (test, createModule) {
|
|||||||
t.error(err, 'nixt')
|
t.error(err, 'nixt')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
}))
|
||||||
|
|
||||||
|
createModule({
|
||||||
|
version: '1.0.0-semantically-released'
|
||||||
|
}, efh()(function (name, cwd) {
|
||||||
|
t.test('not publishing placeholder versions', function (t) {
|
||||||
|
t.plan(1)
|
||||||
|
|
||||||
|
nixt()
|
||||||
|
.cwd(cwd)
|
||||||
|
.env('CI', true)
|
||||||
|
.run('npm publish --semantic-release-rerun')
|
||||||
|
.code(1)
|
||||||
|
.end(function (err) {
|
||||||
|
t.error(err, 'nixt')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}))
|
}))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user