1 | #!/usr/bin/env node
|
2 | var cp = require('child_process')
|
3 | var nps = require('path')
|
4 | var chalk = require('chalk')
|
5 | var os = require('os')
|
6 | var over = require('../lib/lib/utils/overwrite-require');
|
7 |
|
8 | var argv = process.argv.slice(2)
|
9 | if (!argv.length) {
|
10 | console.error('\n ' + chalk.red.bold('`picidae -h`') + ' for help ')
|
11 | process.exit(1)
|
12 | }
|
13 |
|
14 | var execSync
|
15 | if (os.platform() === 'win32') {
|
16 | execSync = function execSync(file, argv, opts) {
|
17 | return cp.spawnSync('node', [file].concat(argv), opts)
|
18 | }
|
19 | }
|
20 | else {
|
21 | execSync = function execSync(file, argv, opts) {
|
22 | return cp.execFileSync(file, argv, opts)
|
23 | }
|
24 | }
|
25 |
|
26 | over.logPkgLocation()
|
27 | var info = over.getInfo()
|
28 | var opts = {
|
29 | stdio: 'inherit'
|
30 | }
|
31 | console.log('')
|
32 | try {
|
33 | if (info.type === 'local') {
|
34 | execSync(require.resolve(nps.join(info.path.workRoot, '../../bin/picidae')), argv, opts)
|
35 | }
|
36 | else {
|
37 | execSync(require.resolve(nps.join(info.path.localRoot, '../../bin/picidae')), argv, opts)
|
38 | }
|
39 | } catch (ex) {
|
40 | process.exit(1)
|
41 | }
|
42 |
|