beidou-cli v2.3.0
beidou-cli
Beidou application cli tool
Install
Global install beidou-cli if you need to init beidou boilerplate, use local install otherwise.
global
$ npm install beidou-cli -glocal
$ npm install beidou-cli --save
Usage
Add beidou to package.json scripts:
{
"scripts": {
"dev": "beidou dev",
"debug": "beidou debug",
"test": "beidou test",
"cov": "beidou cov",
"start": "beidou start",
"stop": "beidou stop",
"build": "beidou build"
}
}Command
All the commands support these specific v8 options:
--debug--inspect--harmony*--es_staging
$ beidou [command] --debug --es_stagingif process.env.NODE_DEBUG_OPTION is provided (WebStorm etc), will use it as debug options.
init command
Init beidou boilerplate project
$ beidou initoptions
--tag=nextinit boilerplate project with npm next tag, used for alpha or beta version.--forceforce to overwrite directory.
Choose boilerplate
$ beidou init
? Please select a boilerplate type (Use arrow keys)
❯ Simple - Simple beidou isomorphic app boilerplate
Redux - Redux beidou isomorphic app boilerplate
CSS-MODULES - css-modules beidou isomorphic app boilerplate
Advanced - Advanced beidou isomorphic app boilerplatedev
Start dev cluster on local env, it will start a master, an agent and a worker.
$ beidou devoptions
--baseDirapplication's root path, default toprocess.cwd().--portserver port, default to6001.--clusterworker process number, skip this argvs will start only1worker, provide this without value will startcpucount worker.--stickystart a sticky cluster server, default tofalse.
debug
Debug beidou app with V8 Inspector Integration.
automatically detect the protocol, use the new inspector when the targeted runtime >=7.0.0 .
use inspector-proxy to proxy worker debug, so you don't need to worry about reload.
$ beidou debug --debug-port=9229 --proxy=9999options
- all
beidou devoptions is accepted. --proxy=9999worker debug proxy port.
test
Using mocha with co-mocha to run test.
power-assert is the default assert library, and intelli-espower-loader will be auto required.
$ beidou test [files] [options]filesis optional, default totest/**/*.test.jstest/fixtures,test/node_modulesis always exclude.
auto require test/.setup.js
If test/.setup.js file exists, it will be auto require as the first test file.
test
├── .setup.js
└── foo.test.jsoptions
You can pass any mocha argv.
--requirerequire the given module--greponly run tests matching--timeoutmilliseconds, default to 30000--full-tracedisplay the full stack trace, default to false.- see more at https://mochajs.org/#usage
environment
Environment is also support, will use it if options not provide.
You can set TESTS env to set the tests directory, it support glob grammar.
TESTS=test/a.test.js beidou testAnd the reporter can set by the TEST_REPORTER env, default is spec.
TEST_REPORTER=doc beidou testThe test timeout can set by TEST_TIMEOUT env, default is 30000 ms.
TEST_TIMEOUT=2000 beidou testcov
Using istanbul to run code coverage, it support all test params above.
Coverage reporter will output text-summary, json and lcov.
options
You can pass any mocha argv.
-xadd dir ignore coverage, support multiple argv--prerequireprerequire files for coverage instrument, you can use this options if load files slowly when callmm.appormm.cluster- also support all test params above.
environment
You can set COV_EXCLUDES env to add dir ignore coverage.
$ COV_EXCLUDES="app/plugins/c*,app/autocreate/**" beidou covstart
Start beidou server at production mode.
$ beidou start [options] [baseDir]
# Usage
# beidou start --port=7001
# beidou start ./server- Arguments
baseDir- directory of application, default toprocess.cwd().
- Options
port- listening port, default toprocess.env.PORT, if unset, egg will use6001as default.title- process title description, use for kill grep, default toegg-server-${APP_NAME}.workers- numbers of app workers, default toprocess.env.EGG_WORKERS, if unset, egg will useos.cpus().lengthas default.daemon- whether run at background daemon mode, don't use it if in docker mode.env- server env, default toprocess.env.EGG_SERVER_ENV, recommended to keep empty then use framwork default env.stdout- customize stdout file, default to$HOME/logs/master-stdout.log.stderr- customize stderr file, default to$HOME/logs/master-stderr.log.timeout- the maximum timeout when app starts, default to 300s.ignore-stderr- whether ignore stderr when app starts.
stop
Stop beidou gracefull.
Note: if exec without --title, it will kill all egg process.
# stop egg
$ beidou stop [--title=example]- Options
title- process title description, use for kill grep.
build
Build beidou assets
- Options
target- build target,nodeorbrowser(default)
License
4 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago