@forinda/kickjs-cli 8.3.0 → 8.4.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-VPtM_Kgj.mjs → agent-docs-BIYv2Od-.mjs} +2 -2
- package/dist/{agent-docs-CpoUa3NG.mjs → agent-docs-DWRW_0cn.mjs} +3 -3
- package/dist/{agent-docs-CpoUa3NG.mjs.map → agent-docs-DWRW_0cn.mjs.map} +1 -1
- package/dist/{build-BhoYGIVD.mjs → build-BrNa6gYZ.mjs} +2 -2
- package/dist/{build-BKNvIOBh.mjs → build-Bw_SFnBG.mjs} +3 -3
- package/dist/{build-BKNvIOBh.mjs.map → build-Bw_SFnBG.mjs.map} +1 -1
- package/dist/{builtins-6FCYMic-.mjs → builtins-CNZ4QP-z.mjs} +4 -4
- package/dist/{builtins-BvdsVFXh.mjs → builtins-DHjV84lv.mjs} +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/{config-LkaeajTr.mjs → config-B6LRxtE1.mjs} +3 -3
- package/dist/{config-LkaeajTr.mjs.map → config-B6LRxtE1.mjs.map} +1 -1
- package/dist/{config-3zv5pWqb.mjs → config-DIH8bQUO.mjs} +2 -2
- package/dist/{doctor-3-n9AElz.mjs → doctor-DzqvC6jF.mjs} +4 -4
- package/dist/{doctor-3-n9AElz.mjs.map → doctor-DzqvC6jF.mjs.map} +1 -1
- package/dist/{fullstack-D_OHhyZX.mjs → fullstack-BwdcyVD3.mjs} +18 -12
- package/dist/fullstack-BwdcyVD3.mjs.map +1 -0
- package/dist/{fullstack-0D2Dgia_.mjs → fullstack-CkAO5DhE.mjs} +17 -11
- package/dist/index.d.mts +7 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{plugin-MfCs1kvG.mjs → plugin-BdN4scZR.mjs} +2 -2
- package/dist/{plugin-3V8ZP2h3.mjs → plugin-C11bSFtE.mjs} +2 -2
- package/dist/{project-Evcbbdbq.mjs → project--WiWkarb.mjs} +5 -5
- package/dist/{project-D-8rOQYi.mjs → project-JoccwqS2.mjs} +7 -7
- package/dist/project-JoccwqS2.mjs.map +1 -0
- package/dist/{project-docs-B6XKHBMO.mjs → project-docs-8d5GNDIw.mjs} +2 -2
- package/dist/{project-docs-B6XKHBMO.mjs.map → project-docs-8d5GNDIw.mjs.map} +1 -1
- package/dist/{project-docs-B-qcYAX9.mjs → project-docs-Ck3uzaEG.mjs} +1 -1
- package/dist/{project-root-6mdsMXwA.mjs → project-root-DORRVmte.mjs} +3 -3
- package/dist/{project-root-6mdsMXwA.mjs.map → project-root-DORRVmte.mjs.map} +1 -1
- package/dist/{project-root-CxadsnDd.mjs → project-root-D_rrQbpy.mjs} +2 -2
- package/dist/{prompts-BtUBi1ob.mjs → prompts-DHHDYxLL.mjs} +2 -2
- package/dist/{prompts-BtUBi1ob.mjs.map → prompts-DHHDYxLL.mjs.map} +1 -1
- package/dist/{rolldown-runtime-BeIFeoWC.mjs → rolldown-runtime-LCdccCoI.mjs} +1 -1
- package/dist/{run-plugins-lLfcDAbT.mjs → run-plugins-DSYGn4AC.mjs} +41 -41
- package/dist/run-plugins-DSYGn4AC.mjs.map +1 -0
- package/dist/{typegen-DLdD6SMm.mjs → typegen-Bv9EzadE.mjs} +4 -4
- package/dist/{typegen-yk3CJH18.mjs → typegen-COTKpuqW.mjs} +5 -5
- package/dist/{typegen-yk3CJH18.mjs.map → typegen-COTKpuqW.mjs.map} +1 -1
- package/dist/{types-HQhLYWkB.mjs → types-CW4qiwB1.mjs} +1 -1
- package/package.json +3 -3
- package/dist/fullstack-D_OHhyZX.mjs.map +0 -1
- package/dist/project-D-8rOQYi.mjs.map +0 -1
- package/dist/run-plugins-lLfcDAbT.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.
|
|
2
|
+
* @forinda/kickjs-cli v8.4.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{l as e}from"./project-docs-
|
|
11
|
+
import{l as e}from"./project-docs-8d5GNDIw.mjs";import{d as t,f as n,i as r,n as i,o as a,p as o,t as s}from"./project-JoccwqS2.mjs";import{join as c}from"node:path";import{execFileSync as l}from"node:child_process";const u=`https://kickjs.app/guide/fullstack-frontend.html`,d=[{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`}],f=`react-ts`;function p(e,t,n=f){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 m(d){let{name:m,directory:g,schemaLib:_=`zod`,runtime:v=`express`,frontend:y=`kick`,viteTemplate:b=f}=d,x=[`pnpm`,`npm`,`yarn`,`bun`].includes(d.packageManager),S=x?d.packageManager:`pnpm`,E=g,D=e=>console.log(` ${e}`);d.packageManager!==void 0&&!x&&D(`Warning: unknown package manager '${String(d.packageManager)}' — falling back to pnpm.`),console.log(`\n Creating fullstack KickJS workspace: ${m}\n`),console.log(` Resolving package versions...`);let O=await i();if(await s({name:`${m}-server`,directory:c(E,`server`),packageManager:S,template:`minimal`,schemaLib:_,runtime:v,withClientMap:!0,strictPort:!0,approveInstallScripts:!1,platformConfig:!1,initGit:!1,installDeps:!1,spaClientDir:`../web/dist`,versions:O}),y===`vite`){console.log(`\n Handing web/ to create-vite (${b})...\n`);let[e,...t]=p(S,`web`,b);o(e,t,{cwd:E})}else await h(E,m,O);await e(c(E,`package.json`),C(m,S,O[`@forinda/kickjs-cli`])),S===`pnpm`&&await e(c(E,`pnpm-workspace.yaml`),`packages:
|
|
12
12
|
- server
|
|
13
13
|
- web
|
|
14
|
-
`),a(E,
|
|
15
|
-
Fullstack workspace scaffolded!`),console.log(),
|
|
14
|
+
`),a(S,E,r),await e(c(E,`.gitignore`),w()),await e(c(E,`netlify.toml`),t({command:`${S} run build:netlify`,publish:`web/dist`,spa:!0})),await e(c(E,`vercel.json`),n(`${S} run build:vercel`)),await e(c(E,`README.md`),T(m,S,y));let{generateAgentDocs:k}=await import(`./agent-docs-DWRW_0cn.mjs`).then(e=>e.t);if(await k({outDir:E,name:m,pm:S,template:`fullstack`,only:`all`,force:!0}),d.installDeps){console.log(`\n Installing workspace dependencies with ${S}...\n`);try{o(S,[`install`],{cwd:E})}catch{console.log(`\n Warning: ${S} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-COTKpuqW.mjs`).then(e=>e.n);await e({cwd:c(E,`server`),allowDuplicates:!0,silent:!0})}catch{}if(d.initGit)try{l(`git`,[`init`],{cwd:E,stdio:`pipe`}),l(`git`,[`branch`,`-M`,`main`],{cwd:E,stdio:`pipe`}),l(`git`,[`add`,`-A`],{cwd:E,stdio:`pipe`}),l(`git`,[`commit`,`-m`,`chore: initial commit from kick new (fullstack)`],{cwd:E,stdio:`pipe`}),D(`Git repository initialized`)}catch{D(`Warning: git init failed (git may not be installed)`)}console.log(`
|
|
15
|
+
Fullstack workspace scaffolded!`),console.log(),D(`Next steps:`),D(` cd ${m}`),d.installDeps||D(` ${S} install`),S===`pnpm`?D(` pnpm dev # runs server (kick dev) + web (vite) together`):(D(` ${S} run dev:server # terminal 1`),D(` ${S} run dev:web # terminal 2`)),D(``),y===`vite`?(D(`web/ is create-vite output, unwired. To type it against the API:`),D(` ${u}`)):(D(`The web app calls the API through @forinda/kickjs-client —`),D(`edit server/src/modules/hello and watch web/src/App.tsx's types follow.`)),D(``)}async function h(t,n,r){await e(c(t,`web/package.json`),g(n,r)),await e(c(t,`web/vite.config.ts`),_()),await e(c(t,`web/tsconfig.json`),v()),await e(c(t,`web/index.html`),y(n)),await e(c(t,`web/src/main.tsx`),b()),await e(c(t,`web/src/App.tsx`),x()),await e(c(t,`web/src/api.ts`),S())}function g(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:{"@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 _(){return`import { defineConfig } from 'vite'
|
|
16
16
|
import react from '@vitejs/plugin-react'
|
|
17
17
|
|
|
18
18
|
export default defineConfig({
|
|
@@ -25,7 +25,7 @@ export default defineConfig({
|
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
})
|
|
28
|
-
`}function
|
|
28
|
+
`}function v(){return`${JSON.stringify({compilerOptions:{target:`ES2022`,lib:[`ES2022`,`DOM`,`DOM.Iterable`],module:`ESNext`,moduleResolution:`bundler`,jsx:`react-jsx`,strict:!0,skipLibCheck:!0,noEmit:!0,isolatedModules:!0,types:[`../server/.kickjs/types/kick__client`]},include:[`src`]},null,2)}\n`}function y(e){return`<!doctype html>
|
|
29
29
|
<html lang="en">
|
|
30
30
|
<head>
|
|
31
31
|
<meta charset="UTF-8" />
|
|
@@ -37,7 +37,7 @@ export default defineConfig({
|
|
|
37
37
|
<script type="module" src="/src/main.tsx"><\/script>
|
|
38
38
|
</body>
|
|
39
39
|
</html>
|
|
40
|
-
`}function
|
|
40
|
+
`}function b(){return`import { StrictMode } from 'react'
|
|
41
41
|
import { createRoot } from 'react-dom/client'
|
|
42
42
|
import { App } from './App'
|
|
43
43
|
|
|
@@ -46,7 +46,7 @@ createRoot(document.getElementById('root')!).render(
|
|
|
46
46
|
<App />
|
|
47
47
|
</StrictMode>,
|
|
48
48
|
)
|
|
49
|
-
`}function
|
|
49
|
+
`}function x(){return`import { useEffect, useState } from 'react'
|
|
50
50
|
import { api } from './api'
|
|
51
51
|
|
|
52
52
|
// The response types below are INFERRED from the server's handlers —
|
|
@@ -89,7 +89,7 @@ export function App() {
|
|
|
89
89
|
</main>
|
|
90
90
|
)
|
|
91
91
|
}
|
|
92
|
-
`}function
|
|
92
|
+
`}function S(){return`import { createClient } from '@forinda/kickjs-client'
|
|
93
93
|
|
|
94
94
|
// KickClientApi is ambient — the resolved route map from
|
|
95
95
|
// server/.kickjs/types/kick__client.d.ts, wired in tsconfig's \`types\`. Every
|
|
@@ -103,7 +103,7 @@ export function App() {
|
|
|
103
103
|
// Prefer an explicit import? The same file exports the type:
|
|
104
104
|
// import type { Api } from '../../server/.kickjs/types/kick__client'
|
|
105
105
|
export const api = createClient<KickClientApi.Api>({ baseUrl: '/api/v1' })
|
|
106
|
-
`}function
|
|
106
|
+
`}function C(e,t,n){let r=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`,"build:netlify":`pnpm build && pnpm --filter ./server exec kick build:netlify`,"build:vercel":`pnpm build && pnpm --filter ./server exec kick build:vercel`,typecheck:`kick typecheck --cwd server && kick typecheck --cwd web`}:{start:`cd server && ${t} run start`,"dev:server":`cd server && ${t} run dev`,"dev:web":`cd web && ${t} run dev`,build:`cd server && ${t} exec kick typegen && cd .. && ${t} run build:server && ${t} run build:web`,"build:netlify":`${t} run build && cd server && ${t} exec kick build:netlify`,"build:vercel":`${t} run build && cd server && ${t} exec kick build:vercel`,"build:server":`cd server && ${t} run build`,"build:web":`cd web && ${t} run build`,typecheck:`kick typecheck --cwd server && kick typecheck --cwd web`};return`${JSON.stringify({name:e,private:!0,version:`0.0.0`,type:`module`,scripts:r,devDependencies:{"@forinda/kickjs-cli":n},workspaces:[`server`,`web`]},null,2)}\n`}function w(){return`node_modules/
|
|
107
107
|
dist/
|
|
108
108
|
.env
|
|
109
109
|
*.log
|
|
@@ -111,7 +111,7 @@ dist/
|
|
|
111
111
|
# Platform build output — written by \`kick build:netlify\` / \`kick build:vercel\`.
|
|
112
112
|
.netlify/
|
|
113
113
|
.vercel/
|
|
114
|
-
`}function
|
|
114
|
+
`}function T(e,t,n=`kick`){let r=`# ${e}
|
|
115
115
|
|
|
116
116
|
Fullstack KickJS workspace — typed end to end.
|
|
117
117
|
|
|
@@ -185,5 +185,11 @@ export const api = createClient<Api>({ baseUrl: '/api/v1' })
|
|
|
185
185
|
\`\`\`
|
|
186
186
|
|
|
187
187
|
Docs: https://kickjs.app/guide/typed-client.html
|
|
188
|
-
`
|
|
189
|
-
|
|
188
|
+
`;if(n!==`vite`)return r;let i=r.indexOf(`## The type loop`);return`${r.slice(0,i).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
|
|
189
|
+
|
|
190
|
+
\`web/\` is whatever create-vite scaffolded; nothing connects it to the API yet.
|
|
191
|
+
Four steps — typed client, \`/api\` dev proxy, route-map types, \`src/api.ts\`:
|
|
192
|
+
|
|
193
|
+
${u}
|
|
194
|
+
`}export{f as DEFAULT_VITE_TEMPLATE,d as VITE_TEMPLATES,m as initFullstackProject};
|
|
195
|
+
//# sourceMappingURL=fullstack-BwdcyVD3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fullstack-BwdcyVD3.mjs","names":[],"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 KickRoutes.Api\n//\n// The type loop: server controllers use return-value handlers → `kick\n// typegen` (run here once, re-run by `kick dev`) 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 { runCommand } from '../utils/shell'\nimport { initProject, resolveSiblingVersions } from './project'\nimport { TEMPLATE_BUILDS, approveInstallScripts } from '../commands/add'\nimport { generateNetlifyToml, generateVercelJson } from './templates/project-config'\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}\n\nexport async function initFullstackProject(options: InitFullstackOptions): Promise<void> {\n const {\n name,\n directory,\n schemaLib = 'zod',\n runtime = 'express',\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 await initProject({\n name: `${name}-server`,\n directory: join(dir, 'server'),\n packageManager,\n template: 'minimal',\n schemaLib,\n runtime,\n // web/ reads the resolved route map from the ambient KickClientApi\n // namespace, which needs the TS 7 compiler API to produce.\n withClientMap: true,\n // web/vite.config.ts proxies /api to the server's port; if kick dev moved\n // to another port the proxy would silently reach the wrong process.\n strictPort: true,\n // server/ is a workspace member; the root records the approvals.\n approveInstallScripts: false,\n // netlify.toml / vercel.json live at the workspace root, written below.\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 await writeWebTemplate(dir, name, versions)\n }\n\n // ── workspace root ──────────────────────────────────────────────────\n await writeFileSafe(\n join(dir, 'package.json'),\n rootPackageJson(name, packageManager, versions['@forinda/kickjs-cli']),\n )\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, TEMPLATE_BUILDS)\n await writeFileSafe(join(dir, '.gitignore'), rootGitignore())\n // Platform deploy config, at the root both platforms build from.\n await writeFileSafe(\n join(dir, 'netlify.toml'),\n generateNetlifyToml({\n command: `${packageManager} run build:netlify`,\n publish: 'web/dist',\n spa: true,\n }),\n )\n await writeFileSafe(\n join(dir, 'vercel.json'),\n generateVercelJson(`${packageManager} run build:vercel`),\n )\n await writeFileSafe(join(dir, 'README.md'), rootReadme(name, packageManager, frontend))\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: 'all',\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 KickRoutes.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 dev` in server/ retries on boot.\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(\"edit server/src/modules/hello and watch web/src/App.tsx's types follow.\")\n }\n log('')\n}\n\n// ── web templates ─────────────────────────────────────────────────────\n\n/** The wired React app: typed client, dev proxy, route-map types. */\nasync function writeWebTemplate(\n dir: string,\n name: string,\n versions: Record<string, string>,\n): Promise<void> {\n await writeFileSafe(join(dir, 'web/package.json'), webPackageJson(name, versions))\n await writeFileSafe(join(dir, 'web/vite.config.ts'), webViteConfig())\n await writeFileSafe(join(dir, 'web/tsconfig.json'), webTsConfig())\n await writeFileSafe(join(dir, 'web/index.html'), webIndexHtml(name))\n await writeFileSafe(join(dir, 'web/src/main.tsx'), webMain())\n await writeFileSafe(join(dir, 'web/src/App.tsx'), webApp())\n await writeFileSafe(join(dir, 'web/src/api.ts'), webApi())\n}\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 '@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\nfunction webViteConfig(): string {\n return `import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\n\nexport default defineConfig({\n plugins: [react()],\n server: {\n // The KickJS server (kick dev) listens on 3000; the client's baseUrl is\n // the relative '/api/v1', so the browser hits Vite and Vite forwards.\n proxy: {\n '/api': 'http://localhost:3000',\n },\n },\n})\n`\n}\n\nexport function webTsConfig(): string {\n return `${JSON.stringify(\n {\n compilerOptions: {\n target: 'ES2022',\n lib: ['ES2022', 'DOM', 'DOM.Iterable'],\n module: 'ESNext',\n moduleResolution: 'bundler',\n jsx: 'react-jsx',\n strict: true,\n skipLibCheck: true,\n noEmit: true,\n isolatedModules: true,\n // The resolved client route map, as an ambient global type package —\n // the same mechanism as \"node\" or \"vitest/globals\". It makes\n // `KickClientApi.Api` available with no import and no bridge file.\n //\n // Note this is a `types` ENTRY, not an `include`: the map is a global\n // type package, not source of this app. It also means the file must\n // exist — `kick new` runs typegen for you, and `kick typegen` in\n // server/ refreshes it. (An `include` entry tolerates the file being\n // absent; a `types` entry reports TS2688, which is the louder and\n // more useful failure for something the app depends on.)\n //\n // No `experimentalDecorators` here: unlike the ambient\n // `KickRoutes.Api` bridge, this map carries no reference to the\n // server's decorated controller sources.\n types: ['../server/.kickjs/types/kick__client'],\n },\n include: ['src'],\n },\n null,\n 2,\n )}\\n`\n}\n\nfunction webIndexHtml(name: string): string {\n return `<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>${name}</title>\n </head>\n <body>\n <div id=\"root\"></div>\n <script type=\"module\" src=\"/src/main.tsx\"></script>\n </body>\n</html>\n`\n}\n\nfunction webMain(): string {\n return `import { StrictMode } from 'react'\nimport { createRoot } from 'react-dom/client'\nimport { App } from './App'\n\ncreateRoot(document.getElementById('root')!).render(\n <StrictMode>\n <App />\n </StrictMode>,\n)\n`\n}\n\nfunction webApp(): string {\n return `import { useEffect, useState } from 'react'\nimport { api } from './api'\n\n// The response types below are INFERRED from the server's handlers —\n// change server/src/modules/hello/hello.service.ts and these types follow on\n// the next \\`kick typegen\\`. Not under \\`kick dev\\`: resolving the client map\n// builds a whole TypeScript program, so it is a build step, not a per-save one.\ntype Greeting = Awaited<ReturnType<typeof fetchGreeting>>\n\nfunction fetchGreeting() {\n return api.get('/hello')\n}\n\nexport function App() {\n const [greeting, setGreeting] = useState<Greeting | null>(null)\n const [health, setHealth] = useState<string>('checking…')\n\n useEffect(() => {\n fetchGreeting().then(setGreeting).catch(console.error)\n api\n .get('/hello/health')\n .then((h) => setHealth(h.status))\n .catch(() => setHealth('down'))\n }, [])\n\n return (\n <main style={{ fontFamily: 'system-ui', maxWidth: 640, margin: '4rem auto', padding: '0 1rem' }}>\n <h1>KickJS fullstack</h1>\n <p>\n <strong>{greeting?.message ?? 'loading…'}</strong>\n </p>\n <p>\n Server said hello at <code>{greeting?.timestamp ?? '…'}</code> — health:{' '}\n <code>{health}</code>\n </p>\n <p style={{ color: '#666' }}>\n This call is typed end to end: <code>api.get('/hello')</code> returns the exact shape\n <code> HelloService.greet()</code> produces. Rename a field on the server and this file\n stops compiling.\n </p>\n </main>\n )\n}\n`\n}\n\nexport function webApi(): string {\n return `import { createClient } from '@forinda/kickjs-client'\n\n// KickClientApi is ambient — the resolved route map from\n// server/.kickjs/types/kick__client.d.ts, wired in tsconfig's \\`types\\`. Every\n// response type is a literal shape, so nothing from the server's source graph\n// enters this program.\n//\n// Keys are module-mount-relative paths; the bootstrap-level '/api/v1' prefix\n// lives here in baseUrl, and the Vite dev proxy forwards it to the KickJS\n// server.\n//\n// Prefer an explicit import? The same file exports the type:\n// import type { Api } from '../../server/.kickjs/types/kick__client'\nexport const api = createClient<KickClientApi.Api>({ baseUrl: '/api/v1' })\n`\n}\n\n// ── root templates ────────────────────────────────────────────────────\n\nfunction rootPackageJson(name: string, pm: string, cliVersion: string): 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 'build:netlify': 'pnpm build && pnpm --filter ./server exec kick build:netlify',\n 'build:vercel': 'pnpm build && pnpm --filter ./server exec kick build:vercel',\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',\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.\n build: `cd server && ${pm} exec kick typegen && cd .. && ${pm} run build:server && ${pm} run build:web`,\n 'build:netlify': `${pm} run build && cd server && ${pm} exec kick build:netlify`,\n 'build:vercel': `${pm} run build && cd server && ${pm} exec kick build:vercel`,\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',\n }\n return `${JSON.stringify(\n {\n name,\n private: true,\n version: '0.0.0',\n type: 'module',\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\nfunction rootGitignore(): string {\n return `node_modules/\ndist/\n.env\n*.log\n.DS_Store\n# Platform build output — written by \\`kick build:netlify\\` / \\`kick build:vercel\\`.\n.netlify/\n.vercel/\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\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**It is not refreshed by \\`kick dev\\`.** 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":";;;;;;;;;;wNAuBA,MAAa,EAAsB,mDAQtB,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,EAEa,EAAwB,WAWrC,SAAgB,EACd,EACA,EACA,EAAmB,EACT,CACV,IAAM,EAAQ,CAAC,aAAc,EAAU,mBAAoB,gBAAgB,EAM3E,OAFI,IAAO,QAAU,IAAO,MAAc,CAAC,EAAI,SAAU,OAAQ,EAAK,GAAG,CAAK,EAC1E,IAAO,MAAc,CAAC,EAAI,SAAU,cAAe,EAAK,KAAM,GAAG,CAAK,EACnE,CAAC,EAAI,SAAU,cAAe,EAAK,GAAG,CAAK,CACpD,CAqBA,eAAsB,EAAqB,EAA8C,CACvF,GAAM,CACJ,OACA,YACA,YAAY,MACZ,UAAU,UACV,WAAW,OACX,eAAe,GACb,EAIE,EAAW,CAAC,OAAQ,MAAO,OAAQ,KAAK,CAAC,CAAW,SACx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O,OAAS,oEAAsE,GAAG,EAAG,kCAAkC,EAAG,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+DjK,GAAI,IAAa,OAAQ,OAAO,EAKhC,IAAM,EAAW,EAAO,QAAQ,kBAAkB,EAClD,MAAO,GAAG,EACP,MAAM,EAAG,CAAQ,CAAC,CAClB,QACC,mEACA,mEACF,CAAC,CACA,QAAQ,yBAA0B,EAAE,EAAE;;;;;EAKzC,EAAoB;CAEtB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.
|
|
2
|
+
* @forinda/kickjs-cli v8.4.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{d as e,f as t,i as n,n as r,o as i,p as a,t as o}from"./project
|
|
11
|
+
import{d as e,f as t,i as n,n as r,o as i,p as a,t as o}from"./project--WiWkarb.mjs";import{l as s}from"./project-docs-Ck3uzaEG.mjs";import{join as c}from"node:path";import{execFileSync as l}from"node:child_process";const u=`https://kickjs.app/guide/fullstack-frontend.html`,d=[{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`}],f=`react-ts`;function p(e,t,n=f){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 m(d){let{name:m,directory:g,schemaLib:_=`zod`,runtime:v=`express`,frontend:y=`kick`,viteTemplate:b=f}=d,x=[`pnpm`,`npm`,`yarn`,`bun`].includes(d.packageManager),S=x?d.packageManager:`pnpm`,E=g,D=e=>console.log(` ${e}`);d.packageManager!==void 0&&!x&&D(`Warning: unknown package manager '${String(d.packageManager)}' — falling back to pnpm.`),console.log(`\n Creating fullstack KickJS workspace: ${m}\n`),console.log(` Resolving package versions...`);let O=await r();if(await o({name:`${m}-server`,directory:c(E,`server`),packageManager:S,template:`minimal`,schemaLib:_,runtime:v,withClientMap:!0,strictPort:!0,approveInstallScripts:!1,platformConfig:!1,initGit:!1,installDeps:!1,spaClientDir:`../web/dist`,versions:O}),y===`vite`){console.log(`\n Handing web/ to create-vite (${b})...\n`);let[e,...t]=p(S,`web`,b);a(e,t,{cwd:E})}else await h(E,m,O);await s(c(E,`package.json`),C(m,S,O[`@forinda/kickjs-cli`])),S===`pnpm`&&await s(c(E,`pnpm-workspace.yaml`),`packages:
|
|
12
12
|
- server
|
|
13
13
|
- web
|
|
14
|
-
`),i(E,
|
|
15
|
-
Fullstack workspace scaffolded!`),console.log(),
|
|
14
|
+
`),i(S,E,n),await s(c(E,`.gitignore`),w()),await s(c(E,`netlify.toml`),e({command:`${S} run build:netlify`,publish:`web/dist`,spa:!0})),await s(c(E,`vercel.json`),t(`${S} run build:vercel`)),await s(c(E,`README.md`),T(m,S,y));let{generateAgentDocs:k}=await import(`./agent-docs-BIYv2Od-.mjs`).then(e=>e.t);if(await k({outDir:E,name:m,pm:S,template:`fullstack`,only:`all`,force:!0}),d.installDeps){console.log(`\n Installing workspace dependencies with ${S}...\n`);try{a(S,[`install`],{cwd:E})}catch{console.log(`\n Warning: ${S} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-Bv9EzadE.mjs`).then(e=>e.n);await e({cwd:c(E,`server`),allowDuplicates:!0,silent:!0})}catch{}if(d.initGit)try{l(`git`,[`init`],{cwd:E,stdio:`pipe`}),l(`git`,[`branch`,`-M`,`main`],{cwd:E,stdio:`pipe`}),l(`git`,[`add`,`-A`],{cwd:E,stdio:`pipe`}),l(`git`,[`commit`,`-m`,`chore: initial commit from kick new (fullstack)`],{cwd:E,stdio:`pipe`}),D(`Git repository initialized`)}catch{D(`Warning: git init failed (git may not be installed)`)}console.log(`
|
|
15
|
+
Fullstack workspace scaffolded!`),console.log(),D(`Next steps:`),D(` cd ${m}`),d.installDeps||D(` ${S} install`),S===`pnpm`?D(` pnpm dev # runs server (kick dev) + web (vite) together`):(D(` ${S} run dev:server # terminal 1`),D(` ${S} run dev:web # terminal 2`)),D(``),y===`vite`?(D(`web/ is create-vite output, unwired. To type it against the API:`),D(` ${u}`)):(D(`The web app calls the API through @forinda/kickjs-client —`),D(`edit server/src/modules/hello and watch web/src/App.tsx's types follow.`)),D(``)}async function h(e,t,n){await s(c(e,`web/package.json`),g(t,n)),await s(c(e,`web/vite.config.ts`),_()),await s(c(e,`web/tsconfig.json`),v()),await s(c(e,`web/index.html`),y(t)),await s(c(e,`web/src/main.tsx`),b()),await s(c(e,`web/src/App.tsx`),x()),await s(c(e,`web/src/api.ts`),S())}function g(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:{"@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 _(){return`import { defineConfig } from 'vite'
|
|
16
16
|
import react from '@vitejs/plugin-react'
|
|
17
17
|
|
|
18
18
|
export default defineConfig({
|
|
@@ -25,7 +25,7 @@ export default defineConfig({
|
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
})
|
|
28
|
-
`}function
|
|
28
|
+
`}function v(){return`${JSON.stringify({compilerOptions:{target:`ES2022`,lib:[`ES2022`,`DOM`,`DOM.Iterable`],module:`ESNext`,moduleResolution:`bundler`,jsx:`react-jsx`,strict:!0,skipLibCheck:!0,noEmit:!0,isolatedModules:!0,types:[`../server/.kickjs/types/kick__client`]},include:[`src`]},null,2)}\n`}function y(e){return`<!doctype html>
|
|
29
29
|
<html lang="en">
|
|
30
30
|
<head>
|
|
31
31
|
<meta charset="UTF-8" />
|
|
@@ -37,7 +37,7 @@ export default defineConfig({
|
|
|
37
37
|
<script type="module" src="/src/main.tsx"><\/script>
|
|
38
38
|
</body>
|
|
39
39
|
</html>
|
|
40
|
-
`}function
|
|
40
|
+
`}function b(){return`import { StrictMode } from 'react'
|
|
41
41
|
import { createRoot } from 'react-dom/client'
|
|
42
42
|
import { App } from './App'
|
|
43
43
|
|
|
@@ -46,7 +46,7 @@ createRoot(document.getElementById('root')!).render(
|
|
|
46
46
|
<App />
|
|
47
47
|
</StrictMode>,
|
|
48
48
|
)
|
|
49
|
-
`}function
|
|
49
|
+
`}function x(){return`import { useEffect, useState } from 'react'
|
|
50
50
|
import { api } from './api'
|
|
51
51
|
|
|
52
52
|
// The response types below are INFERRED from the server's handlers —
|
|
@@ -89,7 +89,7 @@ export function App() {
|
|
|
89
89
|
</main>
|
|
90
90
|
)
|
|
91
91
|
}
|
|
92
|
-
`}function
|
|
92
|
+
`}function S(){return`import { createClient } from '@forinda/kickjs-client'
|
|
93
93
|
|
|
94
94
|
// KickClientApi is ambient — the resolved route map from
|
|
95
95
|
// server/.kickjs/types/kick__client.d.ts, wired in tsconfig's \`types\`. Every
|
|
@@ -103,7 +103,7 @@ export function App() {
|
|
|
103
103
|
// Prefer an explicit import? The same file exports the type:
|
|
104
104
|
// import type { Api } from '../../server/.kickjs/types/kick__client'
|
|
105
105
|
export const api = createClient<KickClientApi.Api>({ baseUrl: '/api/v1' })
|
|
106
|
-
`}function
|
|
106
|
+
`}function C(e,t,n){let r=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`,"build:netlify":`pnpm build && pnpm --filter ./server exec kick build:netlify`,"build:vercel":`pnpm build && pnpm --filter ./server exec kick build:vercel`,typecheck:`kick typecheck --cwd server && kick typecheck --cwd web`}:{start:`cd server && ${t} run start`,"dev:server":`cd server && ${t} run dev`,"dev:web":`cd web && ${t} run dev`,build:`cd server && ${t} exec kick typegen && cd .. && ${t} run build:server && ${t} run build:web`,"build:netlify":`${t} run build && cd server && ${t} exec kick build:netlify`,"build:vercel":`${t} run build && cd server && ${t} exec kick build:vercel`,"build:server":`cd server && ${t} run build`,"build:web":`cd web && ${t} run build`,typecheck:`kick typecheck --cwd server && kick typecheck --cwd web`};return`${JSON.stringify({name:e,private:!0,version:`0.0.0`,type:`module`,scripts:r,devDependencies:{"@forinda/kickjs-cli":n},workspaces:[`server`,`web`]},null,2)}\n`}function w(){return`node_modules/
|
|
107
107
|
dist/
|
|
108
108
|
.env
|
|
109
109
|
*.log
|
|
@@ -111,7 +111,7 @@ dist/
|
|
|
111
111
|
# Platform build output — written by \`kick build:netlify\` / \`kick build:vercel\`.
|
|
112
112
|
.netlify/
|
|
113
113
|
.vercel/
|
|
114
|
-
`}function
|
|
114
|
+
`}function T(e,t,n=`kick`){let r=`# ${e}
|
|
115
115
|
|
|
116
116
|
Fullstack KickJS workspace — typed end to end.
|
|
117
117
|
|
|
@@ -185,4 +185,10 @@ export const api = createClient<Api>({ baseUrl: '/api/v1' })
|
|
|
185
185
|
\`\`\`
|
|
186
186
|
|
|
187
187
|
Docs: https://kickjs.app/guide/typed-client.html
|
|
188
|
-
`
|
|
188
|
+
`;if(n!==`vite`)return r;let i=r.indexOf(`## The type loop`);return`${r.slice(0,i).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
|
|
189
|
+
|
|
190
|
+
\`web/\` is whatever create-vite scaffolded; nothing connects it to the API yet.
|
|
191
|
+
Four steps — typed client, \`/api\` dev proxy, route-map types, \`src/api.ts\`:
|
|
192
|
+
|
|
193
|
+
${u}
|
|
194
|
+
`}export{f as DEFAULT_VITE_TEMPLATE,d as VITE_TEMPLATES,m as initFullstackProject};
|
package/dist/index.d.mts
CHANGED
|
@@ -918,6 +918,13 @@ interface InitProjectOptions {
|
|
|
918
918
|
* member — the platforms build from the root, which owns those files.
|
|
919
919
|
*/
|
|
920
920
|
platformConfig?: boolean;
|
|
921
|
+
/**
|
|
922
|
+
* Ranges resolved by the caller. The fullstack generator passes one map for
|
|
923
|
+
* the whole workspace: resolving per package lets a failed lookup fall back
|
|
924
|
+
* on one side and succeed on the other, which is how server/ and web/ end
|
|
925
|
+
* up on different vite or TypeScript majors.
|
|
926
|
+
*/
|
|
927
|
+
versions?: Record<string, string>;
|
|
921
928
|
}
|
|
922
929
|
/** Scaffold a new KickJS project */
|
|
923
930
|
export declare function initProject(options: InitProjectOptions): Promise<void>;
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"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/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":";;;;KAoPY;;;;;;;;;;;;;;;;;;;UCzNK;EACf;EACA;;;;;;;EAOA;;;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AOE;;;;;;;;;;;;;;;;;;;;;;;EAuBF,WAAW,eAAe;;;;;;;;;;;;EAY1B,UAAU;;;;EAIV;;;;;;;;;IASE;;;;;;;EAOF,KAAK;;EAEL,WAAW;;;;;;;;;;;;;;EAcX,UAAU;;;;;;;EAOV,SAAS;;EAET;IACE;IACA;IACA;IACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCF,SA7CS;;;wBAiDK,aAAa,QAAQ,aAAa;;KAgEtC;;;;;;;;;;;;;;;;;;wBAyHU,eAAe,mBAAmB,QAAQ;;;;;;;;;;;;;;;;;;;KCzxBpD;;;KCNA;KACA,WAAW;UASb;EACR;EACA;EACA;EACA;EACA,OAAO;EACP;EACA;EACA,UAAU;EACV;;EAEA;;;;;;;;EAQA;;EAEA;;EAEA,YAAY;;;;;;EAMZ;;;;;;EAMA,QAAQ;;;;;;;;;wBAUY,eAAe,SAAS,wBAAwB;;;UC/D5D;EACR;EACA;;;;;;;;;;;;;;;;;;wBAmBoB,gBAAgB,SAAS,yBAAyB;;;UCnB9D;EACR;EACA;EACA;EACA;EACA,UAAU;EACV;;;;;;;;EAQA,UAAU;;wBAGU,mBAAmB,SAAS,4BAA4B;;;UCjBpE;EACR;EACA;EACA;EACA;EACA,UAAU;EACV;;wBAGoB,cAAc,SAAS,uBAAuB;;;UCT1D;EACR;EACA;EACA;EACA;EACA,UAAU;EACV;;wBAGoB,gBAAgB,SAAS,yBAAyB;;;UCT9D;EACR;EACA;EACA;EACA;EACA,UAAU;EACV;;wBAGoB,mBAAmB,SAAS,4BAA4B;;;UCRpE;EACR;EACA;EACA;EACA;EACA,UAAU;EACV;;;;;;;EAOA,YAAY;;wBAGQ,YAAY,SAAS,qBAAqB;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"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/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":";;;;KAoPY;;;;;;;;;;;;;;;;;;;UCzNK;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;;;;KChG3C,uBAAuB,uBAAoB;;KAG3C,gBAAgB,gBAAa;;;;UC7BxB;;EAEf;;EAEA;;;;;;;;;EASA;;EAEA;;;KAIU;;KAGA;;;;;;;;;;;;;KAgBA;;UA0BK;EACf;;;KAIU,iBAAiB,oBAAkB;;;;;;;;;;;KAYnC;;;;;;UAOK;;;;;;;EAOf;;;;;;;EAOA;;;;;;EAMA;;;;;;;;;;;;;;;;;;;;;;EAsBA;;;;;;;;;;;;;;;;;;;;;;;;UAyBe;;;;;EAKf;;;;;EAKA;;EAEA;;;;;;;EAOA;;;;;;;EAOA,0BAA0B;;;UAIX;;;;;EAKf;;;;;EAKA;;;;;;;;;;;;;EAaA,kBAAkB;;;;;;;;;;EAUlB;;;;;;;;;;;;;;;;;;EAkBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCA,mBAAmB;;;UAIJ;;EAEf;;;;;;;;EAQA;;;UAIe;;EAEf;;;;;;;;;;;;;;;;;;;;;;EAsBA,OAAO;;EAEP;;;;;;EAMA;;;;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EAET,UAAU;;;;;;;;;;;;;iBAcU,YACpB,QAAQ,mBACR,MAAM,qBACL,QAAQ;;;;;;;;qBCrDE;KAED;;UAGK;EACf,mBAAmB;EACnB,6BAA6B;EAC7B,8BAA8B;EAC9B,oBAAoB;;UAGL;EACf;;EAEA,QAAQ;;;;;EAKR,cAAc;;;;;;EAMd;;EAEA;;EAEA,WAAW;;UAGI;;EAEf,iBAAiB,OAAO,mBAAmB;;;;;EAK3C;;;;;;EAMA;;EAEA;;wBAGc,wBAAwB,MAAM,2BAA2B;;;;;;;;UC3ExD;EACf;EACA,MAAM;;;;;;;UAQS;EACf,YAAY;;EAEZ;;;;;EAKA,QAAQ;IAAQ;IAAgB;;;;;;;;;;;wBCblB,sBAAsB;EACpC;EACA;EACA,QAAQ;EACR;EACA;;;;;;;EAOA;EACA;IACE;;;;wBC5BY,aAAa;;wBAOb,YAAY;;wBAMZ,YAAY;;;;;;wBAYZ,UAAU"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.
|
|
2
|
+
* @forinda/kickjs-cli v8.4.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{A as e,M as t,N as n,P as r,S as i,_ as a,c as o,d as s,g as c,h 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{A as e,M as t,N as n,P as r,S as i,_ as a,c as o,d as s,g as c,h 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-DzqvC6jF.mjs";import{t as v}from"./project-JoccwqS2.mjs";import{o as y,r as b}from"./config-B6LRxtE1.mjs";import{t as x}from"./project-root-DORRVmte.mjs";import{n as S,t as C}from"./types-CW4qiwB1.mjs";export{C as KickPluginConflictError,o as TYPEGEN_OWNER_KEY,p as buildGeneratorContext,u as createTypegenDevWatcher,S as defineCliPlugin,b as defineConfig,g as defineDoctorCheck,f as defineDoctorExtension,h as defineGenerator,s as defineTypegen,x as findProjectRoot,_ as generateAdapter,d as generateController,m as generateDto,c as generateGuard,a as generateMiddleware,i as generateModule,l as generateService,v as initProject,y as loadKickConfig,e as pluralize,t as toCamelCase,n as toKebabCase,r as toPascalCase};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.
|
|
2
|
+
* @forinda/kickjs-cli v8.4.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-LCdccCoI.mjs";import{KickPluginConflictError as t,defineCliPlugin as n}from"@forinda/kickjs-cli-kit";function r(e,n=[]){let r=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=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=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=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-D_rrQbpy.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=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.4.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-CW4qiwB1.mjs";import{r as e}from"./run-plugins-DSYGn4AC.mjs";export{e as mergeCliPlugins};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.
|
|
2
|
+
* @forinda/kickjs-cli v8.4.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{a as e,t}from"./config-
|
|
11
|
+
import{a as e,t}from"./config-DIH8bQUO.mjs";import{l as n,o as r}from"./project-docs-Ck3uzaEG.mjs";import{existsSync as i,readFileSync as a,writeFileSync as o}from"node:fs";import{dirname as s,join as c,resolve as l}from"node:path";import{fileURLToPath as u}from"node:url";import{execFile as d,execFileSync as f,execSync as p,spawnSync as m}from"node:child_process";import{promisify as h}from"node:util";const g=h(d),_=/[&|<>^"'`(){}[\];!%\r\n\\]/;function v(e,t,n=process.platform){if(n!==`win32`)return[e,t];if(_.test(e)||t.some(e=>_.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 y(e,t,n={}){let r=v(e,t);if(!r)return null;try{return f(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 b(e,t,n={}){let r=v(e,t);if(!r)throw Error(`Refusing to run '${e}': unsafe arguments`);f(r[0],r[1],{cwd:n.cwd,stdio:`inherit`,windowsHide:!0})}function ee(e,t,n){p(e,{cwd:t,stdio:`inherit`,env:n?{...process.env,...n}:process.env})}function te(e,t,n){let r=m(process.execPath,[e],{cwd:n,stdio:`inherit`,env:{...process.env,...t}});r.status!==0&&process.exit(r.status??1)}async function ne(e,t,n={}){let r=v(e,t);if(!r)return null;try{let{stdout:e}=await g(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 x={swagger:`@forinda/kickjs-swagger`,ws:`@forinda/kickjs-ws`,queue:`@forinda/kickjs-queue`,devtools:`@forinda/kickjs-devtools`},S={zod:`zod`,valibot:`valibot`,yup:`yup`};function C(e,t){let n=e[t];if(!n)throw Error(`generatePackageJson: missing resolved version for ${t}. Add it to SIBLING_PACKAGES in generators/project.ts.`);return n}function w(e,t,n,r=[],i=`zod`,a=`express`,o=!1){let s=S[i],c={"@forinda/kickjs":C(n,`@forinda/kickjs`),"@forinda/kickjs-schema":C(n,`@forinda/kickjs-schema`),dotenv:C(n,`dotenv`),"reflect-metadata":C(n,`reflect-metadata`),[s]:C(n,s)};a===`express`?c.express=C(n,`express`):a===`fastify`?(c.fastify=C(n,`fastify`),c[`@fastify/middie`]=C(n,`@fastify/middie`),c[`serve-static`]=C(n,`serve-static`)):a===`h3`&&(c.h3=C(n,`h3`),c[`serve-static`]=C(n,`serve-static`));for(let e of r){let t=x[e];t&&!c[t]&&(c[t]=C(n,t))}return JSON.stringify({name:e,version:`0.0.0`,type:`module`,scripts:{dev:`kick dev`,build:`kick build`,start:`kick start`,test:`vitest run`,"build:netlify":`kick build && kick build:netlify`,"build:vercel":`kick build && kick build:vercel`},dependencies:c,devDependencies:{"@forinda/kickjs-cli":C(n,`@forinda/kickjs-cli`),"@forinda/kickjs-testing":C(n,`@forinda/kickjs-testing`),"@forinda/kickjs-vite":C(n,`@forinda/kickjs-vite`),"@types/supertest":C(n,`@types/supertest`),"@swc/core":C(n,`@swc/core`),...a===`express`?{"@types/express":C(n,`@types/express`)}:{},"@types/node":C(n,`@types/node`),"unplugin-swc":C(n,`unplugin-swc`),vite:C(n,`vite`),supertest:C(n,`supertest`),vitest:C(n,`vitest`),typescript:C(n,`typescript`),...o?{"@typescript/typescript6":C(n,`@typescript/typescript6`)}:{},oxfmt:C(n,`oxfmt`),oxlint:C(n,`oxlint`)}},null,2)}function re(e={}){return`import { defineConfig } from 'vite'
|
|
12
12
|
import { fileURLToPath } from 'node:url'
|
|
13
13
|
import swc from 'unplugin-swc'
|
|
14
14
|
import { kickjsVitePlugin, envWatchPlugin } from '@forinda/kickjs-vite'
|
|
@@ -445,6 +445,6 @@ export default defineConfig({
|
|
|
445
445
|
`);for(let e of a)console.log(o(e))}else console.log(`\n Plus ${a.length} optional packages (swagger, db, queue, …).`),console.log(" Run `kick add --list --all` for the full catalog.");console.log(`
|
|
446
446
|
Usage: kick add ai db swagger`),console.log(` kick add queue:bullmq`),console.log(` kick add upload # installs the multipart driver for your runtime`),console.log()}const K={"@swc/core":!0,esbuild:!0};function q(e,t,n){if(e===`pnpm`){let e=l(t,`pnpm-workspace.yaml`),r=i(e)?a(e,`utf-8`):``,s=ie(r,n);return s===r?void 0:(o(e,s),e)}if(e!==`npm`&&e!==`bun`)return;let r=l(t,`package.json`);if(!i(r))return;let s=JSON.parse(a(r,`utf-8`)),c=!1;if(e===`npm`){let e=s.allowScripts??{};for(let[t,r]of Object.entries(n))Object.keys(e).some(e=>e===t||e.startsWith(`${t}@`))||(e[t]=r,c=!0);s.allowScripts=e}else{let e=s.trustedDependencies??[];for(let[t,r]of Object.entries(n))r&&!e.includes(t)&&(e.push(t),c=!0);s.trustedDependencies=e}if(c)return o(r,`${JSON.stringify(s,null,2)}\n`),r}function ye(e){if(e===`pnpm`)return U(`pnpm-workspace.yaml`)??process.cwd();for(let e=process.cwd();;e=s(e)){try{if(JSON.parse(a(l(e,`package.json`),`utf-8`)).workspaces)return e}catch{}if(s(e)===e)return process.cwd()}}function J(e){return Object.assign({},...e.map(e=>F[e]?.builds??{}))}function be(e,t,n=`express`){let r=new Set,i=new Set,a=[],o=[],s=[];for(let c of e){if(c===`upload`){let e=R[n];s.push(`upload (${n}): ${e.note}`),e.prod&&(t?i:r).add(e.prod),e.dev&&i.add(e.dev);continue}let e=F[c];if(!e){a.push(c);continue}e.deprecated&&o.push(`'${c}' (${e.pkg}) is deprecated — ${e.deprecated}`);let l=t||e.dev?i:r;l.add(e.pkg);for(let t of e.peers)l.add(t);if(e.enginePeers){let e=L[n];for(let t of e)l.add(t);s.push(`${c} (${n}): engine peers ${e.join(`, `)}`)}}return{prodDeps:[...r],devDeps:[...i],unknown:a,warnings:o,notices:s}}function xe(e){e.command(`list`).alias(`ls`).description(`List KickJS packages (core only; pair with --all for the full catalog)`).option(`--all`,`Include the full optional catalog`).option(`--runtime <engine>`,`HTTP engine to show peers for: express | fastify | h3`).action(async e=>{G(!!e.all,z(e.runtime)??await B())})}function Se(e){e.command(`add [packages...]`).description(`Add KickJS packages with their required dependencies`).option(`--pm <manager>`,`Package manager override`).option(`-D, --dev`,`Install as dev dependency`).option(`--list`,`List packages (core only by default; pair with --all)`).option(`--runtime <engine>`,`HTTP engine for peer resolution: express | fastify | h3 (overrides kick.config.ts)`).option(`--all`,`When listing, include the full optional catalog`).action(async(e,t)=>{if(t.list||e.length===0){G(!!t.all,z(t.runtime)??await B());return}let{pm:n,source:r}=await W(t.pm);console.log(`\n Using ${n} (resolved from ${r})`);let i=z(t.runtime),a=await V(process.cwd()),o=i??a.runtime;if(!i&&a.ambiguous){console.error(`\n Cannot tell which HTTP engine this app boots on: found ${a.candidates.join(`, `)} in package.json.\n\n Installing engine peers for the wrong one is worse than not installing them, so:\n • set \`runtime: '<engine>'\` in kick.config.ts (permanent, also fixes kick doctor), or\n • pass --runtime <${a.candidates.join(`|`)}> for this command\n`),process.exitCode=1;return}let{prodDeps:s,devDeps:c,unknown:l,warnings:u,notices:d}=be(e,!!t.dev,o);for(let e of u)console.warn(`\n WARNING: ${e}`);for(let e of d)console.log(`\n ${e}`);if(l.length>0&&(console.log(`\n Unknown packages: ${l.join(`, `)}`),console.log(` Run "kick add --list" to see available packages.
|
|
447
447
|
`),s.length===0&&c.length===0))return;let f=J(e);if(Object.keys(f).length>0){let e=q(n,ye(n),f);e&&console.log(`\n Approved install scripts in ${e}`)}if(s.length>0){let e=s,t=`${n} add ${e.join(` `)}`;console.log(`\n Installing ${e.length} dependency(ies):`);for(let t of e)console.log(` + ${t}`);console.log();try{p(t,{stdio:`inherit`})}catch{console.log(`\n Installation failed. Run manually:\n ${t}\n`)}}if(c.length>0){let e=c,t=`${n} add -D ${e.join(` `)}`;console.log(`\n Installing ${e.length} dev dependency(ies):`);for(let t of e)console.log(` + ${t} (dev)`);console.log();try{p(t,{stdio:`inherit`})}catch{console.log(`\n Installation failed. Run manually:\n ${t}\n`)}}console.log(` Done!
|
|
448
|
-
`)})}const Y=s(u(import.meta.url)),X=JSON.parse(a([c(Y,`..`,`package.json`),c(Y,`..`,`..`,`package.json`)].find(i),`utf-8`)),Z=[`@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`];function
|
|
449
|
-
Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${a} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-
|
|
450
|
-
Project scaffolded successfully!`),console.log();let v=f!==process.cwd();m(`Next steps:`),v&&m(` cd ${t}`),e.installDeps||m(` ${a} install`);let y={rest:`kick g module user`,minimal:`# add your routes to src/index.ts`};m(` ${y[o]??y.rest}`),m(` kick dev`),m(``),m(`Commands:`),m(` kick dev Start dev server with Vite HMR`),m(` kick build Production build via Vite`),m(` kick start Run production build`),m(``),m(`Generators:`),m(` kick g module <name> REST module (controller, service, DTOs, repository)`),m(` kick g scaffold <n> <f..> CRUD module from field definitions`),m(` kick g controller <name> Standalone controller`),m(` kick g service <name> @Service() class`),m(` kick g middleware <name> Global connect-style middleware`),m(` kick g guard <name> Route guard (auth, roles, etc.)`),m(` kick g adapter <name> AppAdapter with lifecycle hooks`),m(` kick g dto <name> DTO schema (Zod / Valibot / Yup)`),m(` kick g config Generate kick.config.ts`),m(``),m(`Add packages:`),m(` kick add <pkg> Install a KickJS package + peers`),m(` kick add --list Show all available packages`),m(``),m(`Available: ${I}`),m(``)}export{R as a,xe as c,T as d,E as f,ee as h,K as i,B as l,te as m,Q as n,q as o,b as p,F as r,Se as s,
|
|
448
|
+
`)})}const Y=s(u(import.meta.url)),X=JSON.parse(a([c(Y,`..`,`package.json`),c(Y,`..`,`..`,`package.json`)].find(i),`utf-8`)),Z=[`@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`],Ce={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`},"@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`},"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:`^1.0.0`,cap:`^1`},"serve-static":{fallback:`^2.2.0`,cap:`^2`},zod:{fallback:`^4.3.6`,cap:`^4`},valibot:{fallback:`^1.4.1`,cap:`^1`},yup:{fallback:`^1.7.1`,cap:`^1`}};function we(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 Te(e){return e===`@forinda/kickjs-cli`?`^${X.version}`:`latest`}async function Ee(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 Q(){let e=[...Z.map(e=>({name:e,fallback:Te(e),cap:void 0})),...Object.entries(Ce).map(([e,t])=>({name:e,...t}))],t=Date.now()+2e4,n=await Ee(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=we(await ne(`npm`,r?[`view`,a,`version`,`--json`]:[`view`,a,`version`],{timeout:i}));return[e,o?`^${o}`:n]});return Object.fromEntries(n)}function De(e,t){let n=y(`npm`,[`view`,`${e}@${t}`,`version`],{timeout:2e4});return n&&/^\d+\.\d+\.\d+/.test(n)?n:null}function $(e){return(e??``).replace(/^[\^~>=<\s]+/,``)}function Oe(e,t){let n=e=>$(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}function ke(e,t,n){let r=y(`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 Ae(e){let{name:t,directory:i,packageManager:a=`pnpm`,template:o=`rest`,defaultRepo:s=`inmemory`,packages:l=[],schemaLib:u=`zod`,runtime:d=`express`}=e,f=i,m=e=>console.log(` ${e}`);console.log(`\n Creating KickJS project: ${t}\n`),e.versions||m(`Resolving package versions...`);let h=e.versions??await Q(),g=Object.keys(h).filter(e=>h[e]===`latest`);if(g.length>0&&m(`WARNING: could not reach npm for ${g.join(`, `)} — pinned to 'latest'`),d!==`express`){if(ke(`@forinda/kickjs`,`latest`,`./${d}`))m(`Using @forinda/kickjs@latest (stable ships the ${d} runtime)`);else{let e=[`@forinda/kickjs`,`@forinda/kickjs-cli`,`@forinda/kickjs-vite`],t=[],n=!1;for(let r of e){let e=De(r,`alpha`);e&&Oe(e,$(h[r]))&&(h[r]=`^${e}`,t.push(`${r}@^${e}`),r===`@forinda/kickjs`&&(n=!0))}m(n?`Using the alpha channel for the ${d} runtime: ${t.join(`, `)}`:`WARNING: could not resolve @forinda/kickjs@alpha — the ${d} runtime subpath may be missing. After install, run: ${a} add @forinda/kickjs@alpha`)}}await n(c(f,`package.json`),w(t,o,h,l,u,d,e.withClientMap)),await n(c(f,`vite.config.ts`),re({strictPort:e.strictPort})),await n(c(f,`tsconfig.json`),ae()),await n(c(f,`.oxfmtrc.json`),oe()),await n(c(f,`.editorconfig`),se()),await n(c(f,`.gitignore`),ce()),await n(c(f,`.gitattributes`),le()),await n(c(f,`.env`),ue()),await n(c(f,`.env.example`),de()),await n(c(f,`.env.test`),D()),await n(c(f,`.env.test.example`),fe()),await n(c(f,`src/config/index.ts`),A(u)),await n(c(f,`src/index.ts`),O(t,o,X.version,l,d,e.spaClientDir)),await n(c(f,`src/modules/index.ts`),k()),await n(c(f,`src/modules/hello/hello.service.ts`),j()),await n(c(f,`src/modules/hello/hello.controller.ts`),M()),await n(c(f,`src/modules/hello/hello.module.ts`),N()),await n(c(f,`kick.config.ts`),P(o,s,a,d,e.withClientMap)),await n(c(f,`vitest.config.ts`),pe()),await n(c(f,`README.md`),r(t,o,a));let{generateAgentDocs:_}=await import(`./agent-docs-BIYv2Od-.mjs`).then(e=>e.t);if(await _({outDir:f,name:t,pm:a,template:o,only:`all`,force:!0}),e.platformConfig!==!1&&(await n(c(f,`netlify.toml`),T({command:`${a} run build:netlify`,publish:`dist/public`,spa:!1})),await n(c(f,`vercel.json`),E(`${a} run build:vercel`))),e.approveInstallScripts!==!1&&q(a,f,{...K,...J(l)}),e.installDeps){console.log(`\n Installing dependencies with ${a}...\n`);try{p(`${a} install`,{cwd:f,stdio:`inherit`}),console.log(`
|
|
449
|
+
Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${a} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-Bv9EzadE.mjs`).then(e=>e.n);await e({cwd:f,allowDuplicates:!0,silent:!0})}catch{}if(e.initGit)try{p(`git init`,{cwd:f,stdio:`pipe`}),p(`git branch -M main`,{cwd:f,stdio:`pipe`}),p(`git add -A`,{cwd:f,stdio:`pipe`}),p(`git commit -m "chore: initial commit from kick new"`,{cwd:f,stdio:`pipe`}),m(`Git repository initialized`)}catch{m(`Warning: git init failed (git may not be installed)`)}console.log(`
|
|
450
|
+
Project scaffolded successfully!`),console.log();let v=f!==process.cwd();m(`Next steps:`),v&&m(` cd ${t}`),e.installDeps||m(` ${a} install`);let y={rest:`kick g module user`,minimal:`# add your routes to src/index.ts`};m(` ${y[o]??y.rest}`),m(` kick dev`),m(``),m(`Commands:`),m(` kick dev Start dev server with Vite HMR`),m(` kick build Production build via Vite`),m(` kick start Run production build`),m(``),m(`Generators:`),m(` kick g module <name> REST module (controller, service, DTOs, repository)`),m(` kick g scaffold <n> <f..> CRUD module from field definitions`),m(` kick g controller <name> Standalone controller`),m(` kick g service <name> @Service() class`),m(` kick g middleware <name> Global connect-style middleware`),m(` kick g guard <name> Route guard (auth, roles, etc.)`),m(` kick g adapter <name> AppAdapter with lifecycle hooks`),m(` kick g dto <name> DTO schema (Zod / Valibot / Yup)`),m(` kick g config Generate kick.config.ts`),m(``),m(`Add packages:`),m(` kick add <pkg> Install a KickJS package + peers`),m(` kick add --list Show all available packages`),m(``),m(`Available: ${I}`),m(``)}export{R as a,xe as c,T as d,E as f,ee as h,K as i,B as l,te as m,Q as n,q as o,b as p,F as r,Se as s,Ae as t,ve as u};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.
|
|
2
|
+
* @forinda/kickjs-cli v8.4.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{l as e,o as t}from"./project-docs-
|
|
11
|
+
import{l as e,o as t}from"./project-docs-8d5GNDIw.mjs";import{o as n,t as r}from"./config-B6LRxtE1.mjs";import{dirname as i,join as a,resolve as o}from"node:path";import{existsSync as s,readFileSync as c,writeFileSync as l}from"node:fs";import{execFile as u,execFileSync as d,execSync as f,spawnSync as p}from"node:child_process";import{fileURLToPath as m}from"node:url";import{promisify as h}from"node:util";const g={express:{from:`@forinda/kickjs`,name:`expressRuntime`},fastify:{from:`@forinda/kickjs/fastify`,name:`fastifyRuntime`},h3:{from:`@forinda/kickjs/h3`,name:`h3Runtime`}};function _(e,t,n,r=[],i=`express`,a){let o=g[i],s=i===`express`;switch(t){case`minimal`:{let t=[],i=[],c=s?`import { bootstrap, ${o.name} } from '@forinda/kickjs'`:`import { bootstrap } from '@forinda/kickjs'\nimport { ${o.name} } from '${o.from}'`;r.includes(`swagger`)&&(t.push(`import { SwaggerAdapter } from '@forinda/kickjs-swagger'`),i.push(` SwaggerAdapter({ info: { title: '${e}', version: '${n}' } }),`)),r.includes(`devtools`)&&(t.push(`import { DevToolsAdapter } from '@forinda/kickjs-devtools'`),i.push(` DevToolsAdapter(),`)),a&&(t.push(`import { SpaAdapter } from '@forinda/kickjs/spa'`),i.push(` // Serves the built frontend from this origin in production.
|
|
12
12
|
// Inert until the client build exists, so \`kick dev\` (where Vite
|
|
13
13
|
// serves the client and proxies /api here) is unaffected.
|
|
14
14
|
SpaAdapter({ clientDir: ${JSON.stringify(a)} }),`));let l=t.length?t.join(`
|
|
@@ -310,7 +310,7 @@ export default defineConfig({
|
|
|
310
310
|
},
|
|
311
311
|
],
|
|
312
312
|
})
|
|
313
|
-
`}const x=h(u),S=/[&|<>^"'`(){}[\];!%\r\n\\]/;function C(e,t,n=process.platform){if(n!==`win32`)return[e,t];if(S.test(e)||t.some(e=>S.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 w(e,t,n={}){let r=C(e,t);if(!r)return null;try{return d(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 T(e,t,n={}){let r=C(e,t);if(!r)throw Error(`Refusing to run '${e}': unsafe arguments`);d(r[0],r[1],{cwd:n.cwd,stdio:`inherit`,windowsHide:!0})}function E(e,t,n){let r=p(process.execPath,[e],{cwd:n,stdio:`inherit`,env:{...process.env,...t}});r.status!==0&&process.exit(r.status??1)}async function re(e,t,n={}){let r=C(e,t);if(!r)return null;try{let{stdout:e}=await x(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 ie={swagger:`@forinda/kickjs-swagger`,ws:`@forinda/kickjs-ws`,queue:`@forinda/kickjs-queue`,devtools:`@forinda/kickjs-devtools`},ae={zod
|
|
313
|
+
`}const x=h(u),S=/[&|<>^"'`(){}[\];!%\r\n\\]/;function C(e,t,n=process.platform){if(n!==`win32`)return[e,t];if(S.test(e)||t.some(e=>S.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 w(e,t,n={}){let r=C(e,t);if(!r)return null;try{return d(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 T(e,t,n={}){let r=C(e,t);if(!r)throw Error(`Refusing to run '${e}': unsafe arguments`);d(r[0],r[1],{cwd:n.cwd,stdio:`inherit`,windowsHide:!0})}function E(e,t,n){let r=p(process.execPath,[e],{cwd:n,stdio:`inherit`,env:{...process.env,...t}});r.status!==0&&process.exit(r.status??1)}async function re(e,t,n={}){let r=C(e,t);if(!r)return null;try{let{stdout:e}=await x(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 ie={swagger:`@forinda/kickjs-swagger`,ws:`@forinda/kickjs-ws`,queue:`@forinda/kickjs-queue`,devtools:`@forinda/kickjs-devtools`},ae={zod:`zod`,valibot:`valibot`,yup:`yup`};function D(e,t){let n=e[t];if(!n)throw Error(`generatePackageJson: missing resolved version for ${t}. Add it to SIBLING_PACKAGES in generators/project.ts.`);return n}function oe(e,t,n,r=[],i=`zod`,a=`express`,o=!1){let s=ae[i],c={"@forinda/kickjs":D(n,`@forinda/kickjs`),"@forinda/kickjs-schema":D(n,`@forinda/kickjs-schema`),dotenv:D(n,`dotenv`),"reflect-metadata":D(n,`reflect-metadata`),[s]:D(n,s)};a===`express`?c.express=D(n,`express`):a===`fastify`?(c.fastify=D(n,`fastify`),c[`@fastify/middie`]=D(n,`@fastify/middie`),c[`serve-static`]=D(n,`serve-static`)):a===`h3`&&(c.h3=D(n,`h3`),c[`serve-static`]=D(n,`serve-static`));for(let e of r){let t=ie[e];t&&!c[t]&&(c[t]=D(n,t))}return JSON.stringify({name:e,version:`0.0.0`,type:`module`,scripts:{dev:`kick dev`,build:`kick build`,start:`kick start`,test:`vitest run`,"build:netlify":`kick build && kick build:netlify`,"build:vercel":`kick build && kick build:vercel`},dependencies:c,devDependencies:{"@forinda/kickjs-cli":D(n,`@forinda/kickjs-cli`),"@forinda/kickjs-testing":D(n,`@forinda/kickjs-testing`),"@forinda/kickjs-vite":D(n,`@forinda/kickjs-vite`),"@types/supertest":D(n,`@types/supertest`),"@swc/core":D(n,`@swc/core`),...a===`express`?{"@types/express":D(n,`@types/express`)}:{},"@types/node":D(n,`@types/node`),"unplugin-swc":D(n,`unplugin-swc`),vite:D(n,`vite`),supertest:D(n,`supertest`),vitest:D(n,`vitest`),typescript:D(n,`typescript`),...o?{"@typescript/typescript6":D(n,`@typescript/typescript6`)}:{},oxfmt:D(n,`oxfmt`),oxlint:D(n,`oxlint`)}},null,2)}function se(e={}){return`import { defineConfig } from 'vite'
|
|
314
314
|
import { fileURLToPath } from 'node:url'
|
|
315
315
|
import swc from 'unplugin-swc'
|
|
316
316
|
import { kickjsVitePlugin, envWatchPlugin } from '@forinda/kickjs-vite'
|
|
@@ -445,7 +445,7 @@ export default mergeConfig(
|
|
|
445
445
|
`);for(let e of a)console.log(o(e))}else console.log(`\n Plus ${a.length} optional packages (swagger, db, queue, …).`),console.log(" Run `kick add --list --all` for the full catalog.");console.log(`
|
|
446
446
|
Usage: kick add ai db swagger`),console.log(` kick add queue:bullmq`),console.log(` kick add upload # installs the multipart driver for your runtime`),console.log()}const K={"@swc/core":!0,esbuild:!0};function q(e,t,n){if(e===`pnpm`){let e=o(t,`pnpm-workspace.yaml`),r=s(e)?c(e,`utf-8`):``,i=ce(r,n);return i===r?void 0:(l(e,i),e)}if(e!==`npm`&&e!==`bun`)return;let r=o(t,`package.json`);if(!s(r))return;let i=JSON.parse(c(r,`utf-8`)),a=!1;if(e===`npm`){let e=i.allowScripts??{};for(let[t,r]of Object.entries(n))Object.keys(e).some(e=>e===t||e.startsWith(`${t}@`))||(e[t]=r,a=!0);i.allowScripts=e}else{let e=i.trustedDependencies??[];for(let[t,r]of Object.entries(n))r&&!e.includes(t)&&(e.push(t),a=!0);i.trustedDependencies=e}if(a)return l(r,`${JSON.stringify(i,null,2)}\n`),r}function ve(e){if(e===`pnpm`)return U(`pnpm-workspace.yaml`)??process.cwd();for(let e=process.cwd();;e=i(e)){try{if(JSON.parse(c(o(e,`package.json`),`utf-8`)).workspaces)return e}catch{}if(i(e)===e)return process.cwd()}}function J(e){return Object.assign({},...e.map(e=>F[e]?.builds??{}))}function ye(e,t,n=`express`){let r=new Set,i=new Set,a=[],o=[],s=[];for(let c of e){if(c===`upload`){let e=R[n];s.push(`upload (${n}): ${e.note}`),e.prod&&(t?i:r).add(e.prod),e.dev&&i.add(e.dev);continue}let e=F[c];if(!e){a.push(c);continue}e.deprecated&&o.push(`'${c}' (${e.pkg}) is deprecated — ${e.deprecated}`);let l=t||e.dev?i:r;l.add(e.pkg);for(let t of e.peers)l.add(t);if(e.enginePeers){let e=L[n];for(let t of e)l.add(t);s.push(`${c} (${n}): engine peers ${e.join(`, `)}`)}}return{prodDeps:[...r],devDeps:[...i],unknown:a,warnings:o,notices:s}}function be(e){e.command(`list`).alias(`ls`).description(`List KickJS packages (core only; pair with --all for the full catalog)`).option(`--all`,`Include the full optional catalog`).option(`--runtime <engine>`,`HTTP engine to show peers for: express | fastify | h3`).action(async e=>{G(!!e.all,z(e.runtime)??await B())})}function xe(e){e.command(`add [packages...]`).description(`Add KickJS packages with their required dependencies`).option(`--pm <manager>`,`Package manager override`).option(`-D, --dev`,`Install as dev dependency`).option(`--list`,`List packages (core only by default; pair with --all)`).option(`--runtime <engine>`,`HTTP engine for peer resolution: express | fastify | h3 (overrides kick.config.ts)`).option(`--all`,`When listing, include the full optional catalog`).action(async(e,t)=>{if(t.list||e.length===0){G(!!t.all,z(t.runtime)??await B());return}let{pm:n,source:r}=await W(t.pm);console.log(`\n Using ${n} (resolved from ${r})`);let i=z(t.runtime),a=await V(process.cwd()),o=i??a.runtime;if(!i&&a.ambiguous){console.error(`\n Cannot tell which HTTP engine this app boots on: found ${a.candidates.join(`, `)} in package.json.\n\n Installing engine peers for the wrong one is worse than not installing them, so:\n • set \`runtime: '<engine>'\` in kick.config.ts (permanent, also fixes kick doctor), or\n • pass --runtime <${a.candidates.join(`|`)}> for this command\n`),process.exitCode=1;return}let{prodDeps:s,devDeps:c,unknown:l,warnings:u,notices:d}=ye(e,!!t.dev,o);for(let e of u)console.warn(`\n WARNING: ${e}`);for(let e of d)console.log(`\n ${e}`);if(l.length>0&&(console.log(`\n Unknown packages: ${l.join(`, `)}`),console.log(` Run "kick add --list" to see available packages.
|
|
447
447
|
`),s.length===0&&c.length===0))return;let p=J(e);if(Object.keys(p).length>0){let e=q(n,ve(n),p);e&&console.log(`\n Approved install scripts in ${e}`)}if(s.length>0){let e=s,t=`${n} add ${e.join(` `)}`;console.log(`\n Installing ${e.length} dependency(ies):`);for(let t of e)console.log(` + ${t}`);console.log();try{f(t,{stdio:`inherit`})}catch{console.log(`\n Installation failed. Run manually:\n ${t}\n`)}}if(c.length>0){let e=c,t=`${n} add -D ${e.join(` `)}`;console.log(`\n Installing ${e.length} dev dependency(ies):`);for(let t of e)console.log(` + ${t} (dev)`);console.log();try{f(t,{stdio:`inherit`})}catch{console.log(`\n Installation failed. Run manually:\n ${t}\n`)}}console.log(` Done!
|
|
448
|
-
`)})}const Y=i(m(import.meta.url)),X=JSON.parse(c([a(Y,`..`,`package.json`),a(Y,`..`,`..`,`package.json`)].find(s),`utf-8`)),Se=[`@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`];function
|
|
449
|
-
Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${o} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-
|
|
450
|
-
Project scaffolded successfully!`),console.log();let S=p!==process.cwd();m(`Next steps:`),S&&m(` cd ${r}`),n.installDeps||m(` ${o} install`);let C={rest:`kick g module user`,minimal:`# add your routes to src/index.ts`};m(` ${C[s]??C.rest}`),m(` kick dev`),m(``),m(`Commands:`),m(` kick dev Start dev server with Vite HMR`),m(` kick build Production build via Vite`),m(` kick start Run production build`),m(``),m(`Generators:`),m(` kick g module <name> REST module (controller, service, DTOs, repository)`),m(` kick g scaffold <n> <f..> CRUD module from field definitions`),m(` kick g controller <name> Standalone controller`),m(` kick g service <name> @Service() class`),m(` kick g middleware <name> Global connect-style middleware`),m(` kick g guard <name> Route guard (auth, roles, etc.)`),m(` kick g adapter <name> AppAdapter with lifecycle hooks`),m(` kick g dto <name> DTO schema (Zod / Valibot / Yup)`),m(` kick g config Generate kick.config.ts`),m(``),m(`Add packages:`),m(` kick add <pkg> Install a KickJS package + peers`),m(` kick add --list Show all available packages`),m(``),m(`Available: ${I}`),m(``)}export{R as a,be as c,O as d,k as f,K as i,B as l,E as m,Q as n,q as o,T as p,F as r,xe as s,
|
|
451
|
-
//# sourceMappingURL=project-
|
|
448
|
+
`)})}const Y=i(m(import.meta.url)),X=JSON.parse(c([a(Y,`..`,`package.json`),a(Y,`..`,`..`,`package.json`)].find(s),`utf-8`)),Se=[`@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`],Z={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`},"@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`},"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:`^1.0.0`,cap:`^1`},"serve-static":{fallback:`^2.2.0`,cap:`^2`},zod:{fallback:`^4.3.6`,cap:`^4`},valibot:{fallback:`^1.4.1`,cap:`^1`},yup:{fallback:`^1.7.1`,cap:`^1`}};function Ce(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 we(e){return e===`@forinda/kickjs-cli`?`^${X.version}`:`latest`}async function Te(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 Q(){let e=[...Se.map(e=>({name:e,fallback:we(e),cap:void 0})),...Object.entries(Z).map(([e,t])=>({name:e,...t}))],t=Date.now()+2e4,n=await Te(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=Ce(await re(`npm`,r?[`view`,a,`version`,`--json`]:[`view`,a,`version`],{timeout:i}));return[e,o?`^${o}`:n]});return Object.fromEntries(n)}function Ee(e,t){let n=w(`npm`,[`view`,`${e}@${t}`,`version`],{timeout:2e4});return n&&/^\d+\.\d+\.\d+/.test(n)?n:null}function $(e){return(e??``).replace(/^[\^~>=<\s]+/,``)}function De(e,t){let n=e=>$(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}function Oe(e,t,n){let r=w(`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 ke(n){let{name:r,directory:i,packageManager:o=`pnpm`,template:s=`rest`,defaultRepo:c=`inmemory`,packages:l=[],schemaLib:u=`zod`,runtime:d=`express`}=n,p=i,m=e=>console.log(` ${e}`);console.log(`\n Creating KickJS project: ${r}\n`),n.versions||m(`Resolving package versions...`);let h=n.versions??await Q(),g=Object.keys(h).filter(e=>h[e]===`latest`);if(g.length>0&&m(`WARNING: could not reach npm for ${g.join(`, `)} — pinned to 'latest'`),d!==`express`){if(Oe(`@forinda/kickjs`,`latest`,`./${d}`))m(`Using @forinda/kickjs@latest (stable ships the ${d} runtime)`);else{let e=[`@forinda/kickjs`,`@forinda/kickjs-cli`,`@forinda/kickjs-vite`],t=[],n=!1;for(let r of e){let e=Ee(r,`alpha`);e&&De(e,$(h[r]))&&(h[r]=`^${e}`,t.push(`${r}@^${e}`),r===`@forinda/kickjs`&&(n=!0))}m(n?`Using the alpha channel for the ${d} runtime: ${t.join(`, `)}`:`WARNING: could not resolve @forinda/kickjs@alpha — the ${d} runtime subpath may be missing. After install, run: ${o} add @forinda/kickjs@alpha`)}}await e(a(p,`package.json`),oe(r,s,h,l,u,d,n.withClientMap)),await e(a(p,`vite.config.ts`),se({strictPort:n.strictPort})),await e(a(p,`tsconfig.json`),le()),await e(a(p,`.oxfmtrc.json`),ue()),await e(a(p,`.editorconfig`),de()),await e(a(p,`.gitignore`),fe()),await e(a(p,`.gitattributes`),pe()),await e(a(p,`.env`),A()),await e(a(p,`.env.example`),j()),await e(a(p,`.env.test`),M()),await e(a(p,`.env.test.example`),N()),await e(a(p,`src/config/index.ts`),y(u)),await e(a(p,`src/index.ts`),_(r,s,X.version,l,d,n.spaClientDir)),await e(a(p,`src/modules/index.ts`),v()),await e(a(p,`src/modules/hello/hello.service.ts`),b()),await e(a(p,`src/modules/hello/hello.controller.ts`),ee()),await e(a(p,`src/modules/hello/hello.module.ts`),te()),await e(a(p,`kick.config.ts`),ne(s,c,o,d,n.withClientMap)),await e(a(p,`vitest.config.ts`),P()),await e(a(p,`README.md`),t(r,s,o));let{generateAgentDocs:x}=await import(`./agent-docs-DWRW_0cn.mjs`).then(e=>e.t);if(await x({outDir:p,name:r,pm:o,template:s,only:`all`,force:!0}),n.platformConfig!==!1&&(await e(a(p,`netlify.toml`),O({command:`${o} run build:netlify`,publish:`dist/public`,spa:!1})),await e(a(p,`vercel.json`),k(`${o} run build:vercel`))),n.approveInstallScripts!==!1&&q(o,p,{...K,...J(l)}),n.installDeps){console.log(`\n Installing dependencies with ${o}...\n`);try{f(`${o} install`,{cwd:p,stdio:`inherit`}),console.log(`
|
|
449
|
+
Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${o} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-COTKpuqW.mjs`).then(e=>e.n);await e({cwd:p,allowDuplicates:!0,silent:!0})}catch{}if(n.initGit)try{f(`git init`,{cwd:p,stdio:`pipe`}),f(`git branch -M main`,{cwd:p,stdio:`pipe`}),f(`git add -A`,{cwd:p,stdio:`pipe`}),f(`git commit -m "chore: initial commit from kick new"`,{cwd:p,stdio:`pipe`}),m(`Git repository initialized`)}catch{m(`Warning: git init failed (git may not be installed)`)}console.log(`
|
|
450
|
+
Project scaffolded successfully!`),console.log();let S=p!==process.cwd();m(`Next steps:`),S&&m(` cd ${r}`),n.installDeps||m(` ${o} install`);let C={rest:`kick g module user`,minimal:`# add your routes to src/index.ts`};m(` ${C[s]??C.rest}`),m(` kick dev`),m(``),m(`Commands:`),m(` kick dev Start dev server with Vite HMR`),m(` kick build Production build via Vite`),m(` kick start Run production build`),m(``),m(`Generators:`),m(` kick g module <name> REST module (controller, service, DTOs, repository)`),m(` kick g scaffold <n> <f..> CRUD module from field definitions`),m(` kick g controller <name> Standalone controller`),m(` kick g service <name> @Service() class`),m(` kick g middleware <name> Global connect-style middleware`),m(` kick g guard <name> Route guard (auth, roles, etc.)`),m(` kick g adapter <name> AppAdapter with lifecycle hooks`),m(` kick g dto <name> DTO schema (Zod / Valibot / Yup)`),m(` kick g config Generate kick.config.ts`),m(``),m(`Add packages:`),m(` kick add <pkg> Install a KickJS package + peers`),m(` kick add --list Show all available packages`),m(``),m(`Available: ${I}`),m(``)}export{R as a,be as c,O as d,k as f,K as i,B as l,E as m,Q as n,q as o,T as p,F as r,xe as s,ke as t,_e as u};
|
|
451
|
+
//# sourceMappingURL=project-JoccwqS2.mjs.map
|