@lppx/nlearn 1.1.7 → 1.1.8
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/src/cli/cli.js +4 -3
- package/package.json +1 -1
package/dist/src/cli/cli.js
CHANGED
|
@@ -47,7 +47,8 @@ const fuse_js_1 = __importDefault(require("fuse.js"));
|
|
|
47
47
|
* 扫描 demo 文件夹中的所有示例函数
|
|
48
48
|
*/
|
|
49
49
|
async function scanDemoFunctions() {
|
|
50
|
-
|
|
50
|
+
// 从 cli.ts 所在目录向上找到包根目录,然后定位到 demo 目录
|
|
51
|
+
const demoPath = (0, node_path_1.join)(__dirname, '..', 'demo');
|
|
51
52
|
const results = [];
|
|
52
53
|
try {
|
|
53
54
|
// 读取所有文件夹
|
|
@@ -124,8 +125,8 @@ async function executeDemoFunction(demoFunc) {
|
|
|
124
125
|
try {
|
|
125
126
|
console.log(`\n正在运行: ${demoFunc.displayName}\n`);
|
|
126
127
|
console.log('='.repeat(50));
|
|
127
|
-
//
|
|
128
|
-
const modulePath = (0, node_path_1.join)(
|
|
128
|
+
// 构建模块路径(相对于 cli.ts 所在目录)
|
|
129
|
+
const modulePath = (0, node_path_1.join)(__dirname, '..', 'demo', demoFunc.folder, `${demoFunc.file}.js`);
|
|
129
130
|
// 动态导入模块
|
|
130
131
|
const module = await Promise.resolve(`${modulePath}`).then(s => __importStar(require(s)));
|
|
131
132
|
// 检查函数是否存在
|