@stacksjs/buddy 0.70.92 → 0.70.93
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.
|
@@ -18,6 +18,14 @@ export declare function migrationTable(filename: string): string | null;
|
|
|
18
18
|
* always runs). Used by the migration runner's gating pass.
|
|
19
19
|
*/
|
|
20
20
|
export declare function migrationFeature(filename: string): FeatureName | null;
|
|
21
|
+
/**
|
|
22
|
+
* True when an application-owned, top-level model explicitly declares a table.
|
|
23
|
+
* This lets apps intentionally use generic names such as `payments` without
|
|
24
|
+
* their migrations being mistaken for disabled framework-feature scaffolding.
|
|
25
|
+
* Root models listed in FEATURE_FILES remain feature-owned and do not override
|
|
26
|
+
* the gate.
|
|
27
|
+
*/
|
|
28
|
+
export declare function appModelClaimsTable(table: string, root?: string): boolean;
|
|
21
29
|
/**
|
|
22
30
|
* Returns the subset of a feature's manifest paths that currently exist
|
|
23
31
|
* on disk under `root` (defaults to `projectPath()`). Used by both the
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
1
|
+
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
2
2
|
import { cp, rm } from "node:fs/promises";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import process from "node:process";
|
|
@@ -149,6 +149,21 @@ export function migrationFeature(filename) {
|
|
|
149
149
|
return f;
|
|
150
150
|
return null;
|
|
151
151
|
}
|
|
152
|
+
export function appModelClaimsTable(table, root = projectPath()) {
|
|
153
|
+
const modelsDir = join(root, "app/Models");
|
|
154
|
+
if (!existsSync(modelsDir))
|
|
155
|
+
return !1;
|
|
156
|
+
const featureModelFiles = new Set(FEATURE_NAMES.flatMap((feature) => FEATURE_FILES[feature]).filter((path) => path.startsWith("app/Models/") && !path.endsWith("/"))), escaped = table.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), declaration = new RegExp(`\\btable\\s*:\\s*['"]${escaped}['"]`);
|
|
157
|
+
for (const entry of readdirSync(modelsDir, { withFileTypes: !0 })) {
|
|
158
|
+
if (!entry.isFile() || !/\.[cm]?[jt]s$/.test(entry.name))
|
|
159
|
+
continue;
|
|
160
|
+
if (featureModelFiles.has(`app/Models/${entry.name}`))
|
|
161
|
+
continue;
|
|
162
|
+
if (declaration.test(readFileSync(join(modelsDir, entry.name), "utf8")))
|
|
163
|
+
return !0;
|
|
164
|
+
}
|
|
165
|
+
return !1;
|
|
166
|
+
}
|
|
152
167
|
export function featurePathsPresent(feature, root = projectPath()) {
|
|
153
168
|
return FEATURE_FILES[feature].filter((rel) => existsSync(`${root}/${rel}`));
|
|
154
169
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/buddy",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.70.
|
|
5
|
+
"version": "0.70.93",
|
|
6
6
|
"description": "Meet Buddy. The Stacks runtime.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -75,13 +75,13 @@
|
|
|
75
75
|
"scripts": {
|
|
76
76
|
"buddy": "bunx --bun ./src/cli.ts",
|
|
77
77
|
"build": "bun build.ts",
|
|
78
|
-
"compile": "bun build ./src/cli.ts --compile --minify --sourcemap --external=localtunnels/cloud --external=bun-queue --outfile dist/buddy",
|
|
78
|
+
"compile": "bun build ./src/cli.ts --compile --minify --sourcemap --external=localtunnels/cloud --external=bun-queue --external=@stacksjs/bun-queue --outfile dist/buddy",
|
|
79
79
|
"compile:all": "bun run compile:linux-x64 && bun run compile:linux-arm64 && bun run compile:windows-x64 && bun run compile:darwin-x64 && bun run compile:darwin-arm64",
|
|
80
|
-
"compile:linux-x64": "bun build ./src/cli.ts --compile --minify --target=bun-linux-x64 --external=localtunnels/cloud --external=bun-queue --outfile bin/buddy-linux-x64",
|
|
81
|
-
"compile:linux-arm64": "bun build ./src/cli.ts --compile --minify --target=bun-linux-arm64 --external=localtunnels/cloud --external=bun-queue --outfile bin/buddy-linux-arm64",
|
|
82
|
-
"compile:windows-x64": "bun build ./src/cli.ts --compile --minify --target=bun-windows-x64 --external=localtunnels/cloud --external=bun-queue --outfile bin/buddy-windows-x64.exe",
|
|
83
|
-
"compile:darwin-x64": "bun build ./src/cli.ts --compile --minify --target=bun-darwin-x64 --external=localtunnels/cloud --external=bun-queue --outfile bin/buddy-darwin-x64",
|
|
84
|
-
"compile:darwin-arm64": "bun build ./src/cli.ts --compile --minify --target=bun-darwin-arm64 --external=localtunnels/cloud --external=bun-queue --outfile bin/buddy-darwin-arm64",
|
|
80
|
+
"compile:linux-x64": "bun build ./src/cli.ts --compile --minify --target=bun-linux-x64 --external=localtunnels/cloud --external=bun-queue --external=@stacksjs/bun-queue --outfile bin/buddy-linux-x64",
|
|
81
|
+
"compile:linux-arm64": "bun build ./src/cli.ts --compile --minify --target=bun-linux-arm64 --external=localtunnels/cloud --external=bun-queue --external=@stacksjs/bun-queue --outfile bin/buddy-linux-arm64",
|
|
82
|
+
"compile:windows-x64": "bun build ./src/cli.ts --compile --minify --target=bun-windows-x64 --external=localtunnels/cloud --external=bun-queue --external=@stacksjs/bun-queue --outfile bin/buddy-windows-x64.exe",
|
|
83
|
+
"compile:darwin-x64": "bun build ./src/cli.ts --compile --minify --target=bun-darwin-x64 --external=localtunnels/cloud --external=bun-queue --external=@stacksjs/bun-queue --outfile bin/buddy-darwin-x64",
|
|
84
|
+
"compile:darwin-arm64": "bun build ./src/cli.ts --compile --minify --target=bun-darwin-arm64 --external=localtunnels/cloud --external=bun-queue --external=@stacksjs/bun-queue --outfile bin/buddy-darwin-arm64",
|
|
85
85
|
"typecheck": "bun tsc --noEmit",
|
|
86
86
|
"zip:all": "bun run zip:linux-x64 && bun run zip:linux-arm64 && bun run zip:windows-x64 && bun run zip:darwin-x64 && bun run zip:darwin-arm64",
|
|
87
87
|
"zip:linux-x64": "zip -j bin/buddy-linux-x64.zip bin/buddy-linux-x64",
|