@voltro/cli 0.2.2 → 0.3.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/CHANGELOG.md +20 -0
- package/THIRD-PARTY-NOTICES.md +234 -1
- package/bin/voltro.mjs +71 -1
- package/dist/apiBuild-DdgYydVJ.js +193 -0
- package/dist/apiBuild-cadmH8ca.js +2 -0
- package/dist/bin.js +2 -2
- package/dist/{commands-DQy4812j.js → commands-CXESev-z.js} +2182 -1780
- package/dist/dev-DemiMSSl.js +2 -0
- package/dist/{dev--jHe1vcu.js → dev-x_VqbV_8.js} +1469 -1458
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/{serveCommand-93rRdEp0.js → serveCommand-Dttqe5Ms.js} +2 -2
- package/dist/serveEntry.js +2 -2
- package/package.json +22 -19
- package/templates/AGENTS.core.md +14 -0
- package/templates/AGENTS.md +14 -0
- package/templates/agent-docs/_manifest.json +1 -1
- package/templates/agent-docs/cli.md +59 -0
- package/templates/agent-docs/data.md +39 -0
- package/templates/agent-docs/database/advancedqueries.md +27 -0
- package/templates/agent-docs/deployment.md +3 -1
- package/templates/apps/api-ai/package.json +7 -7
- package/templates/apps/api-auth/package.json +8 -8
- package/templates/apps/api-backend/package.json +7 -7
- package/templates/apps/api-backend-deactivation/package.json +7 -7
- package/templates/apps/api-backend-mail/package.json +8 -8
- package/templates/apps/api-backend-mariadb/package.json +9 -9
- package/templates/apps/api-backend-storage/package.json +8 -8
- package/templates/apps/api-data-advanced/package.json +8 -8
- package/templates/apps/api-durable/package.json +8 -8
- package/templates/apps/api-feature-flags/package.json +9 -9
- package/templates/apps/api-governance/package.json +8 -8
- package/templates/apps/api-kv/package.json +8 -8
- package/templates/apps/api-moderation/package.json +8 -8
- package/templates/apps/api-observability/package.json +8 -8
- package/templates/apps/api-ratelimit/package.json +8 -8
- package/templates/apps/api-rbac/package.json +8 -8
- package/templates/apps/api-rest/package.json +7 -7
- package/templates/apps/api-saas/package.json +11 -11
- package/templates/apps/api-search/package.json +8 -8
- package/templates/apps/api-versioning/package.json +8 -8
- package/templates/apps/api-webhooks/package.json +8 -8
- package/templates/apps/changelog/package.json +6 -6
- package/templates/apps/edge-functions/package.json +2 -2
- package/templates/apps/frontend-admin/package.json +8 -8
- package/templates/apps/frontend-app/package.json +8 -8
- package/templates/apps/frontend-blank/package.json +7 -7
- package/templates/apps/frontend-contact/package.json +7 -7
- package/templates/apps/frontend-dashboard/package.json +7 -7
- package/templates/apps/frontend-docs/package.json +7 -7
- package/templates/apps/frontend-i18n/package.json +6 -6
- package/templates/apps/frontend-landing/package.json +7 -7
- package/templates/apps/frontend-spa/package.json +7 -7
- package/templates/apps/frontend-ssr/package.json +7 -7
- package/templates/apps/frontend-ssr-api/package.json +8 -8
- package/templates/apps/frontend-static-blog/package.json +6 -6
- package/templates/baselines/compose/docker/api.Dockerfile +10 -5
- package/templates/baselines/compose-mariadb/docker/api.Dockerfile +10 -5
- package/dist/apiBuild-OpZROja5.js +0 -2
- package/dist/apiBuild-o70rjpVJ.js +0 -184
- package/dist/dev-BKkZglQV.js +0 -2
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
"test": "voltro test"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@voltro/cli": "0.
|
|
15
|
-
"@voltro/client": "0.
|
|
16
|
-
"@voltro/env": "0.
|
|
17
|
-
"@voltro/i18n": "0.
|
|
18
|
-
"@voltro/web": "0.
|
|
14
|
+
"@voltro/cli": "0.3.0",
|
|
15
|
+
"@voltro/client": "0.3.0",
|
|
16
|
+
"@voltro/env": "0.3.0",
|
|
17
|
+
"@voltro/i18n": "0.3.0",
|
|
18
|
+
"@voltro/web": "0.3.0",
|
|
19
19
|
"react": "^19.0.0",
|
|
20
20
|
"react-dom": "^19.0.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@voltro/devtools": "0.
|
|
23
|
+
"@voltro/devtools": "0.3.0",
|
|
24
24
|
"@types/react": "^19.0.0",
|
|
25
25
|
"@types/react-dom": "^19.0.0",
|
|
26
26
|
"typescript": "^5.7.0",
|
|
@@ -41,16 +41,21 @@ FROM deps AS builder
|
|
|
41
41
|
ARG APP_PATH
|
|
42
42
|
WORKDIR /workspace/${APP_PATH}
|
|
43
43
|
RUN pnpm voltro codegen . || true
|
|
44
|
-
# Precompile the api into
|
|
45
|
-
#
|
|
46
|
-
|
|
44
|
+
# Precompile the api into the SERVE BUNDLE so `voltro serve` boots from one
|
|
45
|
+
# artefact and NEVER transpiles on demand. NOT best-effort: a bundle-build failure
|
|
46
|
+
# is fatal (no `|| true`) so the image never silently falls back to the slow tsx
|
|
47
|
+
# path — production must serve from the bundle.
|
|
48
|
+
RUN pnpm voltro build .
|
|
47
49
|
# Isolate a prod-only, self-contained tree for THIS app (drops devDependencies,
|
|
48
50
|
# the pnpm store, and every other app), then carry the precompiled bundle in.
|
|
49
51
|
# Only the driver for THIS app's DB dialect is included (a memory store ships
|
|
50
|
-
# none)
|
|
52
|
+
# none). `--no-optional` also drops @voltro/cli's BUILD toolchain (tsx/esbuild/
|
|
53
|
+
# vite/tailwind + their native tree) — declared as optionalDependencies so a
|
|
54
|
+
# serve-only prod install excludes them; production serves from the bundle and
|
|
55
|
+
# never transpiles, so the image stays lean with no fragile prune list.
|
|
51
56
|
WORKDIR /workspace
|
|
52
57
|
RUN APP_NAME=$(node -p "require('/workspace/${APP_PATH}/package.json').name") \
|
|
53
|
-
&& pnpm --filter="${APP_NAME}" --prod --legacy deploy /deploy \
|
|
58
|
+
&& pnpm --filter="${APP_NAME}" --prod --no-optional --legacy deploy /deploy \
|
|
54
59
|
; cp -r /workspace/${APP_PATH}/.framework /deploy/.framework 2>/dev/null || echo "no .framework (serve loads from source)"
|
|
55
60
|
|
|
56
61
|
# ---------- prod runner ----------
|
|
@@ -41,16 +41,21 @@ FROM deps AS builder
|
|
|
41
41
|
ARG APP_PATH
|
|
42
42
|
WORKDIR /workspace/${APP_PATH}
|
|
43
43
|
RUN pnpm voltro codegen . || true
|
|
44
|
-
# Precompile the api into
|
|
45
|
-
#
|
|
46
|
-
|
|
44
|
+
# Precompile the api into the SERVE BUNDLE so `voltro serve` boots from one
|
|
45
|
+
# artefact and NEVER transpiles on demand. NOT best-effort: a bundle-build failure
|
|
46
|
+
# is fatal (no `|| true`) so the image never silently falls back to the slow tsx
|
|
47
|
+
# path — production must serve from the bundle.
|
|
48
|
+
RUN pnpm voltro build .
|
|
47
49
|
# Isolate a prod-only, self-contained tree for THIS app (drops devDependencies,
|
|
48
50
|
# the pnpm store, and every other app), then carry the precompiled bundle in.
|
|
49
51
|
# Only the driver for THIS app's DB dialect is included (a memory store ships
|
|
50
|
-
# none)
|
|
52
|
+
# none). `--no-optional` also drops @voltro/cli's BUILD toolchain (tsx/esbuild/
|
|
53
|
+
# vite/tailwind + their native tree) — declared as optionalDependencies so a
|
|
54
|
+
# serve-only prod install excludes them; production serves from the bundle and
|
|
55
|
+
# never transpiles, so the image stays lean with no fragile prune list.
|
|
51
56
|
WORKDIR /workspace
|
|
52
57
|
RUN APP_NAME=$(node -p "require('/workspace/${APP_PATH}/package.json').name") \
|
|
53
|
-
&& pnpm --filter="${APP_NAME}" --prod --legacy deploy /deploy \
|
|
58
|
+
&& pnpm --filter="${APP_NAME}" --prod --no-optional --legacy deploy /deploy \
|
|
54
59
|
; cp -r /workspace/${APP_PATH}/.framework /deploy/.framework 2>/dev/null || echo "no .framework (serve loads from source)"
|
|
55
60
|
|
|
56
61
|
# ---------- prod runner ----------
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { d as e, et as t } from "./dev--jHe1vcu.js";
|
|
2
|
-
import { isAbsolute as n, join as r, relative as i, resolve as a } from "node:path";
|
|
3
|
-
import { createLogger as o } from "@voltro/logger";
|
|
4
|
-
import { existsSync as s, promises as c } from "node:fs";
|
|
5
|
-
import { createRequire as l } from "node:module";
|
|
6
|
-
//#region src/apiBuild.ts
|
|
7
|
-
var u = o({ scope: "voltro:build" }), d = async (e) => {
|
|
8
|
-
let n = r(e, "package.json");
|
|
9
|
-
if (!s(n)) return [];
|
|
10
|
-
let i = {};
|
|
11
|
-
try {
|
|
12
|
-
let e = JSON.parse(await c.readFile(n, "utf8"));
|
|
13
|
-
i = {
|
|
14
|
-
...e.dependencies,
|
|
15
|
-
...e.devDependencies,
|
|
16
|
-
...e.optionalDependencies
|
|
17
|
-
};
|
|
18
|
-
} catch {
|
|
19
|
-
return [];
|
|
20
|
-
}
|
|
21
|
-
let a = l(n);
|
|
22
|
-
return t.filter((e) => {
|
|
23
|
-
if (i[e] === void 0) return !1;
|
|
24
|
-
try {
|
|
25
|
-
return a.resolve(e), !0;
|
|
26
|
-
} catch {
|
|
27
|
-
return !1;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}, f = /(?:\.(?:query|mutation|action|stream)(?:\.server)?\.ts|\.workflow(?:\.server)?\.tsx|\.(?:subscribe|reaction|aggregate|agent|tool|webhook|cron|trigger)(?:\.server)?\.tsx?|\.(?:startup|seed)\.tsx?|\.(?:entity|schema|relations)\.ts|(?:^|\/)schema\.ts)$/, p = (e) => /\.(ts|tsx)$/.test(e) && !/\.(test|spec)\.[tj]sx?$/.test(e), m = async (t) => (await e(t)).filter((e) => f.test(e) && p(e) && !e.includes(`${t}/.framework/`)), h = {
|
|
31
|
-
name: "externalize-bare",
|
|
32
|
-
setup(e) {
|
|
33
|
-
e.onResolve({ filter: /.*/ }, (e) => {
|
|
34
|
-
let t = e.path;
|
|
35
|
-
if (!(t.startsWith(".") || n(t))) return {
|
|
36
|
-
path: t,
|
|
37
|
-
external: !0
|
|
38
|
-
};
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}, g = async (e) => {
|
|
42
|
-
let t = await import("esbuild"), n = r(e, ".framework"), o = r(n, "dist-api");
|
|
43
|
-
await c.mkdir(n, { recursive: !0 });
|
|
44
|
-
let l = [...await m(e)], d = r(e, "app.config.ts");
|
|
45
|
-
if (s(d) && l.push(d), l.length === 0) return u.warn("api build: no handlers or app.config found — nothing to precompile", { root: e }), null;
|
|
46
|
-
let f = r(e, "tsconfig.json"), g = {
|
|
47
|
-
bundle: !0,
|
|
48
|
-
format: "esm",
|
|
49
|
-
platform: "node",
|
|
50
|
-
target: "node22",
|
|
51
|
-
logLevel: "silent",
|
|
52
|
-
jsx: "automatic",
|
|
53
|
-
jsxImportSource: "react",
|
|
54
|
-
absWorkingDir: e,
|
|
55
|
-
...s(f) ? { tsconfig: f } : {},
|
|
56
|
-
plugins: [h]
|
|
57
|
-
}, _ = await t.build({
|
|
58
|
-
...g,
|
|
59
|
-
entryPoints: l,
|
|
60
|
-
write: !1,
|
|
61
|
-
metafile: !0,
|
|
62
|
-
outdir: o
|
|
63
|
-
}), v = Object.keys(_.metafile.inputs).map((t) => a(e, t)).filter((t) => t.startsWith(`${e}/`) && !t.includes("/node_modules/") && !t.includes("/.framework/") && p(t)), y = [
|
|
64
|
-
"// GENERATED BY `voltro build` — do not edit; overwritten on next build.",
|
|
65
|
-
"// Precompiled api entry: the single bundle the serve runtime loads instead",
|
|
66
|
-
"// of importing every handler/schema source at boot. See apiBuild.ts /",
|
|
67
|
-
"// appModuleLoader.ts.",
|
|
68
|
-
""
|
|
69
|
-
], b = [];
|
|
70
|
-
v.forEach((t, n) => {
|
|
71
|
-
y.push(`import * as m${n} from ${JSON.stringify(t)}`), b.push(` ${JSON.stringify(i(e, t))}: m${n},`);
|
|
72
|
-
}), y.push("", "export const modules: Record<string, unknown> = {", ...b, "}", "");
|
|
73
|
-
let x = r(n, "apiEntry.ts");
|
|
74
|
-
return await c.writeFile(x, y.join("\n"), "utf8"), await t.build({
|
|
75
|
-
...g,
|
|
76
|
-
entryPoints: [x],
|
|
77
|
-
outfile: r(o, "apiEntry.js"),
|
|
78
|
-
metafile: !1,
|
|
79
|
-
write: !0
|
|
80
|
-
}), u.info("api build: precompiled bundle written", {
|
|
81
|
-
modules: v.length,
|
|
82
|
-
out: r(".framework", "dist-api", "apiEntry.js")
|
|
83
|
-
}), r(o, "apiEntry.js");
|
|
84
|
-
}, _ = (e) => r(e, ".framework", "dist-api", "apiEntry.js"), v = [
|
|
85
|
-
"better-sqlite3",
|
|
86
|
-
"mysql2",
|
|
87
|
-
"tedious",
|
|
88
|
-
"pg",
|
|
89
|
-
"pg-native",
|
|
90
|
-
"@tursodatabase/*",
|
|
91
|
-
"@libsql/*",
|
|
92
|
-
"ioredis",
|
|
93
|
-
"@vlasky/zongji",
|
|
94
|
-
"nodemailer"
|
|
95
|
-
], y = [
|
|
96
|
-
"tsx",
|
|
97
|
-
"esbuild",
|
|
98
|
-
"vite",
|
|
99
|
-
"@vitejs/*",
|
|
100
|
-
"@tailwindcss/*",
|
|
101
|
-
"rolldown",
|
|
102
|
-
"lightningcss"
|
|
103
|
-
], b = (e, t) => t.some((t) => t.endsWith("/*") ? e === t.slice(0, -2) || e.startsWith(t.slice(0, -1)) : e === t || e.startsWith(`${t}/`)), x = (e, t) => `const { createRequire } = require('node:module')
|
|
104
|
-
const { join } = require('node:path')
|
|
105
|
-
const reqApp = createRequire(join(process.cwd(), 'package.json'))
|
|
106
|
-
const drivers = ${JSON.stringify(t)}\nlet mod\nfor (const d of drivers) {\n try { mod = createRequire(reqApp.resolve(d + '/package.json'))(${JSON.stringify(e)}); break } catch (e) {}\n}\nif (!mod) { try { mod = reqApp(${JSON.stringify(e)}) } catch (e) {} }\nif (!mod) mod = require(${JSON.stringify(e)})\nmodule.exports = mod\n`, S = (e) => ({
|
|
107
|
-
name: "native-leaf-runtime-resolver",
|
|
108
|
-
setup(t) {
|
|
109
|
-
t.onResolve({ filter: /.*/ }, (e) => {
|
|
110
|
-
let t = e.path;
|
|
111
|
-
if (!(t.startsWith(".") || n(t) || t.startsWith("node:"))) {
|
|
112
|
-
if (b(t, v)) return {
|
|
113
|
-
path: t,
|
|
114
|
-
namespace: "native-leaf"
|
|
115
|
-
};
|
|
116
|
-
if (b(t, y)) return {
|
|
117
|
-
path: t,
|
|
118
|
-
external: !0
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
}), t.onLoad({
|
|
122
|
-
filter: /.*/,
|
|
123
|
-
namespace: "native-leaf"
|
|
124
|
-
}, (t) => ({
|
|
125
|
-
contents: x(t.path, e),
|
|
126
|
-
loader: "js"
|
|
127
|
-
}));
|
|
128
|
-
}
|
|
129
|
-
}), C = (e) => r(e, ".framework", "dist-api", "serveBundle", "serveEntry.js"), w = async (e) => {
|
|
130
|
-
let t = await import("esbuild"), n = r(e, ".framework"), o = r(n, "dist-api", "serveBundle");
|
|
131
|
-
await c.mkdir(n, { recursive: !0 });
|
|
132
|
-
let l = [...await m(e)], f = r(e, "app.config.ts");
|
|
133
|
-
if (s(f) && l.push(f), l.length === 0) return null;
|
|
134
|
-
let g = r(e, "tsconfig.json"), _ = await t.build({
|
|
135
|
-
entryPoints: l,
|
|
136
|
-
bundle: !0,
|
|
137
|
-
write: !1,
|
|
138
|
-
metafile: !0,
|
|
139
|
-
format: "esm",
|
|
140
|
-
platform: "node",
|
|
141
|
-
absWorkingDir: e,
|
|
142
|
-
jsx: "automatic",
|
|
143
|
-
jsxImportSource: "react",
|
|
144
|
-
logLevel: "silent",
|
|
145
|
-
plugins: [h],
|
|
146
|
-
outdir: r(o, ".probe"),
|
|
147
|
-
...s(g) ? { tsconfig: g } : {}
|
|
148
|
-
}), v = Object.keys(_.metafile.inputs).map((t) => a(e, t)).filter((t) => t.startsWith(`${e}/`) && !t.includes("/node_modules/") && !t.includes("/.framework/") && p(t)), y = await d(e), b = [
|
|
149
|
-
"// GENERATED BY `voltro build` — do not edit; overwritten on next build.",
|
|
150
|
-
"import { join as __join } from 'node:path'",
|
|
151
|
-
"import { runServe as __runServe, registerAppModules, registerDriver, loadDotEnv } from '@voltro/cli/serveEntry'",
|
|
152
|
-
...y.map((e, t) => `import * as __drv${t} from ${JSON.stringify(e)}`),
|
|
153
|
-
"const __root = process.cwd()",
|
|
154
|
-
"registerAppModules({",
|
|
155
|
-
...v.map((t) => ` [__join(__root, ${JSON.stringify(i(e, t))})]: () => import(${JSON.stringify(t)}),`),
|
|
156
|
-
"})",
|
|
157
|
-
...y.map((e, t) => `registerDriver(${JSON.stringify(e)}, __drv${t})`),
|
|
158
|
-
"export const runServe = (args = []) => { loadDotEnv([]); return __runServe(args) }",
|
|
159
|
-
""
|
|
160
|
-
], x = r(n, "serveEntry.ts");
|
|
161
|
-
return await c.writeFile(x, b.join("\n"), "utf8"), await t.build({
|
|
162
|
-
entryPoints: [x],
|
|
163
|
-
bundle: !0,
|
|
164
|
-
format: "esm",
|
|
165
|
-
platform: "node",
|
|
166
|
-
target: "node22",
|
|
167
|
-
outdir: o,
|
|
168
|
-
splitting: !0,
|
|
169
|
-
write: !0,
|
|
170
|
-
plugins: [S(y)],
|
|
171
|
-
banner: { js: "import { createRequire as __voltroRequire } from 'node:module'; const require = __voltroRequire(import.meta.url);" },
|
|
172
|
-
jsx: "automatic",
|
|
173
|
-
jsxImportSource: "react",
|
|
174
|
-
logLevel: "silent",
|
|
175
|
-
absWorkingDir: e,
|
|
176
|
-
...s(g) ? { tsconfig: g } : {}
|
|
177
|
-
}), u.info("api build: serve bundle written", {
|
|
178
|
-
appModules: v.length,
|
|
179
|
-
drivers: y.length > 0 ? y.join(", ") : "none (memory)",
|
|
180
|
-
out: r(".framework", "dist-api", "serveBundle", "serveEntry.js")
|
|
181
|
-
}), r(o, "serveEntry.js");
|
|
182
|
-
};
|
|
183
|
-
//#endregion
|
|
184
|
-
export { C as a, w as i, m as n, g as r, _ as t };
|
package/dist/dev-BKkZglQV.js
DELETED