create-basalt 1.15.0 → 1.16.0
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/bin-template.d.ts +6 -2
- package/dist/bin-template.js +45 -3
- package/dist/project/doctor.js +1 -1
- package/dist/project/update.js +2 -2
- package/dist/versions.js +3 -3
- package/package.json +10 -10
package/dist/bin-template.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export declare const PROJECT_COMMANDS_MARKER = "['update', 'add', 'doctor', 'inf
|
|
|
4
4
|
export declare const DEV_PRELUDE_MARKER = "process.loadEnvFile(envFile)";
|
|
5
5
|
/** Marker proving a bin/basalt.ts already runs the generators without booting the app. */
|
|
6
6
|
export declare const GENERATORS_PRELUDE_MARKER = "process.argv[2]?.startsWith('make:')";
|
|
7
|
+
/** Marker proving a bin/basalt.ts already starts `dev` without booting the app. */
|
|
8
|
+
export declare const DEV_SERVER_PRELUDE_MARKER = "if (process.argv[2] === 'dev')";
|
|
7
9
|
export declare function basaltBin(): string;
|
|
8
10
|
/**
|
|
9
11
|
* Hashes of every bin/basalt.ts an earlier create-basalt release generated
|
|
@@ -14,6 +16,7 @@ export declare const LEGACY_BIN_HASHES: ReadonlySet<string>;
|
|
|
14
16
|
export declare const hasProjectCommands: (content: string) => boolean;
|
|
15
17
|
export declare const hasDevPrelude: (content: string) => boolean;
|
|
16
18
|
export declare const hasGeneratorsPrelude: (content: string) => boolean;
|
|
19
|
+
export declare const hasDevServerPrelude: (content: string) => boolean;
|
|
17
20
|
/**
|
|
18
21
|
* Upgrades a template-generated bin/basalt.ts to the current template, step by
|
|
19
22
|
* step: (1) without the project commands, inserts their prelude after the
|
|
@@ -21,8 +24,9 @@ export declare const hasGeneratorsPrelude: (content: string) => boolean;
|
|
|
21
24
|
* longer run before it); (2) without the dev prelude, inserts it right after
|
|
22
25
|
* the project commands and routes the app import through `explainBootFailure`;
|
|
23
26
|
* (3) without the generators prelude, inserts it right before the dev tools
|
|
24
|
-
* are imported for the booted CLI
|
|
25
|
-
*
|
|
27
|
+
* are imported for the booted CLI; (4) without the dev server prelude, inserts
|
|
28
|
+
* it at the same place, after the generators prelude.
|
|
29
|
+
* Deterministic for the known templates — for the latest ones (1.9 to 1.15) the
|
|
26
30
|
* result is exactly {@link basaltBin}.
|
|
27
31
|
*/
|
|
28
32
|
export declare function patchBasaltBin(content: string): string;
|
package/dist/bin-template.js
CHANGED
|
@@ -197,12 +197,31 @@ if (process.argv[2]?.startsWith('make:')) {
|
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
`;
|
|
200
|
+
/**
|
|
201
|
+
* The DEV SERVER PRELUDE, after the generators prelude and still before
|
|
202
|
+
* anything of the app is imported: `basalt dev` must start while the app
|
|
203
|
+
* cannot boot (a variable missing, the database down, code mid-edit) — that
|
|
204
|
+
* is when a watcher is needed. `runDev` boots the app only for the route
|
|
205
|
+
* table, prints why when it does not, and starts the watcher either way.
|
|
206
|
+
*/
|
|
207
|
+
const DEV_SERVER_PRELUDE = `// \`dev\` starts the watcher even while the app cannot boot (database down, a
|
|
208
|
+
// variable missing, code mid-edit): the route table is printed when it boots.
|
|
209
|
+
if (process.argv[2] === 'dev') {
|
|
210
|
+
const { runDev } = await import('@basaltkit/cli')
|
|
211
|
+
process.env['NODE_ENV'] ??= 'development'
|
|
212
|
+
process.exit(await runDev({
|
|
213
|
+
loadApp: async () => (await import('../src/app.js')).buildApp({ logLevel: 'silent' }),
|
|
214
|
+
}))
|
|
215
|
+
}
|
|
216
|
+
`;
|
|
200
217
|
/** Marker proving a bin/basalt.ts already delegates the project commands. */
|
|
201
218
|
export const PROJECT_COMMANDS_MARKER = "['update', 'add', 'doctor', 'info'].includes(process.argv[2]";
|
|
202
219
|
/** Marker proving a bin/basalt.ts already has the dev prelude (.env loading, `upgrade`, env errors). */
|
|
203
220
|
export const DEV_PRELUDE_MARKER = 'process.loadEnvFile(envFile)';
|
|
204
221
|
/** Marker proving a bin/basalt.ts already runs the generators without booting the app. */
|
|
205
222
|
export const GENERATORS_PRELUDE_MARKER = "process.argv[2]?.startsWith('make:')";
|
|
223
|
+
/** Marker proving a bin/basalt.ts already starts `dev` without booting the app. */
|
|
224
|
+
export const DEV_SERVER_PRELUDE_MARKER = "if (process.argv[2] === 'dev')";
|
|
206
225
|
const APP_IMPORT = "await import('../src/app.js')";
|
|
207
226
|
const APP_IMPORT_EXPLAINED = `${APP_IMPORT}.catch(explainBootFailure)`;
|
|
208
227
|
const RUN_CLI = 'process.exit(await runCli({ app })';
|
|
@@ -211,6 +230,7 @@ export function basaltBin() {
|
|
|
211
230
|
${PRELUDE}
|
|
212
231
|
${DEV_PRELUDE}
|
|
213
232
|
${GENERATORS_PRELUDE}
|
|
233
|
+
${DEV_SERVER_PRELUDE}
|
|
214
234
|
// The dev tools are imported dynamically, after the project commands above.
|
|
215
235
|
const { runCli } = await import('@basaltkit/cli')
|
|
216
236
|
const { generatorCommands } = await import('@basaltkit/generator')
|
|
@@ -259,10 +279,14 @@ export const LEGACY_BIN_HASHES = new Set([
|
|
|
259
279
|
'sha256-bd0b6c9c40089a18c2c2f1a70953044d6a74a329d38a72903b494b1f2265a114',
|
|
260
280
|
// 2026-10-08: database diagnoses in explainBootFailure — make:* still booted.
|
|
261
281
|
'sha256-abea8cbfdb41a302cabad7929617f7fc2fe822345aa8db6ff777e923eb0fc96b',
|
|
282
|
+
// 2026-10-25 (create-basalt ≤ 1.15): make:* without a boot — but `dev`
|
|
283
|
+
// booted the app first, so it did not start while the app could not boot.
|
|
284
|
+
'sha256-5c2cf3f431399b961de890af457c7be5f9a0cb810cd96d6bdf080ac942e33f1b',
|
|
262
285
|
]);
|
|
263
286
|
export const hasProjectCommands = (content) => content.includes(PROJECT_COMMANDS_MARKER);
|
|
264
287
|
export const hasDevPrelude = (content) => content.includes(DEV_PRELUDE_MARKER);
|
|
265
288
|
export const hasGeneratorsPrelude = (content) => content.includes(GENERATORS_PRELUDE_MARKER);
|
|
289
|
+
export const hasDevServerPrelude = (content) => content.includes(DEV_SERVER_PRELUDE_MARKER);
|
|
266
290
|
/**
|
|
267
291
|
* Upgrades a template-generated bin/basalt.ts to the current template, step by
|
|
268
292
|
* step: (1) without the project commands, inserts their prelude after the
|
|
@@ -270,8 +294,9 @@ export const hasGeneratorsPrelude = (content) => content.includes(GENERATORS_PRE
|
|
|
270
294
|
* longer run before it); (2) without the dev prelude, inserts it right after
|
|
271
295
|
* the project commands and routes the app import through `explainBootFailure`;
|
|
272
296
|
* (3) without the generators prelude, inserts it right before the dev tools
|
|
273
|
-
* are imported for the booted CLI
|
|
274
|
-
*
|
|
297
|
+
* are imported for the booted CLI; (4) without the dev server prelude, inserts
|
|
298
|
+
* it at the same place, after the generators prelude.
|
|
299
|
+
* Deterministic for the known templates — for the latest ones (1.9 to 1.15) the
|
|
275
300
|
* result is exactly {@link basaltBin}.
|
|
276
301
|
*/
|
|
277
302
|
export function patchBasaltBin(content) {
|
|
@@ -282,6 +307,8 @@ export function patchBasaltBin(content) {
|
|
|
282
307
|
text = addDevPrelude(text);
|
|
283
308
|
if (!hasGeneratorsPrelude(text))
|
|
284
309
|
text = addGeneratorsPrelude(text);
|
|
310
|
+
if (!hasDevServerPrelude(text))
|
|
311
|
+
text = addDevServerPrelude(text);
|
|
285
312
|
return text;
|
|
286
313
|
}
|
|
287
314
|
function addProjectCommands(content) {
|
|
@@ -317,11 +344,19 @@ function addGeneratorsPrelude(content) {
|
|
|
317
344
|
return content;
|
|
318
345
|
return `${content.slice(0, anchor.index)}${GENERATORS_PRELUDE}\n${content.slice(anchor.index)}`;
|
|
319
346
|
}
|
|
347
|
+
/** Inserts the dev server prelude right before the dev tools are imported for the booted CLI (after the generators prelude). */
|
|
348
|
+
function addDevServerPrelude(content) {
|
|
349
|
+
const anchor = /^(?:\/\/ The dev tools are imported dynamically[^\n]*\n)?const \{ runCli \} = await import\('@basaltkit\/cli'\)$/m.exec(content);
|
|
350
|
+
// Without the template's dynamic CLI import, the file is not ours to rearrange.
|
|
351
|
+
if (!anchor || !hasGeneratorsPrelude(content))
|
|
352
|
+
return content;
|
|
353
|
+
return `${content.slice(0, anchor.index)}${DEV_SERVER_PRELUDE}\n${content.slice(anchor.index)}`;
|
|
354
|
+
}
|
|
320
355
|
/** Where a bin/basalt.ts stands: already current, an untouched old template, or user code. */
|
|
321
356
|
export function binStatus(content, manifestHash) {
|
|
322
357
|
if (content === undefined)
|
|
323
358
|
return 'absent';
|
|
324
|
-
if (hasProjectCommands(content) && hasDevPrelude(content) && hasGeneratorsPrelude(content))
|
|
359
|
+
if (hasProjectCommands(content) && hasDevPrelude(content) && hasGeneratorsPrelude(content) && hasDevServerPrelude(content))
|
|
325
360
|
return 'current';
|
|
326
361
|
const hash = hashContent(content);
|
|
327
362
|
return LEGACY_BIN_HASHES.has(hash) || hash === manifestHash ? 'patchable' : 'modified';
|
|
@@ -351,6 +386,13 @@ booted CLI) — it runs the make:* generators without booting the app, so they
|
|
|
351
386
|
work before the database is up or migrated:
|
|
352
387
|
|
|
353
388
|
${GENERATORS_PRELUDE}`);
|
|
389
|
+
}
|
|
390
|
+
if (!hasDevServerPrelude(content)) {
|
|
391
|
+
steps.push(`${steps.length > 0 ? 'Then paste' : 'Paste'} this after the generators prelude (before the dev tools are imported for
|
|
392
|
+
the booted CLI) — \`basalt dev\` then starts its watcher even while the app cannot
|
|
393
|
+
boot (database down, a variable missing):
|
|
394
|
+
|
|
395
|
+
${DEV_SERVER_PRELUDE}`);
|
|
354
396
|
}
|
|
355
397
|
return steps.join('\n');
|
|
356
398
|
}
|
package/dist/project/doctor.js
CHANGED
|
@@ -382,7 +382,7 @@ export async function runDoctor(ctx, options = {}) {
|
|
|
382
382
|
const bin = await readText(join(dir, 'bin', 'basalt.ts'));
|
|
383
383
|
const status = binStatus(bin, ctx.manifest?.files['bin/basalt.ts']);
|
|
384
384
|
if (status === 'patchable') {
|
|
385
|
-
push('warn', 'tooling', 'bin/basalt.ts is an older template (it lacks some of: .env loading, pre-boot project commands, make:* without booting the app) — `npx create-basalt@latest update` patches it.');
|
|
385
|
+
push('warn', 'tooling', 'bin/basalt.ts is an older template (it lacks some of: .env loading, pre-boot project commands, make:* and dev without booting the app) — `npx create-basalt@latest update` patches it.');
|
|
386
386
|
}
|
|
387
387
|
if (status === 'modified') {
|
|
388
388
|
push('info', 'tooling', 'bin/basalt.ts is customised and lacks the current preludes (project commands, .env loading, pre-boot `upgrade` and make:*) — see `create-basalt update` for the snippet.');
|
package/dist/project/update.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
-
import { binStatus, hasDevPrelude, hasProjectCommands, manualBinSnippet, patchBasaltBin } from '../bin-template.js';
|
|
3
|
+
import { binStatus, hasDevPrelude, hasGeneratorsPrelude, hasProjectCommands, manualBinSnippet, patchBasaltBin } from '../bin-template.js';
|
|
4
4
|
import { devEntryStatus, MANUAL_DEV_SNIPPET, patchDevEntry, patchEnvExample } from '../dev-entry.js';
|
|
5
5
|
import { alwaysLatest, lookupLatestVersions, minimumReleaseAgeMinutes, } from '../latest-versions.js';
|
|
6
6
|
import { BASALT_PROJECT_SCRIPT } from '../templates.js';
|
|
@@ -207,7 +207,7 @@ export async function planUpdate(ctx, options = {}) {
|
|
|
207
207
|
const after = patchBasaltBin(bin);
|
|
208
208
|
files['bin/basalt.ts'] = { before: bin, after };
|
|
209
209
|
patched['bin/basalt.ts'] = after;
|
|
210
|
-
toolingNotes.push(`bin/basalt.ts: unmodified template from an earlier release — ${hasProjectCommands(bin) ? '' : 'gains update/add/doctor/info; '}${hasDevPrelude(bin) ? '' : 'loads .env for development, runs \`upgrade\` without booting the app, explains env errors; '}runs make:* without booting the app (no database needed to generate code)`);
|
|
210
|
+
toolingNotes.push(`bin/basalt.ts: unmodified template from an earlier release — ${hasProjectCommands(bin) ? '' : 'gains update/add/doctor/info; '}${hasDevPrelude(bin) ? '' : 'loads .env for development, runs \`upgrade\` without booting the app, explains env errors; '}${hasGeneratorsPrelude(bin) ? '' : 'runs make:* without booting the app (no database needed to generate code); '}starts \`basalt dev\` even while the app cannot boot (the route table when it does)`);
|
|
211
211
|
}
|
|
212
212
|
else if (status === 'modified' && bin !== undefined) {
|
|
213
213
|
manual.push(`bin/basalt.ts was customised, so it was not patched. To bring it up to date:\n${manualBinSnippet(bin)}`);
|
package/dist/versions.js
CHANGED
|
@@ -8,10 +8,10 @@ export const SCAFFOLD_VERSIONS = {
|
|
|
8
8
|
'@basaltkit/ai-mcp': '^0.4.0',
|
|
9
9
|
'@basaltkit/auth': '^5.0.0',
|
|
10
10
|
'@basaltkit/auth-prisma': '^3.0.0',
|
|
11
|
-
'@basaltkit/cli': '^1.
|
|
11
|
+
'@basaltkit/cli': '^1.6.0',
|
|
12
12
|
'@basaltkit/config': '^1.1.2',
|
|
13
13
|
'@basaltkit/core': '^1.6.0',
|
|
14
|
-
'@basaltkit/deploy': '^0.10.
|
|
14
|
+
'@basaltkit/deploy': '^0.10.1',
|
|
15
15
|
'@basaltkit/env': '^3.1.1',
|
|
16
16
|
'@basaltkit/events': '^1.3.0',
|
|
17
17
|
'@basaltkit/fastify': '^3.0.0',
|
|
@@ -28,5 +28,5 @@ export const SCAFFOLD_VERSIONS = {
|
|
|
28
28
|
'@basaltkit/tenancy': '^4.0.0',
|
|
29
29
|
'@basaltkit/tenancy-prisma': '^3.0.0',
|
|
30
30
|
'@basaltkit/testing': '^3.0.0',
|
|
31
|
-
'create-basalt': '^1.
|
|
31
|
+
'create-basalt': '^1.16.0',
|
|
32
32
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-basalt",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=22.5.0"
|
|
6
6
|
},
|
|
@@ -32,27 +32,27 @@
|
|
|
32
32
|
"typescript": "^7.0.2",
|
|
33
33
|
"vitest": "^5.0.5",
|
|
34
34
|
"zod": "^4.6.7",
|
|
35
|
-
"@basaltkit/auth": "^5.0.0",
|
|
36
35
|
"@basaltkit/auth-prisma": "^3.0.0",
|
|
37
|
-
"@basaltkit/cli": "^1.4.2",
|
|
38
36
|
"@basaltkit/config": "^1.1.2",
|
|
37
|
+
"@basaltkit/auth": "^5.0.0",
|
|
39
38
|
"@basaltkit/core": "^1.6.0",
|
|
40
|
-
"@basaltkit/
|
|
39
|
+
"@basaltkit/cli": "^1.6.0",
|
|
40
|
+
"@basaltkit/deploy": "^0.10.1",
|
|
41
41
|
"@basaltkit/env": "^3.1.1",
|
|
42
|
-
"@basaltkit/deploy": "^0.10.0",
|
|
43
42
|
"@basaltkit/fastify": "^3.0.0",
|
|
44
|
-
"@basaltkit/
|
|
43
|
+
"@basaltkit/events": "^1.3.0",
|
|
45
44
|
"@basaltkit/logger": "^1.3.0",
|
|
46
|
-
"@basaltkit/generator": "^1.7.0",
|
|
47
|
-
"@basaltkit/subscriptions": "^6.0.0",
|
|
48
45
|
"@basaltkit/mcp": "^6.0.0",
|
|
46
|
+
"@basaltkit/subscriptions": "^6.0.0",
|
|
49
47
|
"@basaltkit/subscriptions-prisma": "^4.0.0",
|
|
48
|
+
"@basaltkit/teams": "^4.1.1",
|
|
49
|
+
"@basaltkit/prisma": "^4.1.1",
|
|
50
50
|
"@basaltkit/teams-prisma": "^1.1.0",
|
|
51
51
|
"@basaltkit/tenancy": "^4.0.0",
|
|
52
52
|
"@basaltkit/tenancy-prisma": "^3.0.0",
|
|
53
|
-
"@basaltkit/
|
|
53
|
+
"@basaltkit/generator": "^1.7.0",
|
|
54
54
|
"@basaltkit/testing": "^3.0.0",
|
|
55
|
-
"@basaltkit/
|
|
55
|
+
"@basaltkit/tsconfig": "^0.24.0"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|