mirror of
https://github.com/Tencent/Hippy.git
synced 2026-10-21 16:26:27 +08:00
52 lines
1.1 KiB
JavaScript
Executable File
52 lines
1.1 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
const yargs = require('yargs');
|
|
const startDebugServer = require('./server');
|
|
|
|
const { argv } = yargs
|
|
.alias('v', 'version')
|
|
.describe('v', 'show version information')
|
|
.alias('h', 'help')
|
|
.help()
|
|
.version()
|
|
.option('entry', {
|
|
type: 'string',
|
|
default: 'dist/dev/index.bundle',
|
|
describe: 'Path of the jsbundle for debugging',
|
|
})
|
|
.option('static', {
|
|
type: 'string',
|
|
describe: 'Path of the static files such as images',
|
|
})
|
|
.option('host', {
|
|
type: 'string',
|
|
default: '0.0.0.0',
|
|
describe: 'The host the debug server will listen to',
|
|
})
|
|
.option('port', {
|
|
type: 'string',
|
|
default: '38989',
|
|
describe: 'The port for debug server will listen to',
|
|
})
|
|
.option('verbose', {
|
|
type: 'boolean',
|
|
default: false,
|
|
describe: 'Output error details',
|
|
})
|
|
.epilog(`Copyright (C) 2017-${new Date().getFullYear()} THL A29 Limited, a Tencent company.`);
|
|
|
|
if (argv.verbose) {
|
|
process.env.VERBOSE = true;
|
|
}
|
|
|
|
if (argv.help) {
|
|
yargs.showHelp().exit();
|
|
}
|
|
|
|
if (argv.version) {
|
|
yargs.version().exit();
|
|
}
|
|
|
|
// Execute command
|
|
startDebugServer(argv);
|