@teamvelix/cli 5.2.1 → 5.2.3
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/{build-ODNAFOEX.js → build-GQNE2ERF.js} +2 -2
- package/dist/{chunk-NP7HMX6A.js → chunk-WOZEFISO.js} +2 -2
- package/dist/{chunk-NP7HMX6A.js.map → chunk-WOZEFISO.js.map} +1 -1
- package/dist/{create-OVXR7Q47.js → create-AWDG24NS.js} +2 -2
- package/dist/{dev-H7P7YCEP.js → dev-UNK6CBTQ.js} +2 -2
- package/dist/{doctor-YYTH474N.js → doctor-MK7AEFZ5.js} +2 -2
- package/dist/{generate-5KBJNW3M.js → generate-JKGPDHH7.js} +36 -27
- package/dist/generate-JKGPDHH7.js.map +1 -0
- package/dist/index.js +9 -9
- package/dist/{ui-IROXYLW2.js → ui-CWB2QIGT.js} +2 -2
- package/package.json +1 -1
- package/dist/generate-5KBJNW3M.js.map +0 -1
- /package/dist/{build-ODNAFOEX.js.map → build-GQNE2ERF.js.map} +0 -0
- /package/dist/{create-OVXR7Q47.js.map → create-AWDG24NS.js.map} +0 -0
- /package/dist/{dev-H7P7YCEP.js.map → dev-UNK6CBTQ.js.map} +0 -0
- /package/dist/{doctor-YYTH474N.js.map → doctor-MK7AEFZ5.js.map} +0 -0
- /package/dist/{ui-IROXYLW2.js.map → ui-CWB2QIGT.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log,
|
|
3
3
|
showBanner
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WOZEFISO.js";
|
|
5
5
|
|
|
6
6
|
// commands/build.ts
|
|
7
7
|
import fs from "fs";
|
|
@@ -60,4 +60,4 @@ export {
|
|
|
60
60
|
buildCommand,
|
|
61
61
|
startCommand
|
|
62
62
|
};
|
|
63
|
-
//# sourceMappingURL=build-
|
|
63
|
+
//# sourceMappingURL=build-GQNE2ERF.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// version.ts
|
|
2
|
-
var VERSION = "5.
|
|
2
|
+
var VERSION = "5.2.3";
|
|
3
3
|
|
|
4
4
|
// commands/shared.ts
|
|
5
5
|
import pc from "picocolors";
|
|
@@ -42,4 +42,4 @@ export {
|
|
|
42
42
|
pascalCase,
|
|
43
43
|
camelCase
|
|
44
44
|
};
|
|
45
|
-
//# sourceMappingURL=chunk-
|
|
45
|
+
//# sourceMappingURL=chunk-WOZEFISO.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../version.ts","../commands/shared.ts"],"sourcesContent":["/**\n * Velix CLI version — single source of truth.\n * Keep in sync with packages/velix/version.ts.\n */\nexport const VERSION = '5.
|
|
1
|
+
{"version":3,"sources":["../version.ts","../commands/shared.ts"],"sourcesContent":["/**\n * Velix CLI version — single source of truth.\n * Keep in sync with packages/velix/version.ts.\n */\nexport const VERSION = '5.2.3';\n","/**\n * Shared CLI utilities — logger, banner, helpers\n */\nimport pc from 'picocolors';\nimport fs from 'fs';\nimport path from 'path';\nimport { VERSION } from '../version.js';\n\nexport const log = {\n info: (msg: string) => console.log(` ${pc.cyan('ℹ')} ${msg}`),\n success: (msg: string) => console.log(` ${pc.green('✔')} ${msg}`),\n warn: (msg: string) => console.log(` ${pc.yellow('⚠')} ${pc.yellow(msg)}`),\n error: (msg: string) => console.log(` ${pc.red('✖')} ${pc.red(msg)}`),\n blank: () => console.log(''),\n};\n\nexport function showBanner() {\n console.log('');\n console.log(` ${pc.cyan('▲')} ${pc.bold('Velix')} ${pc.dim(`v${VERSION}`)}`);\n console.log(` ${pc.dim('──────────────────────────────────────────────')}`);\n console.log('');\n}\n\nexport function writeFile(filePath: string, content: string) {\n fs.mkdirSync(path.dirname(filePath), { recursive: true });\n fs.writeFileSync(filePath, content);\n}\n\nexport function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\nexport function pascalCase(str: string): string {\n return str.split(/[-_\\/]/).map(s => capitalize(s)).join('');\n}\n\nexport function camelCase(str: string): string {\n const pascal = pascalCase(str);\n return pascal.charAt(0).toLowerCase() + pascal.slice(1);\n}\n"],"mappings":";AAIO,IAAM,UAAU;;;ACDvB,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,OAAO,UAAU;AAGV,IAAM,MAAM;AAAA,EACjB,MAAM,CAAC,QAAgB,QAAQ,IAAI,KAAK,GAAG,KAAK,QAAG,CAAC,IAAI,GAAG,EAAE;AAAA,EAC7D,SAAS,CAAC,QAAgB,QAAQ,IAAI,KAAK,GAAG,MAAM,QAAG,CAAC,IAAI,GAAG,EAAE;AAAA,EACjE,MAAM,CAAC,QAAgB,QAAQ,IAAI,KAAK,GAAG,OAAO,QAAG,CAAC,IAAI,GAAG,OAAO,GAAG,CAAC,EAAE;AAAA,EAC1E,OAAO,CAAC,QAAgB,QAAQ,IAAI,KAAK,GAAG,IAAI,QAAG,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,EAAE;AAAA,EACrE,OAAO,MAAM,QAAQ,IAAI,EAAE;AAC7B;AAEO,SAAS,aAAa;AAC3B,UAAQ,IAAI,EAAE;AACd,UAAQ,IAAI,KAAK,GAAG,KAAK,QAAG,CAAC,IAAI,GAAG,KAAK,OAAO,CAAC,IAAI,GAAG,IAAI,IAAI,OAAO,EAAE,CAAC,EAAE;AAC5E,UAAQ,IAAI,KAAK,GAAG,IAAI,sRAAgD,CAAC,EAAE;AAC3E,UAAQ,IAAI,EAAE;AAChB;AAEO,SAAS,UAAU,UAAkB,SAAiB;AAC3D,KAAG,UAAU,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAK,CAAC;AACxD,KAAG,cAAc,UAAU,OAAO;AACpC;AAEO,SAAS,WAAW,KAAqB;AAC9C,SAAO,IAAI,OAAO,CAAC,EAAE,YAAY,IAAI,IAAI,MAAM,CAAC;AAClD;AAEO,SAAS,WAAW,KAAqB;AAC9C,SAAO,IAAI,MAAM,QAAQ,EAAE,IAAI,OAAK,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE;AAC5D;AAEO,SAAS,UAAU,KAAqB;AAC7C,QAAM,SAAS,WAAW,GAAG;AAC7B,SAAO,OAAO,OAAO,CAAC,EAAE,YAAY,IAAI,OAAO,MAAM,CAAC;AACxD;","names":[]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
log,
|
|
4
4
|
showBanner,
|
|
5
5
|
writeFile
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WOZEFISO.js";
|
|
7
7
|
|
|
8
8
|
// commands/create.ts
|
|
9
9
|
import fs from "fs";
|
|
@@ -367,4 +367,4 @@ export function POST(_request: Request) {
|
|
|
367
367
|
export {
|
|
368
368
|
createCommand
|
|
369
369
|
};
|
|
370
|
-
//# sourceMappingURL=create-
|
|
370
|
+
//# sourceMappingURL=create-AWDG24NS.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log,
|
|
3
3
|
showBanner
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WOZEFISO.js";
|
|
5
5
|
|
|
6
6
|
// commands/dev.ts
|
|
7
7
|
import fs from "fs";
|
|
@@ -34,4 +34,4 @@ async function devCommand() {
|
|
|
34
34
|
export {
|
|
35
35
|
devCommand
|
|
36
36
|
};
|
|
37
|
-
//# sourceMappingURL=dev-
|
|
37
|
+
//# sourceMappingURL=dev-UNK6CBTQ.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
VERSION,
|
|
3
3
|
log,
|
|
4
4
|
showBanner
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-WOZEFISO.js";
|
|
6
6
|
|
|
7
7
|
// commands/doctor.ts
|
|
8
8
|
import fs from "fs";
|
|
@@ -44,4 +44,4 @@ export {
|
|
|
44
44
|
doctorCommand,
|
|
45
45
|
infoCommand
|
|
46
46
|
};
|
|
47
|
-
//# sourceMappingURL=doctor-
|
|
47
|
+
//# sourceMappingURL=doctor-MK7AEFZ5.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
capitalize,
|
|
4
4
|
log,
|
|
5
5
|
pascalCase
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WOZEFISO.js";
|
|
7
7
|
|
|
8
8
|
// commands/generate.ts
|
|
9
9
|
import fs from "fs";
|
|
@@ -137,32 +137,41 @@ export function use${pascalCase(n)}() {
|
|
|
137
137
|
}
|
|
138
138
|
`
|
|
139
139
|
}),
|
|
140
|
-
error: () => ({
|
|
141
|
-
path: `app/error.tsx`,
|
|
142
|
-
content:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
<
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
`
|
|
140
|
+
error: (n) => ({
|
|
141
|
+
path: n ? `app/${n}/error.tsx` : `app/error.tsx`,
|
|
142
|
+
content: [
|
|
143
|
+
`import { defineError } from 'velix';`,
|
|
144
|
+
``,
|
|
145
|
+
`export default defineError(({ error, reset }) => {`,
|
|
146
|
+
` return (`,
|
|
147
|
+
` <div>`,
|
|
148
|
+
` <h1>Something went wrong</h1>`,
|
|
149
|
+
` <p>{error.message}</p>`,
|
|
150
|
+
` {(error as any).status && <p>Status: {(error as any).status}</p>}`,
|
|
151
|
+
` <button onClick={reset}>Try again</button>`,
|
|
152
|
+
` <a href="/">Go home</a>`,
|
|
153
|
+
` </div>`,
|
|
154
|
+
` );`,
|
|
155
|
+
`});`,
|
|
156
|
+
``
|
|
157
|
+
].join("\n")
|
|
154
158
|
}),
|
|
155
|
-
"not-found": () => ({
|
|
156
|
-
path: `app/not-found.tsx`,
|
|
157
|
-
content:
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
`
|
|
159
|
+
"not-found": (n) => ({
|
|
160
|
+
path: n ? `app/${n}/not-found.tsx` : `app/not-found.tsx`,
|
|
161
|
+
content: [
|
|
162
|
+
`import { defineNotFound } from 'velix';`,
|
|
163
|
+
``,
|
|
164
|
+
`export default defineNotFound(() => {`,
|
|
165
|
+
` return (`,
|
|
166
|
+
` <div>`,
|
|
167
|
+
` <h1>404</h1>`,
|
|
168
|
+
` <p>This page could not be found.</p>`,
|
|
169
|
+
` <a href="/">Go home</a>`,
|
|
170
|
+
` </div>`,
|
|
171
|
+
` );`,
|
|
172
|
+
`});`,
|
|
173
|
+
``
|
|
174
|
+
].join("\n")
|
|
166
175
|
})
|
|
167
176
|
};
|
|
168
177
|
const generator = templates[type];
|
|
@@ -189,4 +198,4 @@ export default function Error({ error, reset }: { error: Error; reset: () => voi
|
|
|
189
198
|
export {
|
|
190
199
|
generateCommand
|
|
191
200
|
};
|
|
192
|
-
//# sourceMappingURL=generate-
|
|
201
|
+
//# sourceMappingURL=generate-JKGPDHH7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../commands/generate.ts"],"sourcesContent":["/**\n * `velix g <type> <name>` — Generate component/page/api/...\n */\nimport fs from 'fs';\nimport path from 'path';\nimport pc from 'picocolors';\nimport prompts from 'prompts';\nimport { log, writeFile, capitalize, pascalCase, camelCase } from './shared.js';\n\nexport async function generateCommand(type?: string, name?: string) {\n const validTypes = ['page', 'layout', 'component', 'hook', 'api', 'action', 'middleware', 'context', 'loading', 'error', 'not-found'];\n\n if (!type) {\n const { type: selectedType } = await prompts({\n type: 'select',\n name: 'type',\n message: 'What do you want to generate?',\n choices: validTypes.map(t => ({ title: t, value: t })),\n });\n type = selectedType;\n if (!type) process.exit(0);\n }\n\n if (!validTypes.includes(type)) {\n log.error(`Invalid type: ${type}. Valid: ${validTypes.join(', ')}`);\n process.exit(1);\n }\n\n if (!name && !['loading', 'error', 'not-found'].includes(type)) {\n const { name: inputName } = await prompts({\n type: 'text',\n name: 'name',\n message: `${type} name:`,\n });\n name = inputName;\n if (!name) process.exit(0);\n }\n\n const templates: Record<string, (n: string) => { path: string; content: string }> = {\n page: (n) => ({\n path: `app/${n}/page.tsx`,\n content: `export const metadata = {\\n title: \"${capitalize(n)}\",\\n};\\n\\nexport default function ${pascalCase(n)}Page() {\\n return (\\n <main>\\n <h1>${capitalize(n)}</h1>\\n </main>\\n );\\n}\\n`\n }),\n layout: (n) => ({\n path: `app/${n}/layout.tsx`,\n content: `export default function ${pascalCase(n)}Layout({ children }: { children: React.ReactNode }) {\\n return <div>{children}</div>;\\n}\\n`\n }),\n component: (n) => ({\n path: `components/${pascalCase(n)}.tsx`,\n content: `interface ${pascalCase(n)}Props {\\n // props\\n}\\n\\nexport default function ${pascalCase(n)}({}: ${pascalCase(n)}Props) {\\n return <div>${pascalCase(n)}</div>;\\n}\\n`\n }),\n hook: (n) => ({\n path: `hooks/use${pascalCase(n)}.ts`,\n content: `import { useState } from 'react';\\n\\nexport function use${pascalCase(n)}() {\\n const [state, setState] = useState(null);\\n return { state, setState };\\n}\\n`\n }),\n api: (n) => ({\n path: `server/api/${n}.ts`,\n content: `export function GET(_request: Request) {\\n return Response.json({ message: \"Hello from ${n}\" });\\n}\\n\\nexport function POST(_request: Request) {\\n return Response.json({ received: true });\\n}\\n`\n }),\n action: (n) => ({\n path: `server/actions/${n}.ts`,\n content: `'use server';\\n\\nexport async function ${camelCase(n)}Action(_prevState: unknown, formData: FormData) {\\n // Server action logic\\n return { success: true };\\n}\\n`\n }),\n middleware: (n) => ({\n path: `middleware/${n}.ts`,\n content: `export default async function ${camelCase(n)}Middleware(req: Request, res: Response, next: () => Promise<void>) {\\n // Middleware logic\\n await next();\\n}\\n`\n }),\n context: (n) => ({\n path: `contexts/${pascalCase(n)}Context.tsx`,\n content: `'use client';\\nimport { createContext, useContext, type ReactNode } from 'react';\\n\\ninterface ${pascalCase(n)}ContextType {\\n // context values\\n}\\n\\nconst ${pascalCase(n)}Context = createContext<${pascalCase(n)}ContextType | null>(null);\\n\\nexport function ${pascalCase(n)}Provider({ children }: { children: ReactNode }) {\\n return <${pascalCase(n)}Context.Provider value={{}}>{children}</${pascalCase(n)}Context.Provider>;\\n}\\n\\nexport function use${pascalCase(n)}() {\\n const ctx = useContext(${pascalCase(n)}Context);\\n if (!ctx) throw new Error('use${pascalCase(n)} must be used within ${pascalCase(n)}Provider');\\n return ctx;\\n}\\n`\n }),\n loading: () => ({\n path: `app/loading.tsx`,\n content: `export default function Loading() {\\n return <div>Loading...</div>;\\n}\\n`\n }),\n error: (n) => ({\n path: n ? `app/${n}/error.tsx` : `app/error.tsx`,\n content: [\n `import { defineError } from 'velix';`,\n ``,\n `export default defineError(({ error, reset }) => {`,\n ` return (`,\n ` <div>`,\n ` <h1>Something went wrong</h1>`,\n ` <p>{error.message}</p>`,\n ` {(error as any).status && <p>Status: {(error as any).status}</p>}`,\n ` <button onClick={reset}>Try again</button>`,\n ` <a href=\"/\">Go home</a>`,\n ` </div>`,\n ` );`,\n `});`,\n ``,\n ].join('\\n'),\n }),\n 'not-found': (n) => ({\n path: n ? `app/${n}/not-found.tsx` : `app/not-found.tsx`,\n content: [\n `import { defineNotFound } from 'velix';`,\n ``,\n `export default defineNotFound(() => {`,\n ` return (`,\n ` <div>`,\n ` <h1>404</h1>`,\n ` <p>This page could not be found.</p>`,\n ` <a href=\"/\">Go home</a>`,\n ` </div>`,\n ` );`,\n `});`,\n ``,\n ].join('\\n'),\n }),\n };\n\n const generator = templates[type!];\n if (!generator) { log.error(`No template for type: ${type}`); process.exit(1); }\n\n const { path: filePath, content } = generator(name || '');\n const fullPath = path.resolve(process.cwd(), filePath);\n\n if (fs.existsSync(fullPath)) {\n log.warn(`File already exists: ${filePath}`);\n const { overwrite } = await prompts({\n type: 'confirm', name: 'overwrite', message: 'Overwrite?', initial: false,\n });\n if (!overwrite) process.exit(0);\n }\n\n fs.mkdirSync(path.dirname(fullPath), { recursive: true });\n fs.writeFileSync(fullPath, content);\n log.success(`Created ${pc.cyan(filePath)}`);\n}\n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;AAAA,MAAc,SAAS;AAAA,IACtE,CAAC;AACD,QAAI,CAAC,UAAW,SAAQ,KAAK,CAAC;AAAA,EAChC;AAEA,KAAG,UAAU,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAK,CAAC;AACxD,KAAG,cAAc,UAAU,OAAO;AAClC,MAAI,QAAQ,WAAW,GAAG,KAAK,QAAQ,CAAC,EAAE;AAC5C;","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
VERSION,
|
|
4
4
|
log,
|
|
5
5
|
showBanner
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WOZEFISO.js";
|
|
7
7
|
|
|
8
8
|
// index.ts
|
|
9
9
|
import pc from "picocolors";
|
|
@@ -45,38 +45,38 @@ async function main() {
|
|
|
45
45
|
}
|
|
46
46
|
switch (command) {
|
|
47
47
|
case "create": {
|
|
48
|
-
const { createCommand } = await import("./create-
|
|
48
|
+
const { createCommand } = await import("./create-AWDG24NS.js");
|
|
49
49
|
await createCommand(args[1]);
|
|
50
50
|
break;
|
|
51
51
|
}
|
|
52
52
|
case "dev": {
|
|
53
|
-
const { devCommand } = await import("./dev-
|
|
53
|
+
const { devCommand } = await import("./dev-UNK6CBTQ.js");
|
|
54
54
|
await devCommand();
|
|
55
55
|
break;
|
|
56
56
|
}
|
|
57
57
|
case "build": {
|
|
58
|
-
const { buildCommand } = await import("./build-
|
|
58
|
+
const { buildCommand } = await import("./build-GQNE2ERF.js");
|
|
59
59
|
await buildCommand();
|
|
60
60
|
break;
|
|
61
61
|
}
|
|
62
62
|
case "start": {
|
|
63
|
-
const { startCommand } = await import("./build-
|
|
63
|
+
const { startCommand } = await import("./build-GQNE2ERF.js");
|
|
64
64
|
await startCommand();
|
|
65
65
|
break;
|
|
66
66
|
}
|
|
67
67
|
case "g":
|
|
68
68
|
case "generate": {
|
|
69
|
-
const { generateCommand } = await import("./generate-
|
|
69
|
+
const { generateCommand } = await import("./generate-JKGPDHH7.js");
|
|
70
70
|
await generateCommand(args[1], args[2]);
|
|
71
71
|
break;
|
|
72
72
|
}
|
|
73
73
|
case "doctor": {
|
|
74
|
-
const { doctorCommand } = await import("./doctor-
|
|
74
|
+
const { doctorCommand } = await import("./doctor-MK7AEFZ5.js");
|
|
75
75
|
await doctorCommand();
|
|
76
76
|
break;
|
|
77
77
|
}
|
|
78
78
|
case "info": {
|
|
79
|
-
const { infoCommand } = await import("./doctor-
|
|
79
|
+
const { infoCommand } = await import("./doctor-MK7AEFZ5.js");
|
|
80
80
|
await infoCommand();
|
|
81
81
|
break;
|
|
82
82
|
}
|
|
@@ -84,7 +84,7 @@ async function main() {
|
|
|
84
84
|
log.info("Bundle analysis coming soon...");
|
|
85
85
|
break;
|
|
86
86
|
case "ui": {
|
|
87
|
-
const { handleUiCommand } = await import("./ui-
|
|
87
|
+
const { handleUiCommand } = await import("./ui-CWB2QIGT.js");
|
|
88
88
|
await handleUiCommand(args.slice(1));
|
|
89
89
|
break;
|
|
90
90
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log,
|
|
3
3
|
writeFile
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WOZEFISO.js";
|
|
5
5
|
|
|
6
6
|
// commands/ui.ts
|
|
7
7
|
import fs from "fs";
|
|
@@ -77,4 +77,4 @@ Button.displayName = "Button";
|
|
|
77
77
|
export {
|
|
78
78
|
handleUiCommand
|
|
79
79
|
};
|
|
80
|
-
//# sourceMappingURL=ui-
|
|
80
|
+
//# sourceMappingURL=ui-CWB2QIGT.js.map
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../commands/generate.ts"],"sourcesContent":["/**\n * `velix g <type> <name>` — Generate component/page/api/...\n */\nimport fs from 'fs';\nimport path from 'path';\nimport pc from 'picocolors';\nimport prompts from 'prompts';\nimport { log, writeFile, capitalize, pascalCase, camelCase } from './shared.js';\n\nexport async function generateCommand(type?: string, name?: string) {\n const validTypes = ['page', 'layout', 'component', 'hook', 'api', 'action', 'middleware', 'context', 'loading', 'error', 'not-found'];\n\n if (!type) {\n const { type: selectedType } = await prompts({\n type: 'select',\n name: 'type',\n message: 'What do you want to generate?',\n choices: validTypes.map(t => ({ title: t, value: t })),\n });\n type = selectedType;\n if (!type) process.exit(0);\n }\n\n if (!validTypes.includes(type)) {\n log.error(`Invalid type: ${type}. Valid: ${validTypes.join(', ')}`);\n process.exit(1);\n }\n\n if (!name && !['loading', 'error', 'not-found'].includes(type)) {\n const { name: inputName } = await prompts({\n type: 'text',\n name: 'name',\n message: `${type} name:`,\n });\n name = inputName;\n if (!name) process.exit(0);\n }\n\n const templates: Record<string, (n: string) => { path: string; content: string }> = {\n page: (n) => ({\n path: `app/${n}/page.tsx`,\n content: `export const metadata = {\\n title: \"${capitalize(n)}\",\\n};\\n\\nexport default function ${pascalCase(n)}Page() {\\n return (\\n <main>\\n <h1>${capitalize(n)}</h1>\\n </main>\\n );\\n}\\n`\n }),\n layout: (n) => ({\n path: `app/${n}/layout.tsx`,\n content: `export default function ${pascalCase(n)}Layout({ children }: { children: React.ReactNode }) {\\n return <div>{children}</div>;\\n}\\n`\n }),\n component: (n) => ({\n path: `components/${pascalCase(n)}.tsx`,\n content: `interface ${pascalCase(n)}Props {\\n // props\\n}\\n\\nexport default function ${pascalCase(n)}({}: ${pascalCase(n)}Props) {\\n return <div>${pascalCase(n)}</div>;\\n}\\n`\n }),\n hook: (n) => ({\n path: `hooks/use${pascalCase(n)}.ts`,\n content: `import { useState } from 'react';\\n\\nexport function use${pascalCase(n)}() {\\n const [state, setState] = useState(null);\\n return { state, setState };\\n}\\n`\n }),\n api: (n) => ({\n path: `server/api/${n}.ts`,\n content: `export function GET(_request: Request) {\\n return Response.json({ message: \"Hello from ${n}\" });\\n}\\n\\nexport function POST(_request: Request) {\\n return Response.json({ received: true });\\n}\\n`\n }),\n action: (n) => ({\n path: `server/actions/${n}.ts`,\n content: `'use server';\\n\\nexport async function ${camelCase(n)}Action(_prevState: unknown, formData: FormData) {\\n // Server action logic\\n return { success: true };\\n}\\n`\n }),\n middleware: (n) => ({\n path: `middleware/${n}.ts`,\n content: `export default async function ${camelCase(n)}Middleware(req: Request, res: Response, next: () => Promise<void>) {\\n // Middleware logic\\n await next();\\n}\\n`\n }),\n context: (n) => ({\n path: `contexts/${pascalCase(n)}Context.tsx`,\n content: `'use client';\\nimport { createContext, useContext, type ReactNode } from 'react';\\n\\ninterface ${pascalCase(n)}ContextType {\\n // context values\\n}\\n\\nconst ${pascalCase(n)}Context = createContext<${pascalCase(n)}ContextType | null>(null);\\n\\nexport function ${pascalCase(n)}Provider({ children }: { children: ReactNode }) {\\n return <${pascalCase(n)}Context.Provider value={{}}>{children}</${pascalCase(n)}Context.Provider>;\\n}\\n\\nexport function use${pascalCase(n)}() {\\n const ctx = useContext(${pascalCase(n)}Context);\\n if (!ctx) throw new Error('use${pascalCase(n)} must be used within ${pascalCase(n)}Provider');\\n return ctx;\\n}\\n`\n }),\n loading: () => ({\n path: `app/loading.tsx`,\n content: `export default function Loading() {\\n return <div>Loading...</div>;\\n}\\n`\n }),\n error: () => ({\n path: `app/error.tsx`,\n content: `'use client';\\n\\nexport default function Error({ error, reset }: { error: Error; reset: () => void }) {\\n return (\\n <div>\\n <h2>Something went wrong!</h2>\\n <p>{error.message}</p>\\n <button onClick={reset}>Try again</button>\\n </div>\\n );\\n}\\n`\n }),\n 'not-found': () => ({\n path: `app/not-found.tsx`,\n content: `export default function NotFound() {\\n return (\\n <div>\\n <h1>404 - Not Found</h1>\\n <p>The page you're looking for doesn't exist.</p>\\n </div>\\n );\\n}\\n`\n }),\n };\n\n const generator = templates[type!];\n if (!generator) { log.error(`No template for type: ${type}`); process.exit(1); }\n\n const { path: filePath, content } = generator(name || '');\n const fullPath = path.resolve(process.cwd(), filePath);\n\n if (fs.existsSync(fullPath)) {\n log.warn(`File already exists: ${filePath}`);\n const { overwrite } = await prompts({\n type: 'confirm', name: 'overwrite', message: 'Overwrite?', initial: false,\n });\n if (!overwrite) process.exit(0);\n }\n\n fs.mkdirSync(path.dirname(fullPath), { recursive: true });\n fs.writeFileSync(fullPath, content);\n log.success(`Created ${pc.cyan(filePath)}`);\n}\n"],"mappings":";;;;;;;;AAGA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,OAAO,aAAa;AAGpB,eAAsB,gBAAgB,MAAe,MAAe;AAClE,QAAM,aAAa,CAAC,QAAQ,UAAU,aAAa,QAAQ,OAAO,UAAU,cAAc,WAAW,WAAW,SAAS,WAAW;AAEpI,MAAI,CAAC,MAAM;AACT,UAAM,EAAE,MAAM,aAAa,IAAI,MAAM,QAAQ;AAAA,MAC3C,MAAM;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAS,WAAW,IAAI,QAAM,EAAE,OAAO,GAAG,OAAO,EAAE,EAAE;AAAA,IACvD,CAAC;AACD,WAAO;AACP,QAAI,CAAC,KAAM,SAAQ,KAAK,CAAC;AAAA,EAC3B;AAEA,MAAI,CAAC,WAAW,SAAS,IAAI,GAAG;AAC9B,QAAI,MAAM,iBAAiB,IAAI,YAAY,WAAW,KAAK,IAAI,CAAC,EAAE;AAClE,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,MAAI,CAAC,QAAQ,CAAC,CAAC,WAAW,SAAS,WAAW,EAAE,SAAS,IAAI,GAAG;AAC9D,UAAM,EAAE,MAAM,UAAU,IAAI,MAAM,QAAQ;AAAA,MACxC,MAAM;AAAA,MACN,MAAM;AAAA,MACN,SAAS,GAAG,IAAI;AAAA,IAClB,CAAC;AACD,WAAO;AACP,QAAI,CAAC,KAAM,SAAQ,KAAK,CAAC;AAAA,EAC3B;AAEA,QAAM,YAA8E;AAAA,IAClF,MAAM,CAAC,OAAO;AAAA,MACZ,MAAM,OAAO,CAAC;AAAA,MACd,SAAS;AAAA,YAAwC,WAAW,CAAC,CAAC;AAAA;AAAA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