mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
I missed this the last time. --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32777). * #32778 * __->__ #32777
73 lines
1.5 KiB
JavaScript
73 lines
1.5 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
'use strict';
|
|
|
|
const commandLineArgs = require('command-line-args');
|
|
const {splitCommaParams} = require('../utils');
|
|
|
|
const paramDefinitions = [
|
|
{
|
|
name: 'dry',
|
|
type: Boolean,
|
|
description: 'Dry run command without actually publishing to NPM.',
|
|
defaultValue: false,
|
|
},
|
|
{
|
|
name: 'tags',
|
|
type: String,
|
|
multiple: true,
|
|
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,
|
|
multiple: true,
|
|
description: 'Packages to exclude from publishing',
|
|
defaultValue: [],
|
|
},
|
|
{
|
|
name: 'ci',
|
|
type: Boolean,
|
|
description: 'Run in automated environment, without interactive prompts.',
|
|
defaultValue: false,
|
|
},
|
|
{
|
|
name: 'publishVersion',
|
|
type: String,
|
|
description: 'Version to publish',
|
|
},
|
|
];
|
|
|
|
module.exports = () => {
|
|
const params = commandLineArgs(paramDefinitions);
|
|
splitCommaParams(params.skipPackages);
|
|
splitCommaParams(params.onlyPackages);
|
|
splitCommaParams(params.tags);
|
|
params.tags.forEach(tag => {
|
|
switch (tag) {
|
|
case 'latest':
|
|
case 'canary':
|
|
case 'next':
|
|
case 'experimental':
|
|
case 'alpha':
|
|
case 'beta':
|
|
case 'rc':
|
|
case 'untagged':
|
|
break;
|
|
default:
|
|
console.error('Unsupported tag: "' + tag + '"');
|
|
process.exit(1);
|
|
break;
|
|
}
|
|
});
|
|
return params;
|
|
};
|