Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(trigger): replace yarn publish with npm publish #919

Merged
merged 1 commit into from Sep 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 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

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,
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 });
}
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.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,
}
Expand Down Expand Up @@ -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,
}
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 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

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`.
4 changes: 2 additions & 2 deletions website/reference/all-config.md
Expand Up @@ -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

Expand Down