lemonppt 0.2.2 → 1.0.0

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/cli.js +13 -3
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -9,10 +9,20 @@
9
9
  */
10
10
 
11
11
  import { spawnSync } from 'node:child_process';
12
- import { createRequire } from 'node:module';
12
+ import { readFileSync } from 'node:fs';
13
+ import path from 'node:path';
14
+ import { fileURLToPath } from 'node:url';
13
15
 
14
- const require = createRequire(import.meta.url);
15
- const cliPath = require.resolve('@lemonppt/cli/dist/cli.js');
16
+ const mainUrl = import.meta.resolve('@lemonppt/cli');
17
+ const mainPath = fileURLToPath(mainUrl);
18
+ const pkgDir = path.resolve(mainPath, '..', '..');
19
+ const cliPkg = JSON.parse(readFileSync(path.join(pkgDir, 'package.json'), 'utf-8'));
20
+ const binEntry = typeof cliPkg.bin === 'string' ? cliPkg.bin : cliPkg.bin?.lemonppt;
21
+ if (!binEntry) {
22
+ console.error('无法定位 @lemonppt/cli 的 bin 入口');
23
+ process.exit(1);
24
+ }
25
+ const cliPath = path.join(pkgDir, binEntry);
16
26
 
17
27
  const result = spawnSync(
18
28
  process.execPath,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lemonppt",
3
- "version": "0.2.2",
3
+ "version": "1.0.0",
4
4
  "description": "lemonPPT CLI — AI-powered presentation generation (alias for @lemonppt/cli)",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "type": "module",