create-windy 0.2.14 → 0.2.16
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 +38 -4
- package/package.json +1 -1
- package/template/.windy-template.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -4012,7 +4012,9 @@ var recipes = [
|
|
|
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
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
|
+
{ id: "starter-0.2.13-to-0.2.14", from: "0.2.13", to: "0.2.14" },
|
|
4016
|
+
{ id: "starter-0.2.14-to-0.2.15", from: "0.2.14", to: "0.2.15" },
|
|
4017
|
+
{ id: "starter-0.2.15-to-0.2.16", from: "0.2.15", to: "0.2.16" }
|
|
4016
4018
|
];
|
|
4017
4019
|
function resolveRecipeChain(sourceVersion, targetVersion) {
|
|
4018
4020
|
if (sourceVersion === targetVersion)
|
|
@@ -4104,20 +4106,44 @@ import { access as access3, readFile as readFile13 } from "node:fs/promises";
|
|
|
4104
4106
|
import { join as join14 } from "node:path";
|
|
4105
4107
|
|
|
4106
4108
|
// src/update/known-repairs.ts
|
|
4107
|
-
var
|
|
4109
|
+
var wrongTextVersions = new Set(["0.2.12", "0.2.13"]);
|
|
4110
|
+
var formattedBaselineVersions = new Set(["0.2.14", "0.2.15"]);
|
|
4108
4111
|
var wrongExampleDescription = "创建时包含了 `work-order` 示例模块,用于演示 Module Manifest 接入;它不是生产工单产品,可以在正式开发前替换。";
|
|
4109
4112
|
var correctCoreDescription = "创建时未选择 `work-order` 示例模块,当前项目只包含平台模块。";
|
|
4110
4113
|
var wrongExampleRow = /^\|\s*示例工单\s*\|\s*已包含\s*\|$/m;
|
|
4111
4114
|
var correctCoreRow = /^\|\s*示例工单\s*\|\s*未包含\s*\|$/m;
|
|
4112
4115
|
function repairKnownDerivedFile(input) {
|
|
4113
|
-
if (input.path !== "README.md" || input.includeExample || !
|
|
4116
|
+
if (input.path !== "README.md" || input.includeExample || !input.targetContent.includes(correctCoreDescription) || !correctCoreRow.test(input.targetContent)) {
|
|
4114
4117
|
return;
|
|
4115
4118
|
}
|
|
4116
4119
|
const targetRow = input.targetContent.match(correctCoreRow)?.[0];
|
|
4117
4120
|
if (!targetRow)
|
|
4118
4121
|
return;
|
|
4122
|
+
if (formattedBaselineVersions.has(input.sourceVersion)) {
|
|
4123
|
+
if (input.content.includes(correctCoreDescription) && correctCoreRow.test(input.content) && input.content !== input.targetContent && normalizeMarkdownTables(input.content) === normalizeMarkdownTables(input.targetContent)) {
|
|
4124
|
+
return input.content;
|
|
4125
|
+
}
|
|
4126
|
+
return;
|
|
4127
|
+
}
|
|
4128
|
+
if (!wrongTextVersions.has(input.sourceVersion) || !input.content.includes(wrongExampleDescription) || !wrongExampleRow.test(input.content)) {
|
|
4129
|
+
return;
|
|
4130
|
+
}
|
|
4119
4131
|
return input.content.replace(wrongExampleDescription, correctCoreDescription).replace(wrongExampleRow, targetRow);
|
|
4120
4132
|
}
|
|
4133
|
+
function normalizeMarkdownTables(content) {
|
|
4134
|
+
return content.split(`
|
|
4135
|
+
`).map((line) => {
|
|
4136
|
+
const trimmed = line.trim();
|
|
4137
|
+
if (!trimmed.startsWith("|") || !trimmed.endsWith("|"))
|
|
4138
|
+
return line;
|
|
4139
|
+
return `| ${trimmed.slice(1, -1).split("|").map((cell) => normalizeTableCell(cell.trim())).join(" | ")} |`;
|
|
4140
|
+
}).join(`
|
|
4141
|
+
`);
|
|
4142
|
+
}
|
|
4143
|
+
function normalizeTableCell(cell) {
|
|
4144
|
+
const separator = cell.match(/^(:?)-{3,}(:?)$/);
|
|
4145
|
+
return separator ? `${separator[1]}---${separator[2]}` : cell;
|
|
4146
|
+
}
|
|
4121
4147
|
|
|
4122
4148
|
// src/update/merge.ts
|
|
4123
4149
|
import { mkdtemp as mkdtemp2, rm as rm6, writeFile as writeFile10 } from "node:fs/promises";
|
|
@@ -4414,9 +4440,17 @@ async function finalize(result) {
|
|
|
4414
4440
|
const generationContent = `${JSON.stringify(result.plan.targetProvenance, null, 2)}
|
|
4415
4441
|
`;
|
|
4416
4442
|
await writeFile11(join15(root, ".windy/generation.json"), generationContent);
|
|
4443
|
+
const refreshedPaths = new Set([
|
|
4444
|
+
".windy/generation.json",
|
|
4445
|
+
...result.plan.files.filter(({ action }) => action === "create" || action === "update").map(({ path: path2 }) => path2)
|
|
4446
|
+
]);
|
|
4447
|
+
const refreshedHashes = new Map(await Promise.all([...refreshedPaths].map(async (path2) => [path2, hashContent(await readFile14(join15(root, path2)))])));
|
|
4417
4448
|
const targetManifest = {
|
|
4418
4449
|
...result.plan.targetManifest,
|
|
4419
|
-
files: result.plan.targetManifest.files.map((entry) =>
|
|
4450
|
+
files: result.plan.targetManifest.files.map((entry) => ({
|
|
4451
|
+
...entry,
|
|
4452
|
+
hash: refreshedHashes.get(entry.path) ?? entry.hash
|
|
4453
|
+
}))
|
|
4420
4454
|
};
|
|
4421
4455
|
await writeFile11(join15(root, ".windy/files.json"), `${JSON.stringify(targetManifest, null, 2)}
|
|
4422
4456
|
`);
|
package/package.json
CHANGED