diff --git a/scripts/release/prepare-release-from-npm-commands/parse-params.js b/scripts/release/prepare-release-from-npm-commands/parse-params.js index b9aa1a4f5e7e8..b08d81e89dc18 100644 --- a/scripts/release/prepare-release-from-npm-commands/parse-params.js +++ b/scripts/release/prepare-release-from-npm-commands/parse-params.js @@ -13,6 +13,13 @@ const paramDefinitions = [ 'Skip NPM and use the build already present in "build/node_modules".', defaultValue: false, }, + { + name: 'onlyPackages', + type: String, + multiple: true, + description: 'Packages to include in publishing', + defaultValue: [], + }, { name: 'skipPackages', type: String, diff --git a/scripts/release/prepare-release-from-npm.js b/scripts/release/prepare-release-from-npm.js index e23ffb39bc1c0..8220fda220b65 100755 --- a/scripts/release/prepare-release-from-npm.js +++ b/scripts/release/prepare-release-from-npm.js @@ -28,6 +28,9 @@ const run = async () => { params.packages = await getPublicPackages(isExperimental); params.packages = params.packages.filter(packageName => { + if (params.onlyPackages.length > 0) { + return params.onlyPackages.includes(packageName); + } return !params.skipPackages.includes(packageName); }); diff --git a/scripts/release/publish-commands/parse-params.js b/scripts/release/publish-commands/parse-params.js index b7196447d4da8..ce9a9b7825c1a 100644 --- a/scripts/release/publish-commands/parse-params.js +++ b/scripts/release/publish-commands/parse-params.js @@ -19,6 +19,13 @@ const paramDefinitions = [ description: 'NPM tags to point to the new release.', defaultValue: ['untagged'], }, + { + name: 'onlyPackages', + type: String, + multiple: true, + description: 'Packages to include in publishing', + defaultValue: [], + }, { name: 'skipPackages', type: String, @@ -32,6 +39,11 @@ const paramDefinitions = [ description: 'Run in automated environment, without interactive prompts.', defaultValue: false, }, + { + name: 'publishVersion', + type: String, + description: 'Version to publish', + }, ]; module.exports = () => { diff --git a/scripts/release/publish.js b/scripts/release/publish.js index dcd31f1de7796..87b9940636b18 100755 --- a/scripts/release/publish.js +++ b/scripts/release/publish.js @@ -23,14 +23,20 @@ const run = async () => { try { const params = parseParams(); - const version = readJsonSync( - './build/node_modules/react/package.json' - ).version; + const version = + params.publishVersion ?? + readJsonSync('./build/node_modules/react/package.json').version; const isExperimental = version.includes('experimental'); params.cwd = join(__dirname, '..', '..'); params.packages = await getPublicPackages(isExperimental); + if (params.onlyPackages.length > 0) { + params.packages = params.packages.filter(packageName => { + return params.onlyPackages.includes(packageName); + }); + } + // Pre-filter any skipped packages to simplify the following commands. // As part of doing this we can also validate that none of the skipped packages were misspelled. params.skipPackages.forEach(packageName => {