@lukoweb/apitogo 0.1.9 → 0.1.11
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/cli/cli.js +1 -1
- package/package.json +1 -1
- package/src/config/loader.ts +7 -4
- package/src/vite/build.ts +9 -3
- package/src/vite/llms.ts +8 -4
- package/src/vite/prerender/prerender.ts +18 -11
package/dist/cli/cli.js
CHANGED
package/package.json
CHANGED
package/src/config/loader.ts
CHANGED
|
@@ -212,10 +212,13 @@ export async function loadZudokuConfig(
|
|
|
212
212
|
const loadedConfig = await loadZudokuConfigWithMeta(rootDir);
|
|
213
213
|
config = await runPluginTransformConfig(loadedConfig);
|
|
214
214
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
215
|
+
if (!process.env.APITOGO_JSON_ONLY) {
|
|
216
|
+
logger.info(
|
|
217
|
+
colors.cyan(`loaded config file `) +
|
|
218
|
+
colors.dim(config.__meta.configPath),
|
|
219
|
+
{ timestamp: true },
|
|
220
|
+
);
|
|
221
|
+
}
|
|
219
222
|
|
|
220
223
|
return { config, envPrefix, publicEnv };
|
|
221
224
|
} catch (error) {
|
package/src/vite/build.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { build as esbuild } from "esbuild";
|
|
4
4
|
import type { Rollup } from "vite";
|
|
5
|
-
import { build as viteBuild } from "vite";
|
|
5
|
+
import { build as viteBuild, mergeConfig } from "vite";
|
|
6
6
|
import { ZuploEnv } from "../app/env.js";
|
|
7
7
|
import { getZudokuRootDir } from "../cli/common/package-json.js";
|
|
8
8
|
import {
|
|
@@ -38,10 +38,12 @@ export type BuildOptions = {
|
|
|
38
38
|
dir: string;
|
|
39
39
|
ssr?: boolean;
|
|
40
40
|
adapter?: "node" | "cloudflare" | "vercel";
|
|
41
|
+
/** Suppress Vite build table and most build logs (used with `apitogo deploy --json-only`). */
|
|
42
|
+
jsonOnly?: boolean;
|
|
41
43
|
};
|
|
42
44
|
|
|
43
45
|
export async function runBuild(options: BuildOptions) {
|
|
44
|
-
const { dir, ssr, adapter = "node" } = options;
|
|
46
|
+
const { dir, ssr, adapter = "node", jsonOnly = false } = options;
|
|
45
47
|
|
|
46
48
|
// Build client and server bundles
|
|
47
49
|
const viteClientConfig = await getViteConfig(dir, {
|
|
@@ -54,7 +56,11 @@ export async function runBuild(options: BuildOptions) {
|
|
|
54
56
|
isSsrBuild: true,
|
|
55
57
|
});
|
|
56
58
|
|
|
57
|
-
const clientResult = await viteBuild(
|
|
59
|
+
const clientResult = await viteBuild(
|
|
60
|
+
jsonOnly
|
|
61
|
+
? mergeConfig(viteClientConfig, { logLevel: "silent" as const })
|
|
62
|
+
: viteClientConfig,
|
|
63
|
+
);
|
|
58
64
|
const serverResult = await viteBuild({
|
|
59
65
|
...viteServerConfig,
|
|
60
66
|
logLevel: "silent",
|
package/src/vite/llms.ts
CHANGED
|
@@ -60,8 +60,10 @@ export async function generateLlmsTxtFiles({
|
|
|
60
60
|
const llmsTxt = llmsTxtParts.join("\n");
|
|
61
61
|
await writeFile(path.join(baseOutputDir, "llms.txt"), llmsTxt, "utf-8");
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
if (process.env.APITOGO_JSON_ONLY !== "1") {
|
|
64
|
+
// biome-ignore lint/suspicious/noConsole: Logging allowed here
|
|
65
|
+
console.log(colors.blue("✓ generated llms.txt"));
|
|
66
|
+
}
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
// Generate llms-full.txt (full content of all markdown documents)
|
|
@@ -89,7 +91,9 @@ export async function generateLlmsTxtFiles({
|
|
|
89
91
|
"utf-8",
|
|
90
92
|
);
|
|
91
93
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
if (process.env.APITOGO_JSON_ONLY !== "1") {
|
|
95
|
+
// biome-ignore lint/suspicious/noConsole: Allowed here
|
|
96
|
+
console.log(colors.blue("✓ generated llms-full.txt"));
|
|
97
|
+
}
|
|
94
98
|
}
|
|
95
99
|
}
|
|
@@ -91,13 +91,16 @@ export const prerender = async ({
|
|
|
91
91
|
const LOG_INTERVAL_MS = 30_000; // Log every 30 seconds
|
|
92
92
|
let lastLogTime = start;
|
|
93
93
|
|
|
94
|
+
const quietDeployJson = process.env.APITOGO_JSON_ONLY === "1";
|
|
95
|
+
|
|
94
96
|
const writeProgress = throttle(
|
|
95
97
|
(count: number, total: number, urlPath: string) => {
|
|
98
|
+
if (quietDeployJson) return;
|
|
96
99
|
writeLine(`prerendering (${count}/${total}) ${colors.dim(urlPath)}`);
|
|
97
100
|
},
|
|
98
101
|
);
|
|
99
102
|
|
|
100
|
-
if (!isTTY()) {
|
|
103
|
+
if (!isTTY() && !quietDeployJson) {
|
|
101
104
|
logger.info(
|
|
102
105
|
colors.dim(
|
|
103
106
|
`prerendering ${paths.length} routes using ${maxThreads} workers...`,
|
|
@@ -143,7 +146,9 @@ export const prerender = async ({
|
|
|
143
146
|
|
|
144
147
|
completedCount++;
|
|
145
148
|
|
|
146
|
-
if (
|
|
149
|
+
if (quietDeployJson) {
|
|
150
|
+
// no progress output
|
|
151
|
+
} else if (isTTY()) {
|
|
147
152
|
writeProgress(completedCount, paths.length, urlPath);
|
|
148
153
|
} else {
|
|
149
154
|
const now = performance.now();
|
|
@@ -168,15 +173,17 @@ export const prerender = async ({
|
|
|
168
173
|
|
|
169
174
|
const message = `✓ finished prerendering ${paths.length} routes in ${seconds} seconds using ${maxThreads} workers`;
|
|
170
175
|
|
|
171
|
-
if (
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
if (!quietDeployJson) {
|
|
177
|
+
if (isTTY()) {
|
|
178
|
+
writeLine(colors.blue(`${message}\n`));
|
|
179
|
+
} else {
|
|
180
|
+
logger.info(colors.blue(message));
|
|
181
|
+
}
|
|
182
|
+
if (pagefindWriteResult?.outputPath) {
|
|
183
|
+
logger.info(
|
|
184
|
+
colors.blue(`✓ pagefind index built: ${pagefindWriteResult.outputPath}`),
|
|
185
|
+
);
|
|
186
|
+
}
|
|
180
187
|
}
|
|
181
188
|
|
|
182
189
|
const redirectUrls = getRedirectUrls(workerResults, config.basePath);
|