create-mantiq 0.5.18 → 0.5.19

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-mantiq",
3
- "version": "0.5.18",
3
+ "version": "0.5.19",
4
4
  "description": "Scaffold a new MantiqJS application",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -0,0 +1,33 @@
1
+ export default {
2
+
3
+ /*
4
+ |--------------------------------------------------------------------------
5
+ | React Fast Refresh
6
+ |--------------------------------------------------------------------------
7
+ |
8
+ | Injects the React Refresh preamble into dev mode HTML so that HMR
9
+ | works correctly. Required for React — without it, components throw
10
+ | "can't detect preamble" and the page renders blank.
11
+ |
12
+ | Set to false for Vue/Svelte (they don't need this preamble).
13
+ |
14
+ */
15
+ reactRefresh: false,
16
+
17
+ /*
18
+ |--------------------------------------------------------------------------
19
+ | Server-Side Rendering
20
+ |--------------------------------------------------------------------------
21
+ |
22
+ | SSR renders pages on the server so users see content immediately
23
+ | instead of a blank shell. The entry file exports a render() function.
24
+ |
25
+ | In dev: Vite's ssrLoadModule() loads the entry with HMR.
26
+ | In prod: the pre-built bundle at bootstrap/ssr/ is used.
27
+ |
28
+ */
29
+ // ssr: {
30
+ // entry: 'src/ssr.tsx',
31
+ // bundle: 'bootstrap/ssr/ssr.js',
32
+ // },
33
+ }
package/src/index.ts CHANGED
@@ -167,15 +167,24 @@ if (kit) {
167
167
  }
168
168
  }
169
169
 
170
- // Shared stubs (routes, controllers, seeder — overwrites skeleton routes)
170
+ // Shared stubs (routes, controllers, config — overwrites skeleton versions)
171
171
  if (sharedManifest?.files) {
172
- const mainEntry = kitManifest?.mainEntry ?? 'src/main.ts'
172
+ // Build placeholder map from manifest
173
+ const placeholders: Record<string, string> = {}
174
+ if (sharedManifest.placeholders) {
175
+ for (const [key, values] of Object.entries(sharedManifest.placeholders)) {
176
+ placeholders[key] = (values as Record<string, string>)[kit!] ?? ''
177
+ }
178
+ }
179
+
173
180
  for (const { stub, target } of sharedManifest.files) {
174
181
  const src = resolve(stubsDir, 'shared', stub)
175
182
  const dest = resolve(projectDir, target)
176
183
  mkdirSync(dirname(dest), { recursive: true })
177
184
  let content = await Bun.file(src).text()
178
- content = content.replace(/\{\{MAIN_ENTRY\}\}/g, mainEntry)
185
+ for (const [key, value] of Object.entries(placeholders)) {
186
+ content = content.replaceAll(key, value)
187
+ }
179
188
  await Bun.write(dest, content)
180
189
  fileCount++
181
190
  }
@@ -1426,9 +1426,23 @@
1426
1426
  {
1427
1427
  "stub": "config/app.ts.stub",
1428
1428
  "target": "config/app.ts"
1429
+ },
1430
+ {
1431
+ "stub": "config/vite.ts.stub",
1432
+ "target": "config/vite.ts"
1429
1433
  }
1430
1434
  ],
1431
1435
  "placeholders": {
1436
+ "{{REACT_REFRESH}}": {
1437
+ "react": "true",
1438
+ "vue": "false",
1439
+ "svelte": "false"
1440
+ },
1441
+ "{{SSR_ENTRY}}": {
1442
+ "react": "src/ssr.tsx",
1443
+ "vue": "src/ssr.ts",
1444
+ "svelte": "src/ssr.ts"
1445
+ },
1432
1446
  "{{MAIN_ENTRY}}": {
1433
1447
  "react": "src/main.tsx",
1434
1448
  "vue": "src/main.ts",
@@ -0,0 +1,8 @@
1
+ export default {
2
+ reactRefresh: {{REACT_REFRESH}},
3
+
4
+ ssr: {
5
+ entry: '{{SSR_ENTRY}}',
6
+ bundle: 'bootstrap/ssr/ssr.js',
7
+ },
8
+ }