create-windy 0.2.13 → 0.2.14

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
@@ -4011,7 +4011,8 @@ var recipes = [
4011
4011
  { id: "starter-0.2.9-to-0.2.10", from: "0.2.9", to: "0.2.10" },
4012
4012
  { id: "starter-0.2.10-to-0.2.11", from: "0.2.10", to: "0.2.11" },
4013
4013
  { id: "starter-0.2.11-to-0.2.12", from: "0.2.11", to: "0.2.12" },
4014
- { id: "starter-0.2.12-to-0.2.13", from: "0.2.12", to: "0.2.13" }
4014
+ { id: "starter-0.2.12-to-0.2.13", from: "0.2.12", to: "0.2.13" },
4015
+ { id: "starter-0.2.13-to-0.2.14", from: "0.2.13", to: "0.2.14" }
4015
4016
  ];
4016
4017
  function resolveRecipeChain(sourceVersion, targetVersion) {
4017
4018
  if (sourceVersion === targetVersion)
@@ -4102,6 +4103,22 @@ async function readProjectName2(projectDirectory) {
4102
4103
  import { access as access3, readFile as readFile13 } from "node:fs/promises";
4103
4104
  import { join as join14 } from "node:path";
4104
4105
 
4106
+ // src/update/known-repairs.ts
4107
+ var affectedVersions = new Set(["0.2.12", "0.2.13"]);
4108
+ var wrongExampleDescription = "创建时包含了 `work-order` 示例模块,用于演示 Module Manifest 接入;它不是生产工单产品,可以在正式开发前替换。";
4109
+ var correctCoreDescription = "创建时未选择 `work-order` 示例模块,当前项目只包含平台模块。";
4110
+ var wrongExampleRow = /^\|\s*示例工单\s*\|\s*已包含\s*\|$/m;
4111
+ var correctCoreRow = /^\|\s*示例工单\s*\|\s*未包含\s*\|$/m;
4112
+ function repairKnownDerivedFile(input) {
4113
+ if (input.path !== "README.md" || input.includeExample || !affectedVersions.has(input.sourceVersion) || !input.content.includes(wrongExampleDescription) || !wrongExampleRow.test(input.content) || !input.targetContent.includes(correctCoreDescription) || !correctCoreRow.test(input.targetContent)) {
4114
+ return;
4115
+ }
4116
+ const targetRow = input.targetContent.match(correctCoreRow)?.[0];
4117
+ if (!targetRow)
4118
+ return;
4119
+ return input.content.replace(wrongExampleDescription, correctCoreDescription).replace(wrongExampleRow, targetRow);
4120
+ }
4121
+
4105
4122
  // src/update/merge.ts
4106
4123
  import { mkdtemp as mkdtemp2, rm as rm6, writeFile as writeFile10 } from "node:fs/promises";
4107
4124
  import { tmpdir as tmpdir2 } from "node:os";
@@ -4208,7 +4225,7 @@ async function createUpdatePlan(request, artifacts) {
4208
4225
  for (const path2 of [...paths].sort()) {
4209
4226
  if (metadataPaths.has(path2))
4210
4227
  continue;
4211
- const file = await planFile(path2, request.projectDirectory, artifactSet.baseDirectory, artifactSet.targetDirectory, sourceEntries.get(path2), targetEntries.get(path2));
4228
+ const file = await planFile(path2, request.projectDirectory, artifactSet.baseDirectory, artifactSet.targetDirectory, sourceEntries.get(path2), targetEntries.get(path2), provenance);
4212
4229
  if (oxcManagedPaths.has(path2) && file.reason === "客户已修改") {
4213
4230
  file.action = "preserve";
4214
4231
  delete file.conflict;
@@ -4231,13 +4248,23 @@ async function createUpdatePlan(request, artifacts) {
4231
4248
  temporaryRoot: artifactSet.temporaryRoot
4232
4249
  };
4233
4250
  }
4234
- async function planFile(path2, project, baseRoot, targetRoot, source, target) {
4251
+ async function planFile(path2, project, baseRoot, targetRoot, source, target, provenance) {
4235
4252
  const [ours, base, theirs] = await Promise.all([
4236
4253
  readOptional(join14(project, path2)),
4237
4254
  readOptional(join14(baseRoot, path2)),
4238
4255
  readOptional(join14(targetRoot, path2))
4239
4256
  ]);
4240
4257
  const ownership = target?.ownership || source?.ownership || classifyOwnership(path2);
4258
+ const repaired = ours && theirs && provenance ? repairKnownDerivedFile({
4259
+ path: path2,
4260
+ sourceVersion: provenance.windyVersion,
4261
+ includeExample: provenance.choices.includeExample,
4262
+ content: new TextDecoder().decode(ours),
4263
+ targetContent: new TextDecoder().decode(theirs)
4264
+ }) : undefined;
4265
+ if (repaired !== undefined) {
4266
+ return ready(path2, ownership, "update", "修复已发布版本的模块选择派生文本", new TextEncoder().encode(repaired));
4267
+ }
4241
4268
  if (path2.startsWith("packages/database/drizzle/") && path2.endsWith(".sql")) {
4242
4269
  if (source && !target)
4243
4270
  return conflict(path2, ownership, "已发布 migration 不可删除");
@@ -4384,9 +4411,14 @@ class DefaultStarterUpdater {
4384
4411
  }
4385
4412
  async function finalize(result) {
4386
4413
  const root = result.plan.projectDirectory;
4387
- await writeFile11(join15(root, ".windy/generation.json"), `${JSON.stringify(result.plan.targetProvenance, null, 2)}
4388
- `);
4389
- await writeFile11(join15(root, ".windy/files.json"), `${JSON.stringify(result.plan.targetManifest, null, 2)}
4414
+ const generationContent = `${JSON.stringify(result.plan.targetProvenance, null, 2)}
4415
+ `;
4416
+ await writeFile11(join15(root, ".windy/generation.json"), generationContent);
4417
+ const targetManifest = {
4418
+ ...result.plan.targetManifest,
4419
+ files: result.plan.targetManifest.files.map((entry) => entry.path === ".windy/generation.json" ? { ...entry, hash: hashContent(generationContent) } : entry)
4420
+ };
4421
+ await writeFile11(join15(root, ".windy/files.json"), `${JSON.stringify(targetManifest, null, 2)}
4390
4422
  `);
4391
4423
  }
4392
4424
  async function writeReport(result, steps, relativePath2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-windy",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
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": "51ba8808a74c2143803d3ec0584d2a35ba1c18e3",
4
- "generatorVersion": "0.2.13",
3
+ "templateCommit": "3086f275efa558dab15015be61bc93e10968b60a",
4
+ "generatorVersion": "0.2.14",
5
5
  "modules": [
6
6
  {
7
7
  "name": "system",