@forinda/kickjs-cli 8.17.3 → 8.17.4
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/{agent-docs-BkQx62G6.mjs → agent-docs-BKbdsDUQ.mjs} +16 -16
- package/dist/{agent-docs-BkQx62G6.mjs.map → agent-docs-BKbdsDUQ.mjs.map} +1 -1
- package/dist/{agent-docs-BxHRHi1r.mjs → agent-docs-sMPVd5vN.mjs} +11 -11
- package/dist/build-DWbnilcJ.mjs +12 -0
- package/dist/build-NyFTqWDy.mjs +13 -0
- package/dist/{build-CARdsp9F.mjs.map → build-NyFTqWDy.mjs.map} +1 -1
- package/dist/{builtins-Cb02IU36.mjs → builtins-DaPdtAiN.mjs} +2 -2
- package/dist/{builtins-BOWp16P2.mjs → builtins-MVDZcuck.mjs} +9 -9
- package/dist/cli.mjs +2 -2
- package/dist/{config-CadmyiYh.mjs → config-BVw4TFDJ.mjs} +2 -2
- package/dist/{config-DoZ1J2Kh.mjs → config-kPWo_HS4.mjs} +3 -3
- package/dist/{config-DoZ1J2Kh.mjs.map → config-kPWo_HS4.mjs.map} +1 -1
- package/dist/{doctor-C4bdYrM6.mjs → doctor-Bmm7jTXk.mjs} +8 -8
- package/dist/{doctor-C4bdYrM6.mjs.map → doctor-Bmm7jTXk.mjs.map} +1 -1
- package/dist/{fullstack-DjV35qtY.mjs → fullstack-Dj6nndJI.mjs} +4 -4
- package/dist/{fullstack-DjV35qtY.mjs.map → fullstack-Dj6nndJI.mjs.map} +1 -1
- package/dist/{fullstack-CiPh1wb_.mjs → fullstack-HXrTvDQS.mjs} +10 -10
- package/dist/index.d.mts +0 -50
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{plugin-D8VpKAVP.mjs → plugin-CEIikRk4.mjs} +2 -2
- package/dist/{plugin-BAlAQlkw.mjs → plugin-DxBBBZKs.mjs} +2 -2
- package/dist/{project-Bjk2dJc2.mjs → project--dWQ_c8m.mjs} +31 -18
- package/dist/{project-CzMPptXL.mjs → project-BFGUN5KK.mjs} +20 -7
- package/dist/{project-CzMPptXL.mjs.map → project-BFGUN5KK.mjs.map} +1 -1
- package/dist/{project-root-BHqLKyr9.mjs → project-root-CKK8LRzQ.mjs} +3 -3
- package/dist/{project-root-BHqLKyr9.mjs.map → project-root-CKK8LRzQ.mjs.map} +1 -1
- package/dist/{project-root-Ck8UKRHG.mjs → project-root-tvtMzer4.mjs} +2 -2
- package/dist/{rolldown-runtime-BjnQdm0J.mjs → rolldown-runtime-BxKUidhj.mjs} +1 -1
- package/dist/{run-plugins-BrI7b2Y5.mjs → run-plugins-CisH0EMY.mjs} +147 -147
- package/dist/{run-plugins-BrI7b2Y5.mjs.map → run-plugins-CisH0EMY.mjs.map} +1 -1
- package/dist/{typegen-D17TQ6Uy.mjs → typegen-_fQVGRr8.mjs} +5 -5
- package/dist/{typegen-D17TQ6Uy.mjs.map → typegen-_fQVGRr8.mjs.map} +1 -1
- package/dist/{typegen-0Ffq-YuL.mjs → typegen-dZuP30n-.mjs} +4 -4
- package/dist/{types-Bp0MoCVq.mjs → types-DNpeagtq.mjs} +1 -1
- package/package.json +8 -8
- package/templates/feature-storage/files/_dot_env.example.append +6 -0
- package/templates/feature-storage/files/src/adapters/storage.ts +2 -2
- package/dist/build-CARdsp9F.mjs +0 -13
- package/dist/build-I3pY30S2.mjs +0 -12
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.17.
|
|
2
|
+
* @forinda/kickjs-cli v8.17.4
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{C as e,c as t,l as n}from"./agent-docs-
|
|
11
|
+
import{C as e,c as t,l as n}from"./agent-docs-BKbdsDUQ.mjs";import{i as r,p as i}from"./config-kPWo_HS4.mjs";import{C as a,S as o,b as s,c,i as l,n as u,v as d}from"./project-BFGUN5KK.mjs";import{join as f}from"node:path";import{execFileSync as p}from"node:child_process";const m=`https://kickjs.app/guide/fullstack-frontend.html`,h=[{value:`react-ts`,label:`React`},{value:`react-compiler-ts`,label:`React + Compiler`},{value:`vue-ts`,label:`Vue`},{value:`svelte-ts`,label:`Svelte`},{value:`solid-ts`,label:`Solid`},{value:`preact-ts`,label:`Preact`},{value:`lit-ts`,label:`Lit`},{value:`qwik-ts`,label:`Qwik`},{value:`vanilla-ts`,label:`Vanilla`}],g=`react-ts`;function _(e,t,n=g){let r=[`--template`,n,`--no-interactive`,`--no-immediate`];return e===`yarn`||e===`bun`?[e,`create`,`vite`,t,...r]:e===`npm`?[e,`create`,`vite@latest`,t,`--`,...r]:[e,`create`,`vite@latest`,t,...r]}async function v(i){let{name:h,directory:v,schemaLib:S=`zod`,runtime:C=`express`,packages:w=[],frontend:T=`kick`,viteTemplate:E=g}=i,D=[`pnpm`,`npm`,`yarn`,`bun`].includes(i.packageManager),O=D?i.packageManager:`pnpm`,k=v,A=e=>console.log(` ${e}`);i.packageManager!==void 0&&!D&&A(`Warning: unknown package manager '${String(i.packageManager)}' — falling back to pnpm.`),console.log(`\n Creating fullstack KickJS workspace: ${h}\n`),console.log(` Resolving package versions...`);let j=await l(),M=await u({name:`${h}-server`,directory:f(k,`server`),packageManager:O,template:`minimal`,schemaLib:S,runtime:C,packages:w,extraLayers:[`server-fullstack`],approveInstallScripts:!1,platformConfig:!1,initGit:!1,installDeps:!1,spaClientDir:`../web/dist`,versions:j});if(T===`vite`){console.log(`\n Handing web/ to create-vite (${E})...\n`);let[e,...t]=_(O,`web`,E);d(e,t,{cwd:k})}else await e(f(k,`web/package.json`),y(h,j));let N=o(O);await e(f(k,`package.json`),b(h,O,j[`@forinda/kickjs-cli`],N));let P=a(O,N);P&&await e(f(k,`.yarnrc.yml`),P),O===`pnpm`&&await e(f(k,`pnpm-workspace.yaml`),`packages:
|
|
12
12
|
- server
|
|
13
13
|
- web
|
|
14
|
-
`),c(O,k,M.builds);let F=[`fullstack-root`,...T===`vite`?[]:[`web-kick`]],I=t(n(F).files,{name:h,packageManager:O});for(let[t,n]of I)await e(f(k,t),n);await e(f(k,`README.md`),x(h,O,T)),i.deploy?.length&&await s({dir:k,targets:i.deploy,pm:O,force:!0});let{generateAgentDocs:L}=await import(`./agent-docs-
|
|
14
|
+
`),c(O,k,M.builds);let F=[`fullstack-root`,...T===`vite`?[]:[`web-kick`]],I=t(n(F).files,{name:h,packageManager:O});for(let[t,n]of I)await e(f(k,t),n);await e(f(k,`README.md`),x(h,O,T)),i.deploy?.length&&await s({dir:k,targets:i.deploy,pm:O,force:!0});let{generateAgentDocs:L}=await import(`./agent-docs-BKbdsDUQ.mjs`).then(e=>e.t);if(await L({outDir:k,name:h,pm:O,template:`fullstack`,only:`both`,force:!0}),i.installDeps){console.log(`\n Installing workspace dependencies with ${O}...\n`);try{d(O,[`install`],{cwd:k})}catch{console.log(`\n Warning: ${O} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-_fQVGRr8.mjs`).then(e=>e.n);await e({cwd:f(k,`server`),allowDuplicates:!0,silent:!0})}catch{}if(i.initGit)try{p(`git`,[`init`],{cwd:k,stdio:`pipe`}),p(`git`,[`branch`,`-M`,`main`],{cwd:k,stdio:`pipe`}),p(`git`,[`add`,`-A`],{cwd:k,stdio:`pipe`}),p(`git`,[`commit`,`-m`,`chore: initial commit from kick new (fullstack)`],{cwd:k,stdio:`pipe`}),A(`Git repository initialized`)}catch{A(`Warning: git init failed (git may not be installed)`)}console.log(`
|
|
15
15
|
Fullstack workspace scaffolded!`),console.log(),A(`Next steps:`),A(` cd ${h}`),i.installDeps||A(` ${O} install`),O===`pnpm`?A(` pnpm dev # runs server (kick dev) + web (vite) together`):(A(` ${O} run dev:server # terminal 1`),A(` ${O} run dev:web # terminal 2`)),A(``),T===`vite`?(A(`web/ is create-vite output, unwired. To type it against the API:`),A(` ${m}`)):(A(`The web app calls the API through @forinda/kickjs-client —`),A(`edit server/src/modules/hello, run \`${r(O,`kick`)} typegen\` in server/, and`),A(`web/src/App.tsx's types follow.`)),A(``)}function y(e,t){let n=e=>t[e]??`latest`;return`${JSON.stringify({name:`${e}-web`,private:!0,version:`0.0.0`,type:`module`,scripts:{dev:`vite`,build:`tsc --noEmit && vite build`,preview:`vite preview`,typecheck:`tsc --noEmit`},dependencies:{"@forinda/kickjs-client":n(`@forinda/kickjs-client`),react:n(`react`),"react-dom":n(`react-dom`)},devDependencies:{"@forinda/kickjs-vite":n(`@forinda/kickjs-vite`),"@types/react":n(`@types/react`),"@types/react-dom":n(`@types/react-dom`),"@vitejs/plugin-react":n(`@vitejs/plugin-react`),typescript:n(`typescript`),vite:n(`vite`)}},null,2)}\n`}function b(e,t,n,r=o(t)){let i=t===`pnpm`?{dev:`pnpm --parallel -r run dev`,start:`pnpm --filter ./server run start`,"dev:server":`pnpm --filter ./server dev`,"dev:web":`pnpm --filter ./web dev`,build:`pnpm --filter ./server exec kick typegen && pnpm -r run build`,typecheck:`kick typecheck --cwd server && kick typecheck --cwd web --no-typegen`,test:`pnpm --filter ./server test`,format:`cd server && kick format`}:{start:`cd server && ${t} run start`,"dev:server":`cd server && ${t} run dev`,"dev:web":`cd web && ${t} run dev`,build:`cd server && kick typegen && cd .. && ${t} run build:server && ${t} run build:web`,"build:server":`cd server && ${t} run build`,"build:web":`cd web && ${t} run build`,typecheck:`kick typecheck --cwd server && kick typecheck --cwd web --no-typegen`,test:`cd server && ${t} run test`,format:`cd server && kick format`};return`${JSON.stringify({name:e,private:!0,version:`0.0.0`,type:`module`,...r?{packageManager:r}:{},scripts:i,devDependencies:{"@forinda/kickjs-cli":n},workspaces:[`server`,`web`]},null,2)}\n`}function x(e,t,n=`kick`){let a=`# ${e}
|
|
16
16
|
|
|
17
17
|
Fullstack KickJS workspace — typed end to end.
|
|
@@ -108,4 +108,4 @@ Four steps — typed client, \`/api\` dev proxy, route-map types, \`src/api.ts\`
|
|
|
108
108
|
|
|
109
109
|
${m}
|
|
110
110
|
`}export{g as DEFAULT_VITE_TEMPLATE,h as VITE_TEMPLATES,v as initFullstackProject};
|
|
111
|
-
//# sourceMappingURL=fullstack-
|
|
111
|
+
//# sourceMappingURL=fullstack-Dj6nndJI.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fullstack-DjV35qtY.mjs","names":["writeFileSafe","fillVars","renderLayers","execBin","runScript","yarnrc","packageManagerSpec","generateDeploy","resolveSiblingVersions","initProject","runCommand","FRONTEND_WIRING_URL","VITE_TEMPLATES","DEFAULT_VITE_TEMPLATE","createViteCommand","flags","template","pm","dir","initFullstackProject","options","pmValid","packageManager","directory","log","msg","name","versions","server","join","frontend","viteTemplate","file","args","webPackageJson","pmSpec","rootPackageJson","yarnConfig","approveInstallScripts","layers","files","path","contents","rootReadme","n","generateAgentDocs","runTypegen","execFileSync","dep","pkg","scripts","cliVersion","readme","typeLoop"],"sources":["../src/generators/fullstack.ts"],"sourcesContent":["// `kick new --template fullstack` — a pnpm-workspace monorepo:\n//\n// my-app/\n// server/ KickJS API (the standard scaffold, minus its own git/install)\n// web/ Vite + React frontend typed end-to-end via\n// @forinda/kickjs-client + the server's generated KickClientApi.Api\n//\n// The type loop: server controllers use return-value handlers → `kick\n// typegen` (run here once, then by the root `build` script and `kick dev` startup — not on save) emits\n// server/.kickjs/types/kick__client.d.ts → web tsconfig `types` (ambient)\n// side-effect-imports that file (type-only, erased at runtime) → the web\n// client calls `api.get('/hello')` with the handler's actual response type.\n\nimport { join } from 'node:path'\nimport { execFileSync } from 'node:child_process'\n\nimport { writeFileSafe } from '../utils/fs'\nimport { execBin, runScript, type PackageManager } from '../config'\nimport { packageManagerSpec, yarnrc } from './templates/project-config'\nimport { generateDeploy, type DeployTarget } from './deploy'\nimport { runCommand } from '../utils/shell'\nimport { initProject, resolveSiblingVersions } from './project'\nimport { approveInstallScripts } from '../commands/add'\nimport { fillVars, renderLayers } from '../scaffold/overlay'\n\n/** Wiring a frontend we did not scaffold: typed client, proxy, route types. */\nexport const FRONTEND_WIRING_URL = 'https://kickjs.app/guide/fullstack-frontend.html'\n\n/**\n * create-vite's TypeScript templates, in the order it lists them. Only the\n * `-ts` half: the wiring is typed — the route map is a `.d.ts` and the client\n * is `createClient<KickClientApi.Api>` — so a JavaScript template would leave\n * the reader following a guide that cannot apply.\n */\nexport const VITE_TEMPLATES = [\n { value: 'react-ts', label: 'React' },\n { value: 'react-compiler-ts', label: 'React + Compiler' },\n { value: 'vue-ts', label: 'Vue' },\n { value: 'svelte-ts', label: 'Svelte' },\n { value: 'solid-ts', label: 'Solid' },\n { value: 'preact-ts', label: 'Preact' },\n { value: 'lit-ts', label: 'Lit' },\n { value: 'qwik-ts', label: 'Qwik' },\n { value: 'vanilla-ts', label: 'Vanilla' },\n] as const\n\nexport const DEFAULT_VITE_TEMPLATE = 'react-ts'\n\n/**\n * How each package manager runs create-vite, with the framework decided here\n * rather than by its prompts:\n *\n * - `--template` picks a TypeScript template, so the wiring guide applies;\n * - `--no-interactive` means it never waits for input (CI, `--yes`);\n * - `--no-immediate` stops it installing and launching a dev server — the\n * workspace install happens once, at the root, after this returns.\n */\nexport function createViteCommand(\n pm: 'pnpm' | 'npm' | 'yarn' | 'bun',\n dir: string,\n template: string = DEFAULT_VITE_TEMPLATE,\n): string[] {\n const flags = ['--template', template, '--no-interactive', '--no-immediate']\n // yarn and bun resolve `create vite` to create-vite themselves; npm and pnpm\n // take the versioned package name, and npm needs `--` before the flags or it\n // eats them itself.\n if (pm === 'yarn' || pm === 'bun') return [pm, 'create', 'vite', dir, ...flags]\n if (pm === 'npm') return [pm, 'create', 'vite@latest', dir, '--', ...flags]\n return [pm, 'create', 'vite@latest', dir, ...flags]\n}\n\nexport interface InitFullstackOptions {\n name: string\n directory: string\n packageManager?: 'pnpm' | 'npm' | 'yarn' | 'bun'\n /**\n * Who scaffolds `web/`. `'kick'` writes the wired React app (typed client,\n * dev proxy, route-map types). `'vite'` hands the directory to\n * `create-vite` and wires nothing — you pick the framework, and the guide\n * at {@link FRONTEND_WIRING_URL} covers connecting it.\n */\n frontend?: 'kick' | 'vite'\n /** create-vite template for `frontend: 'vite'`. Default `react-ts`. */\n viteTemplate?: string\n initGit?: boolean\n installDeps?: boolean\n schemaLib?: 'zod' | 'valibot' | 'yup'\n runtime?: 'express' | 'fastify' | 'h3'\n /** Optional packages (`--packages`), wired into the server like a plain scaffold. */\n packages?: string[]\n /** Deploy targets to write files for, at the workspace root — `kick new --deploy`. */\n deploy?: DeployTarget[]\n}\n\nexport async function initFullstackProject(options: InitFullstackOptions): Promise<void> {\n const {\n name,\n directory,\n schemaLib = 'zod',\n runtime = 'express',\n packages = [],\n frontend = 'kick',\n viteTemplate = DEFAULT_VITE_TEMPLATE,\n } = options\n // `--pm` arrives as a free CLI string — allowlist before it reaches a\n // process invocation (execFileSync takes an argv array, no shell, but a\n // bogus binary name is still a confusing failure).\n const pmValid = (['pnpm', 'npm', 'yarn', 'bun'] as const).includes(\n options.packageManager as never,\n )\n const packageManager = pmValid\n ? (options.packageManager as 'pnpm' | 'npm' | 'yarn' | 'bun')\n : 'pnpm'\n const dir = directory\n const log = (msg: string) => console.log(` ${msg}`)\n if (options.packageManager !== undefined && !pmValid) {\n log(\n `Warning: unknown package manager '${String(options.packageManager)}' — falling back to pnpm.`,\n )\n }\n\n console.log(`\\n Creating fullstack KickJS workspace: ${name}\\n`)\n\n // One map for both packages: the workspace shares a toolchain, so server/\n // and web/ must not end up on different vite or TypeScript majors.\n console.log(' Resolving package versions...')\n const versions = await resolveSiblingVersions()\n\n // ── server/ — the standard scaffold, deferred install/git ──────────\n const server = await initProject({\n name: `${name}-server`,\n directory: join(dir, 'server'),\n packageManager,\n template: 'minimal',\n schemaLib,\n runtime,\n packages,\n // The client route map web/ reads (with the compiler API it needs), and a\n // strict port — web/vite.config.ts proxies /api to it, so moving to\n // another port would silently reach the wrong process.\n extraLayers: ['server-fullstack'],\n // server/ is a workspace member; the root records the approvals.\n approveInstallScripts: false,\n // The root owns the packageManager field and the deploy files.\n platformConfig: false,\n // Root owns install + git so the lockfile/commit cover the workspace.\n initGit: false,\n installDeps: false,\n // Production single-origin serving. `web/` builds to `web/dist`, and\n // nothing served it before — `pnpm build` produced a frontend the API had\n // no way to hand out, so every deploy needed a hand-wired static host or\n // a second process. The adapter is inert until `../web/dist` exists, so\n // `dev` (Vite serves the client and proxies /api here) is untouched.\n spaClientDir: '../web/dist',\n versions,\n })\n\n // ── web/ — either our wired React app, or whatever create-vite makes ──\n if (frontend === 'vite') {\n // create-vite scaffolds it with the chosen TypeScript template. Nothing\n // is patched afterwards: a scaffold we didn't write is not ours to\n // rewrite, and the wiring is four steps in the guide.\n console.log(`\\n Handing web/ to create-vite (${viteTemplate})...\\n`)\n const [file, ...args] = createViteCommand(packageManager, 'web', viteTemplate)\n runCommand(file!, args, { cwd: dir })\n } else {\n // The wired React app (typed client, dev proxy, route-map types): its\n // package.json here, its files from the web-kick layer below.\n await writeFileSafe(join(dir, 'web/package.json'), webPackageJson(name, versions))\n }\n\n // ── workspace root ──────────────────────────────────────────────────\n const pmSpec = packageManagerSpec(packageManager)\n await writeFileSafe(\n join(dir, 'package.json'),\n rootPackageJson(name, packageManager, versions['@forinda/kickjs-cli'], pmSpec),\n )\n const yarnConfig = yarnrc(packageManager, pmSpec)\n if (yarnConfig) await writeFileSafe(join(dir, '.yarnrc.yml'), yarnConfig)\n // Only pnpm reads this file. npm / yarn / bun declare workspaces via the\n // `workspaces` field in the root package.json instead — see rootPackageJson.\n if (packageManager === 'pnpm') {\n await writeFileSafe(join(dir, 'pnpm-workspace.yaml'), 'packages:\\n - server\\n - web\\n')\n }\n // Before install, at the root every package manager reads them from.\n approveInstallScripts(packageManager, dir, server.builds)\n // .gitignore, plus the kick web app's files under web/.\n const layers = ['fullstack-root', ...(frontend === 'vite' ? [] : ['web-kick'])]\n const files = fillVars(renderLayers(layers).files, { name, packageManager })\n for (const [path, contents] of files) {\n await writeFileSafe(join(dir, path), contents)\n }\n await writeFileSafe(join(dir, 'README.md'), rootReadme(name, packageManager, frontend))\n // Deploy files only for the targets asked for — `kick g deploy` from the\n // root adds the rest later.\n if (options.deploy?.length) {\n await generateDeploy({ dir, targets: options.deploy, pm: packageManager, force: true })\n }\n\n // Workspace-root agent docs (CLAUDE.md + .agents/) flavored for the\n // fullstack layout — the server/ subdir keeps its own generated set.\n const { generateAgentDocs } = await import('./agent-docs')\n await generateAgentDocs({\n outDir: dir,\n name,\n pm: packageManager,\n template: 'fullstack',\n only: 'both',\n force: true,\n })\n\n // ── install (root — covers both workspace packages) ────────────────\n if (options.installDeps) {\n console.log(`\\n Installing workspace dependencies with ${packageManager}...\\n`)\n try {\n // `runCommand`, not bare execFileSync — on Windows every package\n // manager is a `.cmd` shim that execFileSync cannot spawn.\n runCommand(packageManager, ['install'], { cwd: dir })\n } catch {\n console.log(`\\n Warning: ${packageManager} install failed. Run it manually.`)\n }\n }\n\n // ── typegen (server) so web's KickClientApi.Api resolves immediately ──\n try {\n const { runTypegen } = await import('../typegen')\n await runTypegen({ cwd: join(dir, 'server'), allowDuplicates: true, silent: true })\n } catch {\n // Non-fatal — `kick typegen` in server/ (or the root `build`) writes it later.\n }\n\n // ── git (root) ──────────────────────────────────────────────────────\n if (options.initGit) {\n try {\n execFileSync('git', ['init'], { cwd: dir, stdio: 'pipe' })\n execFileSync('git', ['branch', '-M', 'main'], { cwd: dir, stdio: 'pipe' })\n execFileSync('git', ['add', '-A'], { cwd: dir, stdio: 'pipe' })\n execFileSync('git', ['commit', '-m', 'chore: initial commit from kick new (fullstack)'], {\n cwd: dir,\n stdio: 'pipe',\n })\n log('Git repository initialized')\n } catch {\n log('Warning: git init failed (git may not be installed)')\n }\n }\n\n console.log('\\n Fullstack workspace scaffolded!')\n console.log()\n log('Next steps:')\n log(` cd ${name}`)\n if (!options.installDeps) log(` ${packageManager} install`)\n if (packageManager === 'pnpm') {\n log(' pnpm dev # runs server (kick dev) + web (vite) together')\n } else {\n log(` ${packageManager} run dev:server # terminal 1`)\n log(` ${packageManager} run dev:web # terminal 2`)\n }\n log('')\n if (frontend === 'vite') {\n // Nothing in web/ knows about the API yet — say so, and say where the\n // four wiring steps live rather than half-wiring someone else's scaffold.\n log('web/ is create-vite output, unwired. To type it against the API:')\n log(` ${FRONTEND_WIRING_URL}`)\n } else {\n log('The web app calls the API through @forinda/kickjs-client —')\n log(\n `edit server/src/modules/hello, run \\`${execBin(packageManager, 'kick')} typegen\\` in server/, and`,\n )\n log(\"web/src/App.tsx's types follow.\")\n }\n log('')\n}\n\n// ── web templates ─────────────────────────────────────────────────────\n\nfunction webPackageJson(name: string, versions: Record<string, string>): string {\n // Every range here is resolved at scaffold time — see THIRD_PARTY_PACKAGES.\n const dep = (pkg: string) => versions[pkg] ?? 'latest'\n return `${JSON.stringify(\n {\n name: `${name}-web`,\n private: true,\n version: '0.0.0',\n type: 'module',\n scripts: {\n dev: 'vite',\n build: 'tsc --noEmit && vite build',\n preview: 'vite preview',\n typecheck: 'tsc --noEmit',\n },\n dependencies: {\n '@forinda/kickjs-client': dep('@forinda/kickjs-client'),\n react: dep('react'),\n 'react-dom': dep('react-dom'),\n },\n devDependencies: {\n '@forinda/kickjs-vite': dep('@forinda/kickjs-vite'),\n '@types/react': dep('@types/react'),\n '@types/react-dom': dep('@types/react-dom'),\n '@vitejs/plugin-react': dep('@vitejs/plugin-react'),\n // Same majors as the server package: one workspace, one toolchain.\n typescript: dep('typescript'),\n vite: dep('vite'),\n },\n },\n null,\n 2,\n )}\\n`\n}\n\n// ── root templates ────────────────────────────────────────────────────\n\nexport function rootPackageJson(\n name: string,\n pm: string,\n cliVersion: string,\n pmSpec = packageManagerSpec(pm),\n): string {\n const scripts: Record<string, string> =\n pm === 'pnpm'\n ? {\n dev: 'pnpm --parallel -r run dev',\n // One origin: the server serves `web/dist` through SpaAdapter.\n start: 'pnpm --filter ./server run start',\n 'dev:server': 'pnpm --filter ./server dev',\n 'dev:web': 'pnpm --filter ./web dev',\n // Typegen first: web's `tsc` reads server/.kickjs/types, which is\n // git-ignored, so a fresh clone (CI, Netlify, Vercel) has none and\n // `pnpm -r run build` races the two packages anyway.\n build: 'pnpm --filter ./server exec kick typegen && pnpm -r run build',\n // No `npx`: the binary is `kick` but the package is\n // `@forinda/kickjs-cli`, so npx cannot map one to the other and\n // falls back to the REGISTRY — where `kick` is an unrelated\n // AngularJS scaffolder. It runs, prints its own help, and exits 0,\n // so this script would pass without type-checking anything.\n //\n // Every package manager puts `node_modules/.bin` on PATH for\n // scripts, so the bare name resolves locally, and a missing install\n // fails loudly instead of fetching a stranger.\n //\n // `--no-typegen` for web: it has no kick project to generate types\n // for (it reads the server's), and typegen there left a stray\n // web/.kickjs behind.\n typecheck: 'kick typecheck --cwd server && kick typecheck --cwd web --no-typegen',\n test: 'pnpm --filter ./server test',\n // The server's own `format` command (kick.config.ts).\n format: 'cd server && kick format',\n }\n : {\n // cd-based scripts — the one form npm, yarn (classic AND berry),\n // and bun all run identically; workspace-filter flags differ per\n // manager (--workspace vs `yarn workspace <name>` vs --filter).\n start: `cd server && ${pm} run start`,\n 'dev:server': `cd server && ${pm} run dev`,\n 'dev:web': `cd web && ${pm} run dev`,\n // Typegen first — see the pnpm branch above. A bare `kick`, not\n // `<pm> exec kick` (`bun exec` runs a shell string): the root depends\n // on the CLI, so scripts have it on PATH — see `typecheck` below.\n build: `cd server && kick typegen && cd .. && ${pm} run build:server && ${pm} run build:web`,\n 'build:server': `cd server && ${pm} run build`,\n 'build:web': `cd web && ${pm} run build`,\n // No `npx`: the binary is `kick` but the package is\n // `@forinda/kickjs-cli`, so npx cannot map one to the other and\n // falls back to the REGISTRY — where `kick` is an unrelated\n // AngularJS scaffolder. It runs, prints its own help, and exits 0,\n // so this script would pass without type-checking anything.\n //\n // Every package manager puts `node_modules/.bin` on PATH for\n // scripts, so the bare name resolves locally, and a missing install\n // fails loudly instead of fetching a stranger.\n typecheck: 'kick typecheck --cwd server && kick typecheck --cwd web --no-typegen',\n test: `cd server && ${pm} run test`,\n // The server's own `format` command (kick.config.ts).\n format: 'cd server && kick format',\n }\n return `${JSON.stringify(\n {\n name,\n private: true,\n version: '0.0.0',\n type: 'module',\n ...(pmSpec ? { packageManager: pmSpec } : {}),\n scripts,\n // The CLI is a ROOT dependency so the bare `kick` in the scripts above\n // resolves: package managers put `node_modules/.bin` on PATH for\n // scripts, and the CLI otherwise lives only in `server/node_modules`.\n devDependencies: { '@forinda/kickjs-cli': cliVersion },\n workspaces: ['server', 'web'],\n },\n null,\n 2,\n )}\\n`\n}\n\nexport function rootReadme(name: string, pm: string, frontend: 'kick' | 'vite' = 'kick'): string {\n const readme = `# ${name}\n\nFullstack KickJS workspace — typed end to end.\n\n| Package | What |\n| --------- | ----------------------------------------------------------------- |\n| \\`server/\\` | KickJS API (decorators, DI, \\`kick dev\\` with typegen watch) |\n| \\`web/\\` | Vite + React, typed against the API via \\`@forinda/kickjs-client\\` |\n\n## Develop\n\n\\`\\`\\`bash\n${pm} install\n${pm === 'pnpm' ? 'pnpm dev # server (kick dev) + web (vite), in parallel' : `${pm} run dev:server # terminal 1\\n${pm} run dev:web # terminal 2`}\n\\`\\`\\`\n\nServer: http://localhost:3000 · Web: http://localhost:5173 (Vite proxies \\`/api\\`).\n\nFrom this root: \\`${runScript(pm as PackageManager, 'test')}\\` (the server's tests), \\`${runScript(pm as PackageManager, 'typecheck')}\\` (both packages),\n\\`${runScript(pm as PackageManager, 'format')}\\` and \\`${runScript(pm as PackageManager, 'build')}\\`. The \\`kick\\` CLI itself runs in \\`server/\\`, which holds\n\\`kick.config.ts\\`: \\`cd server && ${execBin(pm as PackageManager, 'kick')} typegen\\`.\n\n## Deploy\n\nDeploy files are added when you need them, from this folder:\n\n\\`\\`\\`bash\n${execBin(pm as PackageManager, 'kick')} g deploy docker # Dockerfile for the whole app\n${execBin(pm as PackageManager, 'kick')} g deploy netlify vercel # serverless: platform config, entry and build script\n\\`\\`\\`\n\nSee [Serverless](https://kickjs.app/guide/serverless).\n\n## The type loop\n\n1. Server handlers **return** their payloads (\\`return this.service.greet(...)\\`).\n2. \\`kick typegen\\` emits \\`server/.kickjs/types/kick__client.d.ts\\` — the flat\n route map with every response type resolved to a literal shape.\n3. \\`web/tsconfig.json\\` lists that file in \\`types\\`, so \\`KickClientApi\\` is\n ambient — no import, no bridge file.\n4. \\`web/src/api.ts\\`'s \\`createClient<KickClientApi.Api>\\` types every call site.\n\nBecause the map holds resolved types rather than references to controllers,\n\\`web\\` never compiles server source: no \\`experimentalDecorators\\`, no path\naliases into \\`server/src\\`.\n\nRename a field in \\`server/src/modules/hello/hello.service.ts\\` → \\`web/src/App.tsx\\`\nstops compiling. That's the point.\n\n### Keeping the map fresh\n\n\\`server/.kickjs/types/kick__client.d.ts\\` is generated, and \\`web\\` reads it as\nan ambient type package. Two things follow.\n\n**\\`kick dev\\` writes it at startup, not on save.** Resolving it builds a whole TypeScript\nprogram over the server, which is a build-step cost rather than a per-save one,\nso a renamed response field surfaces on the next \\`kick typegen\\` rather than on\nsave. Everything else in \\`.kickjs/types\\` still updates on save. Add\n\\`kick typegen --check\\` to CI and a stale map fails the build.\n\n**It needs a compiler API.** TypeScript 7 ships none, so \\`server\\` depends on\n\\`@typescript/typescript6\\`. Remove it and typegen skips this one file, saying\nso; \\`web\\` then reports \\`TS2688\\` because the file it lists in \\`types\\` is gone.\n\n### The other way to wire it\n\nA \\`types\\` entry says \"this is a global type package\", which is what the map is,\nand it fails loudly when the file is missing. If you would rather it be quiet\nwhen absent — say, a repo where the map is not always generated — use\n\\`include\\` instead:\n\n\\`\\`\\`json\n{ \"include\": [\"src\", \"../server/.kickjs/types/kick__client.d.ts\"] }\n\\`\\`\\`\n\nThat tolerates the file not existing, at the cost of \\`KickClientApi\\` silently\nnot resolving. Note \\`types\\` replaces TypeScript's automatic \\`@types\\`\ninclusion, so if you add entries there, list the ones you rely on too\n(\\`\"types\": [\"node\", \"../server/.kickjs/types/kick__client\"]\\`).\n\nOr skip the global entirely — the same file exports the type:\n\n\\`\\`\\`ts\nimport type { Api } from '../../server/.kickjs/types/kick__client'\n\nexport const api = createClient<Api>({ baseUrl: '/api/v1' })\n\\`\\`\\`\n\nDocs: https://kickjs.app/guide/typed-client.html\n`\n\n if (frontend !== 'vite') return readme\n\n // create-vite's output is not ours to describe: it has no typed client, no\n // proxy and no route-map types until the reader wires them. Everything from\n // \"The type loop\" on is about files that do not exist in that scaffold.\n const typeLoop = readme.indexOf('## The type loop')\n return `${readme\n .slice(0, typeLoop)\n .replace(\n 'Vite + React, typed against the API via `@forinda/kickjs-client`',\n 'create-vite scaffold — unwired (see below) ',\n )\n .replace(' (Vite proxies `/api`)', '')}## Wiring web/ to the API\n\n\\`web/\\` is whatever create-vite scaffolded; nothing connects it to the API yet.\nFour steps — typed client, \\`/api\\` dev proxy, route-map types, \\`src/api.ts\\`:\n\n${FRONTEND_WIRING_URL}\n`\n}\n"],"mappings":";;;;;;;;;;gRA0BA,MAAaW,EAAsB,mDAQtBC,EAAiB,CAC5B,CAAE,MAAO,WAAY,MAAO,OAAQ,EACpC,CAAE,MAAO,oBAAqB,MAAO,kBAAmB,EACxD,CAAE,MAAO,SAAU,MAAO,KAAM,EAChC,CAAE,MAAO,YAAa,MAAO,QAAS,EACtC,CAAE,MAAO,WAAY,MAAO,OAAQ,EACpC,CAAE,MAAO,YAAa,MAAO,QAAS,EACtC,CAAE,MAAO,SAAU,MAAO,KAAM,EAChC,CAAE,MAAO,UAAW,MAAO,MAAO,EAClC,CAAE,MAAO,aAAc,MAAO,SAAU,CAC1C,EAEaC,EAAwB,WAWrC,SAAgBC,EACd,EACA,EACA,EAAmBD,EACT,CACV,IAAME,EAAQ,CAAC,aAAcC,EAAU,mBAAoB,gBAAgB,EAM3E,OAFIC,IAAO,QAAUA,IAAO,MAAc,CAACA,EAAI,SAAU,OAAQC,EAAK,GAAGH,CAAK,EAC1EE,IAAO,MAAc,CAACA,EAAI,SAAU,c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EAAsB,OAAO,EAAE;qCAC7Dd,EAAQc,EAAsB,MAAM,EAAE;;;;;;;EAOzEd,EAAQc,EAAsB,MAAM,EAAE;EACtCd,EAAQc,EAAsB,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+DtC,GAAIa,IAAa,OAAQ,OAAOsB,EAKhC,IAAMC,EAAWD,EAAO,QAAQ,kBAAkB,EAClD,MAAO,GAAGA,EACP,MAAM,EAAGC,CAAQ,CAAC,CAClB,QACC,mEACA,mEACF,CAAC,CACA,QAAQ,yBAA0B,EAAE,EAAE;;;;;EAKzC1C,EAAoB;CAEtB"}
|
|
1
|
+
{"version":3,"file":"fullstack-Dj6nndJI.mjs","names":["writeFileSafe","fillVars","renderLayers","execBin","runScript","yarnrc","packageManagerSpec","generateDeploy","resolveSiblingVersions","initProject","runCommand","FRONTEND_WIRING_URL","VITE_TEMPLATES","DEFAULT_VITE_TEMPLATE","createViteCommand","flags","template","pm","dir","initFullstackProject","options","pmValid","packageManager","directory","log","msg","name","versions","server","join","frontend","viteTemplate","file","args","webPackageJson","pmSpec","rootPackageJson","yarnConfig","approveInstallScripts","layers","files","path","contents","rootReadme","n","generateAgentDocs","runTypegen","execFileSync","dep","pkg","scripts","cliVersion","readme","typeLoop"],"sources":["../src/generators/fullstack.ts"],"sourcesContent":["// `kick new --template fullstack` — a pnpm-workspace monorepo:\n//\n// my-app/\n// server/ KickJS API (the standard scaffold, minus its own git/install)\n// web/ Vite + React frontend typed end-to-end via\n// @forinda/kickjs-client + the server's generated KickClientApi.Api\n//\n// The type loop: server controllers use return-value handlers → `kick\n// typegen` (run here once, then by the root `build` script and `kick dev` startup — not on save) emits\n// server/.kickjs/types/kick__client.d.ts → web tsconfig `types` (ambient)\n// side-effect-imports that file (type-only, erased at runtime) → the web\n// client calls `api.get('/hello')` with the handler's actual response type.\n\nimport { join } from 'node:path'\nimport { execFileSync } from 'node:child_process'\n\nimport { writeFileSafe } from '../utils/fs'\nimport { execBin, runScript, type PackageManager } from '../config'\nimport { packageManagerSpec, yarnrc } from './templates/project-config'\nimport { generateDeploy, type DeployTarget } from './deploy'\nimport { runCommand } from '../utils/shell'\nimport { initProject, resolveSiblingVersions } from './project'\nimport { approveInstallScripts } from '../commands/add'\nimport { fillVars, renderLayers } from '../scaffold/overlay'\n\n/** Wiring a frontend we did not scaffold: typed client, proxy, route types. */\nexport const FRONTEND_WIRING_URL = 'https://kickjs.app/guide/fullstack-frontend.html'\n\n/**\n * create-vite's TypeScript templates, in the order it lists them. Only the\n * `-ts` half: the wiring is typed — the route map is a `.d.ts` and the client\n * is `createClient<KickClientApi.Api>` — so a JavaScript template would leave\n * the reader following a guide that cannot apply.\n */\nexport const VITE_TEMPLATES = [\n { value: 'react-ts', label: 'React' },\n { value: 'react-compiler-ts', label: 'React + Compiler' },\n { value: 'vue-ts', label: 'Vue' },\n { value: 'svelte-ts', label: 'Svelte' },\n { value: 'solid-ts', label: 'Solid' },\n { value: 'preact-ts', label: 'Preact' },\n { value: 'lit-ts', label: 'Lit' },\n { value: 'qwik-ts', label: 'Qwik' },\n { value: 'vanilla-ts', label: 'Vanilla' },\n] as const\n\nexport const DEFAULT_VITE_TEMPLATE = 'react-ts'\n\n/**\n * How each package manager runs create-vite, with the framework decided here\n * rather than by its prompts:\n *\n * - `--template` picks a TypeScript template, so the wiring guide applies;\n * - `--no-interactive` means it never waits for input (CI, `--yes`);\n * - `--no-immediate` stops it installing and launching a dev server — the\n * workspace install happens once, at the root, after this returns.\n */\nexport function createViteCommand(\n pm: 'pnpm' | 'npm' | 'yarn' | 'bun',\n dir: string,\n template: string = DEFAULT_VITE_TEMPLATE,\n): string[] {\n const flags = ['--template', template, '--no-interactive', '--no-immediate']\n // yarn and bun resolve `create vite` to create-vite themselves; npm and pnpm\n // take the versioned package name, and npm needs `--` before the flags or it\n // eats them itself.\n if (pm === 'yarn' || pm === 'bun') return [pm, 'create', 'vite', dir, ...flags]\n if (pm === 'npm') return [pm, 'create', 'vite@latest', dir, '--', ...flags]\n return [pm, 'create', 'vite@latest', dir, ...flags]\n}\n\nexport interface InitFullstackOptions {\n name: string\n directory: string\n packageManager?: 'pnpm' | 'npm' | 'yarn' | 'bun'\n /**\n * Who scaffolds `web/`. `'kick'` writes the wired React app (typed client,\n * dev proxy, route-map types). `'vite'` hands the directory to\n * `create-vite` and wires nothing — you pick the framework, and the guide\n * at {@link FRONTEND_WIRING_URL} covers connecting it.\n */\n frontend?: 'kick' | 'vite'\n /** create-vite template for `frontend: 'vite'`. Default `react-ts`. */\n viteTemplate?: string\n initGit?: boolean\n installDeps?: boolean\n schemaLib?: 'zod' | 'valibot' | 'yup'\n runtime?: 'express' | 'fastify' | 'h3'\n /** Optional packages (`--packages`), wired into the server like a plain scaffold. */\n packages?: string[]\n /** Deploy targets to write files for, at the workspace root — `kick new --deploy`. */\n deploy?: DeployTarget[]\n}\n\nexport async function initFullstackProject(options: InitFullstackOptions): Promise<void> {\n const {\n name,\n directory,\n schemaLib = 'zod',\n runtime = 'express',\n packages = [],\n frontend = 'kick',\n viteTemplate = DEFAULT_VITE_TEMPLATE,\n } = options\n // `--pm` arrives as a free CLI string — allowlist before it reaches a\n // process invocation (execFileSync takes an argv array, no shell, but a\n // bogus binary name is still a confusing failure).\n const pmValid = (['pnpm', 'npm', 'yarn', 'bun'] as const).includes(\n options.packageManager as never,\n )\n const packageManager = pmValid\n ? (options.packageManager as 'pnpm' | 'npm' | 'yarn' | 'bun')\n : 'pnpm'\n const dir = directory\n const log = (msg: string) => console.log(` ${msg}`)\n if (options.packageManager !== undefined && !pmValid) {\n log(\n `Warning: unknown package manager '${String(options.packageManager)}' — falling back to pnpm.`,\n )\n }\n\n console.log(`\\n Creating fullstack KickJS workspace: ${name}\\n`)\n\n // One map for both packages: the workspace shares a toolchain, so server/\n // and web/ must not end up on different vite or TypeScript majors.\n console.log(' Resolving package versions...')\n const versions = await resolveSiblingVersions()\n\n // ── server/ — the standard scaffold, deferred install/git ──────────\n const server = await initProject({\n name: `${name}-server`,\n directory: join(dir, 'server'),\n packageManager,\n template: 'minimal',\n schemaLib,\n runtime,\n packages,\n // The client route map web/ reads (with the compiler API it needs), and a\n // strict port — web/vite.config.ts proxies /api to it, so moving to\n // another port would silently reach the wrong process.\n extraLayers: ['server-fullstack'],\n // server/ is a workspace member; the root records the approvals.\n approveInstallScripts: false,\n // The root owns the packageManager field and the deploy files.\n platformConfig: false,\n // Root owns install + git so the lockfile/commit cover the workspace.\n initGit: false,\n installDeps: false,\n // Production single-origin serving. `web/` builds to `web/dist`, and\n // nothing served it before — `pnpm build` produced a frontend the API had\n // no way to hand out, so every deploy needed a hand-wired static host or\n // a second process. The adapter is inert until `../web/dist` exists, so\n // `dev` (Vite serves the client and proxies /api here) is untouched.\n spaClientDir: '../web/dist',\n versions,\n })\n\n // ── web/ — either our wired React app, or whatever create-vite makes ──\n if (frontend === 'vite') {\n // create-vite scaffolds it with the chosen TypeScript template. Nothing\n // is patched afterwards: a scaffold we didn't write is not ours to\n // rewrite, and the wiring is four steps in the guide.\n console.log(`\\n Handing web/ to create-vite (${viteTemplate})...\\n`)\n const [file, ...args] = createViteCommand(packageManager, 'web', viteTemplate)\n runCommand(file!, args, { cwd: dir })\n } else {\n // The wired React app (typed client, dev proxy, route-map types): its\n // package.json here, its files from the web-kick layer below.\n await writeFileSafe(join(dir, 'web/package.json'), webPackageJson(name, versions))\n }\n\n // ── workspace root ──────────────────────────────────────────────────\n const pmSpec = packageManagerSpec(packageManager)\n await writeFileSafe(\n join(dir, 'package.json'),\n rootPackageJson(name, packageManager, versions['@forinda/kickjs-cli'], pmSpec),\n )\n const yarnConfig = yarnrc(packageManager, pmSpec)\n if (yarnConfig) await writeFileSafe(join(dir, '.yarnrc.yml'), yarnConfig)\n // Only pnpm reads this file. npm / yarn / bun declare workspaces via the\n // `workspaces` field in the root package.json instead — see rootPackageJson.\n if (packageManager === 'pnpm') {\n await writeFileSafe(join(dir, 'pnpm-workspace.yaml'), 'packages:\\n - server\\n - web\\n')\n }\n // Before install, at the root every package manager reads them from.\n approveInstallScripts(packageManager, dir, server.builds)\n // .gitignore, plus the kick web app's files under web/.\n const layers = ['fullstack-root', ...(frontend === 'vite' ? [] : ['web-kick'])]\n const files = fillVars(renderLayers(layers).files, { name, packageManager })\n for (const [path, contents] of files) {\n await writeFileSafe(join(dir, path), contents)\n }\n await writeFileSafe(join(dir, 'README.md'), rootReadme(name, packageManager, frontend))\n // Deploy files only for the targets asked for — `kick g deploy` from the\n // root adds the rest later.\n if (options.deploy?.length) {\n await generateDeploy({ dir, targets: options.deploy, pm: packageManager, force: true })\n }\n\n // Workspace-root agent docs (CLAUDE.md + .agents/) flavored for the\n // fullstack layout — the server/ subdir keeps its own generated set.\n const { generateAgentDocs } = await import('./agent-docs')\n await generateAgentDocs({\n outDir: dir,\n name,\n pm: packageManager,\n template: 'fullstack',\n only: 'both',\n force: true,\n })\n\n // ── install (root — covers both workspace packages) ────────────────\n if (options.installDeps) {\n console.log(`\\n Installing workspace dependencies with ${packageManager}...\\n`)\n try {\n // `runCommand`, not bare execFileSync — on Windows every package\n // manager is a `.cmd` shim that execFileSync cannot spawn.\n runCommand(packageManager, ['install'], { cwd: dir })\n } catch {\n console.log(`\\n Warning: ${packageManager} install failed. Run it manually.`)\n }\n }\n\n // ── typegen (server) so web's KickClientApi.Api resolves immediately ──\n try {\n const { runTypegen } = await import('../typegen')\n await runTypegen({ cwd: join(dir, 'server'), allowDuplicates: true, silent: true })\n } catch {\n // Non-fatal — `kick typegen` in server/ (or the root `build`) writes it later.\n }\n\n // ── git (root) ──────────────────────────────────────────────────────\n if (options.initGit) {\n try {\n execFileSync('git', ['init'], { cwd: dir, stdio: 'pipe' })\n execFileSync('git', ['branch', '-M', 'main'], { cwd: dir, stdio: 'pipe' })\n execFileSync('git', ['add', '-A'], { cwd: dir, stdio: 'pipe' })\n execFileSync('git', ['commit', '-m', 'chore: initial commit from kick new (fullstack)'], {\n cwd: dir,\n stdio: 'pipe',\n })\n log('Git repository initialized')\n } catch {\n log('Warning: git init failed (git may not be installed)')\n }\n }\n\n console.log('\\n Fullstack workspace scaffolded!')\n console.log()\n log('Next steps:')\n log(` cd ${name}`)\n if (!options.installDeps) log(` ${packageManager} install`)\n if (packageManager === 'pnpm') {\n log(' pnpm dev # runs server (kick dev) + web (vite) together')\n } else {\n log(` ${packageManager} run dev:server # terminal 1`)\n log(` ${packageManager} run dev:web # terminal 2`)\n }\n log('')\n if (frontend === 'vite') {\n // Nothing in web/ knows about the API yet — say so, and say where the\n // four wiring steps live rather than half-wiring someone else's scaffold.\n log('web/ is create-vite output, unwired. To type it against the API:')\n log(` ${FRONTEND_WIRING_URL}`)\n } else {\n log('The web app calls the API through @forinda/kickjs-client —')\n log(\n `edit server/src/modules/hello, run \\`${execBin(packageManager, 'kick')} typegen\\` in server/, and`,\n )\n log(\"web/src/App.tsx's types follow.\")\n }\n log('')\n}\n\n// ── web templates ─────────────────────────────────────────────────────\n\nfunction webPackageJson(name: string, versions: Record<string, string>): string {\n // Every range here is resolved at scaffold time — see THIRD_PARTY_PACKAGES.\n const dep = (pkg: string) => versions[pkg] ?? 'latest'\n return `${JSON.stringify(\n {\n name: `${name}-web`,\n private: true,\n version: '0.0.0',\n type: 'module',\n scripts: {\n dev: 'vite',\n build: 'tsc --noEmit && vite build',\n preview: 'vite preview',\n typecheck: 'tsc --noEmit',\n },\n dependencies: {\n '@forinda/kickjs-client': dep('@forinda/kickjs-client'),\n react: dep('react'),\n 'react-dom': dep('react-dom'),\n },\n devDependencies: {\n '@forinda/kickjs-vite': dep('@forinda/kickjs-vite'),\n '@types/react': dep('@types/react'),\n '@types/react-dom': dep('@types/react-dom'),\n '@vitejs/plugin-react': dep('@vitejs/plugin-react'),\n // Same majors as the server package: one workspace, one toolchain.\n typescript: dep('typescript'),\n vite: dep('vite'),\n },\n },\n null,\n 2,\n )}\\n`\n}\n\n// ── root templates ────────────────────────────────────────────────────\n\nexport function rootPackageJson(\n name: string,\n pm: string,\n cliVersion: string,\n pmSpec = packageManagerSpec(pm),\n): string {\n const scripts: Record<string, string> =\n pm === 'pnpm'\n ? {\n dev: 'pnpm --parallel -r run dev',\n // One origin: the server serves `web/dist` through SpaAdapter.\n start: 'pnpm --filter ./server run start',\n 'dev:server': 'pnpm --filter ./server dev',\n 'dev:web': 'pnpm --filter ./web dev',\n // Typegen first: web's `tsc` reads server/.kickjs/types, which is\n // git-ignored, so a fresh clone (CI, Netlify, Vercel) has none and\n // `pnpm -r run build` races the two packages anyway.\n build: 'pnpm --filter ./server exec kick typegen && pnpm -r run build',\n // No `npx`: the binary is `kick` but the package is\n // `@forinda/kickjs-cli`, so npx cannot map one to the other and\n // falls back to the REGISTRY — where `kick` is an unrelated\n // AngularJS scaffolder. It runs, prints its own help, and exits 0,\n // so this script would pass without type-checking anything.\n //\n // Every package manager puts `node_modules/.bin` on PATH for\n // scripts, so the bare name resolves locally, and a missing install\n // fails loudly instead of fetching a stranger.\n //\n // `--no-typegen` for web: it has no kick project to generate types\n // for (it reads the server's), and typegen there left a stray\n // web/.kickjs behind.\n typecheck: 'kick typecheck --cwd server && kick typecheck --cwd web --no-typegen',\n test: 'pnpm --filter ./server test',\n // The server's own `format` command (kick.config.ts).\n format: 'cd server && kick format',\n }\n : {\n // cd-based scripts — the one form npm, yarn (classic AND berry),\n // and bun all run identically; workspace-filter flags differ per\n // manager (--workspace vs `yarn workspace <name>` vs --filter).\n start: `cd server && ${pm} run start`,\n 'dev:server': `cd server && ${pm} run dev`,\n 'dev:web': `cd web && ${pm} run dev`,\n // Typegen first — see the pnpm branch above. A bare `kick`, not\n // `<pm> exec kick` (`bun exec` runs a shell string): the root depends\n // on the CLI, so scripts have it on PATH — see `typecheck` below.\n build: `cd server && kick typegen && cd .. && ${pm} run build:server && ${pm} run build:web`,\n 'build:server': `cd server && ${pm} run build`,\n 'build:web': `cd web && ${pm} run build`,\n // No `npx`: the binary is `kick` but the package is\n // `@forinda/kickjs-cli`, so npx cannot map one to the other and\n // falls back to the REGISTRY — where `kick` is an unrelated\n // AngularJS scaffolder. It runs, prints its own help, and exits 0,\n // so this script would pass without type-checking anything.\n //\n // Every package manager puts `node_modules/.bin` on PATH for\n // scripts, so the bare name resolves locally, and a missing install\n // fails loudly instead of fetching a stranger.\n typecheck: 'kick typecheck --cwd server && kick typecheck --cwd web --no-typegen',\n test: `cd server && ${pm} run test`,\n // The server's own `format` command (kick.config.ts).\n format: 'cd server && kick format',\n }\n return `${JSON.stringify(\n {\n name,\n private: true,\n version: '0.0.0',\n type: 'module',\n ...(pmSpec ? { packageManager: pmSpec } : {}),\n scripts,\n // The CLI is a ROOT dependency so the bare `kick` in the scripts above\n // resolves: package managers put `node_modules/.bin` on PATH for\n // scripts, and the CLI otherwise lives only in `server/node_modules`.\n devDependencies: { '@forinda/kickjs-cli': cliVersion },\n workspaces: ['server', 'web'],\n },\n null,\n 2,\n )}\\n`\n}\n\nexport function rootReadme(name: string, pm: string, frontend: 'kick' | 'vite' = 'kick'): string {\n const readme = `# ${name}\n\nFullstack KickJS workspace — typed end to end.\n\n| Package | What |\n| --------- | ----------------------------------------------------------------- |\n| \\`server/\\` | KickJS API (decorators, DI, \\`kick dev\\` with typegen watch) |\n| \\`web/\\` | Vite + React, typed against the API via \\`@forinda/kickjs-client\\` |\n\n## Develop\n\n\\`\\`\\`bash\n${pm} install\n${pm === 'pnpm' ? 'pnpm dev # server (kick dev) + web (vite), in parallel' : `${pm} run dev:server # terminal 1\\n${pm} run dev:web # terminal 2`}\n\\`\\`\\`\n\nServer: http://localhost:3000 · Web: http://localhost:5173 (Vite proxies \\`/api\\`).\n\nFrom this root: \\`${runScript(pm as PackageManager, 'test')}\\` (the server's tests), \\`${runScript(pm as PackageManager, 'typecheck')}\\` (both packages),\n\\`${runScript(pm as PackageManager, 'format')}\\` and \\`${runScript(pm as PackageManager, 'build')}\\`. The \\`kick\\` CLI itself runs in \\`server/\\`, which holds\n\\`kick.config.ts\\`: \\`cd server && ${execBin(pm as PackageManager, 'kick')} typegen\\`.\n\n## Deploy\n\nDeploy files are added when you need them, from this folder:\n\n\\`\\`\\`bash\n${execBin(pm as PackageManager, 'kick')} g deploy docker # Dockerfile for the whole app\n${execBin(pm as PackageManager, 'kick')} g deploy netlify vercel # serverless: platform config, entry and build script\n\\`\\`\\`\n\nSee [Serverless](https://kickjs.app/guide/serverless).\n\n## The type loop\n\n1. Server handlers **return** their payloads (\\`return this.service.greet(...)\\`).\n2. \\`kick typegen\\` emits \\`server/.kickjs/types/kick__client.d.ts\\` — the flat\n route map with every response type resolved to a literal shape.\n3. \\`web/tsconfig.json\\` lists that file in \\`types\\`, so \\`KickClientApi\\` is\n ambient — no import, no bridge file.\n4. \\`web/src/api.ts\\`'s \\`createClient<KickClientApi.Api>\\` types every call site.\n\nBecause the map holds resolved types rather than references to controllers,\n\\`web\\` never compiles server source: no \\`experimentalDecorators\\`, no path\naliases into \\`server/src\\`.\n\nRename a field in \\`server/src/modules/hello/hello.service.ts\\` → \\`web/src/App.tsx\\`\nstops compiling. That's the point.\n\n### Keeping the map fresh\n\n\\`server/.kickjs/types/kick__client.d.ts\\` is generated, and \\`web\\` reads it as\nan ambient type package. Two things follow.\n\n**\\`kick dev\\` writes it at startup, not on save.** Resolving it builds a whole TypeScript\nprogram over the server, which is a build-step cost rather than a per-save one,\nso a renamed response field surfaces on the next \\`kick typegen\\` rather than on\nsave. Everything else in \\`.kickjs/types\\` still updates on save. Add\n\\`kick typegen --check\\` to CI and a stale map fails the build.\n\n**It needs a compiler API.** TypeScript 7 ships none, so \\`server\\` depends on\n\\`@typescript/typescript6\\`. Remove it and typegen skips this one file, saying\nso; \\`web\\` then reports \\`TS2688\\` because the file it lists in \\`types\\` is gone.\n\n### The other way to wire it\n\nA \\`types\\` entry says \"this is a global type package\", which is what the map is,\nand it fails loudly when the file is missing. If you would rather it be quiet\nwhen absent — say, a repo where the map is not always generated — use\n\\`include\\` instead:\n\n\\`\\`\\`json\n{ \"include\": [\"src\", \"../server/.kickjs/types/kick__client.d.ts\"] }\n\\`\\`\\`\n\nThat tolerates the file not existing, at the cost of \\`KickClientApi\\` silently\nnot resolving. Note \\`types\\` replaces TypeScript's automatic \\`@types\\`\ninclusion, so if you add entries there, list the ones you rely on too\n(\\`\"types\": [\"node\", \"../server/.kickjs/types/kick__client\"]\\`).\n\nOr skip the global entirely — the same file exports the type:\n\n\\`\\`\\`ts\nimport type { Api } from '../../server/.kickjs/types/kick__client'\n\nexport const api = createClient<Api>({ baseUrl: '/api/v1' })\n\\`\\`\\`\n\nDocs: https://kickjs.app/guide/typed-client.html\n`\n\n if (frontend !== 'vite') return readme\n\n // create-vite's output is not ours to describe: it has no typed client, no\n // proxy and no route-map types until the reader wires them. Everything from\n // \"The type loop\" on is about files that do not exist in that scaffold.\n const typeLoop = readme.indexOf('## The type loop')\n return `${readme\n .slice(0, typeLoop)\n .replace(\n 'Vite + React, typed against the API via `@forinda/kickjs-client`',\n 'create-vite scaffold — unwired (see below) ',\n )\n .replace(' (Vite proxies `/api`)', '')}## Wiring web/ to the API\n\n\\`web/\\` is whatever create-vite scaffolded; nothing connects it to the API yet.\nFour steps — typed client, \\`/api\\` dev proxy, route-map types, \\`src/api.ts\\`:\n\n${FRONTEND_WIRING_URL}\n`\n}\n"],"mappings":";;;;;;;;;;A,gRA0BA,MAAaW,EAAsB,mDAQtBC,EAAiB,CAC5B,CAAE,MAAO,WAAY,MAAO,OAAQ,EACpC,CAAE,MAAO,oBAAqB,MAAO,kBAAmB,EACxD,CAAE,MAAO,SAAU,MAAO,KAAM,EAChC,CAAE,MAAO,YAAa,MAAO,QAAS,EACtC,CAAE,MAAO,WAAY,MAAO,OAAQ,EACpC,CAAE,MAAO,YAAa,MAAO,QAAS,EACtC,CAAE,MAAO,SAAU,MAAO,KAAM,EAChC,CAAE,MAAO,UAAW,MAAO,MAAO,EAClC,CAAE,MAAO,aAAc,MAAO,SAAU,CAC1C,EAEaC,EAAwB,WAWrC,SAAgBC,EACd,E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,EAAG;EACHA,IAAO,OAAS,oEAAsE,GAAGA,EAAG,kCAAkCA,EAAG,gCAAgC;;;;;oBAK/Ib,EAAUa,EAAsB,MAAM,EAAE,6BAA6Bb,EAAUa,EAAsB,WAAW,EAAE;IAClIb,EAAUa,EAAsB,QAAQ,EAAE,WAAWb,EAAUa,EAAsB,OAAO,EAAE;qCAC7Dd,EAAQc,EAAsB,MAAM,EAAE;;;;;;;EAOzEd,EAAQc,EAAsB,MAAM,EAAE;EACtCd,EAAQc,EAAsB,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+DtC,GAAIa,IAAa,OAAQ,OAAOsB,EAKhC,IAAMC,EAAWD,EAAO,QAAQ,kBAAkB,EAClD,MAAO,GAAGA,EACP,MAAM,EAAGC,CAAQ,CAAC,CAClB,QACC,mEACA,mEACF,CAAC,CACA,QAAQ,yBAA0B,EAAE,EAAE;;;;;EAKzC1C,EAAoB;CAEtB,C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.17.
|
|
2
|
+
* @forinda/kickjs-cli v8.17.4
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{
|
|
11
|
+
import{C as e,b as t,y as n}from"./agent-docs-sMPVd5vN.mjs";import{f as r,r as i}from"./config-BVw4TFDJ.mjs";import{S as a,b as o,c as s,i as c,n as l,v as u,x as d}from"./project--dWQ_c8m.mjs";import{join as f}from"node:path";import{execFileSync as p}from"node:child_process";const m=`https://kickjs.app/guide/fullstack-frontend.html`,h=[{value:`react-ts`,label:`React`},{value:`react-compiler-ts`,label:`React + Compiler`},{value:`vue-ts`,label:`Vue`},{value:`svelte-ts`,label:`Svelte`},{value:`solid-ts`,label:`Solid`},{value:`preact-ts`,label:`Preact`},{value:`lit-ts`,label:`Lit`},{value:`qwik-ts`,label:`Qwik`},{value:`vanilla-ts`,label:`Vanilla`}],g=`react-ts`;function _(e,t,n=g){let r=[`--template`,n,`--no-interactive`,`--no-immediate`];return e===`yarn`||e===`bun`?[e,`create`,`vite`,t,...r]:e===`npm`?[e,`create`,`vite@latest`,t,`--`,...r]:[e,`create`,`vite@latest`,t,...r]}async function v(r){let{name:h,directory:v,schemaLib:S=`zod`,runtime:C=`express`,packages:w=[],frontend:T=`kick`,viteTemplate:E=g}=r,D=[`pnpm`,`npm`,`yarn`,`bun`].includes(r.packageManager),O=D?r.packageManager:`pnpm`,k=v,A=e=>console.log(` ${e}`);r.packageManager!==void 0&&!D&&A(`Warning: unknown package manager '${String(r.packageManager)}' — falling back to pnpm.`),console.log(`\n Creating fullstack KickJS workspace: ${h}\n`),console.log(` Resolving package versions...`);let j=await c(),M=await l({name:`${h}-server`,directory:f(k,`server`),packageManager:O,template:`minimal`,schemaLib:S,runtime:C,packages:w,extraLayers:[`server-fullstack`],approveInstallScripts:!1,platformConfig:!1,initGit:!1,installDeps:!1,spaClientDir:`../web/dist`,versions:j});if(T===`vite`){console.log(`\n Handing web/ to create-vite (${E})...\n`);let[e,...t]=_(O,`web`,E);a(e,t,{cwd:k})}else await e(f(k,`web/package.json`),y(h,j));let N=o(O);await e(f(k,`package.json`),b(h,O,j[`@forinda/kickjs-cli`],N));let P=d(O,N);P&&await e(f(k,`.yarnrc.yml`),P),O===`pnpm`&&await e(f(k,`pnpm-workspace.yaml`),`packages:
|
|
12
12
|
- server
|
|
13
13
|
- web
|
|
14
|
-
`),
|
|
15
|
-
Fullstack workspace scaffolded!`),console.log(),A(`Next steps:`),A(` cd ${h}`),
|
|
14
|
+
`),s(O,k,M.builds);let F=[`fullstack-root`,...T===`vite`?[]:[`web-kick`]],I=n(t(F).files,{name:h,packageManager:O});for(let[t,n]of I)await e(f(k,t),n);await e(f(k,`README.md`),x(h,O,T)),r.deploy?.length&&await u({dir:k,targets:r.deploy,pm:O,force:!0});let{generateAgentDocs:L}=await import(`./agent-docs-sMPVd5vN.mjs`).then(e=>e.t);if(await L({outDir:k,name:h,pm:O,template:`fullstack`,only:`both`,force:!0}),r.installDeps){console.log(`\n Installing workspace dependencies with ${O}...\n`);try{a(O,[`install`],{cwd:k})}catch{console.log(`\n Warning: ${O} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-dZuP30n-.mjs`).then(e=>e.n);await e({cwd:f(k,`server`),allowDuplicates:!0,silent:!0})}catch{}if(r.initGit)try{p(`git`,[`init`],{cwd:k,stdio:`pipe`}),p(`git`,[`branch`,`-M`,`main`],{cwd:k,stdio:`pipe`}),p(`git`,[`add`,`-A`],{cwd:k,stdio:`pipe`}),p(`git`,[`commit`,`-m`,`chore: initial commit from kick new (fullstack)`],{cwd:k,stdio:`pipe`}),A(`Git repository initialized`)}catch{A(`Warning: git init failed (git may not be installed)`)}console.log(`
|
|
15
|
+
Fullstack workspace scaffolded!`),console.log(),A(`Next steps:`),A(` cd ${h}`),r.installDeps||A(` ${O} install`),O===`pnpm`?A(` pnpm dev # runs server (kick dev) + web (vite) together`):(A(` ${O} run dev:server # terminal 1`),A(` ${O} run dev:web # terminal 2`)),A(``),T===`vite`?(A(`web/ is create-vite output, unwired. To type it against the API:`),A(` ${m}`)):(A(`The web app calls the API through @forinda/kickjs-client —`),A(`edit server/src/modules/hello, run \`${i(O,`kick`)} typegen\` in server/, and`),A(`web/src/App.tsx's types follow.`)),A(``)}function y(e,t){let n=e=>t[e]??`latest`;return`${JSON.stringify({name:`${e}-web`,private:!0,version:`0.0.0`,type:`module`,scripts:{dev:`vite`,build:`tsc --noEmit && vite build`,preview:`vite preview`,typecheck:`tsc --noEmit`},dependencies:{"@forinda/kickjs-client":n(`@forinda/kickjs-client`),react:n(`react`),"react-dom":n(`react-dom`)},devDependencies:{"@forinda/kickjs-vite":n(`@forinda/kickjs-vite`),"@types/react":n(`@types/react`),"@types/react-dom":n(`@types/react-dom`),"@vitejs/plugin-react":n(`@vitejs/plugin-react`),typescript:n(`typescript`),vite:n(`vite`)}},null,2)}\n`}function b(e,t,n,r=o(t)){let i=t===`pnpm`?{dev:`pnpm --parallel -r run dev`,start:`pnpm --filter ./server run start`,"dev:server":`pnpm --filter ./server dev`,"dev:web":`pnpm --filter ./web dev`,build:`pnpm --filter ./server exec kick typegen && pnpm -r run build`,typecheck:`kick typecheck --cwd server && kick typecheck --cwd web --no-typegen`,test:`pnpm --filter ./server test`,format:`cd server && kick format`}:{start:`cd server && ${t} run start`,"dev:server":`cd server && ${t} run dev`,"dev:web":`cd web && ${t} run dev`,build:`cd server && kick typegen && cd .. && ${t} run build:server && ${t} run build:web`,"build:server":`cd server && ${t} run build`,"build:web":`cd web && ${t} run build`,typecheck:`kick typecheck --cwd server && kick typecheck --cwd web --no-typegen`,test:`cd server && ${t} run test`,format:`cd server && kick format`};return`${JSON.stringify({name:e,private:!0,version:`0.0.0`,type:`module`,...r?{packageManager:r}:{},scripts:i,devDependencies:{"@forinda/kickjs-cli":n},workspaces:[`server`,`web`]},null,2)}\n`}function x(e,t,n=`kick`){let a=`# ${e}
|
|
16
16
|
|
|
17
17
|
Fullstack KickJS workspace — typed end to end.
|
|
18
18
|
|
|
@@ -30,17 +30,17 @@ ${t===`pnpm`?`pnpm dev # server (kick dev) + web (vite), in parallel`
|
|
|
30
30
|
|
|
31
31
|
Server: http://localhost:3000 · Web: http://localhost:5173 (Vite proxies \`/api\`).
|
|
32
32
|
|
|
33
|
-
From this root: \`${
|
|
34
|
-
\`${
|
|
35
|
-
\`kick.config.ts\`: \`cd server && ${
|
|
33
|
+
From this root: \`${r(t,`test`)}\` (the server's tests), \`${r(t,`typecheck`)}\` (both packages),
|
|
34
|
+
\`${r(t,`format`)}\` and \`${r(t,`build`)}\`. The \`kick\` CLI itself runs in \`server/\`, which holds
|
|
35
|
+
\`kick.config.ts\`: \`cd server && ${i(t,`kick`)} typegen\`.
|
|
36
36
|
|
|
37
37
|
## Deploy
|
|
38
38
|
|
|
39
39
|
Deploy files are added when you need them, from this folder:
|
|
40
40
|
|
|
41
41
|
\`\`\`bash
|
|
42
|
-
${
|
|
43
|
-
${
|
|
42
|
+
${i(t,`kick`)} g deploy docker # Dockerfile for the whole app
|
|
43
|
+
${i(t,`kick`)} g deploy netlify vercel # serverless: platform config, entry and build script
|
|
44
44
|
\`\`\`
|
|
45
45
|
|
|
46
46
|
See [Serverless](https://kickjs.app/guide/serverless).
|
|
@@ -101,7 +101,7 @@ export const api = createClient<Api>({ baseUrl: '/api/v1' })
|
|
|
101
101
|
\`\`\`
|
|
102
102
|
|
|
103
103
|
Docs: https://kickjs.app/guide/typed-client.html
|
|
104
|
-
`;if(n!==`vite`)return
|
|
104
|
+
`;if(n!==`vite`)return a;let o=a.indexOf(`## The type loop`);return`${a.slice(0,o).replace("Vite + React, typed against the API via `@forinda/kickjs-client`",`create-vite scaffold — unwired (see below) `).replace(" (Vite proxies `/api`)",``)}## Wiring web/ to the API
|
|
105
105
|
|
|
106
106
|
\`web/\` is whatever create-vite scaffolded; nothing connects it to the API yet.
|
|
107
107
|
Four steps — typed client, \`/api\` dev proxy, route-map types, \`src/api.ts\`:
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { GeneratorArg, GeneratorContext, GeneratorFile, GeneratorFlag, GeneratorSpec, KickCliPlugin as KickCliPlugin$1, KickCliPluginContext as KickCliPluginContext$1, KickPluginConflictError, defineCliPlugin, defineGenerator } from "@forinda/kickjs-cli-kit";
|
|
3
3
|
import "commander";
|
|
4
|
-
//#region src/commands/add.d.ts
|
|
5
4
|
type AppRuntime = 'express' | 'fastify' | 'h3';
|
|
6
|
-
//#endregion
|
|
7
|
-
//#region src/commands/doctor.d.ts
|
|
8
5
|
/**
|
|
9
6
|
* `kick doctor` — pre-flight checks for a KickJS project's dev
|
|
10
7
|
* environment. Detects common misconfigs before they bite, with an
|
|
@@ -115,14 +112,10 @@ export declare function defineDoctorExtension(ext: DoctorExtension): DoctorExten
|
|
|
115
112
|
* ```
|
|
116
113
|
*/
|
|
117
114
|
export declare function defineDoctorCheck(check: DoctorCheck): DoctorCheck;
|
|
118
|
-
//#endregion
|
|
119
|
-
//#region src/plugin/types.d.ts
|
|
120
115
|
/** CLI plugin context with the host config narrowed to `KickConfig`. */
|
|
121
116
|
type KickCliPluginContext = KickCliPluginContext$1<KickConfig>;
|
|
122
117
|
/** A CLI plugin with the host config narrowed to `KickConfig`. */
|
|
123
118
|
type KickCliPlugin = KickCliPlugin$1<KickConfig>;
|
|
124
|
-
//#endregion
|
|
125
|
-
//#region src/config.d.ts
|
|
126
119
|
/** A custom command that developers can register via kick.config.ts */
|
|
127
120
|
interface KickCommandDefinition {
|
|
128
121
|
/** The command name (e.g. 'db:migrate', 'seed', 'proto:gen') */
|
|
@@ -722,8 +715,6 @@ export declare function defineConfig(config: KickConfig): KickConfig;
|
|
|
722
715
|
/** Schema library a generated schema file is written against. */
|
|
723
716
|
type SchemaLib$1 = 'zod' | 'valibot' | 'yup';
|
|
724
717
|
export declare function loadKickConfig(startDir: string): Promise<KickConfig | null>;
|
|
725
|
-
//#endregion
|
|
726
|
-
//#region src/generators/templates/types.d.ts
|
|
727
718
|
/**
|
|
728
719
|
* Module declaration style emitted by the module-index templates.
|
|
729
720
|
*
|
|
@@ -741,8 +732,6 @@ export declare function loadKickConfig(startDir: string): Promise<KickConfig | n
|
|
|
741
732
|
* vs `Module`); `kick rm module` matches both.
|
|
742
733
|
*/
|
|
743
734
|
type ModuleStyle = 'define' | 'class';
|
|
744
|
-
//#endregion
|
|
745
|
-
//#region src/generators/module.d.ts
|
|
746
735
|
type BuiltinRepoType = 'inmemory';
|
|
747
736
|
type RepoType = BuiltinRepoType | (string & {});
|
|
748
737
|
interface GenerateModuleOptions {
|
|
@@ -794,8 +783,6 @@ interface GenerateModuleOptions {
|
|
|
794
783
|
* minimal — just controller + module index
|
|
795
784
|
*/
|
|
796
785
|
export declare function generateModule(options: GenerateModuleOptions): Promise<string[]>;
|
|
797
|
-
//#endregion
|
|
798
|
-
//#region src/generators/adapter.d.ts
|
|
799
786
|
interface GenerateAdapterOptions {
|
|
800
787
|
name: string;
|
|
801
788
|
outDir: string;
|
|
@@ -817,8 +804,6 @@ interface GenerateAdapterOptions {
|
|
|
817
804
|
* `/health/ready` instead of contributing to the built-in one.
|
|
818
805
|
*/
|
|
819
806
|
export declare function generateAdapter(options: GenerateAdapterOptions): Promise<string[]>;
|
|
820
|
-
//#endregion
|
|
821
|
-
//#region src/generators/middleware.d.ts
|
|
822
807
|
interface GenerateMiddlewareOptions {
|
|
823
808
|
name: string;
|
|
824
809
|
outDir?: string;
|
|
@@ -836,8 +821,6 @@ interface GenerateMiddlewareOptions {
|
|
|
836
821
|
runtime?: KickConfig['runtime'];
|
|
837
822
|
}
|
|
838
823
|
export declare function generateMiddleware(options: GenerateMiddlewareOptions): Promise<string[]>;
|
|
839
|
-
//#endregion
|
|
840
|
-
//#region src/generators/guard.d.ts
|
|
841
824
|
interface GenerateGuardOptions {
|
|
842
825
|
name: string;
|
|
843
826
|
outDir?: string;
|
|
@@ -847,8 +830,6 @@ interface GenerateGuardOptions {
|
|
|
847
830
|
pluralize?: boolean;
|
|
848
831
|
}
|
|
849
832
|
export declare function generateGuard(options: GenerateGuardOptions): Promise<string[]>;
|
|
850
|
-
//#endregion
|
|
851
|
-
//#region src/generators/service.d.ts
|
|
852
833
|
interface GenerateServiceOptions {
|
|
853
834
|
name: string;
|
|
854
835
|
outDir?: string;
|
|
@@ -858,8 +839,6 @@ interface GenerateServiceOptions {
|
|
|
858
839
|
pluralize?: boolean;
|
|
859
840
|
}
|
|
860
841
|
export declare function generateService(options: GenerateServiceOptions): Promise<string[]>;
|
|
861
|
-
//#endregion
|
|
862
|
-
//#region src/generators/controller.d.ts
|
|
863
842
|
interface GenerateControllerOptions {
|
|
864
843
|
name: string;
|
|
865
844
|
outDir?: string;
|
|
@@ -869,8 +848,6 @@ interface GenerateControllerOptions {
|
|
|
869
848
|
pluralize?: boolean;
|
|
870
849
|
}
|
|
871
850
|
export declare function generateController(options: GenerateControllerOptions): Promise<string[]>;
|
|
872
|
-
//#endregion
|
|
873
|
-
//#region src/generators/dto.d.ts
|
|
874
851
|
interface GenerateDtoOptions {
|
|
875
852
|
name: string;
|
|
876
853
|
outDir?: string;
|
|
@@ -887,12 +864,8 @@ interface GenerateDtoOptions {
|
|
|
887
864
|
schemaLib?: SchemaLib$1;
|
|
888
865
|
}
|
|
889
866
|
export declare function generateDto(options: GenerateDtoOptions): Promise<string[]>;
|
|
890
|
-
//#endregion
|
|
891
|
-
//#region src/generators/deploy.d.ts
|
|
892
867
|
declare const DEPLOY_TARGETS: readonly ['netlify', 'vercel', 'docker'];
|
|
893
868
|
type DeployTarget = (typeof DEPLOY_TARGETS)[number];
|
|
894
|
-
//#endregion
|
|
895
|
-
//#region src/generators/project.d.ts
|
|
896
869
|
type ProjectTemplate = 'rest' | 'minimal' | 'inertia';
|
|
897
870
|
type SchemaLib = 'zod' | 'valibot' | 'yup';
|
|
898
871
|
interface InitProjectOptions {
|
|
@@ -945,8 +918,6 @@ interface InitProjectOptions {
|
|
|
945
918
|
export declare function initProject(options: InitProjectOptions): Promise<{
|
|
946
919
|
builds: Record<string, boolean>;
|
|
947
920
|
}>;
|
|
948
|
-
//#endregion
|
|
949
|
-
//#region src/utils/project-root.d.ts
|
|
950
921
|
/**
|
|
951
922
|
* Walk up from `startDir` looking for the project root. A directory
|
|
952
923
|
* counts as the root when it contains any of:
|
|
@@ -963,8 +934,6 @@ export declare function initProject(options: InitProjectOptions): Promise<{
|
|
|
963
934
|
* workspace package boundary in a monorepo.
|
|
964
935
|
*/
|
|
965
936
|
export declare function findProjectRoot(startDir?: string): string;
|
|
966
|
-
//#endregion
|
|
967
|
-
//#region src/typegen/scanner.d.ts
|
|
968
937
|
/**
|
|
969
938
|
* Static scanner for KickJS decorated classes and DI tokens.
|
|
970
939
|
*
|
|
@@ -1287,8 +1256,6 @@ interface ScanDelta {
|
|
|
1287
1256
|
/** Files deleted since the last scan. */
|
|
1288
1257
|
removed: string[];
|
|
1289
1258
|
}
|
|
1290
|
-
//#endregion
|
|
1291
|
-
//#region src/typegen/plugin.d.ts
|
|
1292
1259
|
interface TypegenLogger {
|
|
1293
1260
|
info(msg: string): void;
|
|
1294
1261
|
warn(msg: string): void;
|
|
@@ -1389,8 +1356,6 @@ interface TypegenPluginResult {
|
|
|
1389
1356
|
* ```
|
|
1390
1357
|
*/
|
|
1391
1358
|
export declare function defineTypegen(spec: TypegenPlugin): TypegenPlugin;
|
|
1392
|
-
//#endregion
|
|
1393
|
-
//#region src/typegen/token-conventions.d.ts
|
|
1394
1359
|
interface TokenConventionWarning {
|
|
1395
1360
|
token: string;
|
|
1396
1361
|
variable: string | null;
|
|
@@ -1398,8 +1363,6 @@ interface TokenConventionWarning {
|
|
|
1398
1363
|
reason: string;
|
|
1399
1364
|
suggestion?: string;
|
|
1400
1365
|
}
|
|
1401
|
-
//#endregion
|
|
1402
|
-
//#region src/typegen/index.d.ts
|
|
1403
1366
|
/**
|
|
1404
1367
|
* Result of a typegen run — useful for logging and tests. Computed from
|
|
1405
1368
|
* the scan result + asset discovery; the per-file emission itself is now
|
|
@@ -1526,8 +1489,6 @@ declare function runTypegen(opts?: RunTypegenOptions): Promise<{
|
|
|
1526
1489
|
* outputs) for the caller's bookkeeping.
|
|
1527
1490
|
*/
|
|
1528
1491
|
declare function writeTypegenArtifacts(outDir: string, pluginResults: readonly TypegenPluginResult[], silent: boolean): Promise<string[]>;
|
|
1529
|
-
//#endregion
|
|
1530
|
-
//#region src/typegen/run-plugins.d.ts
|
|
1531
1492
|
interface RunAllPluginTypegensOptions {
|
|
1532
1493
|
cwd: string;
|
|
1533
1494
|
/** Pre-loaded kick.config.ts (saves a re-read). */
|
|
@@ -1546,8 +1507,6 @@ interface RunAllPluginTypegensOptions {
|
|
|
1546
1507
|
watch?: boolean;
|
|
1547
1508
|
}
|
|
1548
1509
|
declare function runAllPluginTypegens(opts: RunAllPluginTypegensOptions): Promise<TypegenPluginResult[]>;
|
|
1549
|
-
//#endregion
|
|
1550
|
-
//#region src/asset-manager/build.d.ts
|
|
1551
1510
|
/** Wire-format version for `dist/.kickjs-assets.json`. Bump on shape change. */
|
|
1552
1511
|
declare const ASSET_MANIFEST_VERSION: 1;
|
|
1553
1512
|
/** On-disk manifest format (`dist/.kickjs-assets.json`). */
|
|
@@ -1608,8 +1567,6 @@ interface BuildAssetsResult {
|
|
|
1608
1567
|
* adopters who don't use the feature.
|
|
1609
1568
|
*/
|
|
1610
1569
|
declare function buildAssets(config: KickConfig | null, opts: BuildAssetsOptions): Promise<BuildAssetsResult | null>;
|
|
1611
|
-
//#endregion
|
|
1612
|
-
//#region src/typegen/dev-watcher.d.ts
|
|
1613
1570
|
/**
|
|
1614
1571
|
* `globalThis` key claiming typegen ownership for the current process.
|
|
1615
1572
|
* Set by `kick dev` (which boots Vite in-process) so the vite plugin's
|
|
@@ -1662,8 +1619,6 @@ interface TypegenDevWatcher {
|
|
|
1662
1619
|
dispose(): void;
|
|
1663
1620
|
}
|
|
1664
1621
|
export declare function createTypegenDevWatcher(opts: TypegenDevWatcherOptions): TypegenDevWatcher;
|
|
1665
|
-
//#endregion
|
|
1666
|
-
//#region src/generator-extension/discover.d.ts
|
|
1667
1622
|
/**
|
|
1668
1623
|
* One row in the discovered registry. `source` is the npm package name
|
|
1669
1624
|
* the generator came from — surfaced in error messages so adopters can
|
|
@@ -1691,8 +1646,6 @@ interface DiscoveryResult {
|
|
|
1691
1646
|
reason: string;
|
|
1692
1647
|
}>;
|
|
1693
1648
|
}
|
|
1694
|
-
//#endregion
|
|
1695
|
-
//#region src/generator-extension/context.d.ts
|
|
1696
1649
|
/**
|
|
1697
1650
|
* Build a {@link GeneratorContext} from the raw name + invocation
|
|
1698
1651
|
* arguments. Centralises the case-transformation logic so every plugin
|
|
@@ -1714,8 +1667,6 @@ export declare function buildGeneratorContext(input: {
|
|
|
1714
1667
|
projectRoot?: string;
|
|
1715
1668
|
pluralize?: boolean;
|
|
1716
1669
|
}): GeneratorContext;
|
|
1717
|
-
//#endregion
|
|
1718
|
-
//#region src/utils/naming.d.ts
|
|
1719
1670
|
/** Convert a name to PascalCase */
|
|
1720
1671
|
export declare function toPascalCase(name: string): string;
|
|
1721
1672
|
/** Convert a name to camelCase */
|
|
@@ -1728,6 +1679,5 @@ export declare function toKebabCase(name: string): string;
|
|
|
1728
1679
|
* including irregulars (person → people, status → statuses, child → children).
|
|
1729
1680
|
*/
|
|
1730
1681
|
export declare function pluralize(name: string): string;
|
|
1731
|
-
//#endregion
|
|
1732
1682
|
export { type DiscoveredGenerator, type DiscoveryResult, type DoctorCheck, type DoctorContext, type DoctorExtension, type DoctorResult, type GeneratorArg, type GeneratorContext, type GeneratorFile, type GeneratorFlag, type GeneratorSpec, type KickCliPlugin, type KickCliPluginContext, type KickCommandDefinition, type KickConfig, type KickDbConfigBlock, KickPluginConflictError, type TypegenContext, type TypegenDevWatcher, type TypegenDevWatcherOptions, type TypegenPlugin, type TypegenPluginResult, type TypegenWatchEvent, defineCliPlugin, defineGenerator };
|
|
1733
1683
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":["KitCliPluginContext","KitCliPlugin","BuiltinRepoType","_$__commands_doctor0.DoctorExtension","SchemaLib","SchemaLib","SchemaLib"],"sources":["../src/commands/add.ts","../src/commands/doctor.ts","../src/plugin/types.ts","../src/config.ts","../src/generators/templates/types.ts","../src/generators/module.ts","../src/generators/adapter.ts","../src/generators/middleware.ts","../src/generators/guard.ts","../src/generators/service.ts","../src/generators/controller.ts","../src/generators/dto.ts","../src/generators/deploy.ts","../src/generators/project.ts","../src/utils/project-root.ts","../src/typegen/scanner.ts","../src/typegen/plugin.ts","../src/typegen/token-conventions.ts","../src/typegen/index.ts","../src/typegen/run-plugins.ts","../src/asset-manager/build.ts","../src/typegen/dev-watcher.ts","../src/generator-extension/discover.ts","../src/generator-extension/context.ts","../src/utils/naming.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["KitCliPluginContext","KitCliPlugin","BuiltinRepoType","_$__commands_doctor0.DoctorExtension","SchemaLib","SchemaLib","SchemaLib"],"sources":["../src/commands/add.ts","../src/commands/doctor.ts","../src/plugin/types.ts","../src/config.ts","../src/generators/templates/types.ts","../src/generators/module.ts","../src/generators/adapter.ts","../src/generators/middleware.ts","../src/generators/guard.ts","../src/generators/service.ts","../src/generators/controller.ts","../src/generators/dto.ts","../src/generators/deploy.ts","../src/generators/project.ts","../src/utils/project-root.ts","../src/typegen/scanner.ts","../src/typegen/plugin.ts","../src/typegen/token-conventions.ts","../src/typegen/index.ts","../src/typegen/run-plugins.ts","../src/asset-manager/build.ts","../src/typegen/dev-watcher.ts","../src/generator-extension/discover.ts","../src/generator-extension/context.ts","../src/utils/naming.ts"],"mappings":";;;KAuSY;;;;;;;;;;;;;;;;;UC3QK;EACf;EACA;;;;;;;EAOA;;;;;;EAMA,SAAS;;UAGM;;EAEf;EACA;;EAEA;;EAEA;;KAGU,eACV,KAAK,kBACF,eAAe,wBAAwB,QAAQ,eAAe;;;;;;UAOlD;;EAEf,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqCK,sBAAsB,KAAK,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;wBA0B7C,kBAAkB,OAAO,cAAc;;KCjG3C,uBAAuBA,uBAAoB;;KAG3C,gBAAgBC,gBAAa;;UC5BxB;;EAEf;;EAEA;;;;;;;;;EASA;;EAEA;;;;;;KAOU;;KAGA;;;;;;;;;;;;;KA+BAC;;UA0BK;EACf;;;KAIU,iBAAiBA,oBAAkB;;;;;;;;;;;KAYnC;;;;;;UAOK;;;;;;;EAOf;;;;;;;EAOA;;;;;;EAMA;;;;;;;;;;;;;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as n,P as r,_ as i,c as a,d as o,g as s,h as c,j as l,l as u,m as d,n as f,o as p,p as m,s as h,t as g,y as _}from"./doctor-
|
|
11
|
+
import{C as e,F as t,N as n,P as r,_ as i,c as a,d as o,g as s,h as c,j as l,l as u,m as d,n as f,o as p,p as m,s as h,t as g,y as _}from"./doctor-Bmm7jTXk.mjs";import{n as v}from"./project-BFGUN5KK.mjs";import{r as y,s as b}from"./config-kPWo_HS4.mjs";import{t as x}from"./project-root-CKK8LRzQ.mjs";import{n as S,t as C}from"./types-DNpeagtq.mjs";export{C as KickPluginConflictError,a as TYPEGEN_OWNER_KEY,p as buildGeneratorContext,u as createTypegenDevWatcher,S as defineCliPlugin,y as defineConfig,g as defineDoctorCheck,f as defineDoctorExtension,h as defineGenerator,o as defineTypegen,x as findProjectRoot,_ as generateAdapter,d as generateController,m as generateDto,s as generateGuard,i as generateMiddleware,e as generateModule,c as generateService,v as initProject,b as loadKickConfig,l as pluralize,n as toCamelCase,r as toKebabCase,t as toPascalCase};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.17.
|
|
2
|
+
* @forinda/kickjs-cli v8.17.4
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{t as e}from"./rolldown-runtime-
|
|
11
|
+
import{t as e}from"./rolldown-runtime-BxKUidhj.mjs";import{KickPluginConflictError as t,defineCliPlugin as n}from"@forinda/kickjs-cli-kit";function r(e,n=[]){let r=/* @__PURE__ */ new Map;for(let n of e){let e=(r.get(n.name)??0)+1;if(r.set(n.name,e),e===2)throw new t(`plugin`,n.name,[n.name,n.name])}let i=/* @__PURE__ */ new Map,a=[];for(let n of e)for(let e of n.commands??[]){let r=i.get(e.name);if(r)throw new t(`command`,e.name,[r,n.name]);i.set(e.name,n.name),a.push(e)}let o=new Set(n.map(e=>e.name)),s=[...a.filter(e=>!o.has(e.name)),...n],c=/* @__PURE__ */ new Map,l=[];for(let n of e)for(let e of n.typegens??[]){let r=c.get(e.id);if(r)throw new t(`typegen`,e.id,[r,n.name]);c.set(e.id,n.name),l.push(e)}let u=/* @__PURE__ */ new Map,d=[];for(let n of e)for(let e of n.generators??[]){let r=u.get(e.name);if(r)throw new t(`generator`,e.name,[r,n.name]);u.set(e.name,n.name),d.push({source:n.name,spec:e})}return{commands:s,typegens:l,generators:d,register:async(t,n)=>{let r;if(n)r={generators:d,...n};else{let{findProjectRoot:e}=await import(`./project-root-tvtMzer4.mjs`).then(e=>e.n),t=process.cwd();r={cwd:t,projectRoot:e(t),config:null,log:()=>{},generators:d}}for(let n of e)n.register&&await n.register(t,r)}}}var i=/* @__PURE__ */ e({mergeCliPlugins:()=>r});export{r as n,n as r,i as t};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.17.
|
|
2
|
+
* @forinda/kickjs-cli v8.17.4
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import"./types-
|
|
11
|
+
import"./types-DNpeagtq.mjs";export{r as mergeCliPlugins}from"./run-plugins-CisH0EMY.mjs";
|