From 3250b9a1af9c1ae96f30384a23200afb7e2756e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6nnemann?= Date: Tue, 9 Jun 2015 19:59:23 +0200 Subject: [PATCH 1/2] test(verify): not publishing placeholder versions --- tests/scenarios/verify.js | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/tests/scenarios/verify.js b/tests/scenarios/verify.js index f9d5bbf5..ea251de1 100644 --- a/tests/scenarios/verify.js +++ b/tests/scenarios/verify.js @@ -4,16 +4,15 @@ var efh = require('error-first-handler') var nixt = require('nixt') module.exports = function (test, createModule) { - createModule({ - repository: {}, - scripts: { - prepublish: 'semantic-release pre --no-token' - } - }, efh()(function (name, cwd) { - test('verify', function (t) { + test('verify', function (t) { + createModule({ + repository: {}, + scripts: { + prepublish: 'semantic-release pre --no-token' + } + }, efh()(function (name, cwd) { t.test('verify package and options before publishing', function (t) { t.plan(1) - nixt() .cwd(cwd) .env('CI', true) @@ -29,6 +28,23 @@ module.exports = function (test, createModule) { 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') + }) + }) + })) + }) } From 1591608f834eb629a171110a894ed2542911461a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6nnemann?= Date: Tue, 9 Jun 2015 20:01:14 +0200 Subject: [PATCH 2/2] fix(verify): not publishing placeholder versions closes #24 --- bin/semantic-release.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/semantic-release.js b/bin/semantic-release.js index 93a6ecf3..05521a6e 100755 --- a/bin/semantic-release.js +++ b/bin/semantic-release.js @@ -31,7 +31,14 @@ var npmArgv = process.env.npm_config_argv ? if (~argv._.indexOf('pre')) { // 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 // in this case we abort the command and do nothing. if (