Skip to content

Commit 7543459

Browse files
authored
Allow publishing untagged releases (facebook#19505)
1 parent 3d08955 commit 7543459

File tree

3 files changed

+15
-37
lines changed

3 files changed

+15
-37
lines changed

scripts/release/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ The high level process of creating releases is [documented below](#process). Ind
2020

2121
If this is your first time running the release scripts, go to the `scripts/release` directory and run `yarn` to install the dependencies.
2222

23+
## Publishing Without Tags
24+
25+
The sections bekow include meaningful `--tags` in the instructions. However, keep in mind that **the `--tags` arguments is optional**, and you can omit it if you don't want to tag the release on npm at all. This can be useful when preparing breaking changes.
26+
2327
## Publishing Next
2428

2529
"Next" builds are meant to be lightweight and published often. In most cases, they can be published using artifacts built by Circle CI.

scripts/release/publish-commands/confirm-version-and-tags.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@ const theme = require('../theme');
1111
const run = async ({cwd, packages, tags}) => {
1212
clear();
1313

14-
if (tags.length === 1) {
14+
if (tags.length === 0) {
1515
console.log(
16-
theme`{spinnerSuccess ✓} You are about the publish the following packages under the tag {tag ${tags}}`
16+
theme`{spinnerSuccess ✓} You are about the publish the following packages without any tags:`
17+
);
18+
} else if (tags.length === 1) {
19+
console.log(
20+
theme`{spinnerSuccess ✓} You are about the publish the following packages under the tag {tag ${tags}}:`
1721
);
1822
} else {
1923
console.log(
2024
theme`{spinnerSuccess ✓} You are about the publish the following packages under the tags {tag ${tags.join(
2125
', '
22-
)}}`
26+
)}}:`
2327
);
2428
}
2529

scripts/release/publish-commands/parse-params.js

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
'use strict';
44

55
const commandLineArgs = require('command-line-args');
6-
const commandLineUsage = require('command-line-usage');
76
const {splitCommaParams} = require('../utils');
87

98
const paramDefinitions = [
@@ -30,39 +29,10 @@ const paramDefinitions = [
3029

3130
module.exports = () => {
3231
const params = commandLineArgs(paramDefinitions);
33-
34-
const {skipPackages, tags} = params;
35-
36-
if (!tags || tags.length === 0) {
37-
const usage = commandLineUsage([
38-
{
39-
content:
40-
'Publishes the current contents of "build/node_modules" to NPM.',
41-
},
42-
{
43-
header: 'Options',
44-
optionList: paramDefinitions,
45-
},
46-
{
47-
header: 'Examples',
48-
content: [
49-
{
50-
desc: 'Dry run test:',
51-
example: '$ scripts/release/publish.js --dry --tags next',
52-
},
53-
{
54-
desc: 'Publish a new stable:',
55-
example: '$ scripts/release/publish.js --tags next latest',
56-
},
57-
],
58-
},
59-
]);
60-
console.log(usage);
61-
process.exit(1);
32+
if (!params.tags || !params.tags.length) {
33+
params.tags = [];
6234
}
63-
64-
splitCommaParams(skipPackages);
65-
splitCommaParams(tags);
66-
35+
splitCommaParams(params.skipPackages);
36+
splitCommaParams(params.tags);
6737
return params;
6838
};

0 commit comments

Comments
 (0)