create-windy 0.3.10 → 0.3.12

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,36 @@ 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 backup = entry.existed ? await backupExpectation(root, backupPath, entry.path, entry.mode) : { kind: "missing" };
7373
+ const actualHash = await hashSafePath(root, path2);
7374
+ const actualMode = await safeFileMode(root, path2);
7375
+ const mutation = state.mutationEvidence?.find((evidence) => evidence.path === path2);
7376
+ const matchesBackup = matchesExpected(actualHash, actualMode, backup, entry.mode);
7377
+ const matchesOutcome = Boolean(mutation?.linearized && mutation.outcome && matchesExpected(actualHash, actualMode, mutation.outcome, mutation.outcomeMode));
7378
+ if (!matchesBackup && !matchesOutcome) {
7379
+ unresolved.push(path2);
7380
+ }
7381
+ }
7382
+ return unresolved;
7383
+ }
7384
+ async function backupExpectation(root, backupPath, path2, mode) {
7385
+ const backupFile = `${backupPath}/files/${path2}`;
7386
+ const content = await readSafeOptional(root, backupFile);
7387
+ if (!content || mode !== undefined && await safeFileMode(root, backupFile) !== mode) {
7388
+ throw new Error(`\u4E8B\u52A1\u5907\u4EFD\u4E0D\u5B8C\u6574\uFF0C\u65E0\u6CD5\u89E3\u9664\u4FDD\u62A4\uFF1A${path2}`);
7389
+ }
7390
+ return { kind: "hash", value: hashContent(content) };
7391
+ }
7392
+
7363
7393
  // src/update/transaction-recovery.ts
7364
7394
  async function restoreUpdateState(projectDirectory, state, options) {
7365
7395
  const root = await resolveProjectRoot(projectDirectory);
@@ -7386,8 +7416,17 @@ async function restoreUpdateState(projectDirectory, state, options) {
7386
7416
  current = await retainTransactionConflicts(root, conflicts);
7387
7417
  }
7388
7418
  }
7419
+ const retainedPreservePaths = await unresolvedPreservePaths(root, backupPath, current);
7420
+ if (retainedPreservePaths.length !== (current.preservePaths?.length ?? 0)) {
7421
+ const next = {
7422
+ ...current,
7423
+ preservePaths: retainedPreservePaths.length ? retainedPreservePaths : undefined
7424
+ };
7425
+ await publishTransactionState(root, current, next);
7426
+ current = next;
7427
+ }
7389
7428
  const preserved = new Set([
7390
- ...current.preservePaths ?? [],
7429
+ ...retainedPreservePaths,
7391
7430
  ...options?.preservePaths ?? []
7392
7431
  ]);
7393
7432
  const recoveryExpectations = new Map;
@@ -9060,7 +9099,9 @@ var recipes = [
9060
9099
  { id: "starter-0.3.6-to-0.3.7", from: "0.3.6", to: "0.3.7" },
9061
9100
  { id: "starter-0.3.7-to-0.3.8", from: "0.3.7", to: "0.3.8" },
9062
9101
  { 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" }
9102
+ { id: "starter-0.3.9-to-0.3.10", from: "0.3.9", to: "0.3.10" },
9103
+ { id: "starter-0.3.10-to-0.3.11", from: "0.3.10", to: "0.3.11" },
9104
+ { id: "starter-0.3.11-to-0.3.12", from: "0.3.11", to: "0.3.12" }
9064
9105
  ];
9065
9106
  function resolveRecipeChain(sourceVersion, targetVersion) {
9066
9107
  if (sourceVersion === targetVersion)
@@ -10267,11 +10308,13 @@ class DefaultStarterUpdater {
10267
10308
  #execute;
10268
10309
  #beforeTransactionFinalize;
10269
10310
  #finalizeTransaction;
10311
+ #skipInstall;
10270
10312
  constructor(dependencies = {}) {
10271
10313
  this.#artifacts = dependencies.artifacts ?? new PublishedArtifactProvider;
10272
10314
  this.#execute = dependencies.execute ?? runCommand;
10273
10315
  this.#beforeTransactionFinalize = dependencies.beforeTransactionFinalize;
10274
10316
  this.#finalizeTransaction = dependencies.finalizeTransaction ?? finalizeOwnedTransaction;
10317
+ this.#skipInstall = dependencies.skipInstall ?? false;
10275
10318
  }
10276
10319
  async plan(input) {
10277
10320
  return createUpdatePlan(input, this.#artifacts);
@@ -10313,8 +10356,12 @@ class DefaultStarterUpdater {
10313
10356
  name: "\u540C\u6B65 Server \u4E0E Web Dockerfile workspace COPY \u6E05\u5355",
10314
10357
  status: dockerSync.every(({ sync }) => sync.synced) ? "passed" : "skipped"
10315
10358
  });
10316
- await this.#execute("bun", ["install", "--force"], result2.plan.projectDirectory);
10317
- steps.push({ name: "bun install --force", status: "passed" });
10359
+ if (this.#skipInstall) {
10360
+ steps.push({ name: "bun install --force", status: "skipped" });
10361
+ } else {
10362
+ await this.#execute("bun", ["install", "--force"], result2.plan.projectDirectory);
10363
+ steps.push({ name: "bun install --force", status: "passed" });
10364
+ }
10318
10365
  const stabilized = await stabilizeManagedContent(result2, this.#execute, async (path2, content) => {
10319
10366
  await writeOwnedTransactionFile(result2.plan.projectDirectory, path2, content, expectedForPath(result2, path2));
10320
10367
  replaceExpectations(result2, [expectationForContent(path2, content)]);
@@ -10828,7 +10875,9 @@ async function runUpdate(args, projectDirectory) {
10828
10875
  console.log(`\u9879\u76EE\u5DF2\u7ECF\u662F ${target}\uFF0C\u65E0\u9700\u66F4\u65B0`);
10829
10876
  return;
10830
10877
  }
10831
- const updater = new DefaultStarterUpdater;
10878
+ const updater = new DefaultStarterUpdater({
10879
+ skipInstall: args.includes("--skip-install")
10880
+ });
10832
10881
  const plan = await updater.plan({
10833
10882
  projectDirectory,
10834
10883
  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.12",
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": "e2545e4bb6f80639f12b79ffbdbd16e834bffa77",
4
+ "generatorVersion": "0.3.12",
5
5
  "modules": [
6
6
  {
7
7
  "name": "system",