实例化InitCommand类异常
老师你好,我这边代码执行过程中终端没有报错但实例化InitCommand出现问题,构造函数没有执行
仓库地址
https://gitee.com/xiebinyin/xiebenyin2-cli-dev.git
核心代码
class InitCommand extends Command {
constructor(argv) {
super(argv)
console.log('InitCommand类执行了') // 这里并没有执行
}
init() {
this.projectName = this._argv[0] || ''
this.force = !!this._cmd.force
log.verbose('projectName', this.projectName)
log.verbose('force', this.force)
}
exec() {
try {
// 准备阶段
this.prepare()
// 下载横版
// 安装
} catch (e) {
log.error(e.message)
}
}
prepare() {
// 判断当前目录是否为空
const localPath = process.cwd()
console.log(localPath, 'localPath')
// 是否启动强制更新
// 选择创建项目或组件
// 获取项目的基本信息
}
}
function init(argv) {
return new InitCommand(argv) // 实例化InitCommand类
}这个 init 方法是通过多进程调用的
11
收起
正在回答 回答被采纳积分+1
相似问题
登录后可查看更多问答,登录/注册

恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星