@rife/cli 0.0.6-beta.20 → 0.0.6-beta.21

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.
@@ -59,7 +59,7 @@ function pluginConfig() {
59
59
  }
60
60
  log.debug("filePath %s", filePath);
61
61
  if (!filePath) {
62
- log.error(`找不到配置文件 app.(c|m)?js`);
62
+ log.error("找不到配置文件 app.(c|m)?js");
63
63
  process.exit(1);
64
64
  }
65
65
  let all = [];
@@ -77,14 +77,16 @@ function pluginConfig() {
77
77
  });
78
78
  hook.applyConfig.tapPromise(pluginConfig.name, async ()=>{
79
79
  const result = z.object({
80
- name: z.string().trim().default('')
81
- }).default({}).safeParse(command.opts());
80
+ name: z.string().trim()
81
+ }).default({
82
+ name: ''
83
+ }).safeParse(command.opts());
82
84
  const name = result.data?.name;
83
85
  if (name) {
84
86
  log.debug(`指定 --name ${name}`);
85
87
  const find = config.all.find((t)=>t.name === name);
86
88
  if (!find) {
87
- log.error(`未找到 name '%s'`, name);
89
+ log.error("未找到 name '%s'", name);
88
90
  process.exit(1);
89
91
  }
90
92
  config.current = find;
@@ -54,7 +54,7 @@ function pluginPackage() {
54
54
  const data = require(filePath);
55
55
  runner.package = data;
56
56
  } catch (e) {
57
- log.error(`读取文件失败`, e.message);
57
+ log.error("读取文件失败", e.message);
58
58
  process.exit(1);
59
59
  }
60
60
  });
@@ -78,20 +78,20 @@ function pluginRelease() {
78
78
  const exist = Boolean(nextManifest);
79
79
  const latest = res?.['dist-tags']?.latest;
80
80
  if (exist) {
81
- log.debug(`同步版本存在`);
81
+ log.debug("同步版本存在");
82
82
  break;
83
83
  }
84
84
  log.info(`检查版本 ${nextVersion} 不存在,最新版本为 ${latest}`);
85
85
  if (!hasSync) {
86
86
  hasSync = true;
87
- log.start(`开始同步`);
87
+ log.start("开始同步");
88
88
  const sync = await syncVersion(packageName);
89
89
  if (true === sync.ok) log.info(`调用同步接口成功,日志 https://registry.npmmirror.com/-/package/${packageName}/syncs/${sync.id}/log`);
90
- else log.debug(`调用同步接口失败,%j`, sync);
90
+ else log.debug("调用同步接口失败,%j", sync);
91
91
  }
92
92
  await new Promise((resolve)=>setTimeout(resolve, 2000));
93
93
  }
94
- log.success(`同步成功,${runner.duration}`);
94
+ log.success(`同步成功,最新版本为 ${nextVersion},${runner.duration}`);
95
95
  });
96
96
  }
97
97
  };
@@ -77,10 +77,11 @@ var __webpack_exports__ = {};
77
77
  command.option('--debug', '打开调试日志');
78
78
  command.option('-n, --name <string>', '执行指定配置');
79
79
  command.option('-h, --help', '帮助');
80
- command.parse();
81
80
  const args = external_zod_default().object({
82
- debug: external_zod_default().boolean().default(false)
83
- }).default({}).safeParse(command.opts());
81
+ debug: external_zod_default().boolean()
82
+ }).default({
83
+ debug: false
84
+ }).safeParse(command.opts());
84
85
  const runner = {
85
86
  env: 'prod',
86
87
  hook: {
package/dist/esm/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import 'module';
1
+ import "node:module";
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import { pluginCommander, pluginConfig, pluginPackage, pluginRelease } from "./plugin/index.mjs";
4
4
  import { createRunner } from "./runner.mjs";
@@ -1,4 +1,4 @@
1
- import 'module';
1
+ import "node:module";
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  export * from "./runner.mjs";
4
4
  export * from "./plugin/index.mjs";
@@ -1,4 +1,4 @@
1
- import 'module';
1
+ import "node:module";
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import { createConsola } from "consola";
4
4
  function createLogger(options) {
@@ -1,4 +1,4 @@
1
- import 'module';
1
+ import "node:module";
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  function pluginCommander() {
4
4
  const plugin = {
@@ -1,4 +1,4 @@
1
- import __rslib_shim_module__ from 'module';
1
+ import __rslib_shim_module__ from "node:module";
2
2
  const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(import.meta.url);
3
3
  import path from "path";
4
4
  function pluginConfig() {
@@ -23,7 +23,7 @@ function pluginConfig() {
23
23
  }
24
24
  log.debug("filePath %s", filePath);
25
25
  if (!filePath) {
26
- log.error(`找不到配置文件 app.(c|m)?js`);
26
+ log.error("找不到配置文件 app.(c|m)?js");
27
27
  process.exit(1);
28
28
  }
29
29
  let all = [];
@@ -41,14 +41,16 @@ function pluginConfig() {
41
41
  });
42
42
  hook.applyConfig.tapPromise(pluginConfig.name, async ()=>{
43
43
  const result = z.object({
44
- name: z.string().trim().default('')
45
- }).default({}).safeParse(command.opts());
44
+ name: z.string().trim()
45
+ }).default({
46
+ name: ''
47
+ }).safeParse(command.opts());
46
48
  const name = result.data?.name;
47
49
  if (name) {
48
50
  log.debug(`指定 --name ${name}`);
49
51
  const find = config.all.find((t)=>t.name === name);
50
52
  if (!find) {
51
- log.error(`未找到 name '%s'`, name);
53
+ log.error("未找到 name '%s'", name);
52
54
  process.exit(1);
53
55
  }
54
56
  config.current = find;
@@ -1,4 +1,4 @@
1
- import 'module';
1
+ import "node:module";
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  export * from "./config.mjs";
4
4
  export * from "./package.mjs";
@@ -1,4 +1,4 @@
1
- import __rslib_shim_module__ from 'module';
1
+ import __rslib_shim_module__ from "node:module";
2
2
  const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(import.meta.url);
3
3
  import path from "path";
4
4
  function pluginPackage() {
@@ -18,7 +18,7 @@ function pluginPackage() {
18
18
  const data = require(filePath);
19
19
  runner.package = data;
20
20
  } catch (e) {
21
- log.error(`读取文件失败`, e.message);
21
+ log.error("读取文件失败", e.message);
22
22
  process.exit(1);
23
23
  }
24
24
  });
@@ -1,4 +1,4 @@
1
- import 'module';
1
+ import "node:module";
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import { execSync } from "child_process";
4
4
  function pluginRelease() {
@@ -52,20 +52,20 @@ function pluginRelease() {
52
52
  const exist = Boolean(nextManifest);
53
53
  const latest = res?.['dist-tags']?.latest;
54
54
  if (exist) {
55
- log.debug(`同步版本存在`);
55
+ log.debug("同步版本存在");
56
56
  break;
57
57
  }
58
58
  log.info(`检查版本 ${nextVersion} 不存在,最新版本为 ${latest}`);
59
59
  if (!hasSync) {
60
60
  hasSync = true;
61
- log.start(`开始同步`);
61
+ log.start("开始同步");
62
62
  const sync = await syncVersion(packageName);
63
63
  if (true === sync.ok) log.info(`调用同步接口成功,日志 https://registry.npmmirror.com/-/package/${packageName}/syncs/${sync.id}/log`);
64
- else log.debug(`调用同步接口失败,%j`, sync);
64
+ else log.debug("调用同步接口失败,%j", sync);
65
65
  }
66
66
  await new Promise((resolve)=>setTimeout(resolve, 2000));
67
67
  }
68
- log.success(`同步成功,${runner.duration}`);
68
+ log.success(`同步成功,最新版本为 ${nextVersion},${runner.duration}`);
69
69
  });
70
70
  }
71
71
  };
@@ -1,4 +1,4 @@
1
- import 'module';
1
+ import "node:module";
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import * as __rspack_external_commander from "commander";
4
4
  import { colors } from "consola/utils";
@@ -41,10 +41,11 @@ function createRunner() {
41
41
  command.option('--debug', '打开调试日志');
42
42
  command.option('-n, --name <string>', '执行指定配置');
43
43
  command.option('-h, --help', '帮助');
44
- command.parse();
45
44
  const args = zod.object({
46
- debug: zod.boolean().default(false)
47
- }).default({}).safeParse(command.opts());
45
+ debug: zod.boolean()
46
+ }).default({
47
+ debug: false
48
+ }).safeParse(command.opts());
48
49
  const runner = {
49
50
  env: 'prod',
50
51
  hook: {
package/dist/esm/sync.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import 'module';
1
+ import "node:module";
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  async function sync(name) {
4
4
  const res = await fetch(`https://registry-direct.npmmirror.com/-/package/${name}/syncs`, {
package/dist/esm/util.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import 'module';
1
+ import "node:module";
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import { fileURLToPath } from "node:url";
4
4
  import path from "path";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rife/cli",
3
- "version": "0.0.6-beta.20",
3
+ "version": "0.0.6-beta.21",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "exports": {
@@ -18,20 +18,20 @@
18
18
  "src/**/*"
19
19
  ],
20
20
  "dependencies": {
21
- "commander": "^10.0.1",
21
+ "commander": "^14.0.2",
22
22
  "consola": "^3.4.2",
23
- "fs-extra": "^11.3.2",
24
- "glob": "^11.0.3",
23
+ "fs-extra": "^11.3.3",
24
+ "glob": "^13.0.0",
25
25
  "tapable": "^2.3.0",
26
- "zod": "^3.25.76"
26
+ "zod": "^4.3.6"
27
27
  },
28
28
  "devDependencies": {
29
- "@rslib/core": "^0.18.5",
29
+ "@rslib/core": "^0.19.3",
30
30
  "@types/fs-extra": "^11.0.4",
31
- "@types/node": "^22.16.0",
32
- "vitest": "^4.0.16",
33
- "@rsbuild/plugin-type-check": "^1.3.0",
34
- "@rife/config": "0.0.6-beta.11"
31
+ "@types/node": "^25.1.0",
32
+ "vitest": "^4.0.18",
33
+ "@rsbuild/plugin-type-check": "^1.3.3",
34
+ "@rife/config": "0.0.6-beta.12"
35
35
  },
36
36
  "rife": {
37
37
  "hostDependencies": {
@@ -6,12 +6,14 @@ export function pluginCommander() {
6
6
  apply: runner => {
7
7
  const { hook, command, config, z, logger } = runner;
8
8
  const log = logger.withTag(pluginCommander.name);
9
+
9
10
  hook.registerCommand.tapPromise(pluginCommander.name, async () => {
10
11
  command
11
12
  .command('dev')
12
13
  .description('启动开发')
13
14
  .action(async () => {
14
15
  process.env.NODE_ENV = 'development';
16
+
15
17
  await hook.dev.promise();
16
18
  });
17
19
 
@@ -53,9 +53,11 @@ export function pluginConfig() {
53
53
  hook.applyConfig.tapPromise(pluginConfig.name, async () => {
54
54
  const result = z
55
55
  .object({
56
- name: z.string().trim().default(''),
56
+ name: z.string().trim(),
57
+ })
58
+ .default({
59
+ name: '',
57
60
  })
58
- .default({})
59
61
  .safeParse(command.opts());
60
62
  const name = result.data?.name;
61
63
  if (!name) {
@@ -78,7 +78,7 @@ export function pluginRelease() {
78
78
  }
79
79
  await new Promise(resolve => setTimeout(resolve, 2000));
80
80
  }
81
- log.success(`同步成功,${runner.duration}`);
81
+ log.success(`同步成功,最新版本为 ${nextVersion},${runner.duration}`);
82
82
  });
83
83
  },
84
84
  };
package/src/runner.ts CHANGED
@@ -38,7 +38,7 @@ export interface Runner {
38
38
  package: any;
39
39
  z: typeof zod;
40
40
  fs: typeof import('fs-extra');
41
- glob: typeof import('glob')['glob'];
41
+ glob: (typeof import('glob'))['glob'];
42
42
  duration: string;
43
43
  tempDir: string;
44
44
  clear: () => void;
@@ -71,13 +71,15 @@ export function createRunner() {
71
71
  command.option('--debug', '打开调试日志');
72
72
  command.option('-n, --name <string>', '执行指定配置');
73
73
  command.option('-h, --help', '帮助');
74
- command.parse();
74
+ // command.parse();
75
75
 
76
76
  const args = zod
77
77
  .object({
78
- debug: zod.boolean().default(false),
78
+ debug: zod.boolean(),
79
+ })
80
+ .default({
81
+ debug: false,
79
82
  })
80
- .default({})
81
83
  .safeParse(command.opts());
82
84
 
83
85
  const runner: Runner = {