Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import execa from 'execa'
import { getBinPath } from 'get-bin-path'
import { nodejs } from 'figures'
const BIN_PATH = getBinPath()
// eslint-disable-next-line max-params
export const runSerial = function(opts, versionRange, args, execaOpts) {
return runCli(opts, `${versionRange} ${versionRange}`, args, execaOpts)
}
// eslint-disable-next-line max-params
export const runParallel = function(opts, versionRange, args, execaOpts) {
return runCli(
`${opts} --parallel`,
`${versionRange} ${versionRange}`,
args,
execaOpts,
)
}
import execa from 'execa'
import { getBinPath } from 'get-bin-path'
const BINARY_PATH = getBinPath()
// Call CLI command `unix-permissions COMMAND ...ARGS` and return output
export const callCli = async function(command, ...args) {
const argsA = args.map(stringifyCliArg)
const { stdout, stderr, exitCode } = await execa(
await BINARY_PATH,
[command, ...argsA],
{ reject: false },
)
const stderrA = stderr.replace(HELP_MESSAGE_REGEXP, 'Help message')
return { exitCode, stdout, stderr: stderrA }
}
import { promisify } from 'util'
import Nodemon from 'nodemon'
import { exec } from 'gulp-execa'
import { getBinPath } from 'get-bin-path'
const EXAMPLE_PATH = `${__dirname}/../examples/main.js`
const SRC_PATH = `${__dirname}/../build/src`
const BINARY_PATH = getBinPath()
// We use this instead of requiring the application to test the CLI
export const runProd = async () => {
const binaryPath = await BINARY_PATH
await exec(`node ${binaryPath}`, { cwd: 'examples' })
}
// eslint-disable-next-line fp/no-mutation
runProd.description = 'Run an example production server'
export const runDev = () => startNodemon(NODEMON_CONFIG)
// eslint-disable-next-line fp/no-mutation
runDev.description = 'Start an example dev server'
export const runDebug = () => startNodemon(DEBUG_NODEMON_CONFIG)