@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.
@@ -47,7 +47,8 @@ const fuse_js_1 = __importDefault(require("fuse.js"));
47
47
  * 扫描 demo 文件夹中的所有示例函数
48
48
  */
49
49
  async function scanDemoFunctions() {
50
- const demoPath = (0, node_path_1.join)(process.cwd(), 'src', 'demo');
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)(process.cwd(), 'src', 'demo', demoFunc.folder, `${demoFunc.file}.js`);
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
  // 检查函数是否存在
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.1.7",
6
+ "version": "1.1.8",
7
7
  "description": "一个nodejs学习工具",
8
8
  "bin": {
9
9
  "nlearn": "dist/src/cli/index.js",