jsharness 1.4.0 → 1.4.1
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/jsharness.js +4 -2
- package/package.json +1 -1
package/bin/jsharness.js
CHANGED
|
@@ -13,15 +13,17 @@
|
|
|
13
13
|
* npx jsharness openspec list # 列出 OpenSpec 变更
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import { fileURLToPath } from 'url';
|
|
16
|
+
import { fileURLToPath, pathToFileURL } from 'url';
|
|
17
17
|
import path from 'path';
|
|
18
18
|
|
|
19
19
|
// 关键:用相对路径引用主库,不用 import('jsharness') 包名
|
|
20
20
|
// 这样在 npx 临时安装环境中也能可靠定位模块
|
|
21
|
+
// Windows 上必须用 file:// URL 格式,不能用 C:\path 格式
|
|
21
22
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
22
23
|
const libPath = path.join(__dirname, '..', 'lib', 'index.mjs');
|
|
24
|
+
const libURL = pathToFileURL(libPath).href;
|
|
23
25
|
|
|
24
|
-
const { runInit, listTools, showStatus, listOpenSpecChanges, archiveOpenSpecChange } = await import(
|
|
26
|
+
const { runInit, listTools, showStatus, listOpenSpecChanges, archiveOpenSpecChange } = await import(libURL);
|
|
25
27
|
|
|
26
28
|
// 读取版本号
|
|
27
29
|
import { createRequire } from 'module';
|