@rife/cli 0.0.6-beta.20 → 0.0.6-beta.22
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/dist/cjs/plugin/config.cjs +6 -4
- package/dist/cjs/plugin/package.cjs +1 -1
- package/dist/cjs/plugin/release.cjs +4 -4
- package/dist/cjs/runner.cjs +4 -3
- package/dist/esm/cli.mjs +1 -2
- package/dist/esm/index.mjs +1 -2
- package/dist/esm/logger.mjs +1 -2
- package/dist/esm/plugin/commander.mjs +1 -2
- package/dist/esm/plugin/config.mjs +8 -6
- package/dist/esm/plugin/index.mjs +1 -2
- package/dist/esm/plugin/package.mjs +3 -3
- package/dist/esm/plugin/release.mjs +5 -6
- package/dist/esm/rslib-runtime.mjs +19 -0
- package/dist/esm/runner.mjs +9 -18
- package/dist/esm/sync.mjs +1 -2
- package/dist/esm/util.mjs +3 -4
- package/package.json +11 -11
- package/src/plugin/commander.ts +2 -0
- package/src/plugin/config.ts +4 -2
- package/src/plugin/release.ts +1 -1
- package/src/runner.ts +6 -4
|
@@ -59,7 +59,7 @@ function pluginConfig() {
|
|
|
59
59
|
}
|
|
60
60
|
log.debug("filePath %s", filePath);
|
|
61
61
|
if (!filePath) {
|
|
62
|
-
log.error(
|
|
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()
|
|
81
|
-
}).default({
|
|
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(
|
|
89
|
+
log.error("未找到 name '%s'", name);
|
|
88
90
|
process.exit(1);
|
|
89
91
|
}
|
|
90
92
|
config.current = find;
|
|
@@ -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(
|
|
90
|
+
else log.debug("调用同步接口失败,%j", sync);
|
|
91
91
|
}
|
|
92
92
|
await new Promise((resolve)=>setTimeout(resolve, 2000));
|
|
93
93
|
}
|
|
94
|
-
log.success(
|
|
94
|
+
log.success(`同步成功,最新版本为 ${nextVersion},${runner.duration}`);
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
97
|
};
|
package/dist/cjs/runner.cjs
CHANGED
|
@@ -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()
|
|
83
|
-
}).default({
|
|
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
package/dist/esm/index.mjs
CHANGED
package/dist/esm/logger.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import __rslib_shim_module__ from
|
|
2
|
-
const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(import.meta.url);
|
|
1
|
+
import __rslib_shim_module__ from "node:module";
|
|
2
|
+
const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(/*#__PURE__*/ (()=>import.meta.url)());
|
|
3
3
|
import path from "path";
|
|
4
4
|
function pluginConfig() {
|
|
5
5
|
const plugin = {
|
|
@@ -23,7 +23,7 @@ function pluginConfig() {
|
|
|
23
23
|
}
|
|
24
24
|
log.debug("filePath %s", filePath);
|
|
25
25
|
if (!filePath) {
|
|
26
|
-
log.error(
|
|
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()
|
|
45
|
-
}).default({
|
|
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(
|
|
53
|
+
log.error("未找到 name '%s'", name);
|
|
52
54
|
process.exit(1);
|
|
53
55
|
}
|
|
54
56
|
config.current = find;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import __rslib_shim_module__ from
|
|
2
|
-
const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(import.meta.url);
|
|
1
|
+
import __rslib_shim_module__ from "node:module";
|
|
2
|
+
const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(/*#__PURE__*/ (()=>import.meta.url)());
|
|
3
3
|
import path from "path";
|
|
4
4
|
function pluginPackage() {
|
|
5
5
|
const plugin = {
|
|
@@ -18,7 +18,7 @@ function pluginPackage() {
|
|
|
18
18
|
const data = require(filePath);
|
|
19
19
|
runner.package = data;
|
|
20
20
|
} catch (e) {
|
|
21
|
-
log.error(
|
|
21
|
+
log.error("读取文件失败", e.message);
|
|
22
22
|
process.exit(1);
|
|
23
23
|
}
|
|
24
24
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
/*#__PURE__*/ import.meta.url;
|
|
1
|
+
import "node:module";
|
|
3
2
|
import { execSync } from "child_process";
|
|
4
3
|
function pluginRelease() {
|
|
5
4
|
const plugin = {
|
|
@@ -52,20 +51,20 @@ function pluginRelease() {
|
|
|
52
51
|
const exist = Boolean(nextManifest);
|
|
53
52
|
const latest = res?.['dist-tags']?.latest;
|
|
54
53
|
if (exist) {
|
|
55
|
-
log.debug(
|
|
54
|
+
log.debug("同步版本存在");
|
|
56
55
|
break;
|
|
57
56
|
}
|
|
58
57
|
log.info(`检查版本 ${nextVersion} 不存在,最新版本为 ${latest}`);
|
|
59
58
|
if (!hasSync) {
|
|
60
59
|
hasSync = true;
|
|
61
|
-
log.start(
|
|
60
|
+
log.start("开始同步");
|
|
62
61
|
const sync = await syncVersion(packageName);
|
|
63
62
|
if (true === sync.ok) log.info(`调用同步接口成功,日志 https://registry.npmmirror.com/-/package/${packageName}/syncs/${sync.id}/log`);
|
|
64
|
-
else log.debug(
|
|
63
|
+
else log.debug("调用同步接口失败,%j", sync);
|
|
65
64
|
}
|
|
66
65
|
await new Promise((resolve)=>setTimeout(resolve, 2000));
|
|
67
66
|
}
|
|
68
|
-
log.success(
|
|
67
|
+
log.success(`同步成功,最新版本为 ${nextVersion},${runner.duration}`);
|
|
69
68
|
});
|
|
70
69
|
}
|
|
71
70
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
var __webpack_modules__ = {};
|
|
3
|
+
var __webpack_module_cache__ = {};
|
|
4
|
+
function __webpack_require__(moduleId) {
|
|
5
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
6
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
7
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
8
|
+
exports: {}
|
|
9
|
+
};
|
|
10
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
11
|
+
return module.exports;
|
|
12
|
+
}
|
|
13
|
+
__webpack_require__.m = __webpack_modules__;
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.add = function(modules) {
|
|
16
|
+
Object.assign(__webpack_require__.m, modules);
|
|
17
|
+
};
|
|
18
|
+
})();
|
|
19
|
+
export { __webpack_require__ };
|
package/dist/esm/runner.mjs
CHANGED
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
/*#__PURE__*/ import.meta.url;
|
|
3
|
-
import * as __rspack_external_commander from "commander";
|
|
1
|
+
import "node:module";
|
|
4
2
|
import { colors } from "consola/utils";
|
|
5
3
|
import { AsyncSeriesHook } from "tapable";
|
|
6
4
|
import zod from "zod";
|
|
7
5
|
import { createLogger } from "./logger.mjs";
|
|
8
6
|
import { fs, glob } from "./util.mjs";
|
|
9
|
-
|
|
7
|
+
import { __webpack_require__ } from "./rslib-runtime.mjs";
|
|
8
|
+
import * as __rspack_external_commander from "commander";
|
|
9
|
+
__webpack_require__.add({
|
|
10
10
|
commander (module) {
|
|
11
11
|
module.exports = __rspack_external_commander;
|
|
12
12
|
}
|
|
13
|
-
};
|
|
14
|
-
var __webpack_module_cache__ = {};
|
|
15
|
-
function __webpack_require__(moduleId) {
|
|
16
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
17
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
18
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
19
|
-
exports: {}
|
|
20
|
-
};
|
|
21
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
22
|
-
return module.exports;
|
|
23
|
-
}
|
|
13
|
+
});
|
|
24
14
|
if (void 0 === Promise.withResolvers) Promise.withResolvers = ()=>{
|
|
25
15
|
let resolve;
|
|
26
16
|
let reject;
|
|
@@ -41,10 +31,11 @@ function createRunner() {
|
|
|
41
31
|
command.option('--debug', '打开调试日志');
|
|
42
32
|
command.option('-n, --name <string>', '执行指定配置');
|
|
43
33
|
command.option('-h, --help', '帮助');
|
|
44
|
-
command.parse();
|
|
45
34
|
const args = zod.object({
|
|
46
|
-
debug: zod.boolean()
|
|
47
|
-
}).default({
|
|
35
|
+
debug: zod.boolean()
|
|
36
|
+
}).default({
|
|
37
|
+
debug: false
|
|
38
|
+
}).safeParse(command.opts());
|
|
48
39
|
const runner = {
|
|
49
40
|
env: 'prod',
|
|
50
41
|
hook: {
|
package/dist/esm/sync.mjs
CHANGED
package/dist/esm/util.mjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
/*#__PURE__*/ import.meta.url;
|
|
1
|
+
import "node:module";
|
|
3
2
|
import { fileURLToPath } from "node:url";
|
|
4
3
|
import path from "path";
|
|
5
|
-
import fs_extra from "fs-extra";
|
|
6
4
|
import * as __rspack_external_glob from "glob";
|
|
7
5
|
const getDuration = (perfStart)=>{
|
|
8
6
|
const duration = ((performance.now() - perfStart) / 1000).toFixed(3);
|
|
9
7
|
return `耗时 ${duration} s`;
|
|
10
8
|
};
|
|
11
9
|
const resolve = (...args)=>path.resolve(path.dirname(fileURLToPath(import.meta.url)), ...args);
|
|
12
|
-
export {
|
|
10
|
+
export { default as fs } from "fs-extra";
|
|
11
|
+
export { __rspack_external_glob as glob, getDuration, resolve };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rife/cli",
|
|
3
|
-
"version": "0.0.6-beta.
|
|
3
|
+
"version": "0.0.6-beta.22",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -18,20 +18,20 @@
|
|
|
18
18
|
"src/**/*"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"commander": "^
|
|
21
|
+
"commander": "^14.0.2",
|
|
22
22
|
"consola": "^3.4.2",
|
|
23
|
-
"fs-extra": "^11.3.
|
|
24
|
-
"glob": "^
|
|
25
|
-
"tapable": "^2.3.
|
|
26
|
-
"zod": "^3.
|
|
23
|
+
"fs-extra": "^11.3.3",
|
|
24
|
+
"glob": "^13.0.0",
|
|
25
|
+
"tapable": "^2.3.2",
|
|
26
|
+
"zod": "^4.3.6"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@rslib/core": "^0.
|
|
29
|
+
"@rslib/core": "^0.21.0",
|
|
30
30
|
"@types/fs-extra": "^11.0.4",
|
|
31
|
-
"@types/node": "^
|
|
32
|
-
"vitest": "^4.
|
|
33
|
-
"@rsbuild/plugin-type-check": "^1.3.
|
|
34
|
-
"@rife/config": "0.0.6-beta.
|
|
31
|
+
"@types/node": "^25.1.0",
|
|
32
|
+
"vitest": "^4.1.3",
|
|
33
|
+
"@rsbuild/plugin-type-check": "^1.3.4",
|
|
34
|
+
"@rife/config": "0.0.6-beta.13"
|
|
35
35
|
},
|
|
36
36
|
"rife": {
|
|
37
37
|
"hostDependencies": {
|
package/src/plugin/commander.ts
CHANGED
|
@@ -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
|
|
package/src/plugin/config.ts
CHANGED
|
@@ -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()
|
|
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) {
|
package/src/plugin/release.ts
CHANGED
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()
|
|
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 = {
|