@voltro/cli 0.2.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -0
- package/THIRD-PARTY-NOTICES.md +234 -1
- package/bin/voltro.mjs +71 -1
- package/dist/apiBuild-CvtQeBMs.js +190 -0
- package/dist/apiBuild-DQBNqNZ8.js +2 -0
- package/dist/bin.js +2 -2
- package/dist/{commands-DQy4812j.js → commands-DhyBIs1O.js} +2381 -1768
- package/dist/{dev--jHe1vcu.js → dev-CQxbrpDz.js} +1677 -1626
- package/dist/dev-DYjGqPGD.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/serveCommand-BZzUJIyo.js +1077 -0
- package/dist/serveEntry.js +2 -2
- package/package.json +22 -19
- package/templates/AGENTS.core.md +61 -0
- package/templates/AGENTS.md +61 -0
- package/templates/agent-docs/_manifest.json +4 -4
- package/templates/agent-docs/ai.md +28 -0
- package/templates/agent-docs/authentication.md +5 -2
- package/templates/agent-docs/cli.md +98 -0
- package/templates/agent-docs/data.md +193 -3
- package/templates/agent-docs/database/advancedqueries.md +29 -0
- package/templates/agent-docs/database/querying.md +2 -0
- package/templates/agent-docs/deployment.md +3 -1
- package/templates/agent-docs/internationalization.md +237 -2
- package/templates/agent-docs/observability.md +9 -0
- package/templates/agent-docs/plugins.md +2 -2
- package/templates/agent-docs/reference.md +76 -0
- package/templates/agent-docs/schema-driven-ui.md +551 -2
- package/templates/agent-docs/templates/apibackends.md +10 -8
- package/templates/agent-docs/templates/overview.md +1 -1
- package/templates/agent-docs/testing.md +177 -3
- 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/README.md +9 -4
- package/templates/apps/api-rbac/mutations/notes.create.mutation.server.ts +1 -1
- package/templates/apps/api-rbac/mutations/notes.create.mutation.ts +6 -6
- package/templates/apps/api-rbac/package.json +8 -8
- package/templates/apps/api-rbac/tests/notes.create.test.ts +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
- package/dist/serveCommand-93rRdEp0.js +0 -1077
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { Xt as e, d as t, tt as n } from "./dev-CQxbrpDz.js";
|
|
2
|
+
import { isAbsolute as r, join as i, relative as a, resolve as o } from "node:path";
|
|
3
|
+
import { createLogger as s } from "@voltro/logger";
|
|
4
|
+
import { existsSync as c, promises as l } from "node:fs";
|
|
5
|
+
import { createRequire as u } from "node:module";
|
|
6
|
+
//#region src/apiBuild.ts
|
|
7
|
+
var d = s({ scope: "voltro:build" }), f = async (e) => {
|
|
8
|
+
let t = i(e, "package.json");
|
|
9
|
+
if (!c(t)) return [];
|
|
10
|
+
let r = {};
|
|
11
|
+
try {
|
|
12
|
+
let e = JSON.parse(await l.readFile(t, "utf8"));
|
|
13
|
+
r = {
|
|
14
|
+
...e.dependencies,
|
|
15
|
+
...e.devDependencies,
|
|
16
|
+
...e.optionalDependencies
|
|
17
|
+
};
|
|
18
|
+
} catch {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
let a = u(t);
|
|
22
|
+
return n.filter((e) => {
|
|
23
|
+
if (r[e] === void 0) return !1;
|
|
24
|
+
try {
|
|
25
|
+
return a.resolve(e), !0;
|
|
26
|
+
} catch {
|
|
27
|
+
return !1;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}, p = /(?:\.(?: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)$/, m = (e) => /\.(ts|tsx)$/.test(e) && !/\.(test|spec)\.[tj]sx?$/.test(e), h = async (e) => (await t(e)).filter((t) => p.test(t) && m(t) && !t.includes(`${e}/.framework/`)), g = {
|
|
31
|
+
name: "externalize-bare",
|
|
32
|
+
setup(e) {
|
|
33
|
+
e.onResolve({ filter: /.*/ }, (e) => {
|
|
34
|
+
let t = e.path;
|
|
35
|
+
if (!(t.startsWith(".") || r(t))) return {
|
|
36
|
+
path: t,
|
|
37
|
+
external: !0
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}, _ = async (t) => {
|
|
42
|
+
let n = await e("esbuild", () => import("esbuild")), r = i(t, ".framework"), s = i(r, "dist-api");
|
|
43
|
+
await l.mkdir(r, { recursive: !0 });
|
|
44
|
+
let u = [...await h(t)], f = i(t, "app.config.ts");
|
|
45
|
+
if (c(f) && u.push(f), u.length === 0) return d.warn("api build: no handlers or app.config found — nothing to precompile", { root: t }), null;
|
|
46
|
+
let p = i(t, "tsconfig.json"), _ = {
|
|
47
|
+
bundle: !0,
|
|
48
|
+
format: "esm",
|
|
49
|
+
platform: "node",
|
|
50
|
+
target: "node22",
|
|
51
|
+
logLevel: "silent",
|
|
52
|
+
jsx: "automatic",
|
|
53
|
+
jsxImportSource: "react",
|
|
54
|
+
absWorkingDir: t,
|
|
55
|
+
...c(p) ? { tsconfig: p } : {},
|
|
56
|
+
plugins: [g]
|
|
57
|
+
}, v = await n.build({
|
|
58
|
+
..._,
|
|
59
|
+
entryPoints: u,
|
|
60
|
+
write: !1,
|
|
61
|
+
metafile: !0,
|
|
62
|
+
outdir: s
|
|
63
|
+
}), y = Object.keys(v.metafile.inputs).map((e) => o(t, e)).filter((e) => e.startsWith(`${t}/`) && !e.includes("/node_modules/") && !e.includes("/.framework/") && m(e)), b = [
|
|
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
|
+
], x = [];
|
|
70
|
+
y.forEach((e, n) => {
|
|
71
|
+
b.push(`import * as m${n} from ${JSON.stringify(e)}`), x.push(` ${JSON.stringify(a(t, e))}: m${n},`);
|
|
72
|
+
}), b.push("", "export const modules: Record<string, unknown> = {", ...x, "}", "");
|
|
73
|
+
let S = i(r, "apiEntry.ts");
|
|
74
|
+
return await l.writeFile(S, b.join("\n"), "utf8"), await n.build({
|
|
75
|
+
..._,
|
|
76
|
+
entryPoints: [S],
|
|
77
|
+
outfile: i(s, "apiEntry.js"),
|
|
78
|
+
metafile: !1,
|
|
79
|
+
write: !0
|
|
80
|
+
}), d.info("api build: precompiled bundle written", {
|
|
81
|
+
modules: y.length,
|
|
82
|
+
out: i(".framework", "dist-api", "apiEntry.js")
|
|
83
|
+
}), i(s, "apiEntry.js");
|
|
84
|
+
}, v = (e) => i(e, ".framework", "dist-api", "apiEntry.js"), y = [
|
|
85
|
+
"better-sqlite3",
|
|
86
|
+
"pg-native",
|
|
87
|
+
"@tursodatabase/*",
|
|
88
|
+
"@libsql/*",
|
|
89
|
+
"@vlasky/zongji",
|
|
90
|
+
"ioredis",
|
|
91
|
+
"nodemailer"
|
|
92
|
+
], b = [
|
|
93
|
+
"tsx",
|
|
94
|
+
"esbuild",
|
|
95
|
+
"vite",
|
|
96
|
+
"@vitejs/*",
|
|
97
|
+
"@tailwindcss/*",
|
|
98
|
+
"rolldown",
|
|
99
|
+
"lightningcss"
|
|
100
|
+
], x = (e, t) => t.some((t) => t.endsWith("/*") ? e === t.slice(0, -2) || e.startsWith(t.slice(0, -1)) : e === t || e.startsWith(`${t}/`)), S = (e, t) => `const { createRequire } = require('node:module')
|
|
101
|
+
const { join } = require('node:path')
|
|
102
|
+
const reqApp = createRequire(join(process.cwd(), 'package.json'))
|
|
103
|
+
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`, C = (e, t, n) => ({
|
|
104
|
+
name: "native-leaf-runtime-resolver",
|
|
105
|
+
setup(a) {
|
|
106
|
+
a.onResolve({ filter: /.*/ }, (e) => {
|
|
107
|
+
let a = e.path;
|
|
108
|
+
if (!(a.startsWith(".") || r(a) || a.startsWith("node:"))) {
|
|
109
|
+
if (x(a, y)) return {
|
|
110
|
+
path: a,
|
|
111
|
+
namespace: "native-leaf"
|
|
112
|
+
};
|
|
113
|
+
if (x(a, b)) return {
|
|
114
|
+
path: a,
|
|
115
|
+
external: !0
|
|
116
|
+
};
|
|
117
|
+
for (let n of [e.resolveDir, t]) if (n) try {
|
|
118
|
+
u(i(n, "_.js")).resolve(a);
|
|
119
|
+
return;
|
|
120
|
+
} catch {}
|
|
121
|
+
return n.add(a), {
|
|
122
|
+
path: a,
|
|
123
|
+
external: !0
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}), a.onLoad({
|
|
127
|
+
filter: /.*/,
|
|
128
|
+
namespace: "native-leaf"
|
|
129
|
+
}, (t) => ({
|
|
130
|
+
contents: S(t.path, e),
|
|
131
|
+
loader: "js"
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
}), w = (e) => i(e, ".framework", "dist-api", "serveBundle", "serveEntry.js"), T = async (t) => {
|
|
135
|
+
let n = await e("esbuild", () => import("esbuild")), r = i(t, ".framework"), s = i(r, "dist-api", "serveBundle");
|
|
136
|
+
await l.mkdir(r, { recursive: !0 });
|
|
137
|
+
let u = [...await h(t)], p = i(t, "app.config.ts");
|
|
138
|
+
if (c(p) && u.push(p), u.length === 0) return null;
|
|
139
|
+
let _ = i(t, "tsconfig.json"), v = await n.build({
|
|
140
|
+
entryPoints: u,
|
|
141
|
+
bundle: !0,
|
|
142
|
+
write: !1,
|
|
143
|
+
metafile: !0,
|
|
144
|
+
format: "esm",
|
|
145
|
+
platform: "node",
|
|
146
|
+
absWorkingDir: t,
|
|
147
|
+
jsx: "automatic",
|
|
148
|
+
jsxImportSource: "react",
|
|
149
|
+
logLevel: "silent",
|
|
150
|
+
plugins: [g],
|
|
151
|
+
outdir: i(s, ".probe"),
|
|
152
|
+
...c(_) ? { tsconfig: _ } : {}
|
|
153
|
+
}), y = Object.keys(v.metafile.inputs).map((e) => o(t, e)).filter((e) => e.startsWith(`${t}/`) && !e.includes("/node_modules/") && !e.includes("/.framework/") && m(e)), b = await f(t), x = /* @__PURE__ */ new Set(), S = [
|
|
154
|
+
"// GENERATED BY `voltro build` — do not edit; overwritten on next build.",
|
|
155
|
+
"import { join as __join } from 'node:path'",
|
|
156
|
+
"import { runServe as __runServe, registerAppModules, registerDriver, loadDotEnv } from '@voltro/cli/serveEntry'",
|
|
157
|
+
...b.map((e, t) => `import * as __drv${t} from ${JSON.stringify(e)}`),
|
|
158
|
+
"const __root = process.cwd()",
|
|
159
|
+
"registerAppModules({",
|
|
160
|
+
...y.map((e) => ` [__join(__root, ${JSON.stringify(a(t, e))})]: () => import(${JSON.stringify(e)}),`),
|
|
161
|
+
"})",
|
|
162
|
+
...b.map((e, t) => `registerDriver(${JSON.stringify(e)}, __drv${t})`),
|
|
163
|
+
"export const runServe = (args = []) => { loadDotEnv([]); return __runServe(args) }",
|
|
164
|
+
""
|
|
165
|
+
], w = i(r, "serveEntry.ts");
|
|
166
|
+
return await l.writeFile(w, S.join("\n"), "utf8"), await n.build({
|
|
167
|
+
entryPoints: [w],
|
|
168
|
+
bundle: !0,
|
|
169
|
+
format: "esm",
|
|
170
|
+
platform: "node",
|
|
171
|
+
target: "node22",
|
|
172
|
+
outdir: s,
|
|
173
|
+
splitting: !0,
|
|
174
|
+
write: !0,
|
|
175
|
+
plugins: [C(b, t, x)],
|
|
176
|
+
banner: { js: "import { createRequire as __voltroRequire } from 'node:module'; const require = __voltroRequire(import.meta.url);" },
|
|
177
|
+
jsx: "automatic",
|
|
178
|
+
jsxImportSource: "react",
|
|
179
|
+
logLevel: "silent",
|
|
180
|
+
absWorkingDir: t,
|
|
181
|
+
...c(_) ? { tsconfig: _ } : {}
|
|
182
|
+
}), d.info("api build: serve bundle written", {
|
|
183
|
+
appModules: y.length,
|
|
184
|
+
drivers: b.length > 0 ? b.join(", ") : "none (memory)",
|
|
185
|
+
...x.size > 0 ? { externalizedOptionalPeers: [...x].join(", ") } : {},
|
|
186
|
+
out: i(".framework", "dist-api", "serveBundle", "serveEntry.js")
|
|
187
|
+
}), i(s, "serveEntry.js");
|
|
188
|
+
};
|
|
189
|
+
//#endregion
|
|
190
|
+
export { w as a, T as i, h as n, _ as r, v as t };
|
package/dist/bin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import { n as t } from "./commands-
|
|
2
|
+
import { jt as e } from "./dev-CQxbrpDz.js";
|
|
3
|
+
import { n as t } from "./commands-DhyBIs1O.js";
|
|
4
4
|
import { createLogger as n } from "@voltro/logger";
|
|
5
5
|
//#region src/bin.ts
|
|
6
6
|
var r = n({ scope: "voltro:cli" }), i = process.argv.slice(2);
|