@lark-apaas/fullstack-cli 1.1.47-alpha.2 → 1.1.47-alpha.4

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/dist/index.js +24 -63
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -2370,8 +2370,9 @@ import fs7 from "fs";
2370
2370
  import { fileURLToPath as fileURLToPath3 } from "url";
2371
2371
 
2372
2372
  // src/config/sync.ts
2373
- function buildDefaultRules(opts) {
2374
- const rules = [
2373
+ var syncConfig = {
2374
+ // 派生规则
2375
+ sync: [
2375
2376
  // 1. 派生 scripts 目录(总是覆盖;递归同步,包含 scripts/hooks/run-precommit.js)
2376
2377
  {
2377
2378
  from: "templates/scripts",
@@ -2470,41 +2471,23 @@ function buildDefaultRules(opts) {
2470
2471
  to: "node ./scripts/lint.js",
2471
2472
  ifStartsWith: "concurrently "
2472
2473
  }
2473
- ];
2474
- if (!opts.disableGenOpenapi) {
2475
- rules.push({
2474
+ ],
2475
+ // 文件权限设置
2476
+ permissions: {
2477
+ // 所有 .sh 文件设置为可执行
2478
+ // '**/*.sh': 0o755,
2479
+ }
2480
+ };
2481
+ function genSyncConfig(perms = {}) {
2482
+ if (!perms.disableGenOpenapi) {
2483
+ syncConfig.sync.push({
2476
2484
  from: "templates/helper/gen-openapi.ts",
2477
2485
  to: "scripts/gen-openapi.ts",
2478
2486
  type: "file",
2479
2487
  overwrite: true
2480
2488
  });
2481
2489
  }
2482
- return rules;
2483
- }
2484
- function defaultProfile(opts) {
2485
- return {
2486
- sync: buildDefaultRules(opts),
2487
- // 文件权限设置(所有 .sh 文件设置为可执行:'**/*.sh': 0o755)
2488
- permissions: {},
2489
- activateGitHooks: true
2490
- };
2491
- }
2492
- function emptyProfile() {
2493
- return {
2494
- sync: [],
2495
- permissions: {},
2496
- activateGitHooks: false
2497
- };
2498
- }
2499
- var SYNC_PROFILES = {
2500
- "design-stack": defaultProfile,
2501
- "nestjs-react-fullstack": defaultProfile,
2502
- "vite-react": emptyProfile,
2503
- html: emptyProfile
2504
- };
2505
- function genSyncConfig(stack, opts = {}) {
2506
- const factory = stack && SYNC_PROFILES[stack] || defaultProfile;
2507
- return factory(opts);
2490
+ return syncConfig;
2508
2491
  }
2509
2492
 
2510
2493
  // src/utils/file-ops.ts
@@ -2629,10 +2612,9 @@ async function run2(options) {
2629
2612
  console.log("[fullstack-cli] Skip syncing (not a valid npm project)");
2630
2613
  process.exit(0);
2631
2614
  }
2632
- const stack = resolveStack(userProjectRoot);
2633
2615
  try {
2634
- console.log(`[fullstack-cli] Starting sync${stack ? ` (stack: ${stack})` : ""}...`);
2635
- const config = genSyncConfig(stack, {
2616
+ console.log("[fullstack-cli] Starting sync...");
2617
+ const config = genSyncConfig({
2636
2618
  disableGenOpenapi: options.disableGenOpenapi ?? false
2637
2619
  });
2638
2620
  if (!config || !config.sync) {
@@ -2645,13 +2627,11 @@ async function run2(options) {
2645
2627
  if (config.permissions) {
2646
2628
  setPermissions(config.permissions, userProjectRoot);
2647
2629
  }
2648
- if (config.activateGitHooks !== false) {
2649
- try {
2650
- activateGitHooks(userProjectRoot);
2651
- } catch (error) {
2652
- const message = error instanceof Error ? error.message : String(error);
2653
- console.warn(`[fullstack-cli] \u26A0 Failed to activate git hooks: ${message}`);
2654
- }
2630
+ try {
2631
+ activateGitHooks(userProjectRoot);
2632
+ } catch (error) {
2633
+ const message = error instanceof Error ? error.message : String(error);
2634
+ console.warn(`[fullstack-cli] \u26A0 Failed to activate git hooks: ${message}`);
2655
2635
  }
2656
2636
  console.log("[fullstack-cli] Sync completed successfully \u2705");
2657
2637
  } catch (error) {
@@ -2660,20 +2640,6 @@ async function run2(options) {
2660
2640
  process.exit(1);
2661
2641
  }
2662
2642
  }
2663
- function resolveStack(userProjectRoot) {
2664
- const sparkMetaPath = path5.join(userProjectRoot, ".spark", "meta.json");
2665
- if (!fs7.existsSync(sparkMetaPath)) {
2666
- return void 0;
2667
- }
2668
- try {
2669
- const meta = JSON.parse(fs7.readFileSync(sparkMetaPath, "utf-8"));
2670
- return typeof meta.stack === "string" ? meta.stack : void 0;
2671
- } catch (error) {
2672
- const message = error instanceof Error ? error.message : String(error);
2673
- console.warn(`[fullstack-cli] \u26A0 Failed to read .spark/meta.json, fallback to default sync: ${message}`);
2674
- return void 0;
2675
- }
2676
- }
2677
2643
  async function syncRule(rule, pluginRoot, userProjectRoot) {
2678
2644
  if (rule.type === "delete-file" || rule.type === "delete-directory") {
2679
2645
  const destPath2 = path5.join(userProjectRoot, rule.to);
@@ -3163,9 +3129,9 @@ function getCliVersion() {
3163
3129
 
3164
3130
  // src/commands/upgrade/get-upgrade-files.ts
3165
3131
  function getUpgradeFilesToStage(disableGenOpenapi = true) {
3166
- const syncConfig = genSyncConfig(void 0, { disableGenOpenapi });
3132
+ const syncConfig2 = genSyncConfig({ disableGenOpenapi });
3167
3133
  const filesToStage = /* @__PURE__ */ new Set();
3168
- syncConfig.sync.forEach((rule) => {
3134
+ syncConfig2.sync.forEach((rule) => {
3169
3135
  if (rule.type === "file" || rule.type === "directory" || rule.type === "merge-json") {
3170
3136
  filesToStage.add(rule.to);
3171
3137
  } else if (rule.type === "remove-line" || rule.type === "add-line") {
@@ -4488,15 +4454,10 @@ import fs15 from "fs";
4488
4454
  import { createRequire as createRequire2 } from "module";
4489
4455
  import path13 from "path";
4490
4456
  var CAPABILITIES_DIR = "server/capabilities";
4491
- var SHARED_CAPABILITIES_DIR = "shared/capabilities";
4492
4457
  function getProjectRoot2() {
4493
4458
  return process.cwd();
4494
4459
  }
4495
4460
  function getCapabilitiesDir() {
4496
- const sharedDir = path13.join(getProjectRoot2(), SHARED_CAPABILITIES_DIR);
4497
- if (fs15.existsSync(sharedDir)) {
4498
- return sharedDir;
4499
- }
4500
4461
  return path13.join(getProjectRoot2(), CAPABILITIES_DIR);
4501
4462
  }
4502
4463
  function getCapabilityPath(id) {
@@ -4671,7 +4632,7 @@ function logError(message) {
4671
4632
  async function list2(options) {
4672
4633
  try {
4673
4634
  if (!capabilitiesDirExists()) {
4674
- logError("capabilities directory not found (looked for shared/capabilities and server/capabilities)");
4635
+ logError("server/capabilities directory not found");
4675
4636
  process.exit(1);
4676
4637
  }
4677
4638
  if (options.id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-cli",
3
- "version": "1.1.47-alpha.2",
3
+ "version": "1.1.47-alpha.4",
4
4
  "description": "CLI tool for fullstack template management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -31,7 +31,7 @@
31
31
  "access": "public"
32
32
  },
33
33
  "dependencies": {
34
- "@lark-apaas/http-client": "^0.1.5",
34
+ "@lark-apaas/http-client": "0.1.6-alpha.4",
35
35
  "@lydell/node-pty": "1.1.0",
36
36
  "@vercel/nft": "^0.30.3",
37
37
  "commander": "^13.0.0",