-
Notifications
You must be signed in to change notification settings - Fork 38
/
warthog
executable file
·22 lines (19 loc) · 1.07 KB
/
warthog
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env node
const path = require('path'); // eslint-disable-line @typescript-eslint/no-var-requires
// check if we're running in dev mode
var devMode = require('fs').existsSync(`${__dirname}/../src/cli`);
// or want to "force" running the compiled version with --compiled-build
var wantsCompiled = process.argv.indexOf('--compiled-build') >= 0;
if (wantsCompiled || !devMode) {
// TODO: had to load up ts-node so that we can use the warthog CLI in TypeScript projects
// NOTE: commented the line below because in production, ts-node is not installed
// require('ts-node').register({ project: path.join(process.cwd(), 'tsconfig.json') });
// this runs from the compiled javascript source
require(`${__dirname}/../dist/cli/cli`).run(process.argv);
} else {
// this runs from the typescript source (for dev only)
// hook into ts-node so we can run typescript on the fly
require('ts-node').register({ project: path.join(process.cwd(), 'tsconfig.json') });
// run the CLI with the current process arguments
require(`${__dirname}/../src/cli/cli`).run(process.argv);
}