diff --git a/package.json b/package.json index f3211429..ed6a13e3 100644 --- a/package.json +++ b/package.json @@ -30,41 +30,41 @@ ], "dependencies": { "@samverschueren/stream-to-observable": "^0.3.0", - "any-observable": "^0.3.0", + "any-observable": "^0.4.0", "async-exit-hook": "^2.0.1", "chalk": "^2.3.0", "cosmiconfig": "^5.2.1", "del": "^4.1.0", "escape-string-regexp": "^2.0.0", - "execa": "^1.0.0", + "execa": "^2.0.1", "github-url-from-git": "^1.5.0", "has-yarn": "^2.1.0", "hosted-git-info": "^2.7.1", - "inquirer": "^6.2.1", - "is-installed-globally": "^0.1.0", + "inquirer": "^6.4.1", + "is-installed-globally": "^0.2.0", "is-scoped": "^2.1.0", "issue-regex": "^2.0.0", "listr": "^0.14.3", "listr-input": "^0.1.3", "log-symbols": "^3.0.0", "meow": "^5.0.0", - "npm-name": "^5.0.1", + "npm-name": "^5.4.0", "onetime": "^5.1.0", "open": "^6.1.0", - "ow": "^0.12.0", + "ow": "^0.13.2", "p-memoize": "^3.1.0", "p-timeout": "^3.1.0", "pkg-dir": "^4.1.0", - "read-pkg-up": "^5.0.0", + "read-pkg-up": "^6.0.0", "rxjs": "^6.3.3", - "semver": "^6.0.0", + "semver": "^6.1.2", "split": "^1.0.0", "symbol-observable": "^1.2.0", "terminal-link": "^1.2.0", - "update-notifier": "^2.1.0" + "update-notifier": "^3.0.0" }, "devDependencies": { - "ava": "^1.1.0", + "ava": "^2.1.0", "xo": "^0.24.0" } } diff --git a/source/git-util.js b/source/git-util.js index 4cc1f525..9f9b4142 100644 --- a/source/git-util.js +++ b/source/git-util.js @@ -3,9 +3,15 @@ const execa = require('execa'); const escapeStringRegexp = require('escape-string-regexp'); const {verifyRequirementSatisfied} = require('./version'); -exports.latestTag = () => execa.stdout('git', ['describe', '--abbrev=0', '--tags']); +exports.latestTag = async () => { + const {stdout} = await execa('git', ['describe', '--abbrev=0', '--tags']); + return stdout; +}; -const firstCommit = () => execa.stdout('git', ['rev-list', '--max-parents=0', 'HEAD']); +const firstCommit = async () => { + const {stdout} = await execa('git', ['rev-list', '--max-parents=0', 'HEAD']); + return stdout; +}; exports.latestTagOrFirstCommit = async () => { let latest; @@ -27,7 +33,10 @@ exports.hasUpstream = async () => { return new RegExp(String.raw`^## ${escapedCurrentBranch}\.\.\..+\/${escapedCurrentBranch}`).test(stdout); }; -exports.currentBranch = () => execa.stdout('git', ['symbolic-ref', '--short', 'HEAD']); +exports.currentBranch = async () => { + const {stdout} = await execa('git', ['symbolic-ref', '--short', 'HEAD']); + return stdout; +}; exports.verifyCurrentBranchIsMaster = async () => { if (await exports.currentBranch() !== 'master') { @@ -57,7 +66,8 @@ exports.verifyWorkingTreeIsClean = async () => { exports.isRemoteHistoryClean = async () => { let history; try { // Gracefully handle no remote set up. - history = await execa.stdout('git', ['rev-list', '--count', '--left-only', '@{u}...HEAD']); + const {stdout} = await execa('git', ['rev-list', '--count', '--left-only', '@{u}...HEAD']); + history = stdout; } catch (_) {} if (history && history !== '0') { @@ -81,7 +91,9 @@ exports.verifyRemoteIsValid = async () => { } }; -exports.fetch = () => execa('git', ['fetch']); +exports.fetch = async () => { + await execa('git', ['fetch']); +}; exports.tagExistsOnRemote = async tagName => { try { @@ -109,9 +121,14 @@ exports.verifyTagDoesNotExistOnRemote = async tagName => { } }; -exports.commitLogFromRevision = revision => execa.stdout('git', ['log', '--format=%s %h', `${revision}..HEAD`]); +exports.commitLogFromRevision = async revision => { + const {stdout} = await execa('git', ['log', '--format=%s %h', `${revision}..HEAD`]); + return stdout; +}; -exports.push = () => execa('git', ['push', '--follow-tags']); +exports.push = async () => { + await execa('git', ['push', '--follow-tags']); +}; exports.deleteTag = async tagName => { await execa('git', ['tag', '--delete', tagName]); diff --git a/source/index.js b/source/index.js index 6819645a..8d099a95 100644 --- a/source/index.js +++ b/source/index.js @@ -228,6 +228,6 @@ module.exports = async (input = 'patch', options) => { await tasks.run(); - const {pkg: newPkg} = await readPkgUp(); + const {package: newPkg} = await readPkgUp(); return newPkg; }; diff --git a/source/npm/util.js b/source/npm/util.js index fbc5102e..5831934a 100644 --- a/source/npm/util.js +++ b/source/npm/util.js @@ -26,7 +26,8 @@ exports.username = async ({externalRegistry}) => { } try { - return await execa.stdout('npm', args); + const {stdout} = await execa('npm', args); + return stdout; } catch (error) { throw new Error(/ENEEDAUTH/.test(error.stderr) ? 'You must be logged in. Use `npm login` and try again.' : @@ -38,7 +39,8 @@ exports.collaborators = async packageName => { ow(packageName, ow.string); try { - return await execa.stdout('npm', ['access', 'ls-collaborators', packageName]); + const {stdout} = await execa('npm', ['access', 'ls-collaborators', packageName]); + return stdout; } catch (error) { // Ignore non-existing package error if (error.stderr.includes('code E404')) { @@ -81,7 +83,10 @@ exports.isPackageNameAvailable = async pkg => { exports.isExternalRegistry = pkg => typeof pkg.publishConfig === 'object' && typeof pkg.publishConfig.registry === 'string'; -exports.version = () => execa.stdout('npm', ['--version']); +exports.version = async () => { + const {stdout} = await execa('npm', ['--version']); + return stdout; +}; exports.verifyRecentNpmVersion = async () => { const npmVersion = await exports.version(); diff --git a/source/prerequisite-tasks.js b/source/prerequisite-tasks.js index 8ea6f5e6..3a6fb729 100644 --- a/source/prerequisite-tasks.js +++ b/source/prerequisite-tasks.js @@ -24,7 +24,7 @@ module.exports = (input, pkg, options) => { title: 'Check yarn version', enabled: () => options.yarn === true, task: async () => { - const yarnVersion = await execa.stdout('yarn', ['--version']); + const {stdout: yarnVersion} = await execa('yarn', ['--version']); version.verifyRequirementSatisfied('yarn', yarnVersion); } }, diff --git a/source/util.js b/source/util.js index 8d1f1ed8..264312bd 100644 --- a/source/util.js +++ b/source/util.js @@ -7,7 +7,7 @@ const pMemoize = require('p-memoize'); const ow = require('ow'); exports.readPkg = () => { - const {pkg} = readPkgUp.sync(); + const {package: pkg} = readPkgUp.sync(); if (!pkg) { throw new Error('No package.json found. Make sure you\'re in the correct project.'); @@ -53,10 +53,12 @@ exports.getTagVersionPrefix = pMemoize(async options => { try { if (options.yarn) { - return await execa.stdout('yarn', ['config', 'get', 'version-tag-prefix']); + const {stdout} = await execa('yarn', ['config', 'get', 'version-tag-prefix']); + return stdout; } - return await execa.stdout('npm', ['config', 'get', 'tag-version-prefix']); + const {stdout} = await execa('npm', ['config', 'get', 'tag-version-prefix']); + return stdout; } catch (_) { return 'v'; }