@forinda/kickjs-cli 8.17.3 → 8.18.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-BxHRHi1r.mjs → agent-docs-CbVUB2eN.mjs} +11 -11
- package/dist/{agent-docs-BkQx62G6.mjs → agent-docs-xZISEduq.mjs} +16 -16
- package/dist/{agent-docs-BkQx62G6.mjs.map → agent-docs-xZISEduq.mjs.map} +1 -1
- package/dist/build-BLQQMQtM.mjs +13 -0
- package/dist/{build-CARdsp9F.mjs.map → build-BLQQMQtM.mjs.map} +1 -1
- package/dist/build-CKmAKaJ1.mjs +12 -0
- package/dist/{builtins-BOWp16P2.mjs → builtins-4IV5eliu.mjs} +80 -80
- package/dist/{builtins-Cb02IU36.mjs → builtins-4OFjCWYj.mjs} +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/{config-DoZ1J2Kh.mjs → config-B3kSZiSh.mjs} +3 -3
- package/dist/{config-DoZ1J2Kh.mjs.map → config-B3kSZiSh.mjs.map} +1 -1
- package/dist/{config-CadmyiYh.mjs → config-v0mtdiYe.mjs} +2 -2
- package/dist/{doctor-C4bdYrM6.mjs → doctor-DJxEocJ5.mjs} +8 -8
- package/dist/{doctor-C4bdYrM6.mjs.map → doctor-DJxEocJ5.mjs.map} +1 -1
- package/dist/{fullstack-DjV35qtY.mjs → fullstack-DM0a3A8G.mjs} +4 -4
- package/dist/{fullstack-DjV35qtY.mjs.map → fullstack-DM0a3A8G.mjs.map} +1 -1
- package/dist/{fullstack-CiPh1wb_.mjs → fullstack-iWO7BFX6.mjs} +10 -10
- package/dist/index.d.mts +3 -50
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{plugin-BAlAQlkw.mjs → plugin-BCMbxzi5.mjs} +2 -2
- package/dist/{plugin-D8VpKAVP.mjs → plugin-P1F0k7kH.mjs} +2 -2
- package/dist/{project-CzMPptXL.mjs → project-6h_j0VK0.mjs} +25 -12
- package/dist/project-6h_j0VK0.mjs.map +1 -0
- package/dist/project-9QfIRkON.mjs +152 -0
- package/dist/{project-root-BHqLKyr9.mjs → project-root-DcfsBtCw.mjs} +3 -3
- package/dist/{project-root-BHqLKyr9.mjs.map → project-root-DcfsBtCw.mjs.map} +1 -1
- package/dist/{project-root-Ck8UKRHG.mjs → project-root-rs5vJCt5.mjs} +2 -2
- package/dist/{rolldown-runtime-BjnQdm0J.mjs → rolldown-runtime-CQE1JsWD.mjs} +1 -1
- package/dist/{run-plugins-BrI7b2Y5.mjs → run-plugins-BONtomzM.mjs} +147 -147
- package/dist/run-plugins-BONtomzM.mjs.map +1 -0
- package/dist/{typegen-D17TQ6Uy.mjs → typegen-FLvIFR3i.mjs} +5 -5
- package/dist/{typegen-D17TQ6Uy.mjs.map → typegen-FLvIFR3i.mjs.map} +1 -1
- package/dist/{typegen-0Ffq-YuL.mjs → typegen-ZG4nzOUN.mjs} +4 -4
- package/dist/{types-Bp0MoCVq.mjs → types-Doudtd8d.mjs} +1 -1
- package/package.json +12 -12
- package/templates/feature-storage/files/_dot_env.example.append +6 -0
- package/templates/feature-storage/files/src/adapters/storage.ts +2 -2
- package/templates/inertia-react/feature.json +13 -0
- package/templates/inertia-svelte/feature.json +13 -0
- package/templates/inertia-svelte/files/src/client/Layout.svelte +19 -0
- package/templates/inertia-svelte/files/src/client/Seo.svelte +47 -0
- package/templates/inertia-svelte/files/src/client/main.ts +16 -0
- package/templates/inertia-svelte/files/src/client/pages/Error.svelte +14 -0
- package/templates/inertia-svelte/files/src/client/pages/Home.svelte +13 -0
- package/templates/inertia-svelte/files/src/client/pages/Posts/Index.svelte +33 -0
- package/templates/inertia-svelte/files/src/client/ssr.ts +16 -0
- package/templates/inertia-svelte/files/src/client/svelte.d.ts +7 -0
- package/templates/inertia-svelte/files/vite.client.config.ts +32 -0
- package/templates/inertia-svelte/files/vite.config.ts +42 -0
- package/templates/inertia-vue/feature.json +13 -0
- package/templates/inertia-vue/files/src/client/Layout.vue +21 -0
- package/templates/inertia-vue/files/src/client/Seo.ts +49 -0
- package/templates/inertia-vue/files/src/client/main.ts +17 -0
- package/templates/inertia-vue/files/src/client/pages/Error.vue +16 -0
- package/templates/inertia-vue/files/src/client/pages/Home.vue +15 -0
- package/templates/inertia-vue/files/src/client/pages/Posts/Index.vue +31 -0
- package/templates/inertia-vue/files/src/client/ssr.ts +21 -0
- package/templates/inertia-vue/files/src/client/vue.d.ts +7 -0
- package/templates/inertia-vue/files/vite.client.config.ts +32 -0
- package/templates/inertia-vue/files/vite.config.ts +42 -0
- package/templates/template-inertia/feature.json +3 -13
- package/templates/template-inertia/files/src/client/app.css +1 -1
- package/templates/template-inertia/files/src/index.ts +4 -4
- package/templates/template-inertia/files/src/modules/pages/pages.controller.ts +1 -1
- package/dist/build-CARdsp9F.mjs +0 -13
- package/dist/build-I3pY30S2.mjs +0 -12
- package/dist/project-Bjk2dJc2.mjs +0 -139
- package/dist/project-CzMPptXL.mjs.map +0 -1
- package/dist/run-plugins-BrI7b2Y5.mjs.map +0 -1
- /package/templates/{template-inertia → inertia-react}/files/src/client/Layout.tsx +0 -0
- /package/templates/{template-inertia → inertia-react}/files/src/client/Seo.tsx +0 -0
- /package/templates/{template-inertia → inertia-react}/files/src/client/main.tsx +0 -0
- /package/templates/{template-inertia → inertia-react}/files/src/client/pages/Error.tsx +0 -0
- /package/templates/{template-inertia → inertia-react}/files/src/client/pages/Home.tsx +0 -0
- /package/templates/{template-inertia → inertia-react}/files/src/client/pages/Posts/Index.tsx +0 -0
- /package/templates/{template-inertia → inertia-react}/files/src/client/ssr.tsx +0 -0
- /package/templates/{template-inertia → inertia-react}/files/vite.client.config.ts +0 -0
- /package/templates/{template-inertia → inertia-react}/files/vite.config.ts +0 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Head } from '@inertiajs/vue3'
|
|
2
|
+
import { defineComponent, getCurrentInstance, h, watchEffect } from 'vue'
|
|
3
|
+
import type { PageMeta } from '@forinda/kickjs-inertia'
|
|
4
|
+
|
|
5
|
+
// Renders the meta a controller passes to inertia(..., { meta }), merged with
|
|
6
|
+
// the InertiaAdapter `meta` defaults — on the server (SSR) and again on every
|
|
7
|
+
// client-side visit, so the browser's title and tags follow the page. The
|
|
8
|
+
// head-keys match the tags the adapter writes, so each tag is replaced, not
|
|
9
|
+
// duplicated. A render function, not a .vue template: templates can't hold
|
|
10
|
+
// the JSON-LD <script>.
|
|
11
|
+
export const Seo = defineComponent(() => {
|
|
12
|
+
// `$page`, not usePage(): usePage() leaves out the page's `meta`. Read
|
|
13
|
+
// inside the render and the effect, so both follow each visit.
|
|
14
|
+
const app = getCurrentInstance()!.appContext.config.globalProperties
|
|
15
|
+
const pageMeta = () => (app.$page as { meta?: PageMeta }).meta
|
|
16
|
+
// <html lang> sits outside the app; the first visit's HTML has it already.
|
|
17
|
+
if (typeof document !== 'undefined') {
|
|
18
|
+
watchEffect(() => {
|
|
19
|
+
const lang = pageMeta()?.lang
|
|
20
|
+
if (lang) document.documentElement.lang = lang
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
return () => {
|
|
24
|
+
const meta = pageMeta()
|
|
25
|
+
if (!meta) return null
|
|
26
|
+
const tags = [
|
|
27
|
+
meta.description &&
|
|
28
|
+
h('meta', { 'head-key': 'description', name: 'description', content: meta.description }),
|
|
29
|
+
meta.robots && h('meta', { 'head-key': 'robots', name: 'robots', content: meta.robots }),
|
|
30
|
+
meta.canonical &&
|
|
31
|
+
h('link', { 'head-key': 'canonical', rel: 'canonical', href: meta.canonical }),
|
|
32
|
+
...Object.entries(meta.og ?? {}).map(([key, value]) =>
|
|
33
|
+
h('meta', { 'head-key': `og:${key}`, property: `og:${key}`, content: value }),
|
|
34
|
+
),
|
|
35
|
+
...Object.entries(meta.twitter ?? {}).map(([key, value]) =>
|
|
36
|
+
h('meta', { 'head-key': `twitter:${key}`, name: `twitter:${key}`, content: value }),
|
|
37
|
+
),
|
|
38
|
+
// `<` escaped, so a value can't close the script tag.
|
|
39
|
+
meta.jsonLd &&
|
|
40
|
+
h(
|
|
41
|
+
'script',
|
|
42
|
+
{ 'head-key': 'json-ld', type: 'application/ld+json' },
|
|
43
|
+
JSON.stringify(meta.jsonLd).replace(/</g, '\\u003c'),
|
|
44
|
+
),
|
|
45
|
+
...(meta.head ?? []).map(({ tag, attrs, key }) => h(tag, { 'head-key': key, ...attrs })),
|
|
46
|
+
].filter(Boolean)
|
|
47
|
+
return h(Head, { title: meta.title }, () => tags)
|
|
48
|
+
}
|
|
49
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import './app.css'
|
|
2
|
+
import { createInertiaApp } from '@inertiajs/vue3'
|
|
3
|
+
import type { DefineComponent } from 'vue'
|
|
4
|
+
|
|
5
|
+
// Lazy: each page is its own chunk, fetched when it's first visited, so the
|
|
6
|
+
// first load doesn't download every page. ssr.ts keeps `eager: true`; the
|
|
7
|
+
// server pays no download for it.
|
|
8
|
+
const pages = import.meta.glob<DefineComponent>('./pages/**/*.vue')
|
|
9
|
+
|
|
10
|
+
// Server-rendered pages are hydrated; the rest render from scratch.
|
|
11
|
+
createInertiaApp({
|
|
12
|
+
resolve: (name) => {
|
|
13
|
+
const page = pages[`./pages/${name}.vue`]
|
|
14
|
+
if (!page) throw new Error(`No page component at src/client/pages/${name}.vue`)
|
|
15
|
+
return page()
|
|
16
|
+
},
|
|
17
|
+
})
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Link } from '@inertiajs/vue3'
|
|
3
|
+
import Layout from '../Layout.vue'
|
|
4
|
+
|
|
5
|
+
// Rendered for unknown URLs (404) and errors thrown while handling a page.
|
|
6
|
+
// In production a 5xx message is replaced with a generic one.
|
|
7
|
+
defineProps<{ status: number; message: string }>()
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<Layout>
|
|
12
|
+
<h1>{{ status }}</h1>
|
|
13
|
+
<p>{{ message }}</p>
|
|
14
|
+
<Link href="/">Back home</Link>
|
|
15
|
+
</Layout>
|
|
16
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import Layout from '../Layout.vue'
|
|
3
|
+
|
|
4
|
+
defineProps<{ greeting: string }>()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<Layout>
|
|
9
|
+
<h1>{{ greeting }}</h1>
|
|
10
|
+
<p>
|
|
11
|
+
Pages are Vue components in <code>src/client/pages</code>; their props come from the
|
|
12
|
+
controller in <code>src/modules/pages</code>.
|
|
13
|
+
</p>
|
|
14
|
+
</Layout>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Deferred, useForm } from '@inertiajs/vue3'
|
|
3
|
+
import Layout from '../../Layout.vue'
|
|
4
|
+
|
|
5
|
+
interface Post {
|
|
6
|
+
id: number
|
|
7
|
+
title: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
defineProps<{ posts: Post[]; stats?: { total: number } }>()
|
|
11
|
+
const form = useForm({ title: '' })
|
|
12
|
+
const submit = () => form.post('/posts', { onSuccess: () => form.reset() })
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<Layout>
|
|
17
|
+
<h1>Posts</h1>
|
|
18
|
+
<Deferred data="stats">
|
|
19
|
+
<template #fallback><p>Loading stats…</p></template>
|
|
20
|
+
<p>Total: {{ stats?.total }}</p>
|
|
21
|
+
</Deferred>
|
|
22
|
+
<ul>
|
|
23
|
+
<li v-for="post in posts" :key="post.id">{{ post.title }}</li>
|
|
24
|
+
</ul>
|
|
25
|
+
<form @submit.prevent="submit">
|
|
26
|
+
<input v-model="form.title" aria-label="Title" />
|
|
27
|
+
<button :disabled="form.processing">Add</button>
|
|
28
|
+
<p v-if="form.errors.title" style="color: crimson">{{ form.errors.title }}</p>
|
|
29
|
+
</form>
|
|
30
|
+
</Layout>
|
|
31
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Also imported here, so the dev server can link it in server-rendered HTML.
|
|
2
|
+
import './app.css'
|
|
3
|
+
import { createInertiaApp } from '@inertiajs/vue3'
|
|
4
|
+
import type { Page } from '@inertiajs/core'
|
|
5
|
+
import { createSSRApp, h, type DefineComponent } from 'vue'
|
|
6
|
+
import { renderToString } from 'vue/server-renderer'
|
|
7
|
+
|
|
8
|
+
const pages = import.meta.glob<DefineComponent>('./pages/**/*.vue', {
|
|
9
|
+
eager: true,
|
|
10
|
+
import: 'default',
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
// Called by InertiaAdapter to render a page on the server: the page object
|
|
14
|
+
// in, `{ head, body }` out.
|
|
15
|
+
export default (page: Page) =>
|
|
16
|
+
createInertiaApp({
|
|
17
|
+
page,
|
|
18
|
+
render: renderToString,
|
|
19
|
+
resolve: (name) => pages[`./pages/${name}.vue`]!,
|
|
20
|
+
setup: ({ App, props, plugin }) => createSSRApp({ render: () => h(App, props) }).use(plugin),
|
|
21
|
+
})
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import vue from '@vitejs/plugin-vue'
|
|
3
|
+
import { compressAssets } from '@forinda/kickjs-vite/compress'
|
|
4
|
+
|
|
5
|
+
// Production builds of the pages (`{{runBuild}}` runs both):
|
|
6
|
+
// vite build --config vite.client.config.ts → dist/client
|
|
7
|
+
// vite build --config vite.client.config.ts --ssr src/client/ssr.ts → dist/ssr/ssr.js
|
|
8
|
+
// InertiaAdapter reads dist/client/.vite/manifest.json for the script tags
|
|
9
|
+
// and renders pages with dist/ssr/ssr.js.
|
|
10
|
+
// Production builds only. The server's .env sets NODE_ENV=development, and
|
|
11
|
+
// some tools (the Netlify CLI) load it into the environment: these would
|
|
12
|
+
// become development builds of the pages.
|
|
13
|
+
process.env.NODE_ENV = 'production'
|
|
14
|
+
|
|
15
|
+
export default defineConfig(({ isSsrBuild }) => ({
|
|
16
|
+
// Nothing from the server's .env belongs in the browser bundle.
|
|
17
|
+
envDir: false,
|
|
18
|
+
// compressAssets: .br / .gz beside the built pages' files, which the server
|
|
19
|
+
// sends to browsers that accept them. Skips the SSR build.
|
|
20
|
+
plugins: [vue(), compressAssets()],
|
|
21
|
+
// Same aliases as the dev server: tsconfig.json `paths`.
|
|
22
|
+
resolve: { tsconfigPaths: true },
|
|
23
|
+
// The SSR bundle carries its dependencies: a Netlify or Vercel function
|
|
24
|
+
// has no node_modules to resolve Vue from.
|
|
25
|
+
ssr: { noExternal: true },
|
|
26
|
+
// Inlined, Vue would pick its build from NODE_ENV at runtime and carry both.
|
|
27
|
+
define: isSsrBuild ? { 'process.env.NODE_ENV': JSON.stringify('production') } : {},
|
|
28
|
+
build: isSsrBuild
|
|
29
|
+
? // public/ is served from dist/client; the render bundle doesn't need a copy.
|
|
30
|
+
{ outDir: 'dist/ssr', copyPublicDir: false }
|
|
31
|
+
: { outDir: 'dist/client', manifest: true, rollupOptions: { input: 'src/client/main.ts' } },
|
|
32
|
+
}))
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import { fileURLToPath } from 'node:url'
|
|
3
|
+
import swc from 'unplugin-swc'
|
|
4
|
+
import vue from '@vitejs/plugin-vue'
|
|
5
|
+
import { kickjsVitePlugin, envWatchPlugin } from '@forinda/kickjs-vite'
|
|
6
|
+
|
|
7
|
+
// Dev server for the API and the pages. swc compiles the server, which
|
|
8
|
+
// needs decorator metadata; vue() and Vite's oxc compile the pages, which
|
|
9
|
+
// hot-swaps components on save without a reload.
|
|
10
|
+
const client = /src\/client\/.+\.[jt]sx?$/
|
|
11
|
+
|
|
12
|
+
export default defineConfig({
|
|
13
|
+
oxc: { include: client },
|
|
14
|
+
plugins: [
|
|
15
|
+
// swc's own config hook switches oxc off for every file; drop it so
|
|
16
|
+
// the pages keep oxc. Globs, not the regex above: unplugin-swc's options
|
|
17
|
+
// type takes swc's `exclude` (strings) for its own filter.
|
|
18
|
+
{ ...swc.vite({ exclude: ['**/node_modules/**', '**/src/client/**'] }), config: undefined },
|
|
19
|
+
vue(),
|
|
20
|
+
kickjsVitePlugin({ entry: 'src/index.ts' }),
|
|
21
|
+
// Watches .env files and triggers a full reload on change so the
|
|
22
|
+
// dev server picks up env tweaks without a manual restart.
|
|
23
|
+
envWatchPlugin(),
|
|
24
|
+
],
|
|
25
|
+
// The server renders the HTML, so Vite has no index.html to scan for the
|
|
26
|
+
// browser's dependencies — name the entry.
|
|
27
|
+
optimizeDeps: { entries: ['src/client/main.ts'] },
|
|
28
|
+
// @kick:vite-option
|
|
29
|
+
// Aliases come from tsconfig.json `paths` — one list for the server,
|
|
30
|
+
// the pages and the editor.
|
|
31
|
+
resolve: { tsconfigPaths: true },
|
|
32
|
+
build: {
|
|
33
|
+
target: 'node20',
|
|
34
|
+
ssr: true,
|
|
35
|
+
outDir: 'dist',
|
|
36
|
+
sourcemap: true,
|
|
37
|
+
rollupOptions: {
|
|
38
|
+
input: fileURLToPath(new URL('./src/index.ts', import.meta.url)),
|
|
39
|
+
output: { format: 'esm' },
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
})
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"dependencies": [
|
|
3
|
-
"@forinda/kickjs-inertia",
|
|
4
|
-
"@inertiajs/core",
|
|
5
|
-
"@inertiajs/react",
|
|
6
|
-
"react",
|
|
7
|
-
"react-dom"
|
|
8
|
-
],
|
|
9
|
-
"devDependencies": ["@vitejs/plugin-react", "@types/react", "@types/react-dom"],
|
|
10
|
-
"scripts": {
|
|
11
|
-
"build": "kick build && vite build --config vite.client.config.ts && vite build --config vite.client.config.ts --ssr src/client/ssr.tsx"
|
|
12
|
-
},
|
|
2
|
+
"dependencies": ["@forinda/kickjs-inertia", "@inertiajs/core"],
|
|
13
3
|
"integrations": [
|
|
14
4
|
{
|
|
15
5
|
"import": {
|
|
@@ -25,11 +15,11 @@
|
|
|
25
15
|
},
|
|
26
16
|
{
|
|
27
17
|
"slot": "env-zod",
|
|
28
|
-
"code": "// Signs the session cookie. The public dev-only default is accepted only when\n// NODE_ENV is 'development' (kick dev) or 'test' (vitest); anywhere else,\n// including an unset NODE_ENV, a real secret is required.\nSESSION_SECRET: z\n .string()\n .min(32)\n .default('dev-only-session-secret-not-for-production')\n // `: boolean`
|
|
18
|
+
"code": "// Signs the session cookie. The public dev-only default is accepted only when\n// NODE_ENV is 'development' (kick dev) or 'test' (vitest); anywhere else,\n// including an unset NODE_ENV, a real secret is required.\nSESSION_SECRET: z\n .string()\n .min(32)\n .default('dev-only-session-secret-not-for-production')\n // `: boolean` — inferring it would make this schema's type depend on\n // process.env, whose type `kick typegen` derives from this schema.\n .refine(\n (s): boolean =>\n ['development', 'test'].includes(process.env.NODE_ENV ?? '') ||\n !s.startsWith('dev-only-'),\n { error: 'set SESSION_SECRET — the dev-only default is public' },\n )"
|
|
29
19
|
},
|
|
30
20
|
{
|
|
31
21
|
"slot": "env-zod",
|
|
32
|
-
"code": "// The site's public URL
|
|
22
|
+
"code": "// The site's public URL — canonical links, the sitemap and social-card images\n// are built from it, never from the request's Host header. The localhost\n// default is accepted only when NODE_ENV is 'development' or 'test'; anywhere\n// else, including an unset NODE_ENV, APP_URL must be set.\nAPP_URL: z\n .url()\n .default('http://localhost:3000')\n .refine(\n (): boolean =>\n ['development', 'test'].includes(process.env.NODE_ENV ?? '') ||\n process.env.APP_URL !== undefined,\n { error: 'set APP_URL to the public URL of the site' },\n )"
|
|
33
23
|
}
|
|
34
24
|
]
|
|
35
25
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Global styles, imported by
|
|
1
|
+
/* Global styles, imported by the browser entry (main) and the server-render entry (ssr).
|
|
2
2
|
* Tailwind: {{packageManager}} add -D tailwindcss @tailwindcss/vite, add tailwindcss() to
|
|
3
3
|
* the plugins in vite.config.ts and vite.client.config.ts, then replace this
|
|
4
4
|
* file's contents with: @import "tailwindcss";
|
|
@@ -22,12 +22,13 @@ export const app = await bootstrap({
|
|
|
22
22
|
adapters: [
|
|
23
23
|
InertiaAdapter({
|
|
24
24
|
title: '{{name}}',
|
|
25
|
-
entry
|
|
25
|
+
// The pages' browser entry, and the entry that renders them on the server.
|
|
26
|
+
// @kick:inertia-client
|
|
26
27
|
head: '<link rel="icon" href="/favicon.svg" type="image/svg+xml" />',
|
|
27
28
|
// Canonical URLs and absolute image URLs start here — not at the Host header.
|
|
28
29
|
baseUrl: getEnv('APP_URL'),
|
|
29
30
|
// Every page's meta starts from these; a controller adds its own with
|
|
30
|
-
// inertia(component, props, { meta }), and src/client
|
|
31
|
+
// inertia(component, props, { meta }), and the Seo component in src/client keeps the
|
|
31
32
|
// browser's <head> in sync on client-side visits.
|
|
32
33
|
meta: {
|
|
33
34
|
lang: 'en',
|
|
@@ -42,8 +43,7 @@ export const app = await bootstrap({
|
|
|
42
43
|
},
|
|
43
44
|
// Props every page receives.
|
|
44
45
|
share: () => ({ appName: '{{name}}' }),
|
|
45
|
-
|
|
46
|
-
// Unknown URLs and thrown errors render src/client/pages/Error.tsx
|
|
46
|
+
// Unknown URLs and thrown errors render the Error page in src/client/pages
|
|
47
47
|
// (through inertiaNotFound / inertiaErrorHandler below).
|
|
48
48
|
errorPage: 'Error',
|
|
49
49
|
}),
|
package/dist/build-CARdsp9F.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.17.3
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) Felix Orinda
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
import{t as e}from"./rolldown-runtime-BjnQdm0J.mjs";import{dirname as t,isAbsolute as n,join as r,relative as i,resolve as a}from"node:path";import{cpSync as o,existsSync as s,mkdirSync as c,statSync as l,writeFileSync as u}from"node:fs";import{glob as d}from"glob";import{groupAssetKeys as f}from"@forinda/kickjs";var p=/* @__PURE__ */ e({ASSET_MANIFEST_VERSION:()=>1,buildAssets:()=>m});async function m(e,t){let{cwd:n,silent:o=!1}=t,s=t.distDir??e?.build?.outDir??`dist`,l=e?.assetMap;if(!l||Object.keys(l).length===0)return null;let d=o?()=>{}:console.log,f=a(n,s);c(f,{recursive:!0});let p=[],m={};for(let[e,t]of Object.entries(l)){let r=await h(e,t,n,f);p.push(r.entrySummary),Object.assign(m,r.manifestSlice),d(` ✓ ${e}: ${r.entrySummary.filesCopied} file(s) → ${r.entrySummary.dest}`)}let g={version:1,entries:m},_=r(f,`.kickjs-assets.json`);return u(_,JSON.stringify(g,null,2)+`
|
|
12
|
-
`,`utf-8`),d(` ✓ wrote manifest → ${i(n,_)} (${Object.keys(m).length} entries)`),{manifestPath:_,entries:p,manifest:g}}async function h(e,n,l,u){let p=a(l,n.src),m=n.dest?a(l,n.dest):r(u,e);if(v(m,l))return console.warn(` ⚠ assetMap.${e}.dest ('${n.dest}') resolves outside the project root — skipping copy`),{entrySummary:{namespace:e,src:n.src,dest:i(l,m),filesCopied:0},manifestSlice:{}};if(!s(p)||!y(p))return{entrySummary:{namespace:e,src:n.src,dest:i(l,m),filesCopied:0},manifestSlice:{}};let h=n.glob??`**/*`,b=await d(h,{cwd:p,nodir:!0,dot:!1,posix:!0});c(m,{recursive:!0});let x={},S=[...b].toSorted(),{pairs:C,collisionGroupsResolved:w}=f(e,S,{strategy:n.keys??`auto`}),T=0;for(let{rel:e,key:n}of C){let i=r(p,e),a=r(m,e);x[n]=_(u,a),!g(i,a)&&(c(t(a),{recursive:!0}),o(i,a),T++)}return w>0&&console.log(` ℹ assetMap.${e}: auto-resolved ${w} basename collision(s) by keeping extensions (set 'keys: "strip"' to opt back into legacy last-write-wins behaviour, or 'keys: "with-extension"' to keep all keys verbose).`),{entrySummary:{namespace:e,src:n.src,dest:i(l,m),filesCopied:T},manifestSlice:x}}function g(e,t){if(!s(t))return!1;try{let n=l(e),r=l(t);return r.size===n.size&&r.mtimeMs>=n.mtimeMs}catch{return!1}}function _(e,t){return i(e,t).split(/[\\/]/).filter(Boolean).join(`/`)}function v(e,t){let r=i(t,e);return r===``?!1:r.startsWith(`..`)||n(r)}function y(e){try{return l(e).isDirectory()}catch{return!1}}export{p as n,m as t};
|
|
13
|
-
//# sourceMappingURL=build-CARdsp9F.mjs.map
|
package/dist/build-I3pY30S2.mjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.17.3
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) Felix Orinda
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
import{t as e}from"./rolldown-runtime-BjnQdm0J.mjs";import{cpSync as t,existsSync as n,mkdirSync as r,statSync as i,writeFileSync as a}from"node:fs";import{dirname as o,isAbsolute as s,join as c,relative as l,resolve as u}from"node:path";import{glob as d}from"glob";import{groupAssetKeys as f}from"@forinda/kickjs";var p=/* @__PURE__ */ e({ASSET_MANIFEST_VERSION:()=>1,buildAssets:()=>m});async function m(e,t){let{cwd:n,silent:i=!1}=t,o=t.distDir??e?.build?.outDir??`dist`,s=e?.assetMap;if(!s||Object.keys(s).length===0)return null;let d=i?()=>{}:console.log,f=u(n,o);r(f,{recursive:!0});let p=[],m={};for(let[e,t]of Object.entries(s)){let r=await h(e,t,n,f);p.push(r.entrySummary),Object.assign(m,r.manifestSlice),d(` ✓ ${e}: ${r.entrySummary.filesCopied} file(s) → ${r.entrySummary.dest}`)}let g={version:1,entries:m},_=c(f,`.kickjs-assets.json`);return a(_,JSON.stringify(g,null,2)+`
|
|
12
|
-
`,`utf-8`),d(` ✓ wrote manifest → ${l(n,_)} (${Object.keys(m).length} entries)`),{manifestPath:_,entries:p,manifest:g}}async function h(e,i,a,s){let p=u(a,i.src),m=i.dest?u(a,i.dest):c(s,e);if(v(m,a))return console.warn(` ⚠ assetMap.${e}.dest ('${i.dest}') resolves outside the project root — skipping copy`),{entrySummary:{namespace:e,src:i.src,dest:l(a,m),filesCopied:0},manifestSlice:{}};if(!n(p)||!y(p))return{entrySummary:{namespace:e,src:i.src,dest:l(a,m),filesCopied:0},manifestSlice:{}};let h=i.glob??`**/*`,b=await d(h,{cwd:p,nodir:!0,dot:!1,posix:!0});r(m,{recursive:!0});let x={},S=[...b].toSorted(),{pairs:C,collisionGroupsResolved:w}=f(e,S,{strategy:i.keys??`auto`}),T=0;for(let{rel:e,key:n}of C){let i=c(p,e),a=c(m,e);x[n]=_(s,a),!g(i,a)&&(r(o(a),{recursive:!0}),t(i,a),T++)}return w>0&&console.log(` ℹ assetMap.${e}: auto-resolved ${w} basename collision(s) by keeping extensions (set 'keys: "strip"' to opt back into legacy last-write-wins behaviour, or 'keys: "with-extension"' to keep all keys verbose).`),{entrySummary:{namespace:e,src:i.src,dest:l(a,m),filesCopied:T},manifestSlice:x}}function g(e,t){if(!n(t))return!1;try{let n=i(e),r=i(t);return r.size===n.size&&r.mtimeMs>=n.mtimeMs}catch{return!1}}function _(e,t){return l(e,t).split(/[\\/]/).filter(Boolean).join(`/`)}function v(e,t){let n=l(t,e);return n===``?!1:n.startsWith(`..`)||s(n)}function y(e){try{return i(e).isDirectory()}catch{return!1}}export{p as n,m as t};
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.17.3
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) Felix Orinda
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
import{f as e,o as t,r as n}from"./config-CadmyiYh.mjs";import{C as r,a as i,b as a,o,r as s,s as c,v as l,y as u}from"./agent-docs-BxHRHi1r.mjs";import{existsSync as d,readFileSync as f,writeFileSync as p}from"node:fs";import{dirname as m,join as h,posix as g,relative as _,resolve as v}from"node:path";import{fileURLToPath as y}from"node:url";import{execFile as b,execFileSync as x,execSync as S,spawnSync as C}from"node:child_process";import{promisify as w}from"node:util";import{randomBytes as T}from"node:crypto";import{parseSync as E}from"oxc-parser";const ee=w(b),D=/[&|<>^"'`(){}[\];!%\r\n\\]/;function O(e,t,n=process.platform){if(n!==`win32`)return[e,t];if(D.test(e)||t.some(e=>D.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 k(e,t,n={}){let r=O(e,t);if(!r)return null;try{return x(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 A(e,t,n={}){let r=O(e,t);if(!r)throw Error(`Refusing to run '${e}': unsafe arguments`);x(r[0],r[1],{cwd:n.cwd,stdio:`inherit`,windowsHide:!0})}function j(e,t,n){S(e,{cwd:t,stdio:`inherit`,env:n?{...process.env,...n}:process.env})}function M(e,t,n){let r=C(process.execPath,[e],{cwd:n,stdio:`inherit`,env:{...process.env,...t}});r.status!==0&&process.exit(r.status??1)}async function te(e,t,n={}){let r=O(e,t);if(!r)return null;try{let{stdout:e}=await ee(r[0],r[1],{encoding:`utf-8`,timeout:n.timeout??5e3,cwd:n.cwd,windowsHide:!0});return e.toString().trim()||null}catch{return null}}function ne(e,t){let n=e[t];if(!n)throw Error(`generatePackageJson: missing resolved version for ${t}. Add it to SIBLING_PACKAGES or THIRD_PARTY_PACKAGES in generators/project.ts.`);return n}function N(e,t){return Object.fromEntries(e.toSorted().map(e=>[e,ne(t,e)]))}function P(e){try{let t=x(e,[`--version`],{encoding:`utf-8`,stdio:[`ignore`,`pipe`,`ignore`],timeout:1e4}).trim();return/^\d+\.\d+\.\d+$/.test(t)?`${e}@${t}`:void 0}catch{return}}function re(e){let t=e?.match(/@(\d+)\.(\d+)\./);return t?[Number(t[1]),Number(t[2])]:void 0}function ie(e,t){let n=re(t)?.[0];return e===`yarn`&&n!==void 0&&n>=2?`nodeLinker: node-modules
|
|
12
|
-
`:void 0}function ae(e,t,n,r){return JSON.stringify({name:e,...r?{packageManager:r}:{},version:`0.0.0`,type:`module`,scripts:{dev:`kick dev`,build:`kick build`,start:`kick start`,test:`vitest run --passWithNoTests`,...n.scripts},dependencies:N(n.dependencies,t),devDependencies:N(n.devDependencies,t)},null,2)}function oe(e,t){let n=Object.entries(t);if(n.length===0)return e;let r=e===``?[]:e.replace(/\n$/,``).split(`
|
|
13
|
-
`),i=e=>e.trim().replace(/^['"]|['"]$/g,``),a=e=>/^[\w-]+$/.test(e)?e:`'${e}'`,o=(e,t)=>{let n=r.findIndex(t=>t.replace(/\s+$/,``)===`${e}:`);if(n===-1){if(!t)return;r.length>0&&r[r.length-1]!==``&&r.push(``),r.push(`${e}:`),n=r.length-1}let i=n+1;for(let e=n+1;e<r.length&&/^(\s|$)/.test(r[e]);e++)r[e].trim()!==``&&(i=e+1);return{start:n,end:i}},s=[];for(let[e,t]of n){let{start:n,end:c}=o(`allowBuilds`,!0),l=r.slice(n+1,c).findIndex(t=>i(t.split(`:`)[0])===e),u=l===-1?void 0:/:\s*(true|false)\s*$/.exec(r[n+1+l]);if(u){s.push([e,u[1]===`true`]);continue}let d=` ${a(e)}: ${t}`;l===-1?r.splice(c,0,d):r[n+1+l]=d,s.push([e,t])}let c=[`onlyBuiltDependencies`,`ignoredBuiltDependencies`];for(let[e,t]of s){if(c.some(t=>{let n=o(t,!1);return n!==void 0&&r.slice(n.start+1,n.end).some(t=>i(t.replace(/^\s*-/,``))===e)}))continue;let{end:n}=o(t?c[0]:c[1],!0);r.splice(n,0,` - ${a(e)}`)}return`${r.join(`
|
|
14
|
-
`)}\n`}const F=`node:22-slim`,se={pnpm:{lockfile:`pnpm-lock.yaml`,installFiles:[`pnpm-workspace.yaml`],install:`pnpm install --frozen-lockfile`,installProd:`pnpm install --prod --frozen-lockfile`,run:e=>`pnpm run ${e}`,image:F,setup:`RUN corepack enable`},npm:{lockfile:`package-lock.json`,installFiles:[],install:`npm ci`,installProd:`npm ci --omit=dev`,run:e=>`npm run ${e}`,image:F},yarn:{lockfile:`yarn.lock`,installFiles:[],install:`yarn install --frozen-lockfile`,installProd:`yarn install --production --frozen-lockfile`,run:e=>`yarn run ${e}`,image:F,setup:`RUN corepack enable`},bun:{lockfile:`bun.lock`,installFiles:[],install:`bun install --frozen-lockfile`,installProd:`bun install --production --frozen-lockfile`,run:e=>`bun run ${e}`,image:`oven/bun:1`}},I={lockfile:`yarn.lock`,installFiles:[`.yarnrc.yml`],install:`yarn install --immutable`,installProd:`yarn workspaces focus --all --production`,run:e=>`yarn run ${e}`,image:F,setup:`RUN corepack enable`},ce={api:`docker run -p 3000:3000 <name>`,inertia:`docker run -p 3000:3000 -e SESSION_SECRET=<a long random string> -e APP_URL=<https://your.site> <name>`,fullstack:`docker run -p 3000:3000 <name>`};function le(e,t,n,r){let[i=0,a=0]=re(r)??[],o=t===`yarn`&&i>=2?i>=4?I:{...I,installProd:I.install}:t===`bun`&&r&&(i<1||i===1&&a<2)?{...se.bun,lockfile:`bun.lockb`}:se[t],s=`${o.setup?`\n${o.setup}`:``}
|
|
15
|
-
# Compilers for native addons (better-sqlite3, …) that have no prebuilt binary.
|
|
16
|
-
RUN apt-get update && apt-get install -y --no-install-recommends python3 make g++ \\
|
|
17
|
-
&& rm -rf /var/lib/apt/lists/*`,c=`# The build stage generates the Prisma client, if any.
|
|
18
|
-
ENV PRISMA_SKIP_POSTINSTALL_GENERATE=1`,l=(e===`fullstack`?[`package.json`,o.lockfile,...o.installFiles,`server/package.json`,`web/package.json`]:[`package.json`,o.lockfile,...o.installFiles]).map(e=>`COPY ${e} ./${e.includes(`/`)?e.slice(0,e.lastIndexOf(`/`)+1):``}`).join(`
|
|
19
|
-
`),u=`# syntax=docker/dockerfile:1
|
|
20
|
-
# ${n} — the long-running server in one image.
|
|
21
|
-
#
|
|
22
|
-
# docker build -t ${n} .
|
|
23
|
-
# ${ce[e].replace(`<name>`,n)}
|
|
24
|
-
#
|
|
25
|
-
# Environment comes from the platform or \`docker run\`; .env files are not
|
|
26
|
-
# copied into the image. The lockfile must be committed — installs are frozen.
|
|
27
|
-
`;if(e===`fullstack`)return`${u}
|
|
28
|
-
FROM ${o.image} AS base
|
|
29
|
-
WORKDIR /app${s}
|
|
30
|
-
|
|
31
|
-
# Production dependencies of every workspace member.
|
|
32
|
-
FROM base AS deps
|
|
33
|
-
${c}
|
|
34
|
-
${l}
|
|
35
|
-
RUN ${o.installProd}
|
|
36
|
-
# Hoisting may leave a member without its own node_modules; the runtime copies both.
|
|
37
|
-
RUN mkdir -p node_modules server/node_modules
|
|
38
|
-
|
|
39
|
-
# The server bundle and the built web app.
|
|
40
|
-
FROM base AS build
|
|
41
|
-
${l}
|
|
42
|
-
RUN ${o.install}
|
|
43
|
-
COPY . .
|
|
44
|
-
RUN ${o.run(`build`)}
|
|
45
|
-
# The generated Prisma client lands beside whichever install holds @prisma/client.
|
|
46
|
-
RUN mkdir -p node_modules/.prisma server/node_modules/.prisma
|
|
47
|
-
# kick/db migrations and seeds, read at runtime (empty without kick/db).
|
|
48
|
-
RUN mkdir -p server/db
|
|
49
|
-
|
|
50
|
-
FROM ${F}
|
|
51
|
-
ENV NODE_ENV=production PORT=3000
|
|
52
|
-
WORKDIR /app
|
|
53
|
-
COPY --from=deps /app/node_modules ./node_modules
|
|
54
|
-
COPY --from=deps /app/server/node_modules ./server/node_modules
|
|
55
|
-
COPY --from=build /app/node_modules/.prisma ./node_modules/.prisma
|
|
56
|
-
COPY --from=build /app/server/node_modules/.prisma ./server/node_modules/.prisma
|
|
57
|
-
COPY --from=build /app/package.json ./
|
|
58
|
-
COPY --from=build /app/server/package.json ./server/
|
|
59
|
-
COPY --from=build /app/server/dist ./server/dist
|
|
60
|
-
COPY --from=build /app/server/db ./server/db
|
|
61
|
-
# SpaAdapter serves ../web/dist relative to the server.
|
|
62
|
-
COPY --from=build /app/web/dist ./web/dist
|
|
63
|
-
WORKDIR /app/server
|
|
64
|
-
USER node
|
|
65
|
-
EXPOSE 3000
|
|
66
|
-
CMD ["node", "dist/index.js"]
|
|
67
|
-
`;let d=e===`inertia`?`# The server, the pages (dist/client) and the SSR bundle (dist/ssr).`:`# The server bundle.`;return`${u}
|
|
68
|
-
FROM ${o.image} AS base
|
|
69
|
-
WORKDIR /app${s}
|
|
70
|
-
|
|
71
|
-
FROM base AS deps
|
|
72
|
-
${c}
|
|
73
|
-
${l}
|
|
74
|
-
RUN ${o.installProd}
|
|
75
|
-
|
|
76
|
-
${d}
|
|
77
|
-
FROM base AS build
|
|
78
|
-
${l}
|
|
79
|
-
RUN ${o.install}
|
|
80
|
-
COPY . .
|
|
81
|
-
RUN ${o.run(`build`)}
|
|
82
|
-
RUN mkdir -p node_modules/.prisma
|
|
83
|
-
# kick/db migrations and seeds, read at runtime (empty without kick/db).
|
|
84
|
-
RUN mkdir -p db
|
|
85
|
-
|
|
86
|
-
FROM ${F}
|
|
87
|
-
ENV NODE_ENV=production PORT=3000
|
|
88
|
-
WORKDIR /app
|
|
89
|
-
COPY --from=deps /app/node_modules ./node_modules
|
|
90
|
-
# A Prisma client generated into node_modules (empty otherwise).
|
|
91
|
-
COPY --from=build /app/node_modules/.prisma ./node_modules/.prisma
|
|
92
|
-
COPY --from=build /app/package.json ./
|
|
93
|
-
COPY --from=build /app/dist ./dist
|
|
94
|
-
COPY --from=build /app/db ./db
|
|
95
|
-
# The image's filesystem is replaced on every deploy. Keep a SQLite file (or
|
|
96
|
-
# uploads) in /app/data and mount a volume there: docker run -v ${n}-data:/app/data
|
|
97
|
-
RUN mkdir -p data && chown node:node data
|
|
98
|
-
USER node
|
|
99
|
-
EXPOSE 3000
|
|
100
|
-
CMD ["node", "dist/index.js"]
|
|
101
|
-
`}function ue(){return`${[`# Rebuilt inside the image.`,`**/node_modules`,`**/dist`,`**/.kickjs`,`# Secrets stay out of the image; pass them at run time.`,`**/.env`,`**/.env.*`,`!**/.env.example`,`# Platform and tooling output.`,`.netlify`,`.vercel`,`.git`,`**/coverage`,`*.log`].join(`
|
|
102
|
-
`)}\n`}const de=[`netlify`,`vercel`,`docker`],fe=[`kick.config.ts`,`kick.config.js`,`kick.config.mjs`,`kick.config.json`],L=e=>fe.some(t=>d(h(e,t)));function pe(e){return L(h(e,`server`))&&d(h(e,`web`))}function me(e){let t=(typeof e==`string`?e.split(`,`):e).map(e=>e.trim().toLowerCase()).filter(Boolean),n=t.filter(e=>!de.includes(e));if(n.length>0)throw Error(`Unknown deploy target: ${n.join(`, `)} — expected ${de.join(`, `)}`);return[...new Set(t)]}function R(e){return JSON.parse(f(e,`utf-8`))}function he(e,t){return e===`pnpm`?`pnpm build && pnpm --filter ./server exec kick build:${t}`:`${e} run build && cd server && kick build:${t}`}async function z(e){let{dir:t,targets:n}=e,o=pe(t);if(!o&&!L(t))throw Error(`${t} is not a KickJS project (no kick.config) — run kick g deploy from the project, or from a fullstack workspace's root.`);let s=o?h(t,`server`):t,l=h(t,`package.json`),f=R(l),p=o?R(h(s,`package.json`)):f,m=await i(e.pm,t),g=`@forinda/kickjs-inertia`in{...p.dependencies,...p.devDependencies},v=/* @__PURE__ */ new Map,y={},b=()=>{for(let[e,t]of a([`deploy-serverless`]).files)v.set(h(s,e),t)},x=(e,n)=>{let r=u(a([n]).files,{packageManager:m,netlifyPublish:g?`dist/client`:`dist/public`});for(let[e,n]of r)v.set(h(t,e),n);b(),y[`build:${e}`]=o?he(m,e):`${f.scripts?.build??`kick build`} && kick build:${e}`};for(let e of n)if(e===`netlify`)x(`netlify`,o?`deploy-netlify-workspace`:`deploy-netlify`);else if(e===`vercel`)x(`vercel`,`deploy-vercel`);else{let e=o?`fullstack`:g?`inertia`:`api`;v.set(h(t,`Dockerfile`),le(e,m,String(f.name??`app`),f.packageManager)),v.set(h(t,`.dockerignore`),ue())}let S=[];for(let[n,i]of v)(!d(n)||e.force||!n.endsWith(h(`src`,`serverless.ts`))&&await c({message:`${_(t,n)} already exists. Overwrite?`,initialValue:!1}))&&(await r(n,i),S.push(n));let C=Object.entries(y).filter(([e])=>!f.scripts?.[e]);return C.length>0&&(f.scripts={...f.scripts,...Object.fromEntries(C)},await r(l,`${JSON.stringify(f,null,2)}\n`),S.push(l)),S}const ge={adapter:`adapters`,middleware:`middlewares`};function B(e,t,n=e=>e,r=`src/index.ts`){let i={source:e,added:[],present:[],manual:[]};for(let e of t){if(!e.slot||!e.code||e.slot.startsWith(`env-`)||e.slot.startsWith(`config-`))continue;let t=ge[e.slot],a=n(e.code),o=ve(a),s=E(r,i.source).program,c=t?_e(s):void 0;if(!c){i.manual.push({...e,code:a});continue}let l=c.properties.find(e=>e.type===`Property`&&(e.key?.name??e.key?.value)===t);if(l&&l.value.type!==`ArrayExpression`){i.manual.push({...e,code:a});continue}let u=o&&e.import?V(s,e.import.from,o):o;l&&u&&i.source.slice(l.value.start,l.value.end).includes(`${u}(`)?i.present.push(o??H(a)):(i.source=l?ye(i.source,l.value,l.value.elements,a):Te(i.source,c,t,a),e.import&&(i.source=Ee(i.source,e.import,r)),i.added.push(o??H(a)))}return i}function _e(e){let t,n=e=>{if(t||!e||typeof e!=`object`)return;if(Array.isArray(e))return e.forEach(n);let r=e;if(r.type===`CallExpression`&&r.callee?.type===`Identifier`&&r.callee.name===`bootstrap`&&r.arguments?.[0]?.type===`ObjectExpression`)t=r.arguments[0];else for(let e in r)n(r[e])};return n(e),t}function V(e,t,n){for(let r of e.body)if(r.type===`ImportDeclaration`&&r.source.value===t)for(let e of r.specifiers){let t=e.imported?.name??e.imported?.value;if(e.type===`ImportSpecifier`&&t===n)return e.local.name}return n}function ve(e){let t=e.split(`
|
|
103
|
-
`).filter(e=>!e.trim().startsWith(`//`)).join(`
|
|
104
|
-
`),n=/^\s*([A-Za-z_$][\w$.]*)\s*\(/.exec(t)?.[1];if(n)return n;for(let e of t.matchAll(/(?<![\w$])([A-Za-z_$][\w$]*)\s*\(/g))if(e[1]!==`import`)return e[1]}const H=e=>e.split(`
|
|
105
|
-
`).find(e=>e.trim()&&!e.trim().startsWith(`//`))?.trim()??e,U=(e,t)=>/^[ \t]*/.exec(e.slice(e.lastIndexOf(`
|
|
106
|
-
`,t-1)+1))[0],W=(e,t)=>e.split(`
|
|
107
|
-
`).map(e=>e&&t+e).join(`
|
|
108
|
-
`);function ye(e,t,n,r){let i=n.filter(Boolean),a=U(e,t.start);if(i.length===0){let n=W(`${r},`,`${a} `),[i,o]=t.type===`ObjectExpression`?[`{`,`}`]:[`[`,`]`];return`${e.slice(0,t.start)}${i}\n${n}\n${a}${o}${e.slice(t.end)}`}let o=i.at(-1),s=U(e,o.start),c=e.slice(o.end,t.end-1).match(/^\s*,/),l=c?o.end+c[0].length:o.end,u=`\n${W(`${r},`,s)}`;return c?e.slice(0,l)+u+e.slice(l):`${e.slice(0,l)},${u.replace(/,$/,``)}${e.slice(l)}`}const be=[`zod`,`valibot`,`yup`];function xe(e,t,n=`src/config/index.ts`){let r={source:e,added:[],present:[],manual:[]},{lib:i,object:a}=we(E(n,e).program),o=t.filter(e=>e.slot===`env-${i??`zod`}`&&e.code);if(o.length===0)return r;if(!i||!a)return r.manual.push(...o),r;for(let e of o){let t=Se(e.code),i=we(E(n,r.source).program).object;i.properties.some(e=>e.type===`Property`&&(e.key?.name??e.key?.value)===t)?r.present.push(t):(r.source=ye(r.source,i,i.properties,e.code),r.added.push(t))}return r}const Se=e=>/^\s*['"]?(\w+)['"]?\s*:/m.exec(e)?.[1]??H(e),Ce=e=>e?.type===`CallExpression`&&e.callee?.type===`MemberExpression`&&e.callee.property?.name===`object`&&e.arguments?.[0]?.type===`ObjectExpression`?e.arguments[0]:void 0;function we(e){let t=e.body,n=/* @__PURE__ */ new Map;for(let r of be){let i=`from${r[0].toUpperCase()}${r.slice(1)}`;t.some(e=>e.type===`ImportDeclaration`&&e.source.value===`@forinda/kickjs-schema/${r}`&&e.specifiers.some(e=>(e.imported?.name??e.imported?.value)===i))&&n.set(V(e,`@forinda/kickjs-schema/${r}`,i),r)}let r=[],i=[],a=e=>{if(!e||typeof e!=`object`)return;if(Array.isArray(e))return e.forEach(a);let t=e,o=Ce(t);o&&i.push(o);let s=t.type===`CallExpression`?n.get(t.callee?.name):void 0,c=Ce(t.arguments?.[0]);s&&c&&r.push({call:t,lib:s,object:c});for(let e in t)a(t[e])};if(a(e),r.length>0){let e=t.find(e=>e.type===`ExportDefaultDeclaration`)?.declaration;if(e?.type===`Identifier`){let n=e.name;e=t.map(e=>e.type===`ExportNamedDeclaration`?e.declaration:e).filter(e=>e?.type===`VariableDeclaration`).flatMap(e=>e.declarations).find(e=>e.id?.name===n)?.init}let{lib:n,object:i}=r.find(t=>t.call===e)??r[0];return{lib:n,object:i}}return{lib:be.find(e=>t.some(t=>t.type===`ImportDeclaration`&&t.source.value===e)),object:i[0]}}function Te(e,t,n,r){let i=t.properties.at(-1),a=i?U(e,i.start):`${U(e,t.start)} `,o=`${a}${n}: [\n${W(`${r},`,`${a} `)}\n${a}],`;if(!i)return`${e.slice(0,t.start)}{\n${o}\n${U(e,t.start)}}${e.slice(t.end)}`;let s=e.slice(i.end,t.end-1).match(/^\s*,/),c=s?i.end+s[0].length:i.end;return`${e.slice(0,c)}${s?``:`,`}\n${o}${e.slice(c)}`}function Ee(e,t,n=`src/index.ts`){let r=E(n,e).program.body.filter(e=>e.type===`ImportDeclaration`),i=r.find(e=>e.source.value===t.from&&e.importKind!==`type`&&e.specifiers.length>0&&!e.specifiers.some(e=>e.type===`ImportNamespaceSpecifier`)),a=t.names??[];if(i){let t=new Set(i.specifiers.map(e=>e.local?.name)),n=a.filter(e=>!t.has(e));if(n.length===0)return e;let r=i.specifiers.filter(e=>e.type===`ImportSpecifier`);if(r.length>0){let t=r.at(-1).end;return`${e.slice(0,t)}, ${n.join(`, `)}${e.slice(t)}`}let o=i.specifiers[0];return`${e.slice(0,o.end)}, { ${n.join(`, `)} }${e.slice(o.end)}`}let o=`import ${[t.default,a.length?`{ ${a.join(`, `)} }`:void 0].filter(Boolean).join(`, `)} from '${t.from}'`,s=r.at(-1);return s?`${e.slice(0,s.end)}\n${o}${e.slice(s.end)}`:`${o}\n${e}`}const De={swagger:`feature-swagger`,devtools:`feature-devtools`,ws:`feature-ws`,queue:`feature-queue`,"queue:bullmq":`feature-queue`,storage:`feature-storage`,views:`feature-views`};function Oe(e){let t=[...new Set(e.map(e=>De[e]).filter(Boolean))];return t.length>0?a(t):void 0}function ke(e,t){return(t?[t]:[`src/index.ts`,`src/main.ts`]).find(t=>d(h(e,t)))}function Ae(e,t){try{let n=x(`git`,[`ls-files`,`--modified`,`--`,...t],{cwd:e,encoding:`utf-8`,stdio:[`ignore`,`pipe`,`ignore`]});return[...new Set(n.split(`
|
|
109
|
-
`).filter(Boolean))]}catch{return[]}}function je(e){return[`src/config/index.ts`,`src/env.ts`].find(t=>d(h(e,t)))}async function Me(e,t,n){let i=h(e,t),a=f(i,`utf-8`),o=xe(a,n,t);return o.source!==a&&await r(i,o.source),o}const G=/\.(?:[cm]?[jt]sx?|kick)$/;function Ne(e,t){return[...t].filter(([t,n])=>{let r=h(e,t);return G.test(t)&&d(r)&&f(r,`utf-8`)!==n}).map(([e])=>e)}async function Pe(e,t){let n=[],i=[];for(let[a,o]of t){let t=h(e,a);if(!d(t)){await r(t,o),n.push(a);continue}if(G.test(a))continue;let s=f(t,`utf-8`),c=new Set(s.split(`
|
|
110
|
-
`).map(e=>Le(e)??e)),l=o.split(`
|
|
111
|
-
`).filter(e=>e.trim()&&!c.has(Le(e)??e));if(l.length===0)continue;let u=s===``||s.endsWith(`
|
|
112
|
-
`)?``:`
|
|
113
|
-
`;await r(t,`${s}${u}${l.join(`
|
|
114
|
-
`)}\n`),i.push(a)}return{created:n,updated:i}}function Fe(e,t,n){let r=e.import?.from;if(!r?.startsWith(`.`))return!1;let i=g.join(g.dirname(t.replaceAll(`\\`,`/`)),r);return n.some(e=>e.replace(G,``)===i)}function Ie(e,t){let n=g.dirname(t.replaceAll(`\\`,`/`));return e.map(e=>{let t=e.import?.from;if(!t?.startsWith(`.`))return e;let r=g.relative(n,g.join(`src`,t));return{...e,import:{...e.import,from:r.startsWith(`.`)?r:`./${r}`}}})}const Le=e=>/^\s*([A-Za-z_][\w]*)\s*=/.exec(e)?.[1];async function Re(e,t,n){let i=h(e,t),a=f(i,`utf-8`),o=B(a,n,ze(e),t);return o.source!==a&&await r(i,o.source),o}function ze(e){let t=Be(e),n={name:String(t.name??`app`),version:String(t.version??`0.0.0`)};return e=>e.replace(/\{\{(\w+)\}\}/g,(e,t)=>n[t]??e)}function Be(e){try{return JSON.parse(f(h(e,`package.json`),`utf-8`))}catch{return{}}}function Ve(e,t=``){let n=/\bplugins\s*:\s*\[([^\]]*)\]/.exec(t)?.[1]??``,r=e.filter(e=>e.slot===`config-plugin`&&e.code&&!RegExp(`\\b${e.code.split(`
|
|
115
|
-
`).at(-1).trim()}\\b`).test(n));if(!r.length)return;let i=r.flatMap(e=>e.import?.names?.length?[`import { ${e.import.names.join(`, `)} } from '${e.import.from}'`]:[]),a=r.map(e=>e.code.split(`
|
|
116
|
-
`).at(-1).trim());return[...i,``,`// in defineConfig({ ... }):`,`plugins: [${a.join(`, `)}],`].join(`
|
|
117
|
-
`)}function He(e){let t=e.flatMap(e=>e.import?[e.import]:[]).map(e=>`import ${[e.default,e.names?.length?`{ ${e.names.join(`, `)} }`:void 0].filter(Boolean).join(`, `)} from '${e.from}'`),n=e.map(e=>`${e.code},`);return[...t,``,`// in bootstrap({ adapters: [ ... ] }):`,...n].join(`
|
|
118
|
-
`)}const K={kickjs:{pkg:`@forinda/kickjs`,peers:[],enginePeers:!0,description:`Unified framework: DI, decorators, routing, middleware`,core:!0},vite:{pkg:`@forinda/kickjs-vite`,peers:[`vite`],description:`Vite plugin: dev server, HMR, module discovery`,dev:!0,core:!0},cli:{pkg:`@forinda/kickjs-cli`,peers:[],description:`CLI tool and code generators`,dev:!0,core:!0},zod:{pkg:`zod`,peers:[],description:`Zod schema validation (env, DTOs, OpenAPI) — wrap with fromZod()`},valibot:{pkg:`valibot`,peers:[],description:`Valibot schema validation — wrap with fromValibot()`},yup:{pkg:`yup`,peers:[],description:`Yup schema validation — wrap with fromYup()`},ai:{pkg:`@forinda/kickjs-ai`,peers:[`zod`],description:`AI toolkit — LLM providers, tool definitions from controllers`},storage:{pkg:`@forinda/kickjs-storage`,peers:[],description:`File storage — memory, disk, S3-compatible buckets, signed URLs`},views:{pkg:`@forinda/kickjs-view`,peers:[],description:`Server-rendered .kick templates: layouts, components, pipes, forms`},swagger:{pkg:`@forinda/kickjs-swagger`,peers:[],description:`OpenAPI spec + Swagger UI + ReDoc`,builds:{"@scarf/scarf":!0}},db:{pkg:`@forinda/kickjs-db`,peers:[],description:`kick/db core — schema DSL, migrations, KickDbClient, customType`},pg:{pkg:`@forinda/kickjs-db`,peers:[`pg`],typePeers:[`@types/pg`],description:`kick/db + PostgreSQL driver (use @forinda/kickjs-db/pg)`},sqlite:{pkg:`@forinda/kickjs-db`,peers:[`better-sqlite3`],builds:{"better-sqlite3":!0},typePeers:[`@types/better-sqlite3`],description:`kick/db + SQLite driver (use @forinda/kickjs-db/sqlite)`},mysql:{pkg:`@forinda/kickjs-db`,peers:[`mysql2`],description:`kick/db + MySQL driver (use @forinda/kickjs-db/mysql)`},ws:{pkg:`@forinda/kickjs-ws`,peers:[`ws`],description:`WebSocket with @WsController decorators`},devtools:{pkg:`@forinda/kickjs-devtools`,peers:[`ws`],description:`Development dashboard — routes, DI, metrics, health`,dev:!0},queue:{pkg:`@forinda/kickjs-queue`,peers:[],description:`Queue adapter (BullMQ/RabbitMQ/Kafka)`},"queue:bullmq":{pkg:`@forinda/kickjs-queue`,peers:[`bullmq`,`ioredis`],builds:{"msgpackr-extract":!1},description:`Queue with BullMQ + Redis`},"queue:rabbitmq":{pkg:`@forinda/kickjs-queue`,peers:[`amqplib`],description:`Queue with RabbitMQ`},"queue:kafka":{pkg:`@forinda/kickjs-queue`,peers:[`kafkajs`],description:`Queue with Kafka`},"queue:redis-pubsub":{pkg:`@forinda/kickjs-queue`,peers:[`ioredis`],description:`Lightweight pub/sub via Redis (no persistence)`},mcp:{pkg:`@forinda/kickjs-mcp`,peers:[`@modelcontextprotocol/server`],description:`Model Context Protocol server — expose @Controller endpoints as AI tools`},testing:{pkg:`@forinda/kickjs-testing`,peers:[],description:`Test utilities and TestModule builder`,dev:!0}},Ue=Object.entries(K).filter(([e,t])=>!t.core&&!t.deprecated&&!e.includes(`:`)&&![`pg`,`sqlite`,`mysql`,`zod`,`valibot`,`yup`].includes(e)).map(([e])=>e).concat(`upload`).join(`, `),q={express:[`express`],fastify:[`fastify`,`@fastify/middie`,`serve-static`],h3:[`h3@^2`,`serve-static`]},We={express:{prod:`multer`,dev:`@types/multer`,note:`Express uploads use multer (memory/disk storage, ctx.file / ctx.files).`},fastify:{prod:`@fastify/multipart`,note:`Fastify uploads use @fastify/multipart (buffered into ctx.file / ctx.files).`},h3:{note:`h3 parses multipart natively (readMultipartFormData) — no driver to install.`}};function J(e){if(e!==void 0){if(e===`express`||e===`fastify`||e===`h3`)return e;throw Error(`Invalid --runtime '${String(e)}'. Expected express, fastify or h3.`)}}async function Y(e=process.cwd()){return(await X(e)).runtime}async function X(e=process.cwd()){let n=(await t(e))?.runtime;return n===`express`||n===`fastify`||n===`h3`?{runtime:n,candidates:[n],ambiguous:!1,fromConfig:!0}:{...Ke(e),fromConfig:!1}}const Ge=[[`express`,`express`],[`fastify`,`fastify`],[`h3`,`h3`]];function Ke(e=process.cwd()){let t=qe(`package.json`,e);if(!t)return{runtime:`express`,candidates:[],ambiguous:!1};let n={},r={};try{let e=JSON.parse(f(v(t,`package.json`),`utf-8`));n=e.dependencies??{},r=e.devDependencies??{}}catch{return{runtime:`express`,candidates:[],ambiguous:!1}}let i=Ge.filter(([e])=>e in n).map(([,e])=>e),a=Ge.filter(([e])=>e in r&&!(e in n)).map(([,e])=>e),o=[...i,...a];return i.length===1?{runtime:i[0],candidates:o,ambiguous:!1}:i.length===0&&a.length===1?{runtime:a[0],candidates:o,ambiguous:!1}:o.length===0?{runtime:`express`,candidates:o,ambiguous:!1}:{runtime:`express`,candidates:o,ambiguous:!0}}function qe(e,t=process.cwd()){let n=t;for(;;){if(d(v(n,e)))return n;let t=m(n);if(t===n)return null;n=t}}function Je(e=!1,t){let n=Object.entries(K),r=Math.max(...n.map(([e])=>e.length)),i=n.filter(([,e])=>e.core),a=n.filter(([,e])=>!e.core),o=([e,n])=>{let i=e.padEnd(r+2),a=n.enginePeers?[...n.peers,...q[t??`express`]]:n.peers,o=n.enginePeers?` [${t??`express`} engine]`:``,s=a.length?` (+ ${a.join(`, `)})${o}`:``,c=n.deprecated?` [DEPRECATED — ${n.deprecated}]`:``;return` ${i} ${n.description}${s}${c}`};console.log(`
|
|
119
|
-
Core packages (always installed by \`kick new\`):
|
|
120
|
-
`);for(let e of i)console.log(o(e));if(e){console.log(`
|
|
121
|
-
Optional packages (add as needed):
|
|
122
|
-
`);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(`
|
|
123
|
-
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 Ye={"@swc/core":!0,esbuild:!0};function Z(e,t,n){if(e===`pnpm`){let e=v(t,`pnpm-workspace.yaml`),r=d(e)?f(e,`utf-8`):``,i=oe(r,n);return i===r?void 0:(p(e,i),e)}if(e!==`npm`&&e!==`bun`)return;let r=v(t,`package.json`);if(!d(r))return;let i=JSON.parse(f(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 p(r,`${JSON.stringify(i,null,2)}\n`),r}function Xe(e){if(e===`pnpm`)return qe(`pnpm-workspace.yaml`)??process.cwd();for(let e=process.cwd();;e=m(e)){try{if(JSON.parse(f(v(e,`package.json`),`utf-8`)).workspaces)return e}catch{}if(m(e)===e)return process.cwd()}}function Ze(e){return Object.assign({},...e.map(e=>K[e]?.builds??{}))}function Qe(e,t,n=`express`){let r=/* @__PURE__ */ new Set,i=/* @__PURE__ */ new Set,a=[],o=[],s=[];for(let c of e){if(c===`upload`){let e=We[n];s.push(`upload (${n}): ${e.note}`),e.prod&&(t?i:r).add(e.prod),e.dev&&i.add(e.dev);continue}let e=K[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);for(let t of e.typePeers??[])i.add(t);if(e.enginePeers){let e=q[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 $e(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=>{Je(!!e.all,J(e.runtime)??await Y())})}function et(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`).option(`--no-wire`,`Install only — do not add adapters to the entry file or .env`).option(`--entry <file>`,`Entry file to wire (default: src/index.ts, then src/main.ts)`).option(`-f, --force`,`Wire even when the files it edits have uncommitted changes`).action(async(e,t)=>{if(t.list||e.length===0){Je(!!t.all,J(t.runtime)??await Y());return}let{pm:n,source:r}=await o(t.pm);console.log(`\n Using ${n} (resolved from ${r})`);let i=J(t.runtime),a=await X(process.cwd()),c=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 l=Qe(e,!!t.dev,c),{unknown:u,warnings:p,notices:m}=l,{prodDeps:h,devDeps:g}=l,_=process.cwd();if(t.entry&&!d(v(_,t.entry))){console.error(`\n --entry ${t.entry} does not exist.\n`),process.exitCode=1;return}let y=t.wire===!1?void 0:Oe(e),b=y?ke(_,t.entry):void 0;y&&b&&(y.integrations=Ie(y.integrations,b));let x=y?.integrations.filter(e=>e.slot?.startsWith(`env-`))??[],C=x.length>0?je(_):void 0;if(y){h=[.../* @__PURE__ */ new Set([...h,...y.dependencies])],g=[...new Set([...g,...y.devDependencies].filter(e=>!h.includes(e)))];let e=Ae(_,[...b?[b]:[],...C?[C]:[],...y.files.keys()]);if(e.length>0&&!t.force){console.error(`\n ${e.join(`, `)} ${e.length===1?`has`:`have`} uncommitted changes, and kick add would edit ${e.length===1?`it`:`them`}.\n Commit, stage (git add) or stash them first, rerun with --force to edit anyway, or with --no-wire to install only.\n`),process.exitCode=1;return}}for(let e of p)console.warn(`\n WARNING: ${e}`);for(let e of m)console.log(`\n ${e}`);if(u.length>0&&(console.log(`\n Unknown packages: ${u.join(`, `)}`),console.log(` Run "kick add --list" to see available packages.
|
|
124
|
-
`),h.length===0&&g.length===0))return;let w={...Ze(e),...y?.builds};if(Object.keys(w).length>0){let e=Z(n,Xe(n),w);e&&console.log(`\n Approved install scripts in ${e}`)}let T=!0;if(h.length>0){let e=h,t=`${n} add ${e.join(` `)}`;console.log(`\n Installing ${e.length} dependency(ies):`);for(let t of e)console.log(` + ${t}`);console.log();try{S(t,{stdio:`inherit`})}catch{T=!1,console.log(`\n Installation failed. Run manually:\n ${t}\n`)}}if(g.length>0){let e=g,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{S(t,{stdio:`inherit`})}catch{T=!1,console.log(`\n Installation failed. Run manually:\n ${t}\n`)}}if(y){if(!T)console.log(` Skipped wiring — the install did not finish.
|
|
125
|
-
`);else{let t=Ne(_,y.files),{created:r,updated:i}=await Pe(_,y.files);for(let e of r)console.log(` Created ${e}`);for(let e of i)console.log(` Updated ${e}`);let a=b?y.integrations.filter(e=>Fe(e,b,t)):[],o=y.integrations.filter(e=>!a.includes(e)),c=b?await Re(_,b,o):void 0;for(let e of c?.added??[])console.log(` Added ${e} to ${b}`);for(let e of c?.present??[])console.log(` ${e} is already in ${b}`);let l=C?await Me(_,C,x):void 0;l?.added.length&&console.log(` Declared ${l.added.join(`, `)} in ${C}`);let u=l?l.manual:x.filter(e=>e.slot===`env-zod`);u.length>0&&(console.log(`\n ${C?`Could not find the env schema object in ${C}`:`No env schema (src/config/index.ts) found`} — declare these keys in it yourself:
|
|
126
|
-
`),console.log(u.map(e=>`${e.code},`).join(`
|
|
127
|
-
`).replace(/^/gm,` `)),console.log());let p=ze(_),m=c?c.manual:y.integrations.filter(e=>e.slot&&e.code&&!e.slot.startsWith(`env-`)&&!e.slot.startsWith(`config-`)).map(e=>({...e,code:p(e.code)}));if(t.length>0){let e=a.map(e=>({...e,code:p(e.code??``)}));console.log(`\n ${t.join(`, `)} already exist${t.length===1?`s`:``} — left as ${t.length===1?`it is`:`they are`}. Merge in what the layer needs, then wire it yourself:
|
|
128
|
-
`),console.log(`${He(e)}`.replace(/^/gm,` `)),console.log()}m.length>0&&(console.log(`\n ${b?`Could not find bootstrap({ adapters: [...] }) in ${b}`:`No entry file found`} — add this yourself:
|
|
129
|
-
`),console.log(He(m).replace(/^/gm,` `)),console.log());let h=v(_,`kick.config.ts`),g=Ve(y.integrations,d(h)?f(h,`utf-8`):``);g&&(console.log(`
|
|
130
|
-
Add this to kick.config.ts:
|
|
131
|
-
`),console.log(g.replace(/^/gm,` `)),console.log());let S=[...new Set(e.map(e=>De[e]).filter(Boolean))];for(let e of await s(_,S,n))console.log(` Created ${e}`)}}T?console.log(` Done!
|
|
132
|
-
`):(console.log(` Finished with errors — the install above did not complete.
|
|
133
|
-
`),process.exitCode=1)})}const tt=m(y(import.meta.url));function nt(t){return{kick:n(t,`kick`),runDev:e(t,`dev`),runBuild:e(t,`build`),runStart:e(t,`start`),runTest:e(t,`test`)}}const Q=JSON.parse(f([h(tt,`..`,`package.json`),h(tt,`..`,`..`,`package.json`)].find(d),`utf-8`)),rt=[`@forinda/kickjs`,`@forinda/kickjs-cli`,`@forinda/kickjs-schema`,`@forinda/kickjs-vite`,`@forinda/kickjs-swagger`,`@forinda/kickjs-ws`,`@forinda/kickjs-queue`,`@forinda/kickjs-devtools`,`@forinda/kickjs-testing`,`@forinda/kickjs-client`,`@forinda/kickjs-inertia`,`@forinda/kickjs-storage`,`@forinda/kickjs-view`],it={react:{fallback:`^19.0.0`},"react-dom":{fallback:`^19.0.0`},"@types/react":{fallback:`^19.0.0`},"@types/react-dom":{fallback:`^19.0.0`},"@vitejs/plugin-react":{fallback:`^5.0.0`},"@inertiajs/react":{fallback:`^3.9.0`,cap:`^3`},"@inertiajs/core":{fallback:`^3.9.0`,cap:`^3`},"@types/node":{fallback:`^25.0.0`},"@types/supertest":{fallback:`^7.2.1`},supertest:{fallback:`^7.2.2`},vitest:{fallback:`^4.1.2`},"@swc/core":{fallback:`^1.15.21`},"unplugin-swc":{fallback:`^1.5.9`},oxfmt:{fallback:`^0.65.0`},oxlint:{fallback:`^1.80.0`},dotenv:{fallback:`^17.3.1`,cap:`^17`},"reflect-metadata":{fallback:`^0.2.2`},vite:{fallback:`^8.0.3`,cap:`^8`},typescript:{fallback:`^7.0.2`,cap:`^7`},"@typescript/typescript6":{fallback:`^6.0.2`,cap:`^6`},express:{fallback:`^5.1.0`,cap:`^5`},"@types/express":{fallback:`^5.0.6`,cap:`^5`},fastify:{fallback:`^5.0.0`,cap:`^5`},"@fastify/middie":{fallback:`^9.0.0`,cap:`^9`},h3:{fallback:`^2.0.2`,cap:`^2`},"serve-static":{fallback:`^2.2.0`,cap:`^2`},zod:{fallback:`^4.3.6`,cap:`^4`},valibot:{fallback:`^1.4.1`,cap:`^1`},"@valibot/to-json-schema":{fallback:`^1.8.0`,cap:`^1`},yup:{fallback:`^1.7.1`,cap:`^1`},ws:{fallback:`^8.18.0`,cap:`^8`},bullmq:{fallback:`^5.0.0`,cap:`^5`},ioredis:{fallback:`^5.0.0`,cap:`^5`}};function $(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 at(e){return e===`@forinda/kickjs-cli`?`^${Q.version}`:`latest`}async function ot(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 st(){let e=[...rt.map(e=>({name:e,fallback:at(e),cap:void 0})),...Object.entries(it).map(([e,t])=>({name:e,...t}))],t=Date.now()+2e4,n=await ot(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=$(await te(`npm`,r?[`view`,a,`version`,`--json`]:[`view`,a,`version`],{timeout:i}));return[e,o?`^${o}`:n]});return Object.fromEntries(n)}function ct(e,t){let n=k(`npm`,[`view`,`${e}@${t}`,`version`],{timeout:2e4});return n&&/^\d+\.\d+\.\d+/.test(n)?n:null}function lt(e){return(e??``).replace(/^[\^~>=<\s]+/,``)}function ut(e,t){let n=e=>lt(e).split(`-`)[0].split(`.`).map(e=>Number.parseInt(e,10)||0),[r=0,i=0,a=0]=n(e),[o=0,s=0,c=0]=n(t);return r===o?i===s?a>=c:i>s:r>o}const dt=Q.version;async function ft(){let e=$(await te(`npm`,[`view`,`@forinda/kickjs-cli`,`version`],{timeout:5e3}));return e&&pt(dt,e)?e:null}function pt(e,t){return e.split(`-`)[0]===t.split(`-`)[0]?e.includes(`-`)&&!t.includes(`-`):!ut(e,t)}function mt(e,t,n){let r=k(`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 ht(t){let{name:i,directory:o,packageManager:s=`pnpm`,template:c=`rest`,defaultRepo:f=`inmemory`,packages:p=[],schemaLib:m=`zod`,runtime:g=`express`}=t,_=o,v=e=>console.log(` ${e}`);console.log(`\n Creating KickJS project: ${i}\n`),t.versions||v(`Resolving package versions...`);let y=t.versions??await st(),b=Object.keys(y).filter(e=>y[e]===`latest`);if(b.length>0&&v(`WARNING: could not reach npm for ${b.join(`, `)} — pinned to 'latest'`),g!==`express`){if(mt(`@forinda/kickjs`,`latest`,`./${g}`))v(`Using @forinda/kickjs@latest (stable ships the ${g} runtime)`);else{let e=[`@forinda/kickjs`,`@forinda/kickjs-cli`,`@forinda/kickjs-vite`],t=[],n=!1;for(let r of e){let e=ct(r,`alpha`);e&&ut(e,lt(y[r]))&&(y[r]=`^${e}`,t.push(`${r}@^${e}`),r===`@forinda/kickjs`&&(n=!0))}v(n?`Using the alpha channel for the ${g} runtime: ${t.join(`, `)}`:`WARNING: could not resolve @forinda/kickjs@alpha — the ${g} runtime subpath may be missing. After install, run: ${s} add @forinda/kickjs@alpha`)}}let x=p.filter(e=>!d(h(l,`feature-${e}`)));x.length>0&&v(`WARNING: skipping unknown package(s): ${x.join(`, `)} — add them later with kick add`);let C=a([...vt({template:c,runtime:g,schemaLib:m,packages:p}),...t.extraLayers??[]],{vars:{name:i,version:Q.version},extra:[{slot:`repo`,code:f===`inmemory`?`repo: 'inmemory'`:`repo: { name: '${f.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`)}' }`},...t.spaClientDir?[_t(t.spaClientDir)]:[]]}),w=t.platformConfig===!1?void 0:P(s);await r(h(_,`package.json`),ae(i,y,C,w));let E=ie(s,w);E&&await r(h(_,`.yarnrc.yml`),E);let ee=u(C.files,{name:i,template:c,runtime:g,packageManager:s,...nt(s),templateLabel:{rest:`REST API`,minimal:`Minimal`,inertia:`Inertia (React)`}[c],sessionSecret:T(32).toString(`hex`),packages:[...C.dependencies,...C.devDependencies].filter(e=>e.startsWith(`@forinda/`)).map(e=>`- \`${e}\``).join(`
|
|
134
|
-
`)});for(let[e,t]of ee)await r(h(_,e),t);t.deploy?.length&&t.platformConfig!==!1&&await z({dir:_,targets:t.deploy,pm:s,force:!0});let{generateAgentDocs:D}=await import(`./agent-docs-BxHRHi1r.mjs`).then(e=>e.t);await D({outDir:_,name:i,pm:s,template:c,only:`both`,force:!0});let O={...Ye,...Ze(p),...C.builds};if(t.approveInstallScripts!==!1&&Z(s,_,O),t.installDeps){console.log(`\n Installing dependencies with ${s}...\n`);try{S(`${s} install`,{cwd:_,stdio:`inherit`}),console.log(`
|
|
135
|
-
Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${s} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-0Ffq-YuL.mjs`).then(e=>e.n);await e({cwd:_,allowDuplicates:!0,silent:!0})}catch{}if(t.initGit)try{S(`git init`,{cwd:_,stdio:`pipe`}),S(`git branch -M main`,{cwd:_,stdio:`pipe`}),S(`git add -A`,{cwd:_,stdio:`pipe`}),S(`git commit -m "chore: initial commit from kick new"`,{cwd:_,stdio:`pipe`}),v(`Git repository initialized`)}catch{v(`Warning: git init failed (git may not be installed)`)}console.log(`
|
|
136
|
-
Project scaffolded successfully!`),console.log();let k=_!==process.cwd();v(`Next steps:`),k&&v(` cd ${i}`),t.installDeps||v(` ${s} install`);let A=n(s,`kick`),j={rest:`${A} g module user`,minimal:`# add your routes to src/index.ts`,inertia:`# pages: src/modules/pages + src/client/pages`};v(` ${j[c]??j.rest}`),v(` ${e(s,`dev`)}`);let M=e=>{let t=Math.max(...e.map(([e])=>e.length))+2;for(let[n,r]of e)v(` ${n.padEnd(t)}${r}`)};return v(``),v(`Commands:`),M([[e(s,`dev`),`Start dev server with Vite HMR`],[e(s,`build`),`Production build via Vite`],[e(s,`start`),`Run production build`]]),v(``),v(`Generators:`),M([[`${A} g module <name>`,`REST module (controller, service, DTOs, repository)`],[`${A} g scaffold <n> <f..>`,`CRUD module from field definitions`],[`${A} g controller <name>`,`Standalone controller`],[`${A} g service <name>`,`@Service() class`],[`${A} g middleware <name>`,`Global connect-style middleware`],[`${A} g guard <name>`,`Route guard (auth, roles, etc.)`],[`${A} g adapter <name>`,`AppAdapter with lifecycle hooks`],[`${A} g dto <name>`,`DTO schema (Zod / Valibot / Yup)`],[`${A} g config`,`Generate kick.config.ts`]]),v(``),v(`Add packages:`),M([[`${A} add <pkg>`,`Install a KickJS package + peers`],[`${A} add --list`,`Show all available packages`]]),v(``),v(`Available: ${Ue}`),v(``),{builds:O}}const gt=e=>`'${JSON.stringify(e).slice(1,-1).replaceAll(`\\"`,`"`).replaceAll(`'`,`\\'`)}'`;function _t(e){return{import:{from:`@forinda/kickjs/spa`,names:[`SpaAdapter`]},slot:`adapter`,code:`// Serves the built frontend from this origin in production.
|
|
137
|
-
// Inert until the client build exists, so \`kick dev\` (where Vite
|
|
138
|
-
// serves the client and proxies /api here) is unaffected.
|
|
139
|
-
SpaAdapter({ clientDir: ${gt(e)} })`}}function vt(e){return[`base`,`template-${e.template}`,`runtime-${e.runtime}`,`schema-${e.schemaLib}`,...e.packages.filter(e=>d(h(l,`feature-${e}`))).map(e=>`feature-${e}`)]}export{M as C,A as S,B as _,q as a,P as b,Z as c,$e as d,Y as f,Ee as g,ke as h,st as i,J as l,Ae as m,ht as n,K as o,X as p,ft as r,We as s,dt as t,et as u,z as v,j as w,ie as x,me as y};
|