@vertz/create-vertz-app 0.2.12 → 0.2.14
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/scaffold.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../src/scaffold.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../src/scaffold.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,WAAW,EAAE,MAAM;CAIhC;AAED;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDzF"}
|
package/dist/scaffold.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { promises as fs } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { appComponentTemplate, bunfigTemplate, bunPluginShimTemplate, clientTemplate, dbTemplate, entryClientTemplate, envExampleTemplate, envTemplate, gitignoreTemplate, homePageTemplate, packageJsonTemplate, schemaTemplate, serverTemplate, tasksEntityTemplate, themeTemplate, tsconfigTemplate, vertzConfigTemplate, } from './templates/index.js';
|
|
3
|
+
import { appComponentTemplate, bunfigTemplate, bunPluginShimTemplate, clientTemplate, dbTemplate, entryClientTemplate, envExampleTemplate, envModuleTemplate, envTemplate, gitignoreTemplate, homePageTemplate, packageJsonTemplate, schemaTemplate, serverTemplate, tasksEntityTemplate, themeTemplate, tsconfigTemplate, vertzConfigTemplate, } from './templates/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* Error thrown when the project directory already exists
|
|
6
6
|
*/
|
|
@@ -52,6 +52,7 @@ export async function scaffold(parentDir, options) {
|
|
|
52
52
|
writeFile(projectDir, 'bunfig.toml', bunfigTemplate()),
|
|
53
53
|
writeFile(projectDir, 'bun-plugin-shim.ts', bunPluginShimTemplate()),
|
|
54
54
|
// API source files
|
|
55
|
+
writeFile(apiDir, 'env.ts', envModuleTemplate()),
|
|
55
56
|
writeFile(apiDir, 'server.ts', serverTemplate()),
|
|
56
57
|
writeFile(apiDir, 'schema.ts', schemaTemplate()),
|
|
57
58
|
writeFile(apiDir, 'db.ts', dbTemplate()),
|
|
@@ -30,6 +30,10 @@ export declare function bunPluginShimTemplate(): string;
|
|
|
30
30
|
* .gitignore template
|
|
31
31
|
*/
|
|
32
32
|
export declare function gitignoreTemplate(): string;
|
|
33
|
+
/**
|
|
34
|
+
* src/api/env.ts — validated environment variables
|
|
35
|
+
*/
|
|
36
|
+
export declare function envModuleTemplate(): string;
|
|
33
37
|
/**
|
|
34
38
|
* src/api/server.ts — createServer with entities + db
|
|
35
39
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA6B/D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAoBzC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAa5C;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAIpC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAI3C;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAIvC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAc9C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CA6B1C;AAID;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAW1C;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAoBvC;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAavC;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,MAAM,CASnC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAe5C;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAOvC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAgD7C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAW5C;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAWtC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAkIzC"}
|
package/dist/templates/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export function packageJsonTemplate(projectName) {
|
|
|
11
11
|
scripts: {
|
|
12
12
|
dev: 'vertz dev',
|
|
13
13
|
build: 'vertz build',
|
|
14
|
+
start: 'vertz start',
|
|
14
15
|
codegen: 'vertz codegen',
|
|
15
16
|
},
|
|
16
17
|
imports: {
|
|
@@ -18,15 +19,12 @@ export function packageJsonTemplate(projectName) {
|
|
|
18
19
|
'#generated/types': './.vertz/generated/types/index.ts',
|
|
19
20
|
},
|
|
20
21
|
dependencies: {
|
|
21
|
-
|
|
22
|
-
'@vertz/server': '^0.2.0',
|
|
22
|
+
vertz: '^0.2.0',
|
|
23
23
|
'@vertz/theme-shadcn': '^0.2.0',
|
|
24
|
-
'@vertz/ui': '^0.2.0',
|
|
25
24
|
},
|
|
26
25
|
devDependencies: {
|
|
27
26
|
'@vertz/cli': '^0.2.0',
|
|
28
27
|
'@vertz/ui-compiler': '^0.2.0',
|
|
29
|
-
'@vertz/ui-server': '^0.2.0',
|
|
30
28
|
'bun-types': '^1.0.0',
|
|
31
29
|
typescript: '^5.8.0',
|
|
32
30
|
},
|
|
@@ -78,6 +76,7 @@ export const codegen = {
|
|
|
78
76
|
*/
|
|
79
77
|
export function envTemplate() {
|
|
80
78
|
return `PORT=3000
|
|
79
|
+
DATABASE_URL=local.db
|
|
81
80
|
`;
|
|
82
81
|
}
|
|
83
82
|
/**
|
|
@@ -85,6 +84,7 @@ export function envTemplate() {
|
|
|
85
84
|
*/
|
|
86
85
|
export function envExampleTemplate() {
|
|
87
86
|
return `PORT=3000
|
|
87
|
+
DATABASE_URL=local.db
|
|
88
88
|
`;
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
@@ -106,7 +106,7 @@ export function bunPluginShimTemplate() {
|
|
|
106
106
|
* The @vertz/ui-server/bun-plugin package exports a factory function (createVertzBunPlugin)
|
|
107
107
|
* as a named export — this shim bridges the two.
|
|
108
108
|
*/
|
|
109
|
-
import { createVertzBunPlugin } from '
|
|
109
|
+
import { createVertzBunPlugin } from 'vertz/ui-server/bun-plugin';
|
|
110
110
|
|
|
111
111
|
const { plugin } = createVertzBunPlugin();
|
|
112
112
|
|
|
@@ -147,12 +147,28 @@ Thumbs.db
|
|
|
147
147
|
`;
|
|
148
148
|
}
|
|
149
149
|
// ── Source file templates ───────────────────────────────────
|
|
150
|
+
/**
|
|
151
|
+
* src/api/env.ts — validated environment variables
|
|
152
|
+
*/
|
|
153
|
+
export function envModuleTemplate() {
|
|
154
|
+
return `import { createEnv } from 'vertz/server';
|
|
155
|
+
import { s } from 'vertz/schema';
|
|
156
|
+
|
|
157
|
+
export const env = createEnv({
|
|
158
|
+
schema: s.object({
|
|
159
|
+
PORT: s.coerce.number().default(3000),
|
|
160
|
+
DATABASE_URL: s.string().default('local.db'),
|
|
161
|
+
}),
|
|
162
|
+
});
|
|
163
|
+
`;
|
|
164
|
+
}
|
|
150
165
|
/**
|
|
151
166
|
* src/api/server.ts — createServer with entities + db
|
|
152
167
|
*/
|
|
153
168
|
export function serverTemplate() {
|
|
154
|
-
return `import { createServer } from '
|
|
169
|
+
return `import { createServer } from 'vertz/server';
|
|
155
170
|
import { db } from './db';
|
|
171
|
+
import { env } from './env';
|
|
156
172
|
import { tasks } from './entities/tasks.entity';
|
|
157
173
|
|
|
158
174
|
const app = createServer({
|
|
@@ -164,8 +180,7 @@ const app = createServer({
|
|
|
164
180
|
export default app;
|
|
165
181
|
|
|
166
182
|
if (import.meta.main) {
|
|
167
|
-
|
|
168
|
-
app.listen(PORT).then((handle) => {
|
|
183
|
+
app.listen(env.PORT).then((handle) => {
|
|
169
184
|
console.log(\`Server running at http://localhost:\${handle.port}/api\`);
|
|
170
185
|
});
|
|
171
186
|
}
|
|
@@ -175,7 +190,7 @@ if (import.meta.main) {
|
|
|
175
190
|
* src/api/schema.ts — tasks table + model
|
|
176
191
|
*/
|
|
177
192
|
export function schemaTemplate() {
|
|
178
|
-
return `import { d } from '
|
|
193
|
+
return `import { d } from 'vertz/db';
|
|
179
194
|
|
|
180
195
|
export const tasksTable = d.table('tasks', {
|
|
181
196
|
id: d.uuid().primary({ generate: 'uuid' }),
|
|
@@ -192,7 +207,7 @@ export const tasksModel = d.model(tasksTable);
|
|
|
192
207
|
* src/api/db.ts — createSqliteAdapter with autoApply migrations
|
|
193
208
|
*/
|
|
194
209
|
export function dbTemplate() {
|
|
195
|
-
return `import { createSqliteAdapter } from '
|
|
210
|
+
return `import { createSqliteAdapter } from 'vertz/db/sqlite';
|
|
196
211
|
import { tasksTable } from './schema';
|
|
197
212
|
|
|
198
213
|
export const db = await createSqliteAdapter({
|
|
@@ -205,7 +220,7 @@ export const db = await createSqliteAdapter({
|
|
|
205
220
|
* src/api/entities/tasks.entity.ts — entity with CRUD access
|
|
206
221
|
*/
|
|
207
222
|
export function tasksEntityTemplate() {
|
|
208
|
-
return `import { entity } from '
|
|
223
|
+
return `import { entity } from 'vertz/server';
|
|
209
224
|
import { tasksModel } from '../schema';
|
|
210
225
|
|
|
211
226
|
export const tasks = entity('tasks', {
|
|
@@ -235,7 +250,7 @@ export const api = createClient();
|
|
|
235
250
|
* src/app.tsx — SSR module exports + ThemeProvider + render HomePage
|
|
236
251
|
*/
|
|
237
252
|
export function appComponentTemplate() {
|
|
238
|
-
return `import { css, getInjectedCSS, globalCss, ThemeProvider } from '
|
|
253
|
+
return `import { css, getInjectedCSS, globalCss, ThemeProvider } from 'vertz/ui';
|
|
239
254
|
import { HomePage } from './pages/home';
|
|
240
255
|
import { appTheme, themeGlobals } from './styles/theme';
|
|
241
256
|
|
|
@@ -287,12 +302,12 @@ export function App() {
|
|
|
287
302
|
* src/entry-client.ts — mount + HMR self-accept
|
|
288
303
|
*/
|
|
289
304
|
export function entryClientTemplate() {
|
|
290
|
-
return `import { mount } from '
|
|
305
|
+
return `import { mount } from 'vertz/ui';
|
|
291
306
|
import { App, globalStyles, theme } from './app';
|
|
292
307
|
|
|
293
308
|
import.meta.hot.accept();
|
|
294
309
|
|
|
295
|
-
mount(App,
|
|
310
|
+
mount(App, {
|
|
296
311
|
theme,
|
|
297
312
|
styles: globalStyles,
|
|
298
313
|
});
|
|
@@ -327,7 +342,7 @@ export function homePageTemplate() {
|
|
|
327
342
|
query,
|
|
328
343
|
queryMatch,
|
|
329
344
|
slideInFromTop,
|
|
330
|
-
} from '
|
|
345
|
+
} from 'vertz/ui';
|
|
331
346
|
import { api } from '../client';
|
|
332
347
|
|
|
333
348
|
// Inject global CSS for list item enter/exit animations
|