$ npm install midway-bin
midway developer tool, extends [egg-bin].
$ npm i midway-bin --save-dev
Add midway-bin to package.json scripts:
{
"scripts": {
"dev": "midway-bin dev",
"debug": "midway-bin debug",
"test-local": "midway-bin test",
"test": "npm run lint -- --fix && npm run midway-local",
"cov": "midway-bin cov",
"lint": "eslint .",
"pkgfiles": "midway-bin pkgfiles",
"autod": "midway-bin autod",
"ci": "npm run lint && npm run autod -- --check && npm run pkgfiles -- --check && npm run cov"
}
}
All the commands extends from egg-bin
add build command for new midway.
build typescript source file to dist directory like tsc and copy js/css/html file to same place.
$ midway-bin build
--clean -c clean dist directory before buildwe can copy static file when ts file compiling.
// in package.json
"midway-bin-build": {
"include": [
"app/public",
"app/view"
]
}
it will be copy src/app/public to ${outDir}/app/public.
The outDir field is configured in the tsconfig.json File, see compiler-options.
© 2010 - cnpmjs.org x YWFE | Home | YWFE