INNER CODE UNIT · TypeScript
run
acro5piano/graphql-rest-proxy · src/cli.ts:15
export async function run() {
yargs
.version(await getVersion())
.usage('Usage: $0 <command> [options]')
.command(['$0 <file>'], 'Start graphql-rest-proxy server.', {}, async (args) => {
if (args.config) {
const path = String(args.config)
if (!existsSync(path)) {
console.log(chalk.yellow(`Config file is not found: ${resolve(path)}`))
console.log(chalk.yellow('Make sure your config file is set properly and it exists.'))
process.exit(2)
}
try {
const config: Config = requireFromCwd(path)
setConfig(config)
} catch {
console.log(chalk.yellow(`Cannot read config file: ${resolve(path)}`))
process.exit(2)