Skip to content

Commit

Permalink
Fix up dry runs
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Dec 12, 2018
1 parent a20f184 commit 5c1a8ed
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions lib/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ const npmPublish = (options, pkgName, otpPrompt) => {
const isScopedPkg = pkgName.startsWith('@');
const accessArg = isScopedPkg && access ? `--access ${access}` : '';
const otpArg = otp ? `--otp ${otp}` : '';
return run(`npm publish ${publishPath} --tag ${tag} ${accessArg} ${otpArg}`).catch(err => {
const dryRunArg = config.isDryRun ? '--dry-run' : '';
return run(`npm publish ${publishPath} --tag ${tag} ${accessArg} ${otpArg} ${dryRunArg}`, {
isReadOnly: true,
verbose: config.isVerbose || config.isDryRun
}).catch(err => {
if (/one-time pass/.test(err)) {
if (otp != null) {
warn('The provided OTP is incorrect or has expired.');
Expand Down Expand Up @@ -115,18 +119,12 @@ const copy = (files, options, target) => {
};

const bump = (files, version) => {
logExec('bump', files, version);
if (config.isDryRun) {
logDry();
return noop;
}
return files
? Promise.all(
_.castArray(files).map(file => {
logExec('bump', file, version);
return bumpFile(file, version);
})
)
: noop;
return files ? Promise.all(_.castArray(files).map(file => bumpFile(file, version))) : noop;
};

module.exports = {
Expand Down

0 comments on commit 5c1a8ed

Please sign in to comment.