Skip to content
Permalink
Browse files

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

Co-authored-by: shipjs <shipjs@test.com>
  • Loading branch information
eunjae-lee and shipjs committed Sep 8, 2020
1 parent 53121e2 commit 66149dc4da2884a57dca03296fbc24262843964a
@@ -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

@@ -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 });
}
@@ -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,
}
@@ -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

@@ -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`.
@@ -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

0 comments on commit 66149dc

Please sign in to comment.
You can’t perform that action at this time.