@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.
Files changed (2) hide show
  1. package/bin/index.js +11 -5
  2. 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(join(libPath, 'create.js')),
80
- import(join(libPath, 'cache.js')),
81
- import(join(libPath, 'templates.js')),
82
- import(join(libPath, 'utils.js'))
85
+ import(createUrl),
86
+ import(cacheUrl),
87
+ import(templatesUrl),
88
+ import(utilsUrl)
83
89
  ]);
84
90
 
85
91
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agile-team/robot-cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "🤖 现代化项目脚手架工具,支持多技术栈快速创建项目",
5
5
  "type": "module",
6
6
  "bin": {