create-windy 0.5.0 → 0.5.1
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 +34 -4
- package/package.json +1 -1
- package/template/.windy-template.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -2661,16 +2661,27 @@ async function pruneDatabaseArtifacts(root, tableNames, statementTokens) {
|
|
|
2661
2661
|
for (const path of await collectFiles2(drizzleRoot)) {
|
|
2662
2662
|
if (path.endsWith(".sql")) {
|
|
2663
2663
|
const source = await readFile6(path, "utf8");
|
|
2664
|
-
const statements = source.split("--> statement-breakpoint").map((statement) => statement.trim()).filter(Boolean)
|
|
2665
|
-
|
|
2664
|
+
const statements = source.split("--> statement-breakpoint").map((statement) => statement.trim()).filter(Boolean);
|
|
2665
|
+
const retained = statements.filter((statement) => !tablePatterns.some((pattern) => pattern.test(statement)) && !statementTokens.some((token) => statement.includes(token)));
|
|
2666
|
+
if (retained.length === statements.length)
|
|
2667
|
+
continue;
|
|
2668
|
+
await writeFile5(path, retained.length ? `${retained.join(`
|
|
2666
2669
|
--> statement-breakpoint
|
|
2667
2670
|
`)}
|
|
2668
2671
|
` : `-- \u6B64 migration \u7684\u6A21\u5757\u672A\u88AB\u5F53\u524D\u9879\u76EE\u9009\u62E9\u3002
|
|
2669
2672
|
`);
|
|
2670
2673
|
} else if (path.endsWith("_snapshot.json")) {
|
|
2671
2674
|
const snapshot = JSON.parse(await readFile6(path, "utf8"));
|
|
2672
|
-
|
|
2673
|
-
|
|
2675
|
+
let changed = false;
|
|
2676
|
+
for (const name of tableNames) {
|
|
2677
|
+
const key = `public.${name}`;
|
|
2678
|
+
if (!Object.hasOwn(snapshot.tables ?? {}, key))
|
|
2679
|
+
continue;
|
|
2680
|
+
delete snapshot.tables?.[key];
|
|
2681
|
+
changed = true;
|
|
2682
|
+
}
|
|
2683
|
+
if (!changed)
|
|
2684
|
+
continue;
|
|
2674
2685
|
await writeFile5(path, `${JSON.stringify(snapshot, null, 2)}
|
|
2675
2686
|
`);
|
|
2676
2687
|
}
|
|
@@ -7558,6 +7569,11 @@ var recipes = [
|
|
|
7558
7569
|
id: "starter-0.4.1-to-0.5.0",
|
|
7559
7570
|
from: "0.4.1",
|
|
7560
7571
|
to: "0.5.0"
|
|
7572
|
+
},
|
|
7573
|
+
{
|
|
7574
|
+
id: "starter-0.5.0-to-0.5.1",
|
|
7575
|
+
from: "0.5.0",
|
|
7576
|
+
to: "0.5.1"
|
|
7561
7577
|
}
|
|
7562
7578
|
];
|
|
7563
7579
|
function resolveRecipeChain(sourceVersion, targetVersion) {
|
|
@@ -8634,6 +8650,11 @@ function mergeValue(base, ours, theirs, path2, conflicts) {
|
|
|
8634
8650
|
return theirs;
|
|
8635
8651
|
if (equal(theirs, base))
|
|
8636
8652
|
return ours;
|
|
8653
|
+
if (path2 === "package.json.files") {
|
|
8654
|
+
const files = mergeAppendOnlyStringSet(base, ours, theirs);
|
|
8655
|
+
if (files)
|
|
8656
|
+
return files;
|
|
8657
|
+
}
|
|
8637
8658
|
if (isObject(base) && isObject(ours) && isObject(theirs)) {
|
|
8638
8659
|
const output = {};
|
|
8639
8660
|
const keys = new Set([
|
|
@@ -8654,6 +8675,15 @@ function mergeValue(base, ours, theirs, path2, conflicts) {
|
|
|
8654
8675
|
function equal(left, right) {
|
|
8655
8676
|
return JSON.stringify(left) === JSON.stringify(right);
|
|
8656
8677
|
}
|
|
8678
|
+
function mergeAppendOnlyStringSet(base, ours, theirs) {
|
|
8679
|
+
if (!isStringArray(base) || !isStringArray(ours) || !isStringArray(theirs) || !base.every((value) => ours.includes(value) && theirs.includes(value))) {
|
|
8680
|
+
return;
|
|
8681
|
+
}
|
|
8682
|
+
return [...new Set([...ours, ...theirs])].sort();
|
|
8683
|
+
}
|
|
8684
|
+
function isStringArray(value) {
|
|
8685
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
8686
|
+
}
|
|
8657
8687
|
function isObject(value) {
|
|
8658
8688
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
8659
8689
|
}
|
package/package.json
CHANGED