@samitouri / QOS-React-2 / commits / 7543459a48

Allow publishing untagged releases (#19505)

Dan Abramov committed Jul 31, 2020 at 16:10 UTC 7543459a4819a443f4e3fd9fcf55d773721e0571
3 files changed +15 -37
scripts/release/README.md
+4
@@ -20,6 +20,10 @@ The high level process of creating releases is [documented below](#process). Ind
20
21 If this is your first time running the release scripts, go to the `scripts/release` directory and run `yarn` to install the dependencies.
22
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 +
27 ## Publishing Next
28
29 "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
+7 -3
@@ -11,15 +11,19 @@ const theme = require('../theme');
11 const run = async ({cwd, packages, tags}) => {
12 clear();
13
14 - if (tags.length === 1) {
14 + if (tags.length === 0) {
15 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}}:`
21 );
22 } else {
23 console.log(
24 theme`{spinnerSuccess ✓} You are about the publish the following packages under the tags {tag ${tags.join(
25 ', '
22 - )}}`
26 + )}}:`
27 );
28 }
29
scripts/release/publish-commands/parse-params.js
+4 -34
@@ -3,7 +3,6 @@
3 'use strict';
4
5 const commandLineArgs = require('command-line-args');
6 -const commandLineUsage = require('command-line-usage');
6 const {splitCommaParams} = require('../utils');
7
8 const paramDefinitions = [
@@ -30,39 +29,10 @@ const paramDefinitions = [
29
30 module.exports = () => {
31 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 = [];
34 }
63 -
64 - splitCommaParams(skipPackages);
65 - splitCommaParams(tags);
66 -
35 + splitCommaParams(params.skipPackages);
36 + splitCommaParams(params.tags);
37 return params;
38 };