@forinda/kickjs-cli 8.17.4 → 8.19.0
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-BKbdsDUQ.mjs → agent-docs-D10r5OEG.mjs} +3 -3
- package/dist/agent-docs-D10r5OEG.mjs.map +1 -0
- package/dist/{agent-docs-sMPVd5vN.mjs → agent-docs-D_L3RIUM.mjs} +2 -2
- package/dist/{build-NyFTqWDy.mjs → build-BkfEhRpx.mjs} +3 -3
- package/dist/{build-NyFTqWDy.mjs.map → build-BkfEhRpx.mjs.map} +1 -1
- package/dist/{build-DWbnilcJ.mjs → build-CChfKQA_.mjs} +2 -2
- package/dist/{builtins-MVDZcuck.mjs → builtins-C1mgGr8D.mjs} +147 -147
- package/dist/{builtins-DaPdtAiN.mjs → builtins-cZC3AQMK.mjs} +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/{config-kPWo_HS4.mjs → config-Bb-FdTKY.mjs} +3 -3
- package/dist/config-Bb-FdTKY.mjs.map +1 -0
- package/dist/{config-BVw4TFDJ.mjs → config-xN3ZYiN-.mjs} +2 -2
- package/dist/{doctor-Bmm7jTXk.mjs → doctor-CDdF_pWU.mjs} +4 -4
- package/dist/doctor-CDdF_pWU.mjs.map +1 -0
- package/dist/{fullstack-HXrTvDQS.mjs → fullstack-CHNFDgBX.mjs} +3 -3
- package/dist/{fullstack-Dj6nndJI.mjs → fullstack-D0Yim7JS.mjs} +4 -4
- package/dist/fullstack-D0Yim7JS.mjs.map +1 -0
- package/dist/index.d.mts +98 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{plugin-DxBBBZKs.mjs → plugin-CFT_4ept.mjs} +2 -2
- package/dist/{plugin-CEIikRk4.mjs → plugin-DxXeitAU.mjs} +2 -2
- package/dist/{project-BFGUN5KK.mjs → project-B9sWWiFy.mjs} +12 -12
- package/dist/project-B9sWWiFy.mjs.map +1 -0
- package/dist/{project--dWQ_c8m.mjs → project-DDQFJyNi.mjs} +31 -31
- package/dist/{project-root-tvtMzer4.mjs → project-root-ClOtJ6MM.mjs} +2 -2
- package/dist/{project-root-CKK8LRzQ.mjs → project-root-DNQ4RQHQ.mjs} +3 -3
- package/dist/{project-root-CKK8LRzQ.mjs.map → project-root-DNQ4RQHQ.mjs.map} +1 -1
- package/dist/rolldown-runtime-SDDZy9Be.mjs +11 -0
- package/dist/{run-plugins-CisH0EMY.mjs → run-plugins-lJqFqRny.mjs} +72 -72
- package/dist/run-plugins-lJqFqRny.mjs.map +1 -0
- package/dist/{typegen-_fQVGRr8.mjs → typegen-Bkikzy45.mjs} +5 -5
- package/dist/typegen-Bkikzy45.mjs.map +1 -0
- package/dist/{typegen-dZuP30n-.mjs → typegen-DlnhNbzD.mjs} +4 -4
- package/dist/{types-DNpeagtq.mjs → types-ew1loX4G.mjs} +1 -1
- package/package.json +13 -13
- package/templates/feature-views/files/src/views/shared.ts +19 -0
- package/templates/feature-views/skills/views-forms.txt +1 -1
- package/templates/inertia-react/feature.json +13 -0
- package/templates/inertia-svelte/feature.json +13 -0
- package/templates/inertia-svelte/files/src/client/Layout.svelte +19 -0
- package/templates/inertia-svelte/files/src/client/Seo.svelte +47 -0
- package/templates/inertia-svelte/files/src/client/main.ts +16 -0
- package/templates/inertia-svelte/files/src/client/pages/Error.svelte +14 -0
- package/templates/inertia-svelte/files/src/client/pages/Home.svelte +13 -0
- package/templates/inertia-svelte/files/src/client/pages/Posts/Index.svelte +33 -0
- package/templates/inertia-svelte/files/src/client/ssr.ts +16 -0
- package/templates/inertia-svelte/files/src/client/svelte.d.ts +7 -0
- package/templates/inertia-svelte/files/vite.client.config.ts +32 -0
- package/templates/inertia-svelte/files/vite.config.ts +42 -0
- package/templates/inertia-vue/feature.json +13 -0
- package/templates/inertia-vue/files/src/client/Layout.vue +21 -0
- package/templates/inertia-vue/files/src/client/Seo.ts +49 -0
- package/templates/inertia-vue/files/src/client/main.ts +17 -0
- package/templates/inertia-vue/files/src/client/pages/Error.vue +16 -0
- package/templates/inertia-vue/files/src/client/pages/Home.vue +15 -0
- package/templates/inertia-vue/files/src/client/pages/Posts/Index.vue +31 -0
- package/templates/inertia-vue/files/src/client/ssr.ts +21 -0
- package/templates/inertia-vue/files/src/client/vue.d.ts +7 -0
- package/templates/inertia-vue/files/vite.client.config.ts +32 -0
- package/templates/inertia-vue/files/vite.config.ts +42 -0
- package/templates/template-inertia/feature.json +3 -13
- package/templates/template-inertia/files/src/client/app.css +1 -1
- package/templates/template-inertia/files/src/index.ts +4 -4
- package/templates/template-inertia/files/src/modules/pages/pages.controller.ts +1 -1
- package/dist/agent-docs-BKbdsDUQ.mjs.map +0 -1
- package/dist/config-kPWo_HS4.mjs.map +0 -1
- package/dist/doctor-Bmm7jTXk.mjs.map +0 -1
- package/dist/fullstack-Dj6nndJI.mjs.map +0 -1
- package/dist/project-BFGUN5KK.mjs.map +0 -1
- package/dist/rolldown-runtime-BxKUidhj.mjs +0 -11
- package/dist/run-plugins-CisH0EMY.mjs.map +0 -1
- package/dist/typegen-_fQVGRr8.mjs.map +0 -1
- /package/templates/{template-inertia → inertia-react}/files/src/client/Layout.tsx +0 -0
- /package/templates/{template-inertia → inertia-react}/files/src/client/Seo.tsx +0 -0
- /package/templates/{template-inertia → inertia-react}/files/src/client/main.tsx +0 -0
- /package/templates/{template-inertia → inertia-react}/files/src/client/pages/Error.tsx +0 -0
- /package/templates/{template-inertia → inertia-react}/files/src/client/pages/Home.tsx +0 -0
- /package/templates/{template-inertia → inertia-react}/files/src/client/pages/Posts/Index.tsx +0 -0
- /package/templates/{template-inertia → inertia-react}/files/src/client/ssr.tsx +0 -0
- /package/templates/{template-inertia → inertia-react}/files/vite.client.config.ts +0 -0
- /package/templates/{template-inertia → inertia-react}/files/vite.config.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.
|
|
2
|
+
* @forinda/kickjs-cli v8.19.0
|
|
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-D10r5OEG.mjs";import{i as r,p as i}from"./config-Bb-FdTKY.mjs";import{C as a,S as o,b as s,c,i as l,n as u,v as d}from"./project-B9sWWiFy.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-D10r5OEG.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-Bkikzy45.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-D0Yim7JS.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fullstack-D0Yim7JS.mjs","names":["writeFileSafe","fillVars","renderLayers","execBin","runScript","yarnrc","packageManagerSpec","generateDeploy","resolveSiblingVersions","initProject","runCommand","join","execFileSync","FRONTEND_WIRING_URL","VITE_TEMPLATES","DEFAULT_VITE_TEMPLATE","createViteCommand","pm","dir","template","flags","initFullstackProject","options","name","directory","schemaLib","runtime","packages","frontend","viteTemplate","pmValid","packageManager","log","msg","versions","server","file","args","webPackageJson","pmSpec","rootPackageJson","yarnConfig","approveInstallScripts","layers","files","path","contents","rootReadme","generateAgentDocs","n","runTypegen","dep","pkg","cliVersion","scripts","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,MAAaa,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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EA,SAAgBN,EAAWxB,EAAcN,EAAYW,EAA4B,OAAgB,CAC/F,IAAM2B,EAAS,KAAKhC,EAAK;;;;;;;;;;;;EAYzBN,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,GAAIW,IAAa,OAAQ,OAAO2B,EAKhC,IAAMC,EAAWD,EAAO,QAAQ,kBAAkB,EAClD,MAAO,GAAGA,EACP,MAAM,EAAGC,CAAQ,CAAC,CAClB,QACC,mEACA,mEACF,CAAC,CACA,QAAQ,yBAA0B,EAAE,EAAE;;;;;EAKzC3C,EAAoB;CAEtB,C"}
|
package/dist/index.d.mts
CHANGED
|
@@ -35,6 +35,7 @@ interface DoctorContext {
|
|
|
35
35
|
*/
|
|
36
36
|
runtime: AppRuntime;
|
|
37
37
|
}
|
|
38
|
+
/** One line of `kick doctor` output. */
|
|
38
39
|
interface DoctorResult {
|
|
39
40
|
/** Short label for the check (printed first). */
|
|
40
41
|
name: string;
|
|
@@ -44,6 +45,11 @@ interface DoctorResult {
|
|
|
44
45
|
/** Multi-line actionable fix shown when status is `warn` or `fail`. */
|
|
45
46
|
fix?: string;
|
|
46
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* A `kick doctor` check: returns one result, several, or `null` to print nothing.
|
|
50
|
+
*
|
|
51
|
+
* @see https://kickjs.app/guide/cli-commands#kick-doctor
|
|
52
|
+
*/
|
|
47
53
|
type DoctorCheck = (ctx: DoctorContext) => DoctorResult | DoctorResult[] | null | Promise<DoctorResult | DoctorResult[] | null>;
|
|
48
54
|
/**
|
|
49
55
|
* Shape of a doctor extension — the `doctor` block on `KickConfig`,
|
|
@@ -478,7 +484,26 @@ interface DeployConfig {
|
|
|
478
484
|
*/
|
|
479
485
|
include?: string[];
|
|
480
486
|
}
|
|
487
|
+
/**
|
|
488
|
+
* Shape of `kick.config.ts`; wrap it in `defineConfig()` for autocomplete.
|
|
489
|
+
*
|
|
490
|
+
* @see https://kickjs.app/guide/cli-commands#kick-config-ts-reference
|
|
491
|
+
*/
|
|
481
492
|
interface KickConfig {
|
|
493
|
+
/**
|
|
494
|
+
* `.kick` views: the app's folder and named roots (`billing::invoices/show`).
|
|
495
|
+
* A root value starting with `.` or `/` is a folder (from this file's
|
|
496
|
+
* directory); otherwise an installed package whose package.json has
|
|
497
|
+
* `"kick": { "views": "<folder>" }`. Read by the view CLI, typegen, the Vite
|
|
498
|
+
* plugin and the editor.
|
|
499
|
+
*
|
|
500
|
+
* @see https://kickjs.app/guide/views/roots
|
|
501
|
+
*/
|
|
502
|
+
views?: {
|
|
503
|
+
/** Default `src/views`. */
|
|
504
|
+
dir?: string;
|
|
505
|
+
roots?: Record<string, string>;
|
|
506
|
+
};
|
|
482
507
|
/**
|
|
483
508
|
* Project pattern — the module shape `kick g module` produces by default.
|
|
484
509
|
* `--pattern` overrides it per call.
|
|
@@ -714,6 +739,31 @@ interface KickConfig {
|
|
|
714
739
|
export declare function defineConfig(config: KickConfig): KickConfig;
|
|
715
740
|
/** Schema library a generated schema file is written against. */
|
|
716
741
|
type SchemaLib$1 = 'zod' | 'valibot' | 'yup';
|
|
742
|
+
/**
|
|
743
|
+
* Load `kick.config.*` starting from `startDir` and walking up toward
|
|
744
|
+
* the filesystem root until a config file is found. Returns `null`
|
|
745
|
+
* when no config exists anywhere on the way up.
|
|
746
|
+
*
|
|
747
|
+
* Walking up means adopters can run `kick <cmd>` from any subdirectory
|
|
748
|
+
* (e.g. `src/modules/users/`) and still pick up the project's config —
|
|
749
|
+
* before this change a nested-cwd invocation silently saw `null` and
|
|
750
|
+
* fell back to framework defaults.
|
|
751
|
+
*
|
|
752
|
+
* TypeScript configs (`.ts`) are loaded via `jiti` when available;
|
|
753
|
+
* `.js` / `.mjs` use native `import()`; `.json` uses `JSON.parse`. The
|
|
754
|
+
* jiti import is dynamic + best-effort: if the dep is missing we
|
|
755
|
+
* surface a warning telling the adopter how to install it, instead of
|
|
756
|
+
* silently dropping the config (which is what the previous bare-catch
|
|
757
|
+
* did).
|
|
758
|
+
*
|
|
759
|
+
* @example
|
|
760
|
+
* ```ts
|
|
761
|
+
* const config = await loadKickConfig(process.cwd())
|
|
762
|
+
* const modulesDir = config?.modules?.dir ?? 'src/modules'
|
|
763
|
+
* ```
|
|
764
|
+
*
|
|
765
|
+
* @see https://kickjs.app/guide/cli-commands#kick-config-ts-reference
|
|
766
|
+
*/
|
|
717
767
|
export declare function loadKickConfig(startDir: string): Promise<KickConfig | null>;
|
|
718
768
|
/**
|
|
719
769
|
* Module declaration style emitted by the module-index templates.
|
|
@@ -791,7 +841,7 @@ interface GenerateAdapterOptions {
|
|
|
791
841
|
* Scaffold a `defineAdapter()` factory under `src/adapters/<name>.adapter.ts`.
|
|
792
842
|
*
|
|
793
843
|
* v4 dropped the `class implements AppAdapter` pattern in favour of the
|
|
794
|
-
* `defineAdapter()` factory (
|
|
844
|
+
* `defineAdapter()` factory (https://kickjs.app/guide/adapters). The generated
|
|
795
845
|
* template uses the new factory shape so adopters get a working adapter with
|
|
796
846
|
* EVERY hook on `AppAdapter`, a typed config object with defaults, and the
|
|
797
847
|
* factory's call / `.scoped()` / `.async()` surfaces — without writing a
|
|
@@ -820,6 +870,12 @@ interface GenerateMiddlewareOptions {
|
|
|
820
870
|
*/
|
|
821
871
|
runtime?: KickConfig['runtime'];
|
|
822
872
|
}
|
|
873
|
+
/**
|
|
874
|
+
* Write `<name>.middleware.ts` (the code behind `kick g middleware`) and return the paths written.
|
|
875
|
+
* The handler is typed with Express types only when `runtime` is `'express'`, otherwise with `node:http` types.
|
|
876
|
+
*
|
|
877
|
+
* @see https://kickjs.app/guide/generators#kick-g-middleware
|
|
878
|
+
*/
|
|
823
879
|
export declare function generateMiddleware(options: GenerateMiddlewareOptions): Promise<string[]>;
|
|
824
880
|
interface GenerateGuardOptions {
|
|
825
881
|
name: string;
|
|
@@ -829,6 +885,11 @@ interface GenerateGuardOptions {
|
|
|
829
885
|
pattern?: ProjectPattern;
|
|
830
886
|
pluralize?: boolean;
|
|
831
887
|
}
|
|
888
|
+
/**
|
|
889
|
+
* Write `<name>.guard.ts` (the code behind `kick g guard`) and return the paths written.
|
|
890
|
+
*
|
|
891
|
+
* @see https://kickjs.app/guide/generators#kick-g-guard
|
|
892
|
+
*/
|
|
832
893
|
export declare function generateGuard(options: GenerateGuardOptions): Promise<string[]>;
|
|
833
894
|
interface GenerateServiceOptions {
|
|
834
895
|
name: string;
|
|
@@ -838,6 +899,11 @@ interface GenerateServiceOptions {
|
|
|
838
899
|
pattern?: ProjectPattern;
|
|
839
900
|
pluralize?: boolean;
|
|
840
901
|
}
|
|
902
|
+
/**
|
|
903
|
+
* Write `<name>.service.ts` (the code behind `kick g service`) and return the paths written.
|
|
904
|
+
*
|
|
905
|
+
* @see https://kickjs.app/guide/generators#kick-g-service
|
|
906
|
+
*/
|
|
841
907
|
export declare function generateService(options: GenerateServiceOptions): Promise<string[]>;
|
|
842
908
|
interface GenerateControllerOptions {
|
|
843
909
|
name: string;
|
|
@@ -847,6 +913,11 @@ interface GenerateControllerOptions {
|
|
|
847
913
|
pattern?: ProjectPattern;
|
|
848
914
|
pluralize?: boolean;
|
|
849
915
|
}
|
|
916
|
+
/**
|
|
917
|
+
* Write `<name>.controller.ts` (the code behind `kick g controller`) and return the paths written.
|
|
918
|
+
*
|
|
919
|
+
* @see https://kickjs.app/guide/generators#kick-g-controller
|
|
920
|
+
*/
|
|
850
921
|
export declare function generateController(options: GenerateControllerOptions): Promise<string[]>;
|
|
851
922
|
interface GenerateDtoOptions {
|
|
852
923
|
name: string;
|
|
@@ -863,11 +934,18 @@ interface GenerateDtoOptions {
|
|
|
863
934
|
*/
|
|
864
935
|
schemaLib?: SchemaLib$1;
|
|
865
936
|
}
|
|
937
|
+
/**
|
|
938
|
+
* Write `<name>.dto.ts` (the code behind `kick g dto`) against `schemaLib` (default `'zod'`)
|
|
939
|
+
* and return the paths written.
|
|
940
|
+
*
|
|
941
|
+
* @see https://kickjs.app/guide/generators#kick-g-dto
|
|
942
|
+
*/
|
|
866
943
|
export declare function generateDto(options: GenerateDtoOptions): Promise<string[]>;
|
|
867
944
|
declare const DEPLOY_TARGETS: readonly ['netlify', 'vercel', 'docker'];
|
|
868
945
|
type DeployTarget = (typeof DEPLOY_TARGETS)[number];
|
|
869
946
|
type ProjectTemplate = 'rest' | 'minimal' | 'inertia';
|
|
870
947
|
type SchemaLib = 'zod' | 'valibot' | 'yup';
|
|
948
|
+
type InertiaClient = 'react' | 'vue' | 'svelte';
|
|
871
949
|
interface InitProjectOptions {
|
|
872
950
|
name: string;
|
|
873
951
|
directory: string;
|
|
@@ -875,6 +953,8 @@ interface InitProjectOptions {
|
|
|
875
953
|
initGit?: boolean;
|
|
876
954
|
installDeps?: boolean;
|
|
877
955
|
template?: ProjectTemplate;
|
|
956
|
+
/** What the inertia template's pages are written in. Defaults to `react`. */
|
|
957
|
+
client?: InertiaClient;
|
|
878
958
|
defaultRepo?: string;
|
|
879
959
|
packages?: string[];
|
|
880
960
|
/** Schema library to scaffold env / DTOs with. Defaults to `zod`. */
|
|
@@ -1261,6 +1341,7 @@ interface TypegenLogger {
|
|
|
1261
1341
|
warn(msg: string): void;
|
|
1262
1342
|
error(msg: string): void;
|
|
1263
1343
|
}
|
|
1344
|
+
/** What the typegen runner passes to each plugin's `generate()`. */
|
|
1264
1345
|
interface TypegenContext {
|
|
1265
1346
|
cwd: string;
|
|
1266
1347
|
config: KickConfig;
|
|
@@ -1301,6 +1382,11 @@ interface TypegenContext {
|
|
|
1301
1382
|
*/
|
|
1302
1383
|
watch?: boolean;
|
|
1303
1384
|
}
|
|
1385
|
+
/**
|
|
1386
|
+
* A typegen plugin: owns one file under `.kickjs/types/` and returns its source from `generate()`.
|
|
1387
|
+
*
|
|
1388
|
+
* @see https://kickjs.app/guide/typegen
|
|
1389
|
+
*/
|
|
1304
1390
|
interface TypegenPlugin {
|
|
1305
1391
|
/** Stable id — used as filename: `.kickjs/types/${id}<outExtension>` (slashes → `__`). */
|
|
1306
1392
|
id: string;
|
|
@@ -1327,6 +1413,7 @@ interface TypegenPlugin {
|
|
|
1327
1413
|
*/
|
|
1328
1414
|
generate(ctx: TypegenContext): Promise<string | null>;
|
|
1329
1415
|
}
|
|
1416
|
+
/** Outcome of one plugin in a typegen pass. */
|
|
1330
1417
|
interface TypegenPluginResult {
|
|
1331
1418
|
id: string;
|
|
1332
1419
|
status: 'written' | 'unchanged' | 'skipped' | 'error' | 'drifted';
|
|
@@ -1573,6 +1660,7 @@ declare function buildAssets(config: KickConfig | null, opts: BuildAssetsOptions
|
|
|
1573
1660
|
* own watcher never double-runs the pipeline.
|
|
1574
1661
|
*/
|
|
1575
1662
|
export declare const TYPEGEN_OWNER_KEY = "__kickjs_typegen_owner";
|
|
1663
|
+
/** File-watcher event names that {@link TypegenDevWatcher.handleWatchEvent} accepts. */
|
|
1576
1664
|
type TypegenWatchEvent = 'add' | 'change' | 'unlink' | 'unlinkDir';
|
|
1577
1665
|
/** Injectable pipeline — production uses the real functions. */
|
|
1578
1666
|
interface TypegenDevPipeline {
|
|
@@ -1581,6 +1669,7 @@ interface TypegenDevPipeline {
|
|
|
1581
1669
|
writeTypegenArtifacts: typeof writeTypegenArtifacts;
|
|
1582
1670
|
buildAssets: typeof buildAssets;
|
|
1583
1671
|
}
|
|
1672
|
+
/** Options for {@link createTypegenDevWatcher}. */
|
|
1584
1673
|
interface TypegenDevWatcherOptions {
|
|
1585
1674
|
cwd: string;
|
|
1586
1675
|
/** Pre-loaded kick.config.ts (null when the project has none). */
|
|
@@ -1601,6 +1690,7 @@ interface TypegenDevWatcherOptions {
|
|
|
1601
1690
|
/** Test seam — defaults to the real typegen pipeline. */
|
|
1602
1691
|
pipeline?: TypegenDevPipeline;
|
|
1603
1692
|
}
|
|
1693
|
+
/** Handle returned by {@link createTypegenDevWatcher}. */
|
|
1604
1694
|
interface TypegenDevWatcher {
|
|
1605
1695
|
/** Feed a chokidar-style watcher event into the debounce window. */
|
|
1606
1696
|
handleWatchEvent(event: TypegenWatchEvent, file: string): void;
|
|
@@ -1618,6 +1708,13 @@ interface TypegenDevWatcher {
|
|
|
1618
1708
|
/** Cancel any pending debounced pass. */
|
|
1619
1709
|
dispose(): void;
|
|
1620
1710
|
}
|
|
1711
|
+
/**
|
|
1712
|
+
* Create a debounced typegen runner for dev mode. Feed it file-watcher events: TypeScript
|
|
1713
|
+
* changes trigger an incremental pass, a removed directory triggers a full scan, and asset
|
|
1714
|
+
* template changes rebuild assets. Errors go to `emitWarning` instead of throwing.
|
|
1715
|
+
*
|
|
1716
|
+
* @see https://kickjs.app/guide/typegen#watch-mode-failure-surfacing
|
|
1717
|
+
*/
|
|
1621
1718
|
export declare function createTypegenDevWatcher(opts: TypegenDevWatcherOptions): TypegenDevWatcher;
|
|
1622
1719
|
/**
|
|
1623
1720
|
* One row in the discovered registry. `source` is the npm package name
|
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":";;;KAuSY;;;;;;;;;;;;;;;;;UC3QK;EACf;EACA;;;;;;;EAOA;;;;;;EAMA,SAAS;;
|
|
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;;;UAIM;;EAEf;EACA;;EAEA;;EAEA;;;;;;;KAQU,eACV,KAAK,kBACF,eAAe,wBAAwB,QAAQ,eAAe;;;;;;UAOlD;;EAEf,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqCK,sBAAsB,KAAK,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;wBA0B7C,kBAAkB,OAAO,cAAc;;KCvG3C,uBAAuBA,uBAAoB;;KAG3C,gBAAgBC,gBAAa;;UC5BxB;;EAEf;;EAEA;;;;;;;;;EASA;;EAEA;;;;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AU"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.
|
|
2
|
+
* @forinda/kickjs-cli v8.19.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
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-
|
|
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-CDdF_pWU.mjs";import{n as v}from"./project-B9sWWiFy.mjs";import{r as y,s as b}from"./config-Bb-FdTKY.mjs";import{t as x}from"./project-root-DNQ4RQHQ.mjs";import{n as S,t as C}from"./types-ew1loX4G.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.
|
|
2
|
+
* @forinda/kickjs-cli v8.19.0
|
|
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-ew1loX4G.mjs";export{r as mergeCliPlugins}from"./run-plugins-lJqFqRny.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.
|
|
2
|
+
* @forinda/kickjs-cli v8.19.0
|
|
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-SDDZy9Be.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-ClOtJ6MM.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.
|
|
2
|
+
* @forinda/kickjs-cli v8.19.0
|
|
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,a as t,c as n,l as r,o as i,r as a,s as o,u as s}from"./agent-docs-
|
|
11
|
+
import{C as e,a as t,c as n,l as r,o as i,r as a,s as o,u as s}from"./agent-docs-D10r5OEG.mjs";import{i as c,p as l,s as u}from"./config-Bb-FdTKY.mjs";import{dirname as d,join as f,posix as p,relative as m,resolve as h}from"node:path";import{existsSync as g,readFileSync as _,writeFileSync as v}from"node:fs";import{execFile as y,execFileSync as b,execSync as x,spawnSync as S}from"node:child_process";import{randomBytes as C}from"node:crypto";import{fileURLToPath as w}from"node:url";import{promisify as T}from"node:util";import{parseSync as E}from"oxc-parser";function D(e,t){let n=e[t];if(!n)throw Error(`generatePackageJson: missing resolved version for ${t}. Add it to SIBLING_PACKAGES or THIRD_PARTY_PACKAGES in generators/project.ts.`);return n}function O(e,t){return Object.fromEntries(e.toSorted().map(e=>[e,D(t,e)]))}function k(e){try{let t=b(e,[`--version`],{encoding:`utf-8`,stdio:[`ignore`,`pipe`,`ignore`],timeout:1e4}).trim();return/^\d+\.\d+\.\d+$/.test(t)?`${e}@${t}`:void 0}catch{return}}function A(e){let t=e?.match(/@(\d+)\.(\d+)\./);return t?[Number(t[1]),Number(t[2])]:void 0}function ee(e,t){let n=A(t)?.[0];return e===`yarn`&&n!==void 0&&n>=2?`nodeLinker: node-modules
|
|
12
12
|
`:void 0}function te(e,t,n,r){return JSON.stringify({name:e,...r?{packageManager:r}:{},version:`0.0.0`,type:`module`,scripts:{dev:`kick dev`,build:`kick build`,start:`kick start`,test:`vitest run --passWithNoTests`,...n.scripts},dependencies:O(n.dependencies,t),devDependencies:O(n.devDependencies,t)},null,2)}function j(e,t){let n=Object.entries(t);if(n.length===0)return e;let r=e===``?[]:e.replace(/\n$/,``).split(`
|
|
13
13
|
`),i=e=>e.trim().replace(/^['"]|['"]$/g,``),a=e=>/^[\w-]+$/.test(e)?e:`'${e}'`,o=(e,t)=>{let n=r.findIndex(t=>t.replace(/\s+$/,``)===`${e}:`);if(n===-1){if(!t)return;r.length>0&&r[r.length-1]!==``&&r.push(``),r.push(`${e}:`),n=r.length-1}let i=n+1;for(let e=n+1;e<r.length&&/^(\s|$)/.test(r[e]);e++)r[e].trim()!==``&&(i=e+1);return{start:n,end:i}},s=[];for(let[e,t]of n){let{start:n,end:c}=o(`allowBuilds`,!0),l=r.slice(n+1,c).findIndex(t=>i(t.split(`:`)[0])===e),u=l===-1?void 0:/:\s*(true|false)\s*$/.exec(r[n+1+l]);if(u){s.push([e,u[1]===`true`]);continue}let d=` ${a(e)}: ${t}`;l===-1?r.splice(c,0,d):r[n+1+l]=d,s.push([e,t])}let c=[`onlyBuiltDependencies`,`ignoredBuiltDependencies`];for(let[e,t]of s){if(c.some(t=>{let n=o(t,!1);return n!==void 0&&r.slice(n.start+1,n.end).some(t=>i(t.replace(/^\s*-/,``))===e)}))continue;let{end:n}=o(t?c[0]:c[1],!0);r.splice(n,0,` - ${a(e)}`)}return`${r.join(`
|
|
14
|
-
`)}\n`}const M=`node:22-slim`,N={pnpm:{lockfile:`pnpm-lock.yaml`,installFiles:[`pnpm-workspace.yaml`],install:`pnpm install --frozen-lockfile`,installProd:`pnpm install --prod --frozen-lockfile`,run:e=>`pnpm run ${e}`,image:M,setup:`RUN corepack enable`},npm:{lockfile:`package-lock.json`,installFiles:[],install:`npm ci`,installProd:`npm ci --omit=dev`,run:e=>`npm run ${e}`,image:M},yarn:{lockfile:`yarn.lock`,installFiles:[],install:`yarn install --frozen-lockfile`,installProd:`yarn install --production --frozen-lockfile`,run:e=>`yarn run ${e}`,image:M,setup:`RUN corepack enable`},bun:{lockfile:`bun.lock`,installFiles:[],install:`bun install --frozen-lockfile`,installProd:`bun install --production --frozen-lockfile`,run:e=>`bun run ${e}`,image:`oven/bun:1`}},P={lockfile:`yarn.lock`,installFiles:[`.yarnrc.yml`],install:`yarn install --immutable`,installProd:`yarn workspaces focus --all --production`,run:e=>`yarn run ${e}`,image:M,setup:`RUN corepack enable`},
|
|
14
|
+
`)}\n`}const M=`node:22-slim`,N={pnpm:{lockfile:`pnpm-lock.yaml`,installFiles:[`pnpm-workspace.yaml`],install:`pnpm install --frozen-lockfile`,installProd:`pnpm install --prod --frozen-lockfile`,run:e=>`pnpm run ${e}`,image:M,setup:`RUN corepack enable`},npm:{lockfile:`package-lock.json`,installFiles:[],install:`npm ci`,installProd:`npm ci --omit=dev`,run:e=>`npm run ${e}`,image:M},yarn:{lockfile:`yarn.lock`,installFiles:[],install:`yarn install --frozen-lockfile`,installProd:`yarn install --production --frozen-lockfile`,run:e=>`yarn run ${e}`,image:M,setup:`RUN corepack enable`},bun:{lockfile:`bun.lock`,installFiles:[],install:`bun install --frozen-lockfile`,installProd:`bun install --production --frozen-lockfile`,run:e=>`bun run ${e}`,image:`oven/bun:1`}},P={lockfile:`yarn.lock`,installFiles:[`.yarnrc.yml`],install:`yarn install --immutable`,installProd:`yarn workspaces focus --all --production`,run:e=>`yarn run ${e}`,image:M,setup:`RUN corepack enable`},F={api:`docker run -p 3000:3000 <name>`,inertia:`docker run -p 3000:3000 -e SESSION_SECRET=<a long random string> -e APP_URL=<https://your.site> <name>`,fullstack:`docker run -p 3000:3000 <name>`};function ne(e,t,n,r){let[i=0,a=0]=A(r)??[],o=t===`yarn`&&i>=2?i>=4?P:{...P,installProd:P.install}:t===`bun`&&r&&(i<1||i===1&&a<2)?{...N.bun,lockfile:`bun.lockb`}:N[t],s=`${o.setup?`\n${o.setup}`:``}
|
|
15
15
|
# Compilers for native addons (better-sqlite3, …) that have no prebuilt binary.
|
|
16
16
|
RUN apt-get update && apt-get install -y --no-install-recommends python3 make g++ \\
|
|
17
17
|
&& rm -rf /var/lib/apt/lists/*`,c=`# The build stage generates the Prisma client, if any.
|
|
@@ -20,7 +20,7 @@ ENV PRISMA_SKIP_POSTINSTALL_GENERATE=1`,l=(e===`fullstack`?[`package.json`,o.loc
|
|
|
20
20
|
# ${n} — the long-running server in one image.
|
|
21
21
|
#
|
|
22
22
|
# docker build -t ${n} .
|
|
23
|
-
# ${
|
|
23
|
+
# ${F[e].replace(`<name>`,n)}
|
|
24
24
|
#
|
|
25
25
|
# Environment comes from the platform or \`docker run\`; .env files are not
|
|
26
26
|
# copied into the image. The lockfile must be committed — installs are frozen.
|
|
@@ -98,7 +98,7 @@ RUN mkdir -p data && chown node:node data
|
|
|
98
98
|
USER node
|
|
99
99
|
EXPOSE 3000
|
|
100
100
|
CMD ["node", "dist/index.js"]
|
|
101
|
-
`}function
|
|
101
|
+
`}function re(){return`# Rebuilt inside the image.
|
|
102
102
|
**/node_modules
|
|
103
103
|
**/dist
|
|
104
104
|
**/.kickjs
|
|
@@ -112,7 +112,7 @@ CMD ["node", "dist/index.js"]
|
|
|
112
112
|
.git
|
|
113
113
|
**/coverage
|
|
114
114
|
*.log
|
|
115
|
-
`}const
|
|
115
|
+
`}const ie=[`netlify`,`vercel`,`docker`],ae=[`kick.config.ts`,`kick.config.js`,`kick.config.mjs`,`kick.config.json`],oe=e=>ae.some(t=>g(f(e,t)));function se(e){return oe(f(e,`server`))&&g(f(e,`web`))}function ce(e){let t=(typeof e==`string`?e.split(`,`):e).map(e=>e.trim().toLowerCase()).filter(Boolean),n=t.filter(e=>!ie.includes(e));if(n.length>0)throw Error(`Unknown deploy target: ${n.join(`, `)} — expected ${ie.join(`, `)}`);return[...new Set(t)]}function le(e){return JSON.parse(_(e,`utf-8`))}function ue(e,t){return e===`pnpm`?`pnpm build && pnpm --filter ./server exec kick build:${t}`:`${e} run build && cd server && kick build:${t}`}async function de(i){let{dir:a,targets:o}=i,c=se(a);if(!c&&!oe(a))throw Error(`${a} is not a KickJS project (no kick.config) — run kick g deploy from the project, or from a fullstack workspace's root.`);let l=c?f(a,`server`):a,u=f(a,`package.json`),d=le(u),p=c?le(f(l,`package.json`)):d,h=await t(i.pm,a),_=`@forinda/kickjs-inertia`in{...p.dependencies,...p.devDependencies},v=/* @__PURE__ */ new Map,y={},b=()=>{for(let[e,t]of r([`deploy-serverless`]).files)v.set(f(l,e),t)},x=(e,t)=>{let i=n(r([t]).files,{packageManager:h,netlifyPublish:_?`dist/client`:`dist/public`});for(let[e,t]of i)v.set(f(a,e),t);b(),y[`build:${e}`]=c?ue(h,e):`${d.scripts?.build??`kick build`} && kick build:${e}`};for(let e of o)if(e===`netlify`)x(`netlify`,c?`deploy-netlify-workspace`:`deploy-netlify`);else if(e===`vercel`)x(`vercel`,`deploy-vercel`);else{let e=c?`fullstack`:_?`inertia`:`api`;v.set(f(a,`Dockerfile`),ne(e,h,String(d.name??`app`),d.packageManager)),v.set(f(a,`.dockerignore`),re())}let S=[];for(let[t,n]of v)(!g(t)||i.force||!t.endsWith(f(`src`,`serverless.ts`))&&await s({message:`${m(a,t)} already exists. Overwrite?`,initialValue:!1}))&&(await e(t,n),S.push(t));let C=Object.entries(y).filter(([e])=>!d.scripts?.[e]);return C.length>0&&(d.scripts={...d.scripts,...Object.fromEntries(C)},await e(u,`${JSON.stringify(d,null,2)}\n`),S.push(u)),S}const fe=T(y),I=/[&|<>^"'`(){}[\];!%\r\n\\]/;function L(e,t,n=process.platform){if(n!==`win32`)return[e,t];if(I.test(e)||t.some(e=>I.test(e)))return null;let r=[e,...t].map(e=>e.includes(` `)?`"${e}"`:e).join(` `);return[process.env.ComSpec||`cmd.exe`,[`/d`,`/s`,`/c`,r]]}function R(e,t,n={}){let r=L(e,t);if(!r)return null;try{return b(r[0],r[1],{encoding:`utf-8`,timeout:n.timeout??5e3,cwd:n.cwd,stdio:[`ignore`,`pipe`,`ignore`],windowsHide:!0}).toString().trim()||null}catch{return null}}function pe(e,t,n={}){let r=L(e,t);if(!r)throw Error(`Refusing to run '${e}': unsafe arguments`);b(r[0],r[1],{cwd:n.cwd,stdio:`inherit`,windowsHide:!0})}function me(e,t,n){let r=S(process.execPath,[e],{cwd:n,stdio:`inherit`,env:{...process.env,...t}});r.status!==0&&process.exit(r.status??1)}async function z(e,t,n={}){let r=L(e,t);if(!r)return null;try{let{stdout:e}=await fe(r[0],r[1],{encoding:`utf-8`,timeout:n.timeout??5e3,cwd:n.cwd,windowsHide:!0});return e.toString().trim()||null}catch{return null}}const he={adapter:`adapters`,middleware:`middlewares`};function B(e,t,n=e=>e,r=`src/index.ts`){let i={source:e,added:[],present:[],manual:[]};for(let e of t){if(!e.slot||!e.code||e.slot.startsWith(`env-`)||e.slot.startsWith(`config-`))continue;let t=he[e.slot],a=n(e.code),o=_e(a),s=E(r,i.source).program,c=t?ge(s):void 0;if(!c){i.manual.push({...e,code:a});continue}let l=c.properties.find(e=>e.type===`Property`&&(e.key?.name??e.key?.value)===t);if(l&&l.value.type!==`ArrayExpression`){i.manual.push({...e,code:a});continue}let u=o&&e.import?V(s,e.import.from,o):o;l&&u&&i.source.slice(l.value.start,l.value.end).includes(`${u}(`)?i.present.push(o??H(a)):(i.source=l?ve(i.source,l.value,l.value.elements,a):Ce(i.source,c,t,a),e.import&&(i.source=we(i.source,e.import,r)),i.added.push(o??H(a)))}return i}function ge(e){let t,n=e=>{if(t||!e||typeof e!=`object`)return;if(Array.isArray(e))return e.forEach(n);let r=e;if(r.type===`CallExpression`&&r.callee?.type===`Identifier`&&r.callee.name===`bootstrap`&&r.arguments?.[0]?.type===`ObjectExpression`)t=r.arguments[0];else for(let e in r)n(r[e])};return n(e),t}function V(e,t,n){for(let r of e.body)if(r.type===`ImportDeclaration`&&r.source.value===t)for(let e of r.specifiers){let t=e.imported?.name??e.imported?.value;if(e.type===`ImportSpecifier`&&t===n)return e.local.name}return n}function _e(e){let t=e.split(`
|
|
116
116
|
`).filter(e=>!e.trim().startsWith(`//`)).join(`
|
|
117
117
|
`),n=/^\s*([A-Za-z_$][\w$.]*)\s*\(/.exec(t)?.[1];if(n)return n;for(let e of t.matchAll(/(?<![\w$])([A-Za-z_$][\w$]*)\s*\(/g))if(e[1]!==`import`)return e[1]}const H=e=>e.split(`
|
|
118
118
|
`).find(e=>e.trim()&&!e.trim().startsWith(`//`))?.trim()??e,U=(e,t)=>/^[ \t]*/.exec(e.slice(e.lastIndexOf(`
|
|
@@ -143,11 +143,11 @@ CMD ["node", "dist/index.js"]
|
|
|
143
143
|
Add this to kick.config.ts:
|
|
144
144
|
`),console.log(m.replace(/^/gm,` `)),console.log());let x=[...new Set(e.map(e=>Te[e]).filter(Boolean))];for(let e of await a(v,x,n))console.log(` Created ${e}`)}}T?console.log(` Done!
|
|
145
145
|
`):(console.log(` Finished with errors — the install above did not complete.
|
|
146
|
-
`),process.exitCode=1)})}const $e=d(w(import.meta.url));function et(e){return{kick:c(e,`kick`),runDev:l(e,`dev`),runBuild:l(e,`build`),runStart:l(e,`start`),runTest:l(e,`test`)}}const $=JSON.parse(_([f($e,`..`,`package.json`),f($e,`..`,`..`,`package.json`)].find(g),`utf-8`)),tt=[`@forinda/kickjs`,`@forinda/kickjs-cli`,`@forinda/kickjs-schema`,`@forinda/kickjs-vite`,`@forinda/kickjs-swagger`,`@forinda/kickjs-ws`,`@forinda/kickjs-queue`,`@forinda/kickjs-devtools`,`@forinda/kickjs-testing`,`@forinda/kickjs-client`,`@forinda/kickjs-inertia`,`@forinda/kickjs-storage`,`@forinda/kickjs-view`],nt={react:{fallback:`^19.0.0`},"react-dom":{fallback:`^19.0.0`},"@types/react":{fallback:`^19.0.0`},"@types/react-dom":{fallback:`^19.0.0`},"@vitejs/plugin-react":{fallback:`^5.0.0`},"@inertiajs/react":{fallback:`^3.9.0`,cap:`^3`},"@inertiajs/core":{fallback:`^3.9.0`,cap:`^3`},"@types/node":{fallback:`^25.0.0`},"@types/supertest":{fallback:`^7.2.1`},supertest:{fallback:`^7.2.2`},vitest:{fallback:`^4.1.2`},"@swc/core":{fallback:`^1.15.21`},"unplugin-swc":{fallback:`^1.5.9`},oxfmt:{fallback:`^0.65.0`},oxlint:{fallback:`^1.80.0`},dotenv:{fallback:`^17.3.1`,cap:`^17`},"reflect-metadata":{fallback:`^0.2.2`},vite:{fallback:`^8.0.3`,cap:`^8`},typescript:{fallback:`^7.0.2`,cap:`^7`},"@typescript/typescript6":{fallback:`^6.0.2`,cap:`^6`},express:{fallback:`^5.1.0`,cap:`^5`},"@types/express":{fallback:`^5.0.6`,cap:`^5`},fastify:{fallback:`^5.0.0`,cap:`^5`},"@fastify/middie":{fallback:`^9.0.0`,cap:`^9`},h3:{fallback:`^2.0.2`,cap:`^2`},"serve-static":{fallback:`^2.2.0`,cap:`^2`},zod:{fallback:`^4.3.6`,cap:`^4`},valibot:{fallback:`^1.4.1`,cap:`^1`},"@valibot/to-json-schema":{fallback:`^1.8.0`,cap:`^1`},yup:{fallback:`^1.7.1`,cap:`^1`},ws:{fallback:`^8.18.0`,cap:`^8`},bullmq:{fallback:`^5.0.0`,cap:`^5`},ioredis:{fallback:`^5.0.0`,cap:`^5`}};function rt(e){if(!e)return null;let t=e.trim();if(/^\d+\.\d+\.\d+/.test(t))return t.split(/\s/)[0];try{let e=JSON.parse(t),n=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`);return n.length>0?n[n.length-1]:null}catch{return null}}function it(e){return e===`@forinda/kickjs-cli`?`^${$.version}`:`latest`}async function at(e,t,n){let r=Array.from({length:e.length}),i=0,a=Array.from({length:Math.min(t,e.length)},async()=>{for(;i<e.length;){let t=i++;r[t]=await n(e[t])}});return await Promise.all(a),r}async function ot(){let e=[...tt.map(e=>({name:e,fallback:it(e),cap:void 0})),...Object.entries(nt).map(([e,t])=>({name:e,...t}))],t=Date.now()+2e4,n=await at(e,8,async({name:e,fallback:n,cap:r})=>{let i=t-Date.now();if(i<=0)return[e,n];let a=r?`${e}@${r}`:e,o=rt(await z(`npm`,r?[`view`,a,`version`,`--json`]:[`view`,a,`version`],{timeout:i}));return[e,o?`^${o}`:n]});return Object.fromEntries(n)}function st(e,t){let n=R(`npm`,[`view`,`${e}@${t}`,`version`],{timeout:2e4});return n&&/^\d+\.\d+\.\d+/.test(n)?n:null}function ct(e){return(e??``).replace(/^[\^~>=<\s]+/,``)}function lt(e,t){let n=e=>ct(e).split(`-`)[0].split(`.`).map(e=>Number.parseInt(e,10)||0),[r=0,i=0,a=0]=n(e),[o=0,s=0,c=0]=n(t);return r===o?i===s?a>=c:i>s:r>o}const ut=$.version;async function dt(){let e=rt(await z(`npm`,[`view`,`@forinda/kickjs-cli`,`version`],{timeout:5e3}));return e&&ft(ut,e)?e:null}function ft(e,t){return e.split(`-`)[0]===t.split(`-`)[0]?e.includes(`-`)&&!t.includes(`-`):!lt(e,t)}function pt(e,t,n){let r=R(`npm`,[`view`,`${e}@${t}`,`exports`,`--json`],{timeout:2e4});if(!r)return!1;try{let e=JSON.parse(r);return Object.prototype.hasOwnProperty.call(e,n)}catch{return!1}}async function mt(t){let{name:i,directory:a,packageManager:s=`pnpm`,template:u=`rest`,
|
|
147
|
-
`)});for(let[t,n]of
|
|
148
|
-
Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${s} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-
|
|
149
|
-
Project scaffolded successfully!`),console.log();let
|
|
146
|
+
`),process.exitCode=1)})}const $e=d(w(import.meta.url));function et(e){return{kick:c(e,`kick`),runDev:l(e,`dev`),runBuild:l(e,`build`),runStart:l(e,`start`),runTest:l(e,`test`)}}const $=JSON.parse(_([f($e,`..`,`package.json`),f($e,`..`,`..`,`package.json`)].find(g),`utf-8`)),tt=[`@forinda/kickjs`,`@forinda/kickjs-cli`,`@forinda/kickjs-schema`,`@forinda/kickjs-vite`,`@forinda/kickjs-swagger`,`@forinda/kickjs-ws`,`@forinda/kickjs-queue`,`@forinda/kickjs-devtools`,`@forinda/kickjs-testing`,`@forinda/kickjs-client`,`@forinda/kickjs-inertia`,`@forinda/kickjs-storage`,`@forinda/kickjs-view`],nt={react:{fallback:`^19.0.0`},"react-dom":{fallback:`^19.0.0`},"@types/react":{fallback:`^19.0.0`},"@types/react-dom":{fallback:`^19.0.0`},"@vitejs/plugin-react":{fallback:`^5.0.0`},"@inertiajs/react":{fallback:`^3.9.0`,cap:`^3`},"@inertiajs/core":{fallback:`^3.9.0`,cap:`^3`},"@inertiajs/vue3":{fallback:`^3.9.0`,cap:`^3`},"@inertiajs/svelte":{fallback:`^3.9.0`,cap:`^3`},vue:{fallback:`^3.5.0`,cap:`^3`},"@vitejs/plugin-vue":{fallback:`^6.0.0`},svelte:{fallback:`^5.46.4`,cap:`^5`},"@sveltejs/vite-plugin-svelte":{fallback:`^7.0.0`},"@types/node":{fallback:`^25.0.0`},"@types/supertest":{fallback:`^7.2.1`},supertest:{fallback:`^7.2.2`},vitest:{fallback:`^4.1.2`},"@swc/core":{fallback:`^1.15.21`},"unplugin-swc":{fallback:`^1.5.9`},oxfmt:{fallback:`^0.65.0`},oxlint:{fallback:`^1.80.0`},dotenv:{fallback:`^17.3.1`,cap:`^17`},"reflect-metadata":{fallback:`^0.2.2`},vite:{fallback:`^8.0.3`,cap:`^8`},typescript:{fallback:`^7.0.2`,cap:`^7`},"@typescript/typescript6":{fallback:`^6.0.2`,cap:`^6`},express:{fallback:`^5.1.0`,cap:`^5`},"@types/express":{fallback:`^5.0.6`,cap:`^5`},fastify:{fallback:`^5.0.0`,cap:`^5`},"@fastify/middie":{fallback:`^9.0.0`,cap:`^9`},h3:{fallback:`^2.0.2`,cap:`^2`},"serve-static":{fallback:`^2.2.0`,cap:`^2`},zod:{fallback:`^4.3.6`,cap:`^4`},valibot:{fallback:`^1.4.1`,cap:`^1`},"@valibot/to-json-schema":{fallback:`^1.8.0`,cap:`^1`},yup:{fallback:`^1.7.1`,cap:`^1`},ws:{fallback:`^8.18.0`,cap:`^8`},bullmq:{fallback:`^5.0.0`,cap:`^5`},ioredis:{fallback:`^5.0.0`,cap:`^5`}};function rt(e){if(!e)return null;let t=e.trim();if(/^\d+\.\d+\.\d+/.test(t))return t.split(/\s/)[0];try{let e=JSON.parse(t),n=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`);return n.length>0?n[n.length-1]:null}catch{return null}}function it(e){return e===`@forinda/kickjs-cli`?`^${$.version}`:`latest`}async function at(e,t,n){let r=Array.from({length:e.length}),i=0,a=Array.from({length:Math.min(t,e.length)},async()=>{for(;i<e.length;){let t=i++;r[t]=await n(e[t])}});return await Promise.all(a),r}async function ot(){let e=[...tt.map(e=>({name:e,fallback:it(e),cap:void 0})),...Object.entries(nt).map(([e,t])=>({name:e,...t}))],t=Date.now()+2e4,n=await at(e,8,async({name:e,fallback:n,cap:r})=>{let i=t-Date.now();if(i<=0)return[e,n];let a=r?`${e}@${r}`:e,o=rt(await z(`npm`,r?[`view`,a,`version`,`--json`]:[`view`,a,`version`],{timeout:i}));return[e,o?`^${o}`:n]});return Object.fromEntries(n)}function st(e,t){let n=R(`npm`,[`view`,`${e}@${t}`,`version`],{timeout:2e4});return n&&/^\d+\.\d+\.\d+/.test(n)?n:null}function ct(e){return(e??``).replace(/^[\^~>=<\s]+/,``)}function lt(e,t){let n=e=>ct(e).split(`-`)[0].split(`.`).map(e=>Number.parseInt(e,10)||0),[r=0,i=0,a=0]=n(e),[o=0,s=0,c=0]=n(t);return r===o?i===s?a>=c:i>s:r>o}const ut=$.version;async function dt(){let e=rt(await z(`npm`,[`view`,`@forinda/kickjs-cli`,`version`],{timeout:5e3}));return e&&ft(ut,e)?e:null}function ft(e,t){return e.split(`-`)[0]===t.split(`-`)[0]?e.includes(`-`)&&!t.includes(`-`):!lt(e,t)}function pt(e,t,n){let r=R(`npm`,[`view`,`${e}@${t}`,`exports`,`--json`],{timeout:2e4});if(!r)return!1;try{let e=JSON.parse(r);return Object.prototype.hasOwnProperty.call(e,n)}catch{return!1}}async function mt(t){let{name:i,directory:a,packageManager:s=`pnpm`,template:u=`rest`,client:d=`react`,defaultRepo:p=`inmemory`,packages:m=[],schemaLib:h=`zod`,runtime:_=`express`}=t,v=a,y=e=>console.log(` ${e}`);console.log(`\n Creating KickJS project: ${i}\n`),t.versions||y(`Resolving package versions...`);let b=t.versions??await ot(),S=Object.keys(b).filter(e=>b[e]===`latest`);if(S.length>0&&y(`WARNING: could not reach npm for ${S.join(`, `)} — pinned to 'latest'`),_!==`express`){if(pt(`@forinda/kickjs`,`latest`,`./${_}`))y(`Using @forinda/kickjs@latest (stable ships the ${_} runtime)`);else{let e=[`@forinda/kickjs`,`@forinda/kickjs-cli`,`@forinda/kickjs-vite`],t=[],n=!1;for(let r of e){let e=st(r,`alpha`);e&<(e,ct(b[r]))&&(b[r]=`^${e}`,t.push(`${r}@^${e}`),r===`@forinda/kickjs`&&(n=!0))}y(n?`Using the alpha channel for the ${_} runtime: ${t.join(`, `)}`:`WARNING: could not resolve @forinda/kickjs@alpha — the ${_} runtime subpath may be missing. After install, run: ${s} add @forinda/kickjs@alpha`)}}let w=m.filter(e=>!g(f(o,`feature-${e}`)));w.length>0&&y(`WARNING: skipping unknown package(s): ${w.join(`, `)} — add them later with kick add`);let T=r([..._t({template:u,client:d,runtime:_,schemaLib:h,packages:m}),...t.extraLayers??[]],{vars:{name:i,version:$.version},extra:[{slot:`repo`,code:p===`inmemory`?`repo: 'inmemory'`:`repo: { name: '${p.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`)}' }`},...t.spaClientDir?[gt(t.spaClientDir)]:[]]}),E=t.platformConfig===!1?void 0:k(s);await e(f(v,`package.json`),te(i,b,T,E));let D=ee(s,E);D&&await e(f(v,`.yarnrc.yml`),D);let O=n(T.files,{name:i,template:u,runtime:_,packageManager:s,...et(s),templateLabel:{rest:`REST API`,minimal:`Minimal`,inertia:`Inertia (${{react:`React`,vue:`Vue`,svelte:`Svelte`}[d]})`}[u],sessionSecret:C(32).toString(`hex`),packages:[...T.dependencies,...T.devDependencies].filter(e=>e.startsWith(`@forinda/`)).map(e=>`- \`${e}\``).join(`
|
|
147
|
+
`)});for(let[t,n]of O)await e(f(v,t),n);t.deploy?.length&&t.platformConfig!==!1&&await de({dir:v,targets:t.deploy,pm:s,force:!0});let{generateAgentDocs:A}=await import(`./agent-docs-D10r5OEG.mjs`).then(e=>e.t);await A({outDir:v,name:i,pm:s,template:u,only:`both`,force:!0});let j={...qe,...Ye(m),...T.builds};if(t.approveInstallScripts!==!1&&Q(s,v,j),t.installDeps){console.log(`\n Installing dependencies with ${s}...\n`);try{x(`${s} install`,{cwd:v,stdio:`inherit`}),console.log(`
|
|
148
|
+
Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${s} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-Bkikzy45.mjs`).then(e=>e.n);await e({cwd:v,allowDuplicates:!0,silent:!0})}catch{}if(t.initGit)try{x(`git init`,{cwd:v,stdio:`pipe`}),x(`git branch -M main`,{cwd:v,stdio:`pipe`}),x(`git add -A`,{cwd:v,stdio:`pipe`}),x(`git commit -m "chore: initial commit from kick new"`,{cwd:v,stdio:`pipe`}),y(`Git repository initialized`)}catch{y(`Warning: git init failed (git may not be installed)`)}console.log(`
|
|
149
|
+
Project scaffolded successfully!`),console.log();let M=v!==process.cwd();y(`Next steps:`),M&&y(` cd ${i}`),t.installDeps||y(` ${s} install`);let N=c(s,`kick`),P={rest:`${N} g module user`,minimal:`# add your routes to src/index.ts`,inertia:`# pages: src/modules/pages + src/client/pages`};y(` ${P[u]??P.rest}`),y(` ${l(s,`dev`)}`);let F=e=>{let t=Math.max(...e.map(([e])=>e.length))+2;for(let[n,r]of e)y(` ${n.padEnd(t)}${r}`)};return y(``),y(`Commands:`),F([[l(s,`dev`),`Start dev server with Vite HMR`],[l(s,`build`),`Production build via Vite`],[l(s,`start`),`Run production build`]]),y(``),y(`Generators:`),F([[`${N} g module <name>`,`REST module (controller, service, DTOs, repository)`],[`${N} g scaffold <n> <f..>`,`CRUD module from field definitions`],[`${N} g controller <name>`,`Standalone controller`],[`${N} g service <name>`,`@Service() class`],[`${N} g middleware <name>`,`Global connect-style middleware`],[`${N} g guard <name>`,`Route guard (auth, roles, etc.)`],[`${N} g adapter <name>`,`AppAdapter with lifecycle hooks`],[`${N} g dto <name>`,`DTO schema (Zod / Valibot / Yup)`],[`${N} g config`,`Generate kick.config.ts`]]),y(``),y(`Add packages:`),F([[`${N} add <pkg>`,`Install a KickJS package + peers`],[`${N} add --list`,`Show all available packages`]]),y(``),y(`Available: ${Ve}`),y(``),{builds:j}}const ht=e=>`'${JSON.stringify(e).slice(1,-1).replaceAll(`\\"`,`"`).replaceAll(`'`,`\\'`)}'`;function gt(e){return{import:{from:`@forinda/kickjs/spa`,names:[`SpaAdapter`]},slot:`adapter`,code:`// Serves the built frontend from this origin in production.
|
|
150
150
|
// Inert until the client build exists, so \`kick dev\` (where Vite
|
|
151
151
|
// serves the client and proxies /api here) is unaffected.
|
|
152
|
-
SpaAdapter({ clientDir: ${ht(e)} })`}}function _t(e){return[`base`,`template-${e.template}
|
|
153
|
-
//# sourceMappingURL=project-
|
|
152
|
+
SpaAdapter({ clientDir: ${ht(e)} })`}}function _t(e){return[`base`,`template-${e.template}`,...e.template===`inertia`?[`inertia-${e.client??`react`}`]:[],`runtime-${e.runtime}`,`schema-${e.schemaLib}`,...e.packages.filter(e=>g(f(o,`feature-${e}`))).map(e=>`feature-${e}`)]}export{ee as C,k as S,B as _,J as a,de as b,Q as c,Ze as d,X as f,we as g,De as h,ot as i,Y as l,Oe as m,mt as n,q as o,Z as p,dt as r,He as s,ut as t,Qe as u,pe as v,ce as x,me as y};
|
|
153
|
+
//# sourceMappingURL=project-B9sWWiFy.mjs.map
|