react/scripts/release/prepare-stable-commands/parse-params.js
Brian Vaughn 8482cbe22d
Automated fixture tests (#14370)
* Renamed snapshot test from test.js to snapshot-test.js
* Automate fixtures tests
2018-12-02 11:25:45 -08:00

58 lines
1.2 KiB
JavaScript

#!/usr/bin/env node
'use strict';
const commandLineArgs = require('command-line-args');
const commandLineUsage = require('command-line-usage');
const paramDefinitions = [
{
name: 'local',
type: Boolean,
description:
'Skip NPM and use the build already present in "build/node_modules".',
defaultValue: false,
},
{
name: 'skipTests',
type: Boolean,
description: 'Skip automated fixture tests.',
defaultValue: false,
},
{
name: 'version',
type: String,
description: 'Version of published canary release (e.g. 0.0.0-ddaf2b07c)',
},
];
module.exports = () => {
const params = commandLineArgs(paramDefinitions);
if (!params.version) {
const usage = commandLineUsage([
{
content: 'Prepare a published canary release to be promoted to stable.',
},
{
header: 'Options',
optionList: paramDefinitions,
},
{
header: 'Examples',
content: [
{
desc: 'Example:',
example:
'$ ./prepare-stable.js [bold]{--version=}[underline]{0.0.0-ddaf2b07c}',
},
],
},
]);
console.log(usage);
process.exit(1);
}
return params;
};