UNPKG

605 BJavaScriptView Raw
1'use strict';
2const { debugWrapper } = require('@midwayjs/debugger');
3const cliFun = async argv => {
4 require('source-map-support/register');
5 const { CLI } = require('../dist');
6 const cli = new CLI(argv);
7 cli
8 .start()
9 .then(() => {
10 process.exit();
11 })
12 .catch(e => {
13 process.exit();
14 });
15};
16
17const cli = argv => {
18 const isDebug = argv.debug;
19 delete argv.debug;
20 debugWrapper({
21 file: __filename, // 要包裹的方法所在文件
22 export: 'cliFun', // 要包裹的方法的方法名
23 debug: isDebug,
24 })(argv);
25};
26
27module.exports = {
28 cliFun,
29 cli,
30};