|
1 | 1 | #!/usr/bin/env node
|
2 | 2 |
|
3 | 3 | var run = require('..');
|
4 |
| -var optimist = require('optimist'); |
| 4 | +var yargs = require('yargs/yargs'); |
| 5 | +var { hideBin } = require('yargs/helpers'); |
5 | 6 | var spawn = require('child_process').spawn;
|
6 | 7 |
|
7 |
| -var argv = optimist |
| 8 | +var argv = yargs(hideBin(process.argv)) |
8 | 9 | .usage('Pipe a browserify stream into this.\nbrowserify [opts] [files] | $0 [opts]')
|
9 | 10 |
|
10 |
| - .describe('wait', 'Timeout for tap-finished') |
11 |
| - .alias('w', 'wait') |
12 |
| - |
13 |
| - .describe('port', 'Wait to be opened by a browser on that port') |
14 |
| - .alias('p', 'port') |
15 |
| - |
16 |
| - .describe('static', 'Serve static files from this directory') |
17 |
| - .alias('s', 'static') |
18 |
| - |
19 |
| - .describe('browser', 'Browser to use. ' + |
20 |
| - 'Always available: electron. ' + |
21 |
| - 'Available if installed: chrome, firefox, ie, phantom, safari') |
22 |
| - .alias('b', 'browser') |
23 |
| - .default('browser', 'electron') |
24 |
| - |
25 |
| - .describe('render', 'Command to pipe tap output to for custom rendering') |
26 |
| - .alias('r', 'render') |
27 |
| - |
28 |
| - .describe('keep-open', 'Leave the browser open for debugging after running tests') |
29 |
| - .alias('k', 'keep-open') |
30 |
| - .alias('keepOpen', 'keep-open') |
31 |
| - |
32 |
| - .describe('node', 'Enable nodejs integration for electron') |
33 |
| - .alias('n', 'integration') |
34 |
| - .alias('node-integration', 'node') |
35 |
| - .alias('nodeIntegration', 'node') |
36 |
| - |
37 |
| - .describe('sandbox', 'Enable electron sandbox') |
38 |
| - .boolean('sandbox') |
39 |
| - .default('sandbox', true) |
40 |
| - |
41 |
| - .describe('basedir', 'Set this if you need to require node modules in node mode') |
42 |
| - |
43 |
| - .describe('help', 'Print usage instructions') |
44 |
| - .alias('h', 'help') |
45 |
| - |
46 |
| - .argv; |
47 |
| - |
48 |
| -if (argv.help) { |
49 |
| - return optimist.showHelp(); |
50 |
| -} |
| 11 | + .option('wait', { |
| 12 | + alias: 'w', |
| 13 | + type: 'number', |
| 14 | + description: 'Timeout for tap-finished' |
| 15 | + }) |
| 16 | + .option('port', { |
| 17 | + alias: 'p', |
| 18 | + type: 'number', |
| 19 | + description: 'Wait to be opened by a browser on that port' |
| 20 | + }) |
| 21 | + .option('static', { |
| 22 | + alias: 's', |
| 23 | + type: 'string', |
| 24 | + description: 'Serve static files from this directory' |
| 25 | + }) |
| 26 | + .option('browser', { |
| 27 | + alias: 'b', |
| 28 | + type: 'string', |
| 29 | + default: 'electron', |
| 30 | + description: 'Browser to use. ' + |
| 31 | + 'Always available: electron. ' + |
| 32 | + 'Available if installed: chrome, firefox, ie, phantom, safari' |
| 33 | + }) |
| 34 | + .option('render', { |
| 35 | + alias: 'r', |
| 36 | + type: 'string', |
| 37 | + description: 'Command to pipe tap output to for custom rendering' |
| 38 | + }) |
| 39 | + .option('keep-open', { |
| 40 | + alias: ['k', 'keepOpen'], |
| 41 | + type: 'boolean', |
| 42 | + description: 'Leave the browser open for debugging after running tests' |
| 43 | + }) |
| 44 | + .option('node', { |
| 45 | + alias: ['n', 'node-integration', 'nodeIntegration'], |
| 46 | + type: 'boolean', |
| 47 | + description: 'Enable nodejs integration for electron' |
| 48 | + }) |
| 49 | + .option('sandbox', { |
| 50 | + type: 'boolean', |
| 51 | + default: true, |
| 52 | + description: 'Enable electron sandbox' |
| 53 | + }) |
| 54 | + .option('basedir', { |
| 55 | + description: 'Set this if you need to require node modules in node mode' |
| 56 | + }) |
| 57 | + .parse(); |
51 | 58 |
|
52 | 59 | var runner = run(argv);
|
53 | 60 |
|
|
0 commit comments