Skip to content

Commit db5945e

Browse files
author
Brian Vaughn
authored
Set default release channel for download-experimental-build script (#20663)
1 parent a511dc7 commit db5945e

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

scripts/release/download-experimental-build.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
'use strict';
44

55
const {join} = require('path');
6-
const {getPublicPackages, handleError} = require('./utils');
6+
const {
7+
addDefaultParamValue,
8+
getPublicPackages,
9+
handleError,
10+
} = require('./utils');
711

812
const checkEnvironmentVariables = require('./shared-commands/check-environment-variables');
913
const downloadBuildArtifacts = require('./shared-commands/download-build-artifacts');
@@ -13,6 +17,8 @@ const printSummary = require('./download-experimental-build-commands/print-summa
1317

1418
const run = async () => {
1519
try {
20+
addDefaultParamValue('-r', '--releaseChannel', 'experimental');
21+
1622
const params = parseParams();
1723
params.cwd = join(__dirname, '..', '..');
1824
params.packages = await getPublicPackages(true);

scripts/release/utils.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,21 @@ const logger = createLogger({
1717
storagePath: join(__dirname, '.progress-estimator'),
1818
});
1919

20+
const addDefaultParamValue = (shortName, longName, defaultValue) => {
21+
let found = false;
22+
for (let i = 0; i < process.argv.length; i++) {
23+
const current = process.argv[i];
24+
if (current === shortName || current.startsWith(`${longName}=`)) {
25+
found = true;
26+
break;
27+
}
28+
}
29+
30+
if (!found) {
31+
process.argv.push(shortName, defaultValue);
32+
}
33+
};
34+
2035
const confirm = async message => {
2136
const confirmation = await prompt(theme`\n{caution ${message}} (y/N) `);
2237
prompt.done();
@@ -249,6 +264,7 @@ const updateVersionsForNext = async (cwd, reactVersion, version) => {
249264
};
250265

251266
module.exports = {
267+
addDefaultParamValue,
252268
confirm,
253269
execRead,
254270
getArtifactsList,

0 commit comments

Comments
 (0)