From 9155ccef4e4033891a27babd0cf49353185bacc2 Mon Sep 17 00:00:00 2001 From: Niklas Higi Date: Thu, 10 Oct 2019 09:51:22 +0200 Subject: [PATCH 01/14] Fix Yarn OTP failure (#461) --- source/npm/handle-npm-error.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/npm/handle-npm-error.js b/source/npm/handle-npm-error.js index ccafd8f3..d3390151 100644 --- a/source/npm/handle-npm-error.js +++ b/source/npm/handle-npm-error.js @@ -9,7 +9,8 @@ const handleNpmError = (error, task, message, executor) => { message = undefined; } - if (error.stderr.includes('one-time pass') || error.message.includes('user TTY')) { + // `one-time pass` is for npm and `Two factor authentication` is for Yarn. + if (error.stderr.includes('one-time pass') || error.stdout.includes('Two factor authentication')) { const {title} = task; task.title = `${title} ${chalk.yellow('(waiting for input…)')}`; From 55eec55c0cbd2263d38172a72b8089e1cb932bf8 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Thu, 10 Oct 2019 14:56:14 +0700 Subject: [PATCH 02/14] 5.1.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b3cbf705..bf4840fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "np", - "version": "5.1.0", + "version": "5.1.1", "description": "A better `npm publish`", "license": "MIT", "repository": "sindresorhus/np", From e335d26098b2437d024f26d52ae1e1c3a2d91671 Mon Sep 17 00:00:00 2001 From: Shazron Abdullah Date: Mon, 28 Oct 2019 14:42:19 +0800 Subject: [PATCH 03/14] Don't log "Aborted!" message when publish is a success (#464) --- source/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/index.js b/source/index.js index 969489d4..3368bf0e 100644 --- a/source/index.js +++ b/source/index.js @@ -92,6 +92,8 @@ module.exports = async (input = 'patch', options) => { await rollback(); callback(); })(); + } else if (publishStatus === 'SUCCESS' && runPublish) { + // Do nothing } else { console.log('\nAborted!'); callback(); From 83ecc79a47fd95328ec92595ee80523116c112c2 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Mon, 28 Oct 2019 13:47:48 +0700 Subject: [PATCH 04/14] 5.1.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bf4840fe..1801e852 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "np", - "version": "5.1.1", + "version": "5.1.2", "description": "A better `npm publish`", "license": "MIT", "repository": "sindresorhus/np", From 1b280200a88ab42eb706afc8ecf1470b6b26f10e Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sat, 9 Nov 2019 00:10:06 +0700 Subject: [PATCH 05/14] Fix global detection for when Node.js was installed with Homebrew Fixes #453 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1801e852..c912fe5f 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "has-yarn": "^2.1.0", "hosted-git-info": "^3.0.0", "inquirer": "^7.0.0", - "is-installed-globally": "^0.2.0", + "is-installed-globally": "^0.3.1", "is-scoped": "^2.1.0", "issue-regex": "^2.0.0", "listr": "^0.14.3", From 817a03018862ee4b692f9ee66d2720431325bb37 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sat, 9 Nov 2019 00:22:17 +0700 Subject: [PATCH 06/14] 5.1.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c912fe5f..9f7d275c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "np", - "version": "5.1.2", + "version": "5.1.3", "description": "A better `npm publish`", "license": "MIT", "repository": "sindresorhus/np", From e53cbe849b1c4ca717883e086f07e1a804aa6f71 Mon Sep 17 00:00:00 2001 From: Xianming Zhong Date: Sat, 30 Nov 2019 17:44:24 +0800 Subject: [PATCH 07/14] Fix incorrectly showing "Aborted!" message on successful publish (#471) --- source/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/index.js b/source/index.js index 3368bf0e..82f63eba 100644 --- a/source/index.js +++ b/source/index.js @@ -87,13 +87,13 @@ module.exports = async (input = 'patch', options) => { // The default parameter is a workaround for https://github.com/Tapppi/async-exit-hook/issues/9 exitHook((callback = () => {}) => { - if (publishStatus === 'FAILED' && runPublish) { + if (publishStatus === 'FAILED') { (async () => { await rollback(); callback(); })(); - } else if (publishStatus === 'SUCCESS' && runPublish) { - // Do nothing + } else if (publishStatus === 'SUCCESS') { + callback(); } else { console.log('\nAborted!'); callback(); @@ -212,6 +212,8 @@ module.exports = async (input = 'patch', options) => { } ]); } + } else { + publishStatus = 'SUCCESS'; } tasks.add({ From 8360cb6d72f57275bd06256bfa50834852b1afbd Mon Sep 17 00:00:00 2001 From: Itai Steinherz Date: Sat, 30 Nov 2019 11:44:59 +0200 Subject: [PATCH 08/14] Check package name availability in custom registry (#429) --- source/npm/util.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/npm/util.js b/source/npm/util.js index 21a550ae..95ddd99b 100644 --- a/source/npm/util.js +++ b/source/npm/util.js @@ -77,12 +77,14 @@ exports.prereleaseTags = async packageName => { }; exports.isPackageNameAvailable = async pkg => { - const isExternalRegistry = exports.isExternalRegistry(pkg); - if (isExternalRegistry) { - return true; + const args = [pkg.name]; + if (exports.isExternalRegistry(pkg)) { + args.push({ + registryUrl: pkg.publishConfig.registry + }); } - return npmName(pkg.name); + return npmName(...args); }; exports.isExternalRegistry = pkg => typeof pkg.publishConfig === 'object' && typeof pkg.publishConfig.registry === 'string'; From 23524b5a28a6f6a9a29a52a69fe9cbd4c5a61ca7 Mon Sep 17 00:00:00 2001 From: Xianming Zhong Date: Sat, 30 Nov 2019 17:46:04 +0800 Subject: [PATCH 09/14] Don't ask for tag if `--no-publish` (#473) --- source/ui.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/ui.js b/source/ui.js index b29377ad..97796943 100644 --- a/source/ui.js +++ b/source/ui.js @@ -100,7 +100,7 @@ module.exports = async (options, pkg) => { type: 'list', name: 'tag', message: 'How should this pre-release version be tagged in npm?', - when: answers => !pkg.private && version.isPrereleaseOrIncrement(answers.version) && !options.tag, + when: answers => options.publish && !pkg.private && version.isPrereleaseOrIncrement(answers.version) && !options.tag, choices: async () => { const existingPrereleaseTags = await prereleaseTags(pkg.name); @@ -118,7 +118,7 @@ module.exports = async (options, pkg) => { type: 'input', name: 'tag', message: 'Tag', - when: answers => !pkg.private && version.isPrereleaseOrIncrement(answers.version) && !options.tag && !answers.tag, + when: answers => options.publish && !pkg.private && version.isPrereleaseOrIncrement(answers.version) && !options.tag && !answers.tag, validate: input => { if (input.length === 0) { return 'Please specify a tag, for example, `next`.'; From 000ddcf455a5c6ec42b494114f702fed8db146d0 Mon Sep 17 00:00:00 2001 From: Xianming Zhong Date: Sat, 30 Nov 2019 17:47:35 +0800 Subject: [PATCH 10/14] Don't check `"files"` in package.json or `.npmignore` if private package or not publishing (#472) --- source/ui.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/ui.js b/source/ui.js index 97796943..3848cacc 100644 --- a/source/ui.js +++ b/source/ui.js @@ -53,8 +53,11 @@ module.exports = async (options, pkg) => { const oldVersion = pkg.version; const extraBaseUrls = ['gitlab.com']; const repoUrl = pkg.repository && githubUrlFromGit(pkg.repository.url, {extraBaseUrls}); + const runPublish = options.publish && !pkg.private; - checkIgnoreStrategy(pkg); + if (runPublish) { + checkIgnoreStrategy(pkg); + } console.log(`\nPublish a new version of ${chalk.bold.magenta(pkg.name)} ${chalk.dim(`(current: ${oldVersion})`)}\n`); From 7d7900a28cb643d37de7ee979d7d1f76c1f14048 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sat, 30 Nov 2019 17:19:23 +0700 Subject: [PATCH 11/14] Update dependencies --- package.json | 16 ++++++++-------- source/index.js | 3 ++- source/pretty-version-diff.js | 12 ++++++------ source/release-task-helper.js | 2 +- source/util.js | 6 +++--- 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 9f7d275c..c979f625 100644 --- a/package.json +++ b/package.json @@ -30,13 +30,13 @@ ], "dependencies": { "@samverschueren/stream-to-observable": "^0.3.0", - "any-observable": "^0.4.0", + "any-observable": "^0.5.0", "async-exit-hook": "^2.0.1", - "chalk": "^2.3.0", + "chalk": "^3.0.0", "cosmiconfig": "^5.2.1", "del": "^4.1.0", "escape-string-regexp": "^2.0.0", - "execa": "^2.0.1", + "execa": "^3.4.0", "github-url-from-git": "^1.5.0", "has-yarn": "^2.1.0", "hosted-git-info": "^3.0.0", @@ -45,17 +45,17 @@ "is-scoped": "^2.1.0", "issue-regex": "^2.0.0", "listr": "^0.14.3", - "listr-input": "^0.1.3", + "listr-input": "^0.2.0", "log-symbols": "^3.0.0", "meow": "^5.0.0", "npm-name": "^5.4.0", "onetime": "^5.1.0", - "open": "^6.1.0", - "ow": "^0.13.2", + "open": "^7.0.0", + "ow": "^0.15.0", "p-memoize": "^3.1.0", "p-timeout": "^3.1.0", "pkg-dir": "^4.1.0", - "read-pkg-up": "^6.0.0", + "read-pkg-up": "^7.0.0", "rxjs": "^6.3.3", "semver": "^6.1.2", "split": "^1.0.0", @@ -67,6 +67,6 @@ "ava": "^2.3.0", "proxyquire": "^2.1.0", "sinon": "^7.3.2", - "xo": "^0.24.0" + "xo": "^0.25.3" } } diff --git a/source/index.js b/source/index.js index 82f63eba..4becf332 100644 --- a/source/index.js +++ b/source/index.js @@ -35,6 +35,7 @@ const exec = (cmd, args) => { ).pipe(filter(Boolean)); }; +// eslint-disable-next-line default-param-last module.exports = async (input = 'patch', options) => { options = { cleanup: true, @@ -239,6 +240,6 @@ module.exports = async (input = 'patch', options) => { await tasks.run(); - const {package: newPkg} = await readPkgUp(); + const {packageJson: newPkg} = await readPkgUp(); return newPkg; }; diff --git a/source/pretty-version-diff.js b/source/pretty-version-diff.js index 3f34fba3..15eb60b8 100644 --- a/source/pretty-version-diff.js +++ b/source/pretty-version-diff.js @@ -8,16 +8,16 @@ module.exports = (oldVersion, inc) => { let firstVersionChange = false; const output = []; - for (let i = 0; i < newVersion.length; i++) { - if ((newVersion[i] !== oldVersion[i] && !firstVersionChange)) { - output.push(`${chalk.dim.cyan(newVersion[i])}`); + for (const [i, element] of newVersion.entries()) { + if ((element !== oldVersion[i] && !firstVersionChange)) { + output.push(`${chalk.dim.cyan(element)}`); firstVersionChange = true; - } else if (newVersion[i].indexOf('-') >= 1) { + } else if (element.indexOf('-') >= 1) { let preVersion = []; - preVersion = newVersion[i].split('-'); + preVersion = element.split('-'); output.push(`${chalk.dim.cyan(`${preVersion[0]}-${preVersion[1]}`)}`); } else { - output.push(chalk.reset.dim(newVersion[i])); + output.push(chalk.reset.dim(element)); } } diff --git a/source/release-task-helper.js b/source/release-task-helper.js index 5a32383d..08751c04 100644 --- a/source/release-task-helper.js +++ b/source/release-task-helper.js @@ -15,5 +15,5 @@ module.exports = async (options, pkg) => { isPrerelease: version(options.version).isPrerelease() }); - await open(url); + await open(url, {url: true}); }; diff --git a/source/util.js b/source/util.js index 264312bd..b0098704 100644 --- a/source/util.js +++ b/source/util.js @@ -7,13 +7,13 @@ const pMemoize = require('p-memoize'); const ow = require('ow'); exports.readPkg = () => { - const {package: pkg} = readPkgUp.sync(); + const {packageJson} = readPkgUp.sync(); - if (!pkg) { + if (!packageJson) { throw new Error('No package.json found. Make sure you\'re in the correct project.'); } - return pkg; + return packageJson; }; exports.linkifyIssues = (url, message) => { From b67cdb452833dd16bc6b5a61972e781a7e487cf8 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sat, 30 Nov 2019 17:21:04 +0700 Subject: [PATCH 12/14] 5.2.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c979f625..5e36d422 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "np", - "version": "5.1.3", + "version": "5.2.0", "description": "A better `npm publish`", "license": "MIT", "repository": "sindresorhus/np", From 0b5a2b5d4a7536c387753ae6d0eb7cfa7efea7d5 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sat, 30 Nov 2019 17:30:13 +0700 Subject: [PATCH 13/14] Fix double-encoding of the release notes --- source/release-task-helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/release-task-helper.js b/source/release-task-helper.js index 08751c04..5a32383d 100644 --- a/source/release-task-helper.js +++ b/source/release-task-helper.js @@ -15,5 +15,5 @@ module.exports = async (options, pkg) => { isPrerelease: version(options.version).isPrerelease() }); - await open(url, {url: true}); + await open(url); }; From abe21ab35bd3ff2eed18862e522b6fbd2f63240a Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sat, 30 Nov 2019 17:32:23 +0700 Subject: [PATCH 14/14] 5.2.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5e36d422..1ec014a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "np", - "version": "5.2.0", + "version": "5.2.1", "description": "A better `npm publish`", "license": "MIT", "repository": "sindresorhus/np",