From 66149dc4da2884a57dca03296fbc24262843964a Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Tue, 8 Sep 2020 13:28:42 +0200 Subject: [PATCH] fix(trigger): replace yarn publish with npm publish (#919) Co-authored-by: shipjs --- README.md | 2 +- packages/shipjs/src/helper/getPublishCommand.js | 6 +++--- .../shipjs/src/step/release/__tests__/runPublish.spec.js | 6 +++--- website/guide/README.md | 2 +- website/guide/useful-config.md | 2 +- website/reference/all-config.md | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 2e1c0d50..58a8e22a 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ When releasing, you go through something like the following: - Update the version in `package.json` - Update the changelog -- Actually release it (e.g. `yarn build && yarn publish`) +- Actually release it (e.g. `npm run build && npm publish`) - Create a git tag - Create a release on GitHub diff --git a/packages/shipjs/src/helper/getPublishCommand.js b/packages/shipjs/src/helper/getPublishCommand.js index 27066ead..3eac784f 100644 --- a/packages/shipjs/src/helper/getPublishCommand.js +++ b/packages/shipjs/src/helper/getPublishCommand.js @@ -4,9 +4,9 @@ export default function getPublishCommand({ tag, dir, }) { - const defaultCommand = isYarn - ? `yarn publish --no-git-tag-version --non-interactive --tag ${tag}` - : `npm publish --tag ${tag}`; + const npmPublish = `npm publish --tag ${tag}`; + const setRegistry = 'npm_config_registry=https://registry.npmjs.org/'; + const defaultCommand = isYarn ? `${setRegistry} ${npmPublish}` : npmPublish; return publishCommand({ isYarn, tag, defaultCommand, dir }); } diff --git a/packages/shipjs/src/step/release/__tests__/runPublish.spec.js b/packages/shipjs/src/step/release/__tests__/runPublish.spec.js index e82d6601..776e9c64 100644 --- a/packages/shipjs/src/step/release/__tests__/runPublish.spec.js +++ b/packages/shipjs/src/step/release/__tests__/runPublish.spec.js @@ -22,7 +22,7 @@ describe('runPublish', () => { expect(run).toHaveBeenCalledTimes(1); expect(run.mock.calls[0][0]).toMatchInlineSnapshot(` Object { - "command": "yarn publish --no-git-tag-version --non-interactive --tag latest", + "command": "npm_config_registry=https://registry.npmjs.org/ npm publish --tag latest", "dir": ".", "dryRun": false, } @@ -76,14 +76,14 @@ describe('runPublish', () => { expect(run).toHaveBeenCalledTimes(2); expect(run.mock.calls[0][0]).toMatchInlineSnapshot(` Object { - "command": "yarn publish --no-git-tag-version --non-interactive --tag latest", + "command": "npm_config_registry=https://registry.npmjs.org/ npm publish --tag latest", "dir": "/package-a", "dryRun": false, } `); expect(run.mock.calls[1][0]).toMatchInlineSnapshot(` Object { - "command": "yarn publish --no-git-tag-version --non-interactive --tag latest", + "command": "npm_config_registry=https://registry.npmjs.org/ npm publish --tag latest", "dir": "/package-b", "dryRun": false, } diff --git a/website/guide/README.md b/website/guide/README.md index 94fb304c..748dac42 100644 --- a/website/guide/README.md +++ b/website/guide/README.md @@ -30,7 +30,7 @@ When releasing, you go through something like the following: - Update the version in `package.json` - Update the changelog -- Actually release it (e.g. `yarn build && yarn publish`) +- Actually release it (e.g. `npm run build && npm publish`) - Create a git tag - Create a release on GitHub diff --git a/website/guide/useful-config.md b/website/guide/useful-config.md index abbafede..a5a27b6d 100644 --- a/website/guide/useful-config.md +++ b/website/guide/useful-config.md @@ -169,6 +169,6 @@ module.exports = { }; ``` -By default, `publishCommand` returns `yarn publish` or `npm publish`. You can override it like the above to release it to wherever you want. +By default, `publishCommand` returns `npm publish`. You can override it like the above to release it to wherever you want. If you have configured `monorepo`, this command will run in each package in `monorepo.packagesToPublish`. diff --git a/website/reference/all-config.md b/website/reference/all-config.md index f1a36336..bde98bd4 100644 --- a/website/reference/all-config.md +++ b/website/reference/all-config.md @@ -227,11 +227,11 @@ publishCommand: ({ isYarn, tag, defaultCommand, dir }) => defaultCommand; ```js isYarn - ? `yarn publish --no-git-tag-version --non-interactive --tag ${tag}` + ? `npm_config_registry=https://registry.npmjs.org/ npm publish --tag ${tag}` : `npm publish --tag ${tag}`; ``` -By default, `publishCommand` will return either `yarn publish ...` or `npm publish ...`. +By default, `publishCommand` will return `npm publish ...`. ### Scoped Package