@vertz/create-vertz-app 0.2.35 → 0.2.36
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/bin/create-vertz-app.ts +3 -2
- package/dist/prompts.d.ts +6 -0
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +24 -1
- package/dist/scaffold.d.ts.map +1 -1
- package/dist/scaffold.js +48 -4
- package/dist/templates/index.d.ts +21 -0
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +138 -0
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/bin/create-vertz-app.ts
CHANGED
|
@@ -13,10 +13,11 @@ program
|
|
|
13
13
|
.description('Scaffold a new Vertz project')
|
|
14
14
|
.version(pkg.version)
|
|
15
15
|
.argument('[name]', 'Project name')
|
|
16
|
-
.
|
|
16
|
+
.option('--template <type>', 'Template to use (hello-world, todo-app)', 'todo-app')
|
|
17
|
+
.action(async (name: string | undefined, opts: { template?: string }) => {
|
|
17
18
|
const { resolveOptions, scaffold } = await import('../dist/index.js');
|
|
18
19
|
try {
|
|
19
|
-
const resolved = await resolveOptions({ projectName: name });
|
|
20
|
+
const resolved = await resolveOptions({ projectName: name, template: opts.template });
|
|
20
21
|
|
|
21
22
|
console.log(`Creating Vertz app: ${resolved.projectName} (v${pkg.version})`);
|
|
22
23
|
|
package/dist/prompts.d.ts
CHANGED
|
@@ -5,6 +5,12 @@ import type { CliOptions, ScaffoldOptions } from './types.js';
|
|
|
5
5
|
export declare class ProjectNameRequiredError extends Error {
|
|
6
6
|
constructor();
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Error thrown when an invalid template type is provided
|
|
10
|
+
*/
|
|
11
|
+
export declare class InvalidTemplateError extends Error {
|
|
12
|
+
constructor(template: string);
|
|
13
|
+
}
|
|
8
14
|
/**
|
|
9
15
|
* Prompts the user for project name
|
|
10
16
|
*/
|
package/dist/prompts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAgB,MAAM,YAAY,CAAC;AAK5E;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;;CAKlD;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,QAAQ,EAAE,MAAM;CAM7B;AAED;;GAEG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,CAY5D;AAaD;;;GAGG;AACH,wBAAsB,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,CAc9F"}
|
package/dist/prompts.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { createInterface } from 'node:readline';
|
|
2
|
+
const VALID_TEMPLATES = ['hello-world', 'todo-app'];
|
|
3
|
+
const DEFAULT_TEMPLATE = 'todo-app';
|
|
2
4
|
/**
|
|
3
5
|
* Error thrown in CI mode when project name is required but not provided
|
|
4
6
|
*/
|
|
@@ -8,6 +10,15 @@ export class ProjectNameRequiredError extends Error {
|
|
|
8
10
|
this.name = 'ProjectNameRequiredError';
|
|
9
11
|
}
|
|
10
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Error thrown when an invalid template type is provided
|
|
15
|
+
*/
|
|
16
|
+
export class InvalidTemplateError extends Error {
|
|
17
|
+
constructor(template) {
|
|
18
|
+
super(`Invalid template "${template}". Available templates: ${VALID_TEMPLATES.join(', ')}`);
|
|
19
|
+
this.name = 'InvalidTemplateError';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
11
22
|
/**
|
|
12
23
|
* Prompts the user for project name
|
|
13
24
|
*/
|
|
@@ -23,6 +34,17 @@ export async function promptForProjectName() {
|
|
|
23
34
|
});
|
|
24
35
|
});
|
|
25
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Validates and returns a template type
|
|
39
|
+
*/
|
|
40
|
+
function resolveTemplate(template) {
|
|
41
|
+
if (!template)
|
|
42
|
+
return DEFAULT_TEMPLATE;
|
|
43
|
+
if (VALID_TEMPLATES.includes(template)) {
|
|
44
|
+
return template;
|
|
45
|
+
}
|
|
46
|
+
throw new InvalidTemplateError(template);
|
|
47
|
+
}
|
|
26
48
|
/**
|
|
27
49
|
* Resolves CLI options into complete scaffold options
|
|
28
50
|
* Handles both interactive and CI modes
|
|
@@ -36,5 +58,6 @@ export async function resolveOptions(cliOptions) {
|
|
|
36
58
|
}
|
|
37
59
|
projectName = await promptForProjectName();
|
|
38
60
|
}
|
|
39
|
-
|
|
61
|
+
const template = resolveTemplate(cliOptions.template);
|
|
62
|
+
return { projectName, template };
|
|
40
63
|
}
|
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":"AA+BA,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,CAoBzF"}
|
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 { apiDevelopmentRuleTemplate, appComponentTemplate, bunfigTemplate, bunPluginShimTemplate, claudeMdTemplate, clientTemplate, dbTemplate, entryClientTemplate, envExampleTemplate, envModuleTemplate, envTemplate, faviconTemplate, gitignoreTemplate, homePageTemplate, packageJsonTemplate, schemaTemplate, serverTemplate, tasksEntityTemplate, themeTemplate, tsconfigTemplate, uiDevelopmentRuleTemplate, vertzConfigTemplate, } from './templates/index.js';
|
|
3
|
+
import { apiDevelopmentRuleTemplate, appComponentTemplate, bunfigTemplate, bunPluginShimTemplate, claudeMdTemplate, clientTemplate, dbTemplate, entryClientTemplate, envExampleTemplate, envModuleTemplate, envTemplate, faviconTemplate, gitignoreTemplate, helloWorldAppTemplate, helloWorldClaudeMdTemplate, helloWorldHomePageTemplate, helloWorldPackageJsonTemplate, helloWorldVertzConfigTemplate, homePageTemplate, packageJsonTemplate, schemaTemplate, serverTemplate, tasksEntityTemplate, themeTemplate, tsconfigTemplate, uiDevelopmentRuleTemplate, vertzConfigTemplate, } from './templates/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* Error thrown when the project directory already exists
|
|
6
6
|
*/
|
|
@@ -16,7 +16,7 @@ export class DirectoryExistsError extends Error {
|
|
|
16
16
|
* @param options - Scaffold options
|
|
17
17
|
*/
|
|
18
18
|
export async function scaffold(parentDir, options) {
|
|
19
|
-
const { projectName } = options;
|
|
19
|
+
const { projectName, template } = options;
|
|
20
20
|
const projectDir = path.join(parentDir, projectName);
|
|
21
21
|
// Check if directory already exists
|
|
22
22
|
try {
|
|
@@ -29,7 +29,52 @@ export async function scaffold(parentDir, options) {
|
|
|
29
29
|
}
|
|
30
30
|
// Directory doesn't exist, which is what we want
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
if (template === 'hello-world') {
|
|
33
|
+
await scaffoldHelloWorld(projectDir, projectName);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
await scaffoldTodoApp(projectDir, projectName);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Scaffolds the hello-world template — UI-only with a reactive counter
|
|
41
|
+
*/
|
|
42
|
+
async function scaffoldHelloWorld(projectDir, projectName) {
|
|
43
|
+
const srcDir = path.join(projectDir, 'src');
|
|
44
|
+
const pagesDir = path.join(srcDir, 'pages');
|
|
45
|
+
const stylesDir = path.join(srcDir, 'styles');
|
|
46
|
+
const claudeRulesDir = path.join(projectDir, '.claude', 'rules');
|
|
47
|
+
const publicDir = path.join(projectDir, 'public');
|
|
48
|
+
await Promise.all([
|
|
49
|
+
fs.mkdir(pagesDir, { recursive: true }),
|
|
50
|
+
fs.mkdir(stylesDir, { recursive: true }),
|
|
51
|
+
fs.mkdir(claudeRulesDir, { recursive: true }),
|
|
52
|
+
fs.mkdir(publicDir, { recursive: true }),
|
|
53
|
+
]);
|
|
54
|
+
await Promise.all([
|
|
55
|
+
// Config files
|
|
56
|
+
writeFile(projectDir, 'package.json', helloWorldPackageJsonTemplate(projectName)),
|
|
57
|
+
writeFile(projectDir, 'tsconfig.json', tsconfigTemplate()),
|
|
58
|
+
writeFile(projectDir, 'vertz.config.ts', helloWorldVertzConfigTemplate()),
|
|
59
|
+
writeFile(projectDir, '.gitignore', gitignoreTemplate()),
|
|
60
|
+
writeFile(projectDir, 'bunfig.toml', bunfigTemplate()),
|
|
61
|
+
writeFile(projectDir, 'bun-plugin-shim.ts', bunPluginShimTemplate()),
|
|
62
|
+
// UI source files
|
|
63
|
+
writeFile(srcDir, 'app.tsx', helloWorldAppTemplate()),
|
|
64
|
+
writeFile(srcDir, 'entry-client.ts', entryClientTemplate()),
|
|
65
|
+
writeFile(pagesDir, 'home.tsx', helloWorldHomePageTemplate()),
|
|
66
|
+
writeFile(stylesDir, 'theme.ts', themeTemplate()),
|
|
67
|
+
// Static assets
|
|
68
|
+
writeFile(publicDir, 'favicon.svg', faviconTemplate()),
|
|
69
|
+
// LLM rules
|
|
70
|
+
writeFile(projectDir, 'CLAUDE.md', helloWorldClaudeMdTemplate(projectName)),
|
|
71
|
+
writeFile(claudeRulesDir, 'ui-development.md', uiDevelopmentRuleTemplate()),
|
|
72
|
+
]);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Scaffolds the todo-app template — full-stack with DB, API, entities, and UI
|
|
76
|
+
*/
|
|
77
|
+
async function scaffoldTodoApp(projectDir, projectName) {
|
|
33
78
|
const srcDir = path.join(projectDir, 'src');
|
|
34
79
|
const apiDir = path.join(srcDir, 'api');
|
|
35
80
|
const entitiesDir = path.join(apiDir, 'entities');
|
|
@@ -44,7 +89,6 @@ export async function scaffold(parentDir, options) {
|
|
|
44
89
|
fs.mkdir(claudeRulesDir, { recursive: true }),
|
|
45
90
|
fs.mkdir(publicDir, { recursive: true }),
|
|
46
91
|
]);
|
|
47
|
-
// Write all files in parallel
|
|
48
92
|
await Promise.all([
|
|
49
93
|
// Config files
|
|
50
94
|
writeFile(projectDir, 'package.json', packageJsonTemplate(projectName)),
|
|
@@ -88,4 +88,25 @@ export declare function themeTemplate(): string;
|
|
|
88
88
|
* Demonstrates theme components (Button, Input) and DialogStack confirmation.
|
|
89
89
|
*/
|
|
90
90
|
export declare function homePageTemplate(): string;
|
|
91
|
+
/**
|
|
92
|
+
* CLAUDE.md for hello-world template — UI-only project description
|
|
93
|
+
*/
|
|
94
|
+
export declare function helloWorldClaudeMdTemplate(projectName: string): string;
|
|
95
|
+
/**
|
|
96
|
+
* Package.json for hello-world — no API deps, no #generated imports, no codegen
|
|
97
|
+
*/
|
|
98
|
+
export declare function helloWorldPackageJsonTemplate(projectName: string): string;
|
|
99
|
+
/**
|
|
100
|
+
* vertz.config.ts for hello-world — minimal, no server entry
|
|
101
|
+
*/
|
|
102
|
+
export declare function helloWorldVertzConfigTemplate(): string;
|
|
103
|
+
/**
|
|
104
|
+
* src/app.tsx for hello-world — simple App with ThemeProvider
|
|
105
|
+
*/
|
|
106
|
+
export declare function helloWorldAppTemplate(): string;
|
|
107
|
+
/**
|
|
108
|
+
* src/pages/home.tsx for hello-world — reactive counter demonstrating
|
|
109
|
+
* the Vertz compiler's signal transformation (let → signal)
|
|
110
|
+
*/
|
|
111
|
+
export declare function helloWorldHomePageTemplate(): string;
|
|
91
112
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA6B5D;AAED;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,CAyJnD;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAoRlD;AAID;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAGxC;AAID;;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,CAWnC;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,CActC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAmLzC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA6B5D;AAED;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,CAyJnD;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAoRlD;AAID;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAGxC;AAID;;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,CAWnC;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,CActC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAmLzC;AAID;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA8BtE;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAuBzE;AAED;;GAEG;AACH,wBAAgB,6BAA6B,IAAI,MAAM,CAItD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAgC9C;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,CA4BnD"}
|
package/dist/templates/index.js
CHANGED
|
@@ -997,3 +997,141 @@ export function HomePage() {
|
|
|
997
997
|
}
|
|
998
998
|
`;
|
|
999
999
|
}
|
|
1000
|
+
// ── Hello World template functions ────────────────────────
|
|
1001
|
+
/**
|
|
1002
|
+
* CLAUDE.md for hello-world template — UI-only project description
|
|
1003
|
+
*/
|
|
1004
|
+
export function helloWorldClaudeMdTemplate(projectName) {
|
|
1005
|
+
return `# ${projectName}
|
|
1006
|
+
|
|
1007
|
+
A UI-only TypeScript application built with [Vertz](https://vertz.dev).
|
|
1008
|
+
|
|
1009
|
+
## Stack
|
|
1010
|
+
|
|
1011
|
+
- Runtime: Bun
|
|
1012
|
+
- Framework: Vertz (UI)
|
|
1013
|
+
- Language: TypeScript (strict mode)
|
|
1014
|
+
- Docs: https://docs.vertz.dev
|
|
1015
|
+
|
|
1016
|
+
## Development
|
|
1017
|
+
|
|
1018
|
+
\`\`\`bash
|
|
1019
|
+
bun install # Install dependencies
|
|
1020
|
+
bun run dev # Start dev server with HMR
|
|
1021
|
+
bun run build # Production build
|
|
1022
|
+
\`\`\`
|
|
1023
|
+
|
|
1024
|
+
## Adding a Backend
|
|
1025
|
+
|
|
1026
|
+
To add API and database support, see https://docs.vertz.dev/guides/server/overview
|
|
1027
|
+
|
|
1028
|
+
## Conventions
|
|
1029
|
+
|
|
1030
|
+
- See \`.claude/rules/\` for UI development conventions
|
|
1031
|
+
- Refer to https://docs.vertz.dev for full framework documentation
|
|
1032
|
+
- The Vertz compiler handles all reactivity — never use \`.value\`, \`signal()\`, or \`computed()\` manually
|
|
1033
|
+
`;
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* Package.json for hello-world — no API deps, no #generated imports, no codegen
|
|
1037
|
+
*/
|
|
1038
|
+
export function helloWorldPackageJsonTemplate(projectName) {
|
|
1039
|
+
const pkg = {
|
|
1040
|
+
name: projectName,
|
|
1041
|
+
version: '0.1.0',
|
|
1042
|
+
type: 'module',
|
|
1043
|
+
license: 'MIT',
|
|
1044
|
+
scripts: {
|
|
1045
|
+
dev: 'vertz dev',
|
|
1046
|
+
build: 'vertz build',
|
|
1047
|
+
},
|
|
1048
|
+
dependencies: {
|
|
1049
|
+
vertz: '^0.2.0',
|
|
1050
|
+
'@vertz/theme-shadcn': '^0.2.0',
|
|
1051
|
+
},
|
|
1052
|
+
devDependencies: {
|
|
1053
|
+
'@vertz/cli': '^0.2.0',
|
|
1054
|
+
'@vertz/ui-compiler': '^0.2.0',
|
|
1055
|
+
'bun-types': '^1.0.0',
|
|
1056
|
+
typescript: '^5.8.0',
|
|
1057
|
+
},
|
|
1058
|
+
};
|
|
1059
|
+
return JSON.stringify(pkg, null, 2);
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
* vertz.config.ts for hello-world — minimal, no server entry
|
|
1063
|
+
*/
|
|
1064
|
+
export function helloWorldVertzConfigTemplate() {
|
|
1065
|
+
return `/** @type {import('@vertz/compiler').VertzConfig} */
|
|
1066
|
+
export default {};
|
|
1067
|
+
`;
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* src/app.tsx for hello-world — simple App with ThemeProvider
|
|
1071
|
+
*/
|
|
1072
|
+
export function helloWorldAppTemplate() {
|
|
1073
|
+
return `import { css, getInjectedCSS, globalCss, ThemeProvider } from 'vertz/ui';
|
|
1074
|
+
import { HomePage } from './pages/home';
|
|
1075
|
+
import { appTheme, themeGlobals } from './styles/theme';
|
|
1076
|
+
|
|
1077
|
+
const appGlobals = globalCss({
|
|
1078
|
+
a: {
|
|
1079
|
+
textDecoration: 'none',
|
|
1080
|
+
color: 'inherit',
|
|
1081
|
+
},
|
|
1082
|
+
});
|
|
1083
|
+
|
|
1084
|
+
const styles = css({
|
|
1085
|
+
shell: ['min-h:screen', 'bg:background', 'text:foreground'],
|
|
1086
|
+
});
|
|
1087
|
+
|
|
1088
|
+
export { getInjectedCSS };
|
|
1089
|
+
export const theme = appTheme;
|
|
1090
|
+
export const globalStyles = [themeGlobals.css, appGlobals.css];
|
|
1091
|
+
|
|
1092
|
+
export function App() {
|
|
1093
|
+
return (
|
|
1094
|
+
<div data-testid="app-root">
|
|
1095
|
+
<ThemeProvider theme="light">
|
|
1096
|
+
<div className={styles.shell}>
|
|
1097
|
+
<HomePage />
|
|
1098
|
+
</div>
|
|
1099
|
+
</ThemeProvider>
|
|
1100
|
+
</div>
|
|
1101
|
+
);
|
|
1102
|
+
}
|
|
1103
|
+
`;
|
|
1104
|
+
}
|
|
1105
|
+
/**
|
|
1106
|
+
* src/pages/home.tsx for hello-world — reactive counter demonstrating
|
|
1107
|
+
* the Vertz compiler's signal transformation (let → signal)
|
|
1108
|
+
*/
|
|
1109
|
+
export function helloWorldHomePageTemplate() {
|
|
1110
|
+
return `import { css } from 'vertz/ui';
|
|
1111
|
+
import { Button } from '@vertz/ui/components';
|
|
1112
|
+
|
|
1113
|
+
const styles = css({
|
|
1114
|
+
container: ['flex', 'flex-col', 'items:center', 'justify:center', 'min-h:screen', 'gap:6'],
|
|
1115
|
+
title: ['font:4xl', 'font:bold', 'text:foreground'],
|
|
1116
|
+
subtitle: ['text:muted-foreground', 'text:lg'],
|
|
1117
|
+
count: ['font:6xl', 'font:bold', 'text:primary'],
|
|
1118
|
+
actions: ['flex', 'gap:3'],
|
|
1119
|
+
});
|
|
1120
|
+
|
|
1121
|
+
export function HomePage() {
|
|
1122
|
+
let count = 0;
|
|
1123
|
+
|
|
1124
|
+
return (
|
|
1125
|
+
<div className={styles.container} data-testid="home-page">
|
|
1126
|
+
<h1 className={styles.title}>Hello, Vertz!</h1>
|
|
1127
|
+
<p className={styles.subtitle}>A reactive counter powered by the Vertz compiler</p>
|
|
1128
|
+
<p className={styles.count}>{count}</p>
|
|
1129
|
+
<div className={styles.actions}>
|
|
1130
|
+
<Button intent="ghost" onClick={() => { count = 0; }}>Reset</Button>
|
|
1131
|
+
<Button onClick={() => { count++; }}>Count is {count}</Button>
|
|
1132
|
+
</div>
|
|
1133
|
+
</div>
|
|
1134
|
+
);
|
|
1135
|
+
}
|
|
1136
|
+
`;
|
|
1137
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Available scaffold template types
|
|
3
|
+
*/
|
|
4
|
+
export type TemplateType = 'hello-world' | 'todo-app';
|
|
1
5
|
/**
|
|
2
6
|
* Options for the scaffold function
|
|
3
7
|
*/
|
|
4
8
|
export interface ScaffoldOptions {
|
|
5
9
|
/** Name of the project to create */
|
|
6
10
|
projectName: string;
|
|
11
|
+
/** Template to scaffold (default: 'todo-app') */
|
|
12
|
+
template: TemplateType;
|
|
7
13
|
}
|
|
8
14
|
/**
|
|
9
15
|
* CLI options parsed from command line flags
|
|
@@ -11,5 +17,7 @@ export interface ScaffoldOptions {
|
|
|
11
17
|
export interface CliOptions {
|
|
12
18
|
/** Project name (positional argument or --name) */
|
|
13
19
|
projectName?: string;
|
|
20
|
+
/** Template type */
|
|
21
|
+
template?: string;
|
|
14
22
|
}
|
|
15
23
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oCAAoC;IACpC,WAAW,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,UAAU,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oCAAoC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,QAAQ,EAAE,YAAY,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|