@agile-team/robot-cli 1.0.4 → 1.0.5
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/bin/index.js +11 -5
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
3
|
+
import { fileURLToPath, pathToFileURL } from 'url';
|
|
4
4
|
import { dirname, join, resolve } from 'path';
|
|
5
5
|
import { existsSync } from 'fs';
|
|
6
6
|
|
|
@@ -61,6 +61,12 @@ async function loadModules() {
|
|
|
61
61
|
try {
|
|
62
62
|
const libPath = resolveLibPath();
|
|
63
63
|
|
|
64
|
+
// 将路径转换为 file:// URL 格式(Windows 兼容)
|
|
65
|
+
const createUrl = pathToFileURL(join(libPath, 'create.js')).href;
|
|
66
|
+
const cacheUrl = pathToFileURL(join(libPath, 'cache.js')).href;
|
|
67
|
+
const templatesUrl = pathToFileURL(join(libPath, 'templates.js')).href;
|
|
68
|
+
const utilsUrl = pathToFileURL(join(libPath, 'utils.js')).href;
|
|
69
|
+
|
|
64
70
|
// 动态导入所有需要的模块
|
|
65
71
|
const [
|
|
66
72
|
{ Command },
|
|
@@ -76,10 +82,10 @@ async function loadModules() {
|
|
|
76
82
|
import('chalk'),
|
|
77
83
|
import('boxen'),
|
|
78
84
|
import('inquirer'),
|
|
79
|
-
import(
|
|
80
|
-
import(
|
|
81
|
-
import(
|
|
82
|
-
import(
|
|
85
|
+
import(createUrl),
|
|
86
|
+
import(cacheUrl),
|
|
87
|
+
import(templatesUrl),
|
|
88
|
+
import(utilsUrl)
|
|
83
89
|
]);
|
|
84
90
|
|
|
85
91
|
return {
|