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.
Files changed (2) hide show
  1. package/lib/cli/karin.js +5 -4
  2. 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
- get pkg () {
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 */))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-karin",
3
- "version": "0.8.9",
3
+ "version": "0.8.10",
4
4
  "private": false,
5
5
  "description": "基于 Kritor 进行开发的nodejs机器人框架",
6
6
  "homepage": "https://github.com/KarinJS/Karin",