@wwkit/cft 1.0.15 → 1.0.17

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/bin/index.js +10 -0
  2. package/package.json +2 -2
package/bin/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import { execSync } from 'node:child_process'
4
+ import { readFileSync } from 'node:fs'
3
5
  import { install, status, clear, showConfig, showEnv } from '../src/index.js'
4
6
 
7
+ const pkgVersion = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version
8
+
5
9
  const command = process.argv[2]
6
10
 
7
11
  if (command === 'install') {
@@ -25,6 +29,10 @@ if (command === 'install') {
25
29
  showConfig()
26
30
  } else if (command === 'env') {
27
31
  showEnv()
32
+ } else if (command === 'upgrade') {
33
+ execSync('npm install -g @wwkit/cft@latest', { stdio: 'inherit' })
34
+ } else if (command === 'version') {
35
+ console.log(pkgVersion)
28
36
  } else if (command === 'help' || command === undefined) {
29
37
  console.log(`cft - Chrome for Testing 安装器
30
38
 
@@ -34,6 +42,8 @@ if (command === 'install') {
34
42
  cft config 显示用户配置(~/.config/cft/config.json5)
35
43
  cft env 显示 cft 创建的全局环境变量
36
44
  cft clear 删除安装产物(~/.config/cft/)
45
+ cft upgrade 升级 cft 自身(npm install -g @wwkit/cft@latest)
46
+ cft version 显示版本号
37
47
  cft help 显示本帮助
38
48
 
39
49
  安装目录: ~/.config/cft/`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wwkit/cft",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "author": "bluesliu <langcai163@163.com>",
5
5
  "description": "Chrome for Testing (CFT) installer — download, extract, chmod, dep-check",
6
6
  "type": "module",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "extract-zip": "^2.0.1",
39
- "@wwkit/shared": "1.0.15"
39
+ "@wwkit/shared": "1.0.17"
40
40
  },
41
41
  "devDependencies": {
42
42
  "jest": "^29.7.0"