Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
const spec = {
'--debug': Boolean,
'--safe': Boolean,
'--dump-keyboard-layout': Boolean,
'--new-window': Boolean,
'-n': '--new-window',
'--disable-gpu': Boolean,
'--user-data-dir': String,
// Misc
'--help': Boolean,
'-h': '--help',
'--verbose': arg.COUNT,
'-v': '--verbose',
'--version': Boolean
}
return arg(spec, { argv, permissive })
}
import { resolve } from 'path';
import arg from 'arg';
import chalk from 'chalk';
import delay from 'delay';
import got from 'got';
import serve from './serve';
import * as spinner from './spinner';
const args = arg({});
if (!args._[0]) {
console.error(chalk.red('Please specify a server entrypoint: `react-ssr server.js`'));
process.exit(1);
}
const cwd = process.cwd();
const server: string = resolve(cwd, args._[0]);
async function dev() {
let proc;
const wrapper = () => {
if (proc) {
proc.kill();
}
};
function parseArgumentsIntoOptions(rawArgs) {
const args = arg(
{
'--angular': Boolean,
'--no-watch': Boolean,
'--packages': String,
'--all-packages': Boolean,
'--excluded-packages': String,
'--sync-build': Boolean,
'--sync': Boolean,
'--yarn': Boolean,
'-a': '--angular',
'-y': '--yarn',
},
{
argv: rawArgs,
},
);
export default function getArgs(
argv: string[],
argsOptions: T,
argOptions: ArgOptions = {}
) {
return arg(Object.assign({}, getCommonArgs(), argsOptions), {
...argOptions,
argv
});
}