@lark-apaas/fullstack-cli 1.1.13-alpha.0 → 1.1.13-alpha.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-cli",
3
- "version": "1.1.13-alpha.0",
3
+ "version": "1.1.13-alpha.2",
4
4
  "description": "CLI tool for fullstack template management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -31,12 +31,15 @@
31
31
  "access": "public"
32
32
  },
33
33
  "dependencies": {
34
- "@lark-apaas/devtool-kits": "^1.2.12",
35
- "@lark-apaas/http-client": "0.1.2",
34
+ "@lark-apaas/http-client": "^0.1.2",
36
35
  "@vercel/nft": "^0.30.3",
37
36
  "commander": "^13.0.0",
38
37
  "dotenv": "^16.0.0",
39
38
  "drizzle-kit": "0.31.5",
39
+ "drizzle-orm": "0.44.6",
40
+ "inflection": "^3.0.2",
41
+ "pinyin-pro": "^3.27.0",
42
+ "postgres": "^3.4.3",
40
43
  "ts-morph": "^27.0.0",
41
44
  "zod-to-json-schema": "^3.24.1"
42
45
  },
@@ -214,7 +214,7 @@ log_event "INFO" "main" "========== Dev session started =========="
214
214
 
215
215
  # Initialize action plugins before starting dev servers
216
216
  echo "🔌 Initializing action plugins..."
217
- if npx fullstack-cli action-plugin init; then
217
+ if fullstack-cli action-plugin init; then
218
218
  echo "✅ Action plugins initialized"
219
219
  else
220
220
  echo "⚠️ Action plugin initialization failed, continuing anyway..."
@@ -9,7 +9,7 @@ const ROOT_DIR = path.resolve(__dirname, '..');
9
9
  const DIST_SERVER_DIR = path.join(ROOT_DIR, 'dist/server');
10
10
  const ROOT_PACKAGE_JSON = path.join(ROOT_DIR, 'package.json');
11
11
  const ROOT_NODE_MODULES = path.join(ROOT_DIR, 'node_modules');
12
- const OUT_NODE_MODULES = path.join(DIST_SERVER_DIR, 'node_modules');
12
+ const OUT_NODE_MODULES = path.join(ROOT_DIR, 'dist/node_modules');
13
13
  const OUT_PACKAGE_JSON = path.join(DIST_SERVER_DIR, 'package.json');
14
14
 
15
15
  // Server 入口文件
@@ -180,8 +180,43 @@ async function smartPrune() {
180
180
 
181
181
  console.log(`📦 静态分析需要 ${requiredPackages.size} 个 npm 包`);
182
182
 
183
- // 4. 处理 actionPlugins(动态加载的插件,无法被静态分析追踪)
183
+ // 4. 主动收集项目直接依赖的子依赖(处理动态 require 无法被静态分析追踪的问题)
184
+ // 某些包(如 pdf-parse)使用 try-catch 动态加载依赖(如 @napi-rs/canvas),
185
+ // @vercel/nft 无法追踪这类依赖,需要直接信任包的 package.json 声明
184
186
  const originalPackage = JSON.parse(fs.readFileSync(ROOT_PACKAGE_JSON, 'utf8'));
187
+ const projectDeps = Object.keys(originalPackage.dependencies || {});
188
+
189
+ let addedSubDeps = 0;
190
+ for (const depName of projectDeps) {
191
+ const depPkgPath = path.join(ROOT_NODE_MODULES, depName, 'package.json');
192
+ if (!fs.existsSync(depPkgPath)) continue;
193
+
194
+ try {
195
+ const depPkg = JSON.parse(fs.readFileSync(depPkgPath, 'utf8'));
196
+ const subDeps = {
197
+ ...depPkg.dependencies,
198
+ ...depPkg.optionalDependencies,
199
+ };
200
+
201
+ for (const subDep of Object.keys(subDeps)) {
202
+ if (!requiredPackages.has(subDep)) {
203
+ const subDepPath = path.join(ROOT_NODE_MODULES, subDep);
204
+ if (fs.existsSync(subDepPath)) {
205
+ requiredPackages.add(subDep);
206
+ addedSubDeps++;
207
+ }
208
+ }
209
+ }
210
+ } catch {
211
+ // 忽略解析错误
212
+ }
213
+ }
214
+
215
+ if (addedSubDeps > 0) {
216
+ console.log(`📦 主动收集项目依赖的子依赖,新增 ${addedSubDeps} 个包`);
217
+ }
218
+
219
+ // 5. 处理 actionPlugins(动态加载的插件,无法被静态分析追踪)
185
220
  const actionPlugins = originalPackage.actionPlugins || {};
186
221
  const actionPluginNames = Object.keys(actionPlugins);
187
222
 
@@ -212,7 +247,7 @@ async function smartPrune() {
212
247
 
213
248
  console.log(`📦 总共需要 ${requiredPackages.size} 个 npm 包\n`);
214
249
 
215
- // 5. 选择性复制包(只复制需要的)
250
+ // 6. 选择性复制包(只复制需要的)
216
251
  console.log('📋 选择性复制 node_modules(仅复制需要的包)...');
217
252
  const copyStart = Date.now();
218
253
 
@@ -224,7 +259,7 @@ async function smartPrune() {
224
259
  console.log(` 成功: ${copiedCount.success} 个包,失败: ${copiedCount.failed} 个`);
225
260
  console.log(` 硬链接: ${fileStats.hardLinks} 个文件,复制: ${fileStats.copies} 个文件\n`);
226
261
 
227
- // 6. 生成精简版 package.json
262
+ // 7. 生成精简版 package.json
228
263
  // 优化:直接构建 dependencies,避免多次对象展开
229
264
  const prunedDependencies = {};
230
265
  const allDeps = originalPackage.dependencies || {};
@@ -253,7 +288,7 @@ async function smartPrune() {
253
288
 
254
289
  const totalElapsed = Date.now() - totalStartTime;
255
290
 
256
- // 7. 输出统计信息
291
+ // 8. 输出统计信息
257
292
  console.log('='.repeat(60));
258
293
  console.log('📊 智能裁剪统计:');
259
294
  console.log('='.repeat(60));