Set default release channel for download-experimental-build script (#20663)

This commit is contained in:
Brian Vaughn
2021-01-26 12:17:56 -08:00
committed by GitHub
parent a511dc7090
commit db5945efee
2 changed files with 23 additions and 1 deletions

View File

@@ -3,7 +3,11 @@
'use strict';
const {join} = require('path');
const {getPublicPackages, handleError} = require('./utils');
const {
addDefaultParamValue,
getPublicPackages,
handleError,
} = require('./utils');
const checkEnvironmentVariables = require('./shared-commands/check-environment-variables');
const downloadBuildArtifacts = require('./shared-commands/download-build-artifacts');
@@ -13,6 +17,8 @@ const printSummary = require('./download-experimental-build-commands/print-summa
const run = async () => {
try {
addDefaultParamValue('-r', '--releaseChannel', 'experimental');
const params = parseParams();
params.cwd = join(__dirname, '..', '..');
params.packages = await getPublicPackages(true);

View File

@@ -17,6 +17,21 @@ const logger = createLogger({
storagePath: join(__dirname, '.progress-estimator'),
});
const addDefaultParamValue = (shortName, longName, defaultValue) => {
let found = false;
for (let i = 0; i < process.argv.length; i++) {
const current = process.argv[i];
if (current === shortName || current.startsWith(`${longName}=`)) {
found = true;
break;
}
}
if (!found) {
process.argv.push(shortName, defaultValue);
}
};
const confirm = async message => {
const confirmation = await prompt(theme`\n{caution ${message}} (y/N) `);
prompt.done();
@@ -249,6 +264,7 @@ const updateVersionsForNext = async (cwd, reactVersion, version) => {
};
module.exports = {
addDefaultParamValue,
confirm,
execRead,
getArtifactsList,