@forinda/kickjs-cli 8.6.0 → 8.6.1
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-BFOgLbXq.mjs → agent-docs-BO_QMIkN.mjs} +3 -3
- package/dist/{agent-docs-BFOgLbXq.mjs.map → agent-docs-BO_QMIkN.mjs.map} +1 -1
- package/dist/{agent-docs-BU1rORKA.mjs → agent-docs-DTg4y5mT.mjs} +2 -2
- package/dist/{build-CdIpRyfy.mjs → build-DSQ6SPr4.mjs} +3 -3
- package/dist/{build-CdIpRyfy.mjs.map → build-DSQ6SPr4.mjs.map} +1 -1
- package/dist/{build-DlfIkjcw.mjs → build-DfrjvGMx.mjs} +2 -2
- package/dist/{builtins-CmuUgcIq.mjs → builtins-A-wfYHI9.mjs} +4 -4
- package/dist/{builtins-CfAXBoIM.mjs → builtins-KQmcywFY.mjs} +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/{config-ndsVdO8u.mjs → config-BoXFaObA.mjs} +3 -3
- package/dist/{config-ndsVdO8u.mjs.map → config-BoXFaObA.mjs.map} +1 -1
- package/dist/{config-SvlcF3Ls.mjs → config-Bz1suLYz.mjs} +2 -2
- package/dist/{doctor-D3RMXkxE.mjs → doctor-p4bjILiU.mjs} +4 -4
- package/dist/{doctor-D3RMXkxE.mjs.map → doctor-p4bjILiU.mjs.map} +1 -1
- package/dist/{fs-v57MCgpH.mjs → fs-DH9oxW0t.mjs} +1 -1
- package/dist/{fs-DdNMcW_P.mjs → fs-Dz7zBXL4.mjs} +2 -2
- package/dist/{fs-DdNMcW_P.mjs.map → fs-Dz7zBXL4.mjs.map} +1 -1
- package/dist/{fullstack-LJwhodT-.mjs → fullstack-BKD9McZF.mjs} +4 -4
- package/dist/{fullstack-LJwhodT-.mjs.map → fullstack-BKD9McZF.mjs.map} +1 -1
- package/dist/{fullstack-DOufUeMv.mjs → fullstack-DQbVCW5U.mjs} +3 -3
- package/dist/index.mjs +2 -2
- package/dist/{plugin-Dighdqh-.mjs → plugin-Aof9UWs7.mjs} +2 -2
- package/dist/{plugin-Dn67elEZ.mjs → plugin-B-kr8WAU.mjs} +2 -2
- package/dist/{project-AXCA1hD9.mjs → project-BAGDIkJa.mjs} +4 -4
- package/dist/{project-Cb_NLUWI.mjs → project-BjxeGJBn.mjs} +5 -5
- package/dist/{project-Cb_NLUWI.mjs.map → project-BjxeGJBn.mjs.map} +1 -1
- package/dist/{project-root-Dgvy5kYG.mjs → project-root-4oQKPMOs.mjs} +2 -2
- package/dist/{project-root-C7TrLJlZ.mjs → project-root-D8VclnwB.mjs} +3 -3
- package/dist/{project-root-C7TrLJlZ.mjs.map → project-root-D8VclnwB.mjs.map} +1 -1
- package/dist/{prompts-CSATvwXw.mjs → prompts-BIl0rZ4C.mjs} +2 -2
- package/dist/{prompts-CSATvwXw.mjs.map → prompts-BIl0rZ4C.mjs.map} +1 -1
- package/dist/{rolldown-runtime-BhxEEqxa.mjs → rolldown-runtime-DElgkk48.mjs} +1 -1
- package/dist/{run-plugins-Cf_6BgGZ.mjs → run-plugins-DCVSqa5a.mjs} +4 -4
- package/dist/{run-plugins-Cf_6BgGZ.mjs.map → run-plugins-DCVSqa5a.mjs.map} +1 -1
- package/dist/{typegen-CYhFNfIu.mjs → typegen-BOxA_1DU.mjs} +5 -5
- package/dist/{typegen-CYhFNfIu.mjs.map → typegen-BOxA_1DU.mjs.map} +1 -1
- package/dist/{typegen-97E_RYNp.mjs → typegen-Dss5L5p7.mjs} +4 -4
- package/dist/{types-lHwt_SNI.mjs → types-Dudqvbd1.mjs} +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.6.
|
|
2
|
+
* @forinda/kickjs-cli v8.6.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{r as e,t}from"./fs-
|
|
11
|
+
import{r as e,t}from"./fs-Dz7zBXL4.mjs";import{a as n,n as r,r as i,t as a,u as o}from"./prompts-BIl0rZ4C.mjs";import{c as s,i as c}from"./project-BjxeGJBn.mjs";import{o as l}from"./config-BoXFaObA.mjs";import{t as u}from"./project-root-D8VclnwB.mjs";import{createRequire as d}from"node:module";import f,{dirname as p,join as m,relative as h,resolve as g}from"node:path";import{existsSync as _,readFileSync as v,readdirSync as y,statSync as b}from"node:fs";import{readFile as x,writeFile as S}from"node:fs/promises";import C from"pluralize";import{pathToFileURL as ee}from"node:url";import{defineGenerator as te}from"@forinda/kickjs-cli-kit";function w(e){return e.replace(/[-_\s]+(.)?/g,(e,t)=>t?t.toUpperCase():``).replace(/^(.)/,e=>e.toUpperCase())}function T(e){let t=w(e);return t.charAt(0).toLowerCase()+t.slice(1)}function E(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).replace(/[\s_]+/g,`-`).toLowerCase()}function D(e){return C.plural(e)}function O(e){return C.plural(e)}function k(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const ne={inmemory:`in-memory`,drizzle:`Drizzle`,prisma:`Prisma`};function re(e){return e.charAt(0).toUpperCase()+e.slice(1).replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function ie(e){return ne[e]??re(e)}function ae(e){return`create${e}Repository`}function A(e){return e??`define`}function j(e){let{pascal:t,kebab:n,plural:r=``,repo:i,style:a}=e,o=ae(t),s=A(a),c=`/**
|
|
12
12
|
* ${t} Module
|
|
13
13
|
*
|
|
14
14
|
* REST module with a flat folder structure.
|
|
@@ -954,7 +954,7 @@ export const ${l}Schema = ${F(u,`// Define your schema fields here\n name: ${d.
|
|
|
954
954
|
|
|
955
955
|
export type ${c}DTO = ${d.infer(`${l}Schema`)}
|
|
956
956
|
`),f.push(p),f}function we(){let e=(process.env.LOG_LEVEL??process.env.KICKJS_LOG_LEVEL??``).toLowerCase();return e===`debug`||e===`trace`}var Te=class extends Error{drifted;constructor(e){let t=e.map(e=>` ${e.id} → ${e.outFile}`).join(`
|
|
957
|
-
`);super(`kick typegen --check: ${e.length} generated file(s) are out of date:\n${t}\n Run \`kick typegen\` and commit the result.`),this.name=`TypegenDriftError`,this.drifted=e}};function Ee(e){return e}function De(e){let t=new Map;return{report(n,r){let i=r instanceof Error?r.message:String(r);t.get(n)!==i&&(t.set(n,i),e(` kick typegen: ${n} pass failed (${i}) — types in .kickjs/types may be stale`))},clear(e){t.delete(e)}}}const Oe=`__kickjs_typegen_owner`;function ke(e){let{cwd:t,config:n}=e,r=e.debounceMs??100,i=e.pipeline??{runTypegen:async e=>(await import(`./typegen-
|
|
957
|
+
`);super(`kick typegen --check: ${e.length} generated file(s) are out of date:\n${t}\n Run \`kick typegen\` and commit the result.`),this.name=`TypegenDriftError`,this.drifted=e}};function Ee(e){return e}function De(e){let t=new Map;return{report(n,r){let i=r instanceof Error?r.message:String(r);t.get(n)!==i&&(t.set(n,i),e(` kick typegen: ${n} pass failed (${i}) — types in .kickjs/types may be stale`))},clear(e){t.delete(e)}}}const Oe=`__kickjs_typegen_owner`;function ke(e){let{cwd:t,config:n}=e,r=e.debounceMs??100,i=e.pipeline??{runTypegen:async e=>(await import(`./typegen-BOxA_1DU.mjs`).then(e=>e.n)).runTypegen(e),runAllPluginTypegens:async e=>(await import(`./run-plugins-DCVSqa5a.mjs`).then(e=>e.n)).runAllPluginTypegens(e),writeTypegenArtifacts:async(e,t,n)=>(await import(`./typegen-BOxA_1DU.mjs`).then(e=>e.n)).writeTypegenArtifacts(e,t,n),buildAssets:async(e,t)=>(await import(`./build-DSQ6SPr4.mjs`).then(e=>e.n)).buildAssets(e,t)},a=n?.typegen?.schemaValidator??`zod`,o=n?.typegen?.envFile,s=f.resolve(t,n?.typegen?.outDir??`.kickjs/types`),c=n?.assetMap?Object.values(n.assetMap).map(e=>e?.src).filter(e=>typeof e==`string`&&e.length>0).map(e=>f.resolve(t,e)):[],l=!!n?.assetMap&&Object.keys(n.assetMap).length>0,u=e=>e.replaceAll(`\\`,`/`),d=c.map(u),p=e=>{let t=u(e);return d.some(e=>t===e||t.startsWith(`${e}/`))},m=De(e.emitWarning),h=null,g=!1,_=new Set,v=new Set,y=!1,b=!1;function x(r,c){i.runTypegen({cwd:t,silent:!0,allowDuplicates:!0,schemaValidator:a,envFile:o,srcDir:n?.typegen?.srcDir,outDir:n?.typegen?.outDir,assetMap:n?.assetMap,changedFiles:r,runPlugins:!1}).then(()=>m.clear(`scan`)).catch(e=>m.report(`scan`,e)),i.runAllPluginTypegens({cwd:t,config:n,silent:!0,changedFiles:r,watch:!0}).then(e=>i.writeTypegenArtifacts(s,e,!0)).then(()=>m.clear(`plugins`)).catch(e=>m.report(`plugins`,e)).finally(()=>e.onPassComplete?.()),c&&n&&i.buildAssets(n,{cwd:t,silent:!0}).catch(()=>{})}function S(){let e=y?void 0:{changed:[..._],removed:[...v]},t=b;_.clear(),v.clear(),y=!1,b=!1,x(e,t)}return{assetSrcRoots:c,handleWatchEvent(e,t){if(!g&&!u(t).includes(`/.kickjs/`)){if(e===`unlinkDir`)y=!0,l&&(b=!0);else{if(t.endsWith(`.d.ts`))return;let n=/\.(ts|tsx|mts|cts)$/.test(t),r=p(t);if(!n&&!r)return;r&&l&&(b=!0),n&&(e===`unlink`?(v.add(t),_.delete(t)):(_.add(t),v.delete(t)))}h&&clearTimeout(h),h=setTimeout(S,r)}},runOnce(){g||x(void 0,l)},dispose(){g=!0,h&&clearTimeout(h),h=null}}}function Ae(e){return E(e).replace(/-/g,`_`)}function G(e){let t=e.cwd??process.cwd(),n=e.projectRoot??u(t),r=e.pluralize??!0,i=w(e.name),a=T(e.name),o=E(e.name),s=Ae(e.name),c={name:e.name,pascal:i,camel:a,kebab:o,snake:s,modulesDir:e.modulesDir??`src/modules`,cwd:t,projectRoot:n,args:e.args??[],flags:e.flags??{}};if(r){let e=D(o);c.pluralKebab=e,c.pluralPascal=w(e),c.pluralCamel=T(e)}return c}function je(e,t){return g(e.cwd,t)}async function Me(e){return import(ee(e).href)}const K=new Map;async function q(e){let t=K.get(e);if(t)return t;let n=Ne(e);return K.set(e,n),n}async function Ne(e){let t=g(e,`package.json`);if(!_(t))return{generators:[],loaded:[],failed:[]};let n=Pe(JSON.parse(await x(t,`utf-8`))),r=d(g(e,`package.json`)),i=[],a=[],o=[];for(let e of n){let t;try{t=r.resolve(`${e}/package.json`)}catch{continue}let n;try{n=JSON.parse(await x(t,`utf-8`))}catch(t){o.push({source:e,reason:`failed to parse package.json: ${t}`});continue}if(!n.kickjs?.generators)continue;let s=n.kickjs.generators,c=g(p(t),s);if(!_(c)){o.push({source:e,reason:`kickjs.generators points to missing file: ${s}`});continue}let l;try{l=await Me(c)}catch(t){o.push({source:e,reason:`failed to import manifest: ${t}`});continue}let u=l.default;if(!Array.isArray(u)){o.push({source:e,reason:`manifest's default export is not an array of GeneratorSpec`});continue}for(let t of u){if(!Fe(t)){o.push({source:e,reason:`manifest entry is not a valid GeneratorSpec (missing name/files)`});continue}i.push({source:e,spec:t})}a.push(e)}return{generators:i,loaded:a,failed:o}}function Pe(e){let t=new Set;for(let n of[e.dependencies,e.devDependencies,e.peerDependencies])if(n)for(let e of Object.keys(n))t.add(e);return Array.from(t)}function Fe(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.name==`string`&&typeof t.files==`function`}async function Ie(e,t=[]){let n=e.cwd??process.cwd(),r=t.find(t=>t.spec.name===e.generatorName);if(r)return J(r.spec,r.source,e,n);let i=Re(await q(n),e.generatorName);return i?J(i.spec,i.source,e,n):null}async function Le(e,t=[]){let n=await q(e),r=new Set(t.map(e=>e.spec.name)),i=n.generators.filter(e=>!r.has(e.spec.name));return{generators:[...t,...i],loaded:n.loaded,failed:n.failed}}function Re(e,t){return e.generators.find(e=>e.spec.name===t)}async function J(t,n,r,i){let a=G({name:r.itemName,args:r.args,flags:r.flags,modulesDir:r.modulesDir,pluralize:r.pluralize,cwd:i,projectRoot:r.projectRoot}),o=await t.files(a),s=[];for(let t of o){let n=je(a,t.path);await e(n,t.content),s.push(n)}return{files:s,source:n}}function ze(e){return e}function Be(e){return e}function Ve(e){try{return JSON.parse(v(e,`utf-8`))}catch{return null}}function Y(e){try{return v(e,`utf-8`)}catch{return null}}function He(e){let t=e.replace(/\/\*[\s\S]*?\*\//g,``).replace(/(^|[^:"'\\])\/\/.*$/gm,`$1`).replace(/,(\s*[}\]])/g,`$1`);try{return JSON.parse(t)}catch{return null}}function Ue(e){let t=m(e,`tsconfig.json`);if(_(t))return X(t,new Set)}function X(e,t){if(t.has(e)||t.size>=16)return null;t.add(e);let n=Y(e);if(n===null)return null;let r=He(n);if(typeof r!=`object`||!r)return null;let i=Array.isArray(r.extends)?r.extends:typeof r.extends==`string`?[r.extends]:[],a={};for(let n of i){if(typeof n!=`string`)continue;let r=We(p(e),n);if(!r)continue;let i=X(r,t);i&&Object.assign(a,i.compilerOptions)}return r.compilerOptions={...a,...r.compilerOptions},r}function We(e,t){if(t.startsWith(`.`)||t.startsWith(`/`))return Z(g(e,t));let n=e;for(;;){let e=Z(m(n,`node_modules`,t));if(e)return e;let r=p(n);if(r===n)break;n=r}return null}function Z(e){if(_(e)){try{if(b(e).isDirectory()){let t=m(e,`tsconfig.json`);return _(t)?t:null}}catch{return null}return e}let t=`${e}.json`;return _(t)?t:null}function Ge(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ke(){let e=process.version,t=Number.parseInt(e.replace(/^v/,``).split(`.`)[0],10);return Number.isNaN(t)||t<20?{name:`Node version`,status:`fail`,message:e,fix:`KickJS requires Node 20 or newer.
|
|
958
958
|
Install a supported version via nvm / fnm / volta.`}:{name:`Node version`,status:`pass`,message:e}}function qe(e){if(!e.pkg)return{name:`@forinda/kickjs installed`,status:`warn`,message:`no package.json`};let t={...e.pkg.dependencies,...e.pkg.peerDependencies};return t[`@forinda/kickjs`]?{name:`@forinda/kickjs installed`,status:`pass`,message:t[`@forinda/kickjs`]}:{name:`@forinda/kickjs installed`,status:`fail`,fix:"This directory does not look like a KickJS project — `@forinda/kickjs` is not in your package.json. Run `kick doctor` from the project root, or scaffold a fresh project with `kick new <name>`."}}function Je(e){if(!e.pkg)return null;let t={...e.pkg.dependencies,...e.pkg.peerDependencies};return t[`@forinda/kickjs`]&&!t.express?{name:`express installed`,status:`fail`,fix:"`@forinda/kickjs` declares `express` as a required peer dependency, but your package.json does not include it. Install: pnpm add express"}:t.express?{name:`express installed`,status:`pass`,message:t.express}:null}const Ye={express:[],fastify:[`fastify`,`@fastify/middie`],h3:[`h3`]};function Xe(e){if(!e.pkg||e.runtime===`express`)return null;let t={...e.pkg.dependencies,...e.pkg.peerDependencies,...e.pkg.devDependencies},n=Ye[e.runtime].filter(e=>!t[e]),r=`runtime engine (${e.runtime})`;return n.length>0?{name:r,status:`fail`,fix:`Resolved runtime '${e.runtime}' is missing engine peer(s): ${n.join(`, `)}.\nInstall: pnpm add ${n.join(` `)}`}:{name:r,status:`pass`}}function Ze(e){if(!e.pkg||!Qe(e.cwd))return null;let t=c[e.runtime],n=`upload driver (${e.runtime})`;return t.prod?{...e.pkg.dependencies,...e.pkg.peerDependencies,...e.pkg.devDependencies}[t.prod]?{name:n,status:`pass`,message:t.prod}:{name:n,status:`fail`,fix:`This project uses file uploads on the '${e.runtime}' runtime, which needs '${t.prod}'.\nInstall it: kick add upload (or pnpm add ${t.prod})`}:{name:n,status:`pass`,message:`native multipart`}}const Q=2e3;function Qe(e){let t=m(e,`src`);if(!_(t))return!1;let n=/@FileUpload\b|\bupload\.(single|array|none)\s*\(/,r=[t],i=0;for(;r.length>0&&i<Q;){let e=r.pop(),t;try{t=y(e,{withFileTypes:!0})}catch{continue}for(let a of t){if(i>=Q)break;let t=m(e,a.name);if(a.isDirectory()){a.name!==`node_modules`&&r.push(t);continue}if(/\.(ts|tsx|mts|cts)$/.test(a.name)&&(i++,n.test(Y(t)??``)))return!0}}return!1}function $e(e){if(!e.pkg)return{name:`reflect-metadata installed`,status:`warn`,message:`no package.json`};let t={...e.pkg.dependencies,...e.pkg.peerDependencies,...e.pkg.devDependencies};return t[`reflect-metadata`]?{name:`reflect-metadata installed`,status:`pass`,message:t[`reflect-metadata`]}:{name:`reflect-metadata installed`,status:`fail`,fix:`KickJS decorators require the reflect-metadata polyfill.
|
|
959
959
|
Install it: pnpm add reflect-metadata
|
|
960
960
|
Then import it at the top of src/index.ts:
|
|
@@ -970,4 +970,4 @@ holding the whole environment the suite should run against
|
|
|
970
970
|
and supply env from the test runner.`}}const lt=[()=>Ke(),qe,Je,Xe,Ze,$e,et,tt,ct,rt];async function ut(e,t={}){let n={cwd:e,pkg:Ve(m(e,`package.json`)),tsconfig:Ue(e),runtime:t.runtime??`express`},r=[...lt,...t.extraChecks??[]],i=[];for(let e of r){let t;try{t=await e(n)}catch(t){i.push({name:e.name||`doctor check`,status:`fail`,message:t instanceof Error?t.message:String(t)});continue}t!=null&&(Array.isArray(t)?i.push(...t):i.push(t))}return i}function dt(e){switch(e){case`pass`:return o.green(`✔`);case`warn`:return o.yellow(`⚠`);case`fail`:return o.red(`✖`)}}function ft(e){let t=dt(e.status),n=e.message?` ${o.dim(`(${e.message})`)}`:``;return`${t} ${e.name}${n}`}function pt(e){return e.split(`
|
|
971
971
|
`).map(e=>` ${o.dim(`→`)} ${e}`).join(`
|
|
972
972
|
`)}function mt(e){return e?.doctor?.checks??[]}function ht(e){e.command(`doctor`).description(`Pre-flight checks for your KickJS project (dev environment health)`).action(async()=>{let e=process.cwd(),t=mt(await l(e)),a=await s(e);r(`KickJS Doctor`);let c=await ut(e,{extraChecks:t,runtime:a});for(let e of c)i.message(ft(e)),e.fix&&e.status!==`pass`&&i.message(pt(e.fix));let u=c.filter(e=>e.status===`pass`).length,d=c.filter(e=>e.status===`warn`).length,f=c.filter(e=>e.status===`fail`).length,p=[o.green(`${u} passed`),d>0?o.yellow(`${d} warning${d===1?``:`s`}`):`${d} warnings`,f>0?o.red(`${f} error${f===1?``:`s`}`):`${f} errors`].join(`, `);f>0?(n(`${p} — fix the errors above before running the app`),process.exit(1)):n(d>0?`${p} — review the warnings`:o.green(`${p} — your environment looks good`))})}export{D as A,pe as C,N as D,I as E,T as M,E as N,j as O,w as P,me as S,L as T,ye as _,Ie as a,z as b,Oe as c,Ee as d,we as f,be as g,xe as h,Le as i,O as j,k,ke as l,Se as m,ze as n,G as o,Ce as p,ht as r,te as s,Be as t,Te as u,W as v,R as w,V as x,_e as y};
|
|
973
|
-
//# sourceMappingURL=doctor-
|
|
973
|
+
//# sourceMappingURL=doctor-p4bjILiU.mjs.map
|