Skip to content

Commit

Permalink
fix(trigger): replace yarn publish with npm publish (#919)
Browse files Browse the repository at this point in the history
Co-authored-by: shipjs <shipjs@test.com>
  • Loading branch information
Eunjae Lee and shipjs committed Sep 8, 2020
1 parent 53121e2 commit 66149dc
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -42,7 +42,7 @@ When releasing, you go through something like the following:


- Update the version in `package.json` - Update the version in `package.json`
- Update the changelog - 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 git tag
- Create a release on GitHub - Create a release on GitHub


Expand Down
6 changes: 3 additions & 3 deletions packages/shipjs/src/helper/getPublishCommand.js
Expand Up @@ -4,9 +4,9 @@ export default function getPublishCommand({
tag, tag,
dir, dir,
}) { }) {
const defaultCommand = isYarn const npmPublish = `npm publish --tag ${tag}`;
? `yarn publish --no-git-tag-version --non-interactive --tag ${tag}` const setRegistry = 'npm_config_registry=https://registry.npmjs.org/';
: `npm publish --tag ${tag}`; const defaultCommand = isYarn ? `${setRegistry} ${npmPublish}` : npmPublish;


return publishCommand({ isYarn, tag, defaultCommand, dir }); return publishCommand({ isYarn, tag, defaultCommand, dir });
} }
6 changes: 3 additions & 3 deletions packages/shipjs/src/step/release/__tests__/runPublish.spec.js
Expand Up @@ -22,7 +22,7 @@ describe('runPublish', () => {
expect(run).toHaveBeenCalledTimes(1); expect(run).toHaveBeenCalledTimes(1);
expect(run.mock.calls[0][0]).toMatchInlineSnapshot(` expect(run.mock.calls[0][0]).toMatchInlineSnapshot(`
Object { 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": ".", "dir": ".",
"dryRun": false, "dryRun": false,
} }
Expand Down Expand Up @@ -76,14 +76,14 @@ describe('runPublish', () => {
expect(run).toHaveBeenCalledTimes(2); expect(run).toHaveBeenCalledTimes(2);
expect(run.mock.calls[0][0]).toMatchInlineSnapshot(` expect(run.mock.calls[0][0]).toMatchInlineSnapshot(`
Object { 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", "dir": "/package-a",
"dryRun": false, "dryRun": false,
} }
`); `);
expect(run.mock.calls[1][0]).toMatchInlineSnapshot(` expect(run.mock.calls[1][0]).toMatchInlineSnapshot(`
Object { 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", "dir": "/package-b",
"dryRun": false, "dryRun": false,
} }
Expand Down
2 changes: 1 addition & 1 deletion website/guide/README.md
Expand Up @@ -30,7 +30,7 @@ When releasing, you go through something like the following:


- Update the version in `package.json` - Update the version in `package.json`
- Update the changelog - 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 git tag
- Create a release on GitHub - Create a release on GitHub


Expand Down
2 changes: 1 addition & 1 deletion website/guide/useful-config.md
Expand Up @@ -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`. If you have configured `monorepo`, this command will run in each package in `monorepo.packagesToPublish`.
4 changes: 2 additions & 2 deletions website/reference/all-config.md
Expand Up @@ -227,11 +227,11 @@ publishCommand: ({ isYarn, tag, defaultCommand, dir }) => defaultCommand;
```js ```js
isYarn 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}`; : `npm publish --tag ${tag}`;
``` ```
By default, `publishCommand` will return either `yarn publish ...` or `npm publish ...`. By default, `publishCommand` will return `npm publish ...`.
### Scoped Package ### Scoped Package
Expand Down

0 comments on commit 66149dc

Please sign in to comment.