@suluk/platform 0.1.0 → 0.1.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/package.json +1 -1
- package/src/catalog.ts +6 -1
- package/test/plan.test.ts +20 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suluk/platform",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "The platform generator (C051): write one `definePlatform` manifest → it plans the shadcn-registry adds, generates the wired Hono entry, and merges each module's provision fragment into a single provision.config. The manifest compiles to a shadcn-add list + a C047 provision.config; the generator runs the adds + `@suluk/provision`. Turns the Suluk backend registry into a one-command platform. CANDIDATE tooling.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
package/src/catalog.ts
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
export type Mount =
|
|
9
9
|
| { kind: "base" } // the app skeleton — `createApp()`
|
|
10
10
|
| { kind: "middleware"; symbol: string; from: string } // e.g. `mountAuthRoutes(app)`
|
|
11
|
-
| { kind: "route"; path: string; symbol: string; from: string }
|
|
11
|
+
| { kind: "route"; path: string; symbol: string; from: string } // e.g. `app.route("/credits", creditsRoutes())`
|
|
12
|
+
| { kind: "dev" }; // dev/CI tooling (journeys, audit) — files only, no runtime mount, no provision fragment
|
|
12
13
|
|
|
13
14
|
export interface CatalogEntry {
|
|
14
15
|
/** how it mounts into the entry. */
|
|
@@ -23,7 +24,11 @@ export const CATALOG: Record<string, CatalogEntry> = {
|
|
|
23
24
|
credits: { mount: { kind: "route", path: "/credits", symbol: "creditsRoutes", from: "./routes/credits" }, provision: { symbol: "creditsProvision", from: "./src/provision/credits" } },
|
|
24
25
|
keys: { mount: { kind: "route", path: "/keys", symbol: "keysRoutes", from: "./routes/keys" }, provision: { symbol: "keysProvision", from: "./src/provision/keys" } },
|
|
25
26
|
billing: { mount: { kind: "route", path: "/billing", symbol: "billingRoutes", from: "./routes/billing" }, provision: { symbol: "billingProvision", from: "./src/provision/billing" } },
|
|
27
|
+
cost: { mount: { kind: "route", path: "/cost", symbol: "costRoutes", from: "./routes/cost" }, provision: { symbol: "costProvision", from: "./src/provision/cost" } },
|
|
26
28
|
logs: { mount: { kind: "route", path: "/logs", symbol: "logsRoutes", from: "./routes/logs" }, provision: { symbol: "logsProvision", from: "./src/provision/logs" } },
|
|
29
|
+
// dev/CI tooling — pulled in as files, no runtime mount, no provision fragment.
|
|
30
|
+
journeys: { mount: { kind: "dev" } },
|
|
31
|
+
audit: { mount: { kind: "dev" } },
|
|
27
32
|
};
|
|
28
33
|
|
|
29
34
|
/** app + auth always come first (the base + the user/apikey tables others reference); the rest keep manifest order. */
|
package/test/plan.test.ts
CHANGED
|
@@ -37,6 +37,26 @@ describe("planPlatform — manifest → shadcn adds + entry + provision.config",
|
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
+
describe("cost (route + provision) + dev modules (journeys/audit — files only)", () => {
|
|
41
|
+
const plan = planPlatform(definePlatform({ name: "full", registry: "acme/reg", services: ["auth", "credits", "cost", "logs", "journeys", "audit"] }));
|
|
42
|
+
|
|
43
|
+
test("cost mounts a /cost route and contributes a provision fragment", () => {
|
|
44
|
+
expect(plan.entry).toContain('import { costRoutes } from "./routes/cost";');
|
|
45
|
+
expect(plan.entry).toContain('app.route("/cost", costRoutes());');
|
|
46
|
+
expect(plan.provisionConfig).toContain('import { costProvision } from "./src/provision/cost";');
|
|
47
|
+
expect(plan.provisionConfig).toContain("mergeProvision([authProvision, creditsProvision, costProvision, logsProvision])");
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test("dev modules add shadcn refs but NO entry mount and NO provision fragment", () => {
|
|
51
|
+
expect(plan.adds).toContain("acme/reg/journeys");
|
|
52
|
+
expect(plan.adds).toContain("acme/reg/audit");
|
|
53
|
+
expect(plan.entry).not.toContain("journeys");
|
|
54
|
+
expect(plan.entry).not.toContain("audit");
|
|
55
|
+
expect(plan.provisionConfig).not.toContain("journeys");
|
|
56
|
+
expect(plan.provisionConfig).not.toContain("audit");
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
40
60
|
describe("mergeProvision — combine same-ref instances, union migrations in order", () => {
|
|
41
61
|
test("two `db` fragments merge into one with both migrations (fragment order preserved)", () => {
|
|
42
62
|
const auth: InstanceSpec[] = [{ ref: "db", service: "cloudflare-d1", name: "app-db", params: { migrations: [{ name: "0000_auth", sql: "A" }] }, bind: { database_id: "ID" }, protected: true }];
|