@junejs/server 0.0.15 → 0.0.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/package.json +3 -3
- package/src/index.ts +1 -0
- package/src/migrate.ts +18 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@junejs/server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "June host adapters + dev server. Host-coupled; depends on the pure @junejs/core contract layer.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"typecheck": "tsc --noEmit"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@junejs/core": "0.0.
|
|
34
|
-
"@junejs/db": "0.0.
|
|
33
|
+
"@junejs/core": "0.0.16",
|
|
34
|
+
"@junejs/db": "0.0.16",
|
|
35
35
|
"marked": "^18.0.5",
|
|
36
36
|
"rolldown": "^1.1.0",
|
|
37
37
|
"postcss": "^8.4.0",
|
package/src/index.ts
CHANGED
package/src/migrate.ts
CHANGED
|
@@ -112,6 +112,24 @@ export async function migrateApp(
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
// `june db types`: open the declared db, bring it to head (safe migrations only, so
|
|
116
|
+
// the schema is present even on a fresh checkout), then hand it to the data layer's
|
|
117
|
+
// codegen hook for the type-declaration text. Returns null when there's no db or the
|
|
118
|
+
// data layer doesn't generate types — the CLI owns the messaging. Introspection is
|
|
119
|
+
// read-only; the safe migrate is idempotent (the ledger skips applied ones).
|
|
120
|
+
export async function typesApp(root: string, config: JuneConfig): Promise<string | null> {
|
|
121
|
+
const factory = config.resources?.db;
|
|
122
|
+
const emit = config.dataLayer?.emitTypes;
|
|
123
|
+
if (!factory || !emit) return null;
|
|
124
|
+
const db = await factory.open();
|
|
125
|
+
try {
|
|
126
|
+
await migrate(db, join(root, "db", "migrations"), { allowDestructive: false });
|
|
127
|
+
return await emit(db);
|
|
128
|
+
} finally {
|
|
129
|
+
await db.close();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
115
133
|
// The "this migration was gated" guidance, shared by dev (warns, keeps serving)
|
|
116
134
|
// and `june db migrate` (exits non-zero).
|
|
117
135
|
export function blockedMessage(m: ClassifiedMigration): string {
|