create-windy 0.3.10 → 0.3.11

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/cli.js CHANGED
@@ -835,7 +835,7 @@ var helpText = `create-windy <\u9879\u76EE\u540D> [\u9009\u9879]
835
835
 
836
836
  \u9009\u9879\uFF1A
837
837
  --profile private-enterprise \u5355\u7EC4\u7EC7\u3001\u5355\u79DF\u6237\u3001\u79C1\u6709\u90E8\u7F72 profile
838
- --skip-install \u53EA\u751F\u6210\u6587\u4EF6\uFF0C\u4E0D\u6267\u884C bun install
838
+ --skip-install \u751F\u6210\u6216\u66F4\u65B0\u65F6\u4E0D\u6267\u884C bun install
839
839
  --verify \u5B89\u88C5\u540E\u6267\u884C lint\uFF08\u82E5\u6709\uFF09\u3001typecheck\u3001test \u548C build
840
840
  --keep-on-error \u5931\u8D25\u65F6\u4FDD\u7559\u65B0\u751F\u6210\u76EE\u5F55\u7528\u4E8E\u8BCA\u65AD
841
841
  --module <key> \u589E\u52A0\u6A21\u5757\uFF0C\u53EF\u91CD\u590D\u4F7F\u7528
@@ -866,7 +866,7 @@ async function runCommand(command, args, cwd) {
866
866
  await new Promise((resolve2, reject) => {
867
867
  const child = spawn(command, args, { cwd, stdio: "inherit" });
868
868
  child.once("error", reject);
869
- child.once("exit", (code, signal) => {
869
+ child.once("close", (code, signal) => {
870
870
  if (code === 0)
871
871
  resolve2();
872
872
  else
@@ -7360,6 +7360,31 @@ async function assertRestoredEntries(root, state, backups) {
7360
7360
  }
7361
7361
  }
7362
7362
 
7363
+ // src/update/transaction-recovery-preserves.ts
7364
+ async function unresolvedPreservePaths(root, backupPath, state) {
7365
+ const unresolved = [];
7366
+ for (const path2 of state.preservePaths ?? []) {
7367
+ const entry = state.entries.find((candidate) => candidate.path === path2);
7368
+ if (!entry) {
7369
+ unresolved.push(path2);
7370
+ continue;
7371
+ }
7372
+ const expected = entry.existed ? await backupExpectation(root, backupPath, entry.path, entry.mode) : { kind: "missing" };
7373
+ if (!matchesExpected(await hashSafePath(root, path2), await safeFileMode(root, path2), expected, entry.mode)) {
7374
+ unresolved.push(path2);
7375
+ }
7376
+ }
7377
+ return unresolved;
7378
+ }
7379
+ async function backupExpectation(root, backupPath, path2, mode) {
7380
+ const backupFile = `${backupPath}/files/${path2}`;
7381
+ const content = await readSafeOptional(root, backupFile);
7382
+ if (!content || mode !== undefined && await safeFileMode(root, backupFile) !== mode) {
7383
+ throw new Error(`\u4E8B\u52A1\u5907\u4EFD\u4E0D\u5B8C\u6574\uFF0C\u65E0\u6CD5\u89E3\u9664\u4FDD\u62A4\uFF1A${path2}`);
7384
+ }
7385
+ return { kind: "hash", value: hashContent(content) };
7386
+ }
7387
+
7363
7388
  // src/update/transaction-recovery.ts
7364
7389
  async function restoreUpdateState(projectDirectory, state, options) {
7365
7390
  const root = await resolveProjectRoot(projectDirectory);
@@ -7386,8 +7411,17 @@ async function restoreUpdateState(projectDirectory, state, options) {
7386
7411
  current = await retainTransactionConflicts(root, conflicts);
7387
7412
  }
7388
7413
  }
7414
+ const retainedPreservePaths = await unresolvedPreservePaths(root, backupPath, current);
7415
+ if (retainedPreservePaths.length !== (current.preservePaths?.length ?? 0)) {
7416
+ const next = {
7417
+ ...current,
7418
+ preservePaths: retainedPreservePaths.length ? retainedPreservePaths : undefined
7419
+ };
7420
+ await publishTransactionState(root, current, next);
7421
+ current = next;
7422
+ }
7389
7423
  const preserved = new Set([
7390
- ...current.preservePaths ?? [],
7424
+ ...retainedPreservePaths,
7391
7425
  ...options?.preservePaths ?? []
7392
7426
  ]);
7393
7427
  const recoveryExpectations = new Map;
@@ -9060,7 +9094,8 @@ var recipes = [
9060
9094
  { id: "starter-0.3.6-to-0.3.7", from: "0.3.6", to: "0.3.7" },
9061
9095
  { id: "starter-0.3.7-to-0.3.8", from: "0.3.7", to: "0.3.8" },
9062
9096
  { id: "starter-0.3.8-to-0.3.9", from: "0.3.8", to: "0.3.9" },
9063
- { id: "starter-0.3.9-to-0.3.10", from: "0.3.9", to: "0.3.10" }
9097
+ { id: "starter-0.3.9-to-0.3.10", from: "0.3.9", to: "0.3.10" },
9098
+ { id: "starter-0.3.10-to-0.3.11", from: "0.3.10", to: "0.3.11" }
9064
9099
  ];
9065
9100
  function resolveRecipeChain(sourceVersion, targetVersion) {
9066
9101
  if (sourceVersion === targetVersion)
@@ -10267,11 +10302,13 @@ class DefaultStarterUpdater {
10267
10302
  #execute;
10268
10303
  #beforeTransactionFinalize;
10269
10304
  #finalizeTransaction;
10305
+ #skipInstall;
10270
10306
  constructor(dependencies = {}) {
10271
10307
  this.#artifacts = dependencies.artifacts ?? new PublishedArtifactProvider;
10272
10308
  this.#execute = dependencies.execute ?? runCommand;
10273
10309
  this.#beforeTransactionFinalize = dependencies.beforeTransactionFinalize;
10274
10310
  this.#finalizeTransaction = dependencies.finalizeTransaction ?? finalizeOwnedTransaction;
10311
+ this.#skipInstall = dependencies.skipInstall ?? false;
10275
10312
  }
10276
10313
  async plan(input) {
10277
10314
  return createUpdatePlan(input, this.#artifacts);
@@ -10313,8 +10350,12 @@ class DefaultStarterUpdater {
10313
10350
  name: "\u540C\u6B65 Server \u4E0E Web Dockerfile workspace COPY \u6E05\u5355",
10314
10351
  status: dockerSync.every(({ sync }) => sync.synced) ? "passed" : "skipped"
10315
10352
  });
10316
- await this.#execute("bun", ["install", "--force"], result2.plan.projectDirectory);
10317
- steps.push({ name: "bun install --force", status: "passed" });
10353
+ if (this.#skipInstall) {
10354
+ steps.push({ name: "bun install --force", status: "skipped" });
10355
+ } else {
10356
+ await this.#execute("bun", ["install", "--force"], result2.plan.projectDirectory);
10357
+ steps.push({ name: "bun install --force", status: "passed" });
10358
+ }
10318
10359
  const stabilized = await stabilizeManagedContent(result2, this.#execute, async (path2, content) => {
10319
10360
  await writeOwnedTransactionFile(result2.plan.projectDirectory, path2, content, expectedForPath(result2, path2));
10320
10361
  replaceExpectations(result2, [expectationForContent(path2, content)]);
@@ -10828,7 +10869,9 @@ async function runUpdate(args, projectDirectory) {
10828
10869
  console.log(`\u9879\u76EE\u5DF2\u7ECF\u662F ${target}\uFF0C\u65E0\u9700\u66F4\u65B0`);
10829
10870
  return;
10830
10871
  }
10831
- const updater = new DefaultStarterUpdater;
10872
+ const updater = new DefaultStarterUpdater({
10873
+ skipInstall: args.includes("--skip-install")
10874
+ });
10832
10875
  const plan = await updater.plan({
10833
10876
  projectDirectory,
10834
10877
  targetVersion: target,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-windy",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "description": "创建单组织、单租户、私有部署优先的 Windy 企业 Dashboard Starter",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "templateCommit": "3bbd8ca1fcd1fca58daeba2e800510e42db191b0",
4
- "generatorVersion": "0.3.10",
3
+ "templateCommit": "3adb3c8663d8b57b769e4abfef0f598c70241cde",
4
+ "generatorVersion": "0.3.11",
5
5
  "modules": [
6
6
  {
7
7
  "name": "system",