@vertz/create-vertz-app 0.2.11 → 0.2.13
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,CAgC/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: {
|
|
@@ -46,13 +47,13 @@ export function tsconfigTemplate() {
|
|
|
46
47
|
module: 'ESNext',
|
|
47
48
|
moduleResolution: 'bundler',
|
|
48
49
|
outDir: 'dist',
|
|
49
|
-
rootDir: '
|
|
50
|
+
rootDir: '.',
|
|
50
51
|
skipLibCheck: true,
|
|
51
52
|
strict: true,
|
|
52
53
|
target: 'ES2022',
|
|
53
54
|
types: ['bun-types'],
|
|
54
55
|
},
|
|
55
|
-
include: ['src'],
|
|
56
|
+
include: ['src', '.vertz/generated'],
|
|
56
57
|
};
|
|
57
58
|
return JSON.stringify(tsconfig, null, 2);
|
|
58
59
|
}
|
|
@@ -78,6 +79,7 @@ export const codegen = {
|
|
|
78
79
|
*/
|
|
79
80
|
export function envTemplate() {
|
|
80
81
|
return `PORT=3000
|
|
82
|
+
DATABASE_URL=local.db
|
|
81
83
|
`;
|
|
82
84
|
}
|
|
83
85
|
/**
|
|
@@ -85,6 +87,7 @@ export function envTemplate() {
|
|
|
85
87
|
*/
|
|
86
88
|
export function envExampleTemplate() {
|
|
87
89
|
return `PORT=3000
|
|
90
|
+
DATABASE_URL=local.db
|
|
88
91
|
`;
|
|
89
92
|
}
|
|
90
93
|
/**
|
|
@@ -147,12 +150,28 @@ Thumbs.db
|
|
|
147
150
|
`;
|
|
148
151
|
}
|
|
149
152
|
// ── Source file templates ───────────────────────────────────
|
|
153
|
+
/**
|
|
154
|
+
* src/api/env.ts — validated environment variables
|
|
155
|
+
*/
|
|
156
|
+
export function envModuleTemplate() {
|
|
157
|
+
return `import { createEnv } from '@vertz/server';
|
|
158
|
+
import { s } from '@vertz/schema';
|
|
159
|
+
|
|
160
|
+
export const env = createEnv({
|
|
161
|
+
schema: s.object({
|
|
162
|
+
PORT: s.coerce.number().default(3000),
|
|
163
|
+
DATABASE_URL: s.string().default('local.db'),
|
|
164
|
+
}),
|
|
165
|
+
});
|
|
166
|
+
`;
|
|
167
|
+
}
|
|
150
168
|
/**
|
|
151
169
|
* src/api/server.ts — createServer with entities + db
|
|
152
170
|
*/
|
|
153
171
|
export function serverTemplate() {
|
|
154
172
|
return `import { createServer } from '@vertz/server';
|
|
155
173
|
import { db } from './db';
|
|
174
|
+
import { env } from './env';
|
|
156
175
|
import { tasks } from './entities/tasks.entity';
|
|
157
176
|
|
|
158
177
|
const app = createServer({
|
|
@@ -164,8 +183,7 @@ const app = createServer({
|
|
|
164
183
|
export default app;
|
|
165
184
|
|
|
166
185
|
if (import.meta.main) {
|
|
167
|
-
|
|
168
|
-
app.listen(PORT).then((handle) => {
|
|
186
|
+
app.listen(env.PORT).then((handle) => {
|
|
169
187
|
console.log(\`Server running at http://localhost:\${handle.port}/api\`);
|
|
170
188
|
});
|
|
171
189
|
}
|
|
@@ -292,7 +310,7 @@ import { App, globalStyles, theme } from './app';
|
|
|
292
310
|
|
|
293
311
|
import.meta.hot.accept();
|
|
294
312
|
|
|
295
|
-
mount(App,
|
|
313
|
+
mount(App, {
|
|
296
314
|
theme,
|
|
297
315
|
styles: globalStyles,
|
|
298
316
|
});
|