node-karin 0.8.9 → 0.8.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli/karin.js +5 -4
- package/package.json +1 -1
package/lib/cli/karin.js
CHANGED
|
@@ -25,9 +25,10 @@ class KarinCli {
|
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* 获取pkg
|
|
28
|
+
* @param isNpm - 是否是npm包
|
|
28
29
|
*/
|
|
29
|
-
|
|
30
|
-
const filePath = path.join(this.karinDir, 'package.json')
|
|
30
|
+
pkg (isNpm) {
|
|
31
|
+
const filePath = isNpm ? path.join(this.karinDir, 'package.json') : path.join(process.cwd(), 'package.json')
|
|
31
32
|
const data = JSON.parse(fs.readFileSync(filePath, 'utf-8'))
|
|
32
33
|
return data
|
|
33
34
|
}
|
|
@@ -191,7 +192,7 @@ class KarinCli {
|
|
|
191
192
|
'yaml',
|
|
192
193
|
]
|
|
193
194
|
let cmd = ''
|
|
194
|
-
const list = Object.keys(this.pkg.dependencies).filter(key => !pkgdependencies.includes(key))
|
|
195
|
+
const list = Object.keys(this.pkg(false).dependencies).filter(key => !pkgdependencies.includes(key))
|
|
195
196
|
/** 获取包管理器 */
|
|
196
197
|
const pkg = new KarinInit().getRegistry()
|
|
197
198
|
switch (pkg) {
|
|
@@ -261,7 +262,7 @@ class KarinCli {
|
|
|
261
262
|
}
|
|
262
263
|
}
|
|
263
264
|
const cli = new KarinCli()
|
|
264
|
-
program.version(cli.pkg.version, '-v, --version', '显示版本号')
|
|
265
|
+
program.version(cli.pkg(true).version, '-v, --version', '显示版本号')
|
|
265
266
|
program.command('.').description('启动karin').action(() => cli.start('prod' /* Mode.Prod */, 'js' /* Lang.Js */, 'node' /* Runner.Node */))
|
|
266
267
|
program.command('start').description('启动karin').action(() => cli.start('prod' /* Mode.Prod */, 'js' /* Lang.Js */, 'node' /* Runner.Node */))
|
|
267
268
|
program.command('pm2').description('后台运行karin').action(() => cli.start('prod' /* Mode.Prod */, 'js' /* Lang.Js */, 'pm2' /* Runner.Pm2 */))
|