INNER CODE UNIT · TypeScript

requireFromCwd

acro5piano/graphql-rest-proxy · src/cli.ts:11

function requireFromCwd(path: string) {
  return require(`${process.cwd()}/${path}`)
}

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)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…