@docubook/flame 1.6.6 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docu/lib/build.deno.js +3 -3
- package/.docu/lib/{build.impl-EV3EJRZ3.js → build.impl-TUVHCOIP.js} +3 -3
- package/.docu/lib/build.node.js +3 -3
- package/.docu/lib/{chunk-VW7B64WE.js → chunk-B6LGUADD.js} +1 -1
- package/.docu/lib/{chunk-DXFKHOTN.js → chunk-ICNXW4Z4.js} +2 -2
- package/.docu/lib/{chunk-GHM253YH.js → chunk-PFXUCD2U.js} +1 -1
- package/.docu/lib/{chunk-7IXQY2KM.js → chunk-QL6TQV3S.js} +63 -9
- package/.docu/lib/{chunk-PIL6YLLW.js → chunk-QPO4DS5F.js} +2 -2
- package/.docu/lib/{chunk-BWZFBPBP.js → chunk-XMIEMHTQ.js} +1 -1
- package/.docu/lib/clean.js +1 -1
- package/.docu/lib/deploy.deno.js +1 -1
- package/.docu/lib/deploy.node.js +1 -1
- package/.docu/lib/preview.deno.js +2 -2
- package/.docu/lib/preview.node.js +2 -2
- package/.docu/lib/server.deno.js +3 -3
- package/.docu/lib/server.node.js +3 -3
- package/.docu/node/deploy.shared.ts +66 -9
- package/.docu/node/deploy.ts +65 -8
- package/.docu/node/hydrate.node.ts +1 -1
- package/.docu/node/hydrate.ts +1 -1
- package/bin/cli.js +4 -1
- package/package.json +3 -3
package/.docu/lib/build.deno.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runBuildCli
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-ICNXW4Z4.js";
|
|
4
|
+
import "./chunk-B6LGUADD.js";
|
|
5
5
|
import "./chunk-EOK6KATZ.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-PFXUCD2U.js";
|
|
7
7
|
import "./chunk-4IQXHHPF.js";
|
|
8
8
|
|
|
9
9
|
// .docu/node/build.deno.ts
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runBuild,
|
|
3
3
|
runBuildCli
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-ICNXW4Z4.js";
|
|
5
|
+
import "./chunk-B6LGUADD.js";
|
|
6
6
|
import "./chunk-EOK6KATZ.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-PFXUCD2U.js";
|
|
8
8
|
import "./chunk-4IQXHHPF.js";
|
|
9
9
|
export {
|
|
10
10
|
runBuild,
|
package/.docu/lib/build.node.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runBuildCli
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-ICNXW4Z4.js";
|
|
4
|
+
import "./chunk-B6LGUADD.js";
|
|
5
5
|
import "./chunk-EOK6KATZ.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-PFXUCD2U.js";
|
|
7
7
|
import "./chunk-4IQXHHPF.js";
|
|
8
8
|
|
|
9
9
|
// .docu/node/build.node.ts
|
|
@@ -717,7 +717,7 @@ function tailwindCacheKey() {
|
|
|
717
717
|
}
|
|
718
718
|
} catch {
|
|
719
719
|
}
|
|
720
|
-
return createHash("
|
|
720
|
+
return createHash("sha256").update(globalsContent + themeSuffix).digest("hex").slice(0, 16);
|
|
721
721
|
}
|
|
722
722
|
async function buildTailwindCss(key) {
|
|
723
723
|
const cachedFile = `client-${key}.css`;
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
htmlShell,
|
|
14
14
|
initSentry,
|
|
15
15
|
loadPlugins
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-B6LGUADD.js";
|
|
17
17
|
import {
|
|
18
18
|
cspHeader,
|
|
19
19
|
generateNonce,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
} from "./chunk-EOK6KATZ.js";
|
|
22
22
|
import {
|
|
23
23
|
logger
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-PFXUCD2U.js";
|
|
25
25
|
import {
|
|
26
26
|
ASSETS_DIR,
|
|
27
27
|
CACHE_FILE,
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DIST_DIR,
|
|
3
|
+
FRAMEWORK_ROOT,
|
|
3
4
|
PROJECT_ROOT
|
|
4
5
|
} from "./chunk-4IQXHHPF.js";
|
|
5
6
|
|
|
6
7
|
// .docu/node/deploy.shared.ts
|
|
7
8
|
import { writeFile, mkdir } from "node:fs/promises";
|
|
8
|
-
import { existsSync } from "node:fs";
|
|
9
|
-
import { join } from "node:path";
|
|
9
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
10
|
+
import { join, resolve } from "node:path";
|
|
11
|
+
var FLAME_MAJOR = JSON.parse(
|
|
12
|
+
readFileSync(resolve(FRAMEWORK_ROOT, "package.json"), "utf-8")
|
|
13
|
+
).version.split(".")[0];
|
|
10
14
|
var WORKFLOW_DIR = join(PROJECT_ROOT, ".github/workflows");
|
|
11
15
|
var WORKFLOW_FILE = join(WORKFLOW_DIR, "deploy.yml");
|
|
12
16
|
var NGINX_CONF = `server {
|
|
@@ -116,6 +120,7 @@ var HEADERS_FILE = `/*
|
|
|
116
120
|
`;
|
|
117
121
|
var isDocker = !!process.env.FLAME_DEPLOY_DOCKER;
|
|
118
122
|
var isSilent = !!process.env.FLAME_DEPLOY_SILENT;
|
|
123
|
+
var isCi = !!process.env.FLAME_DEPLOY_CI;
|
|
119
124
|
var log = isSilent ? { info: () => {
|
|
120
125
|
}, ok: () => {
|
|
121
126
|
}, created: () => {
|
|
@@ -132,22 +137,19 @@ async function runBuild() {
|
|
|
132
137
|
process.env.FLAME_BUILD_SILENT = "1";
|
|
133
138
|
process.env.LOG_LEVEL = "error";
|
|
134
139
|
}
|
|
135
|
-
const { runBuildCli } = await import("./build.impl-
|
|
140
|
+
const { runBuildCli } = await import("./build.impl-TUVHCOIP.js");
|
|
136
141
|
await runBuildCli();
|
|
137
142
|
}
|
|
138
143
|
async function writeDockerFiles() {
|
|
139
144
|
const dockerDir = PROJECT_ROOT;
|
|
140
|
-
const pm = detectPkgManager(dockerDir);
|
|
141
145
|
if (!existsSync(join(dockerDir, "Dockerfile"))) {
|
|
142
146
|
await writeFile(
|
|
143
147
|
join(dockerDir, "Dockerfile"),
|
|
144
|
-
`FROM
|
|
148
|
+
`FROM ghcr.io/docubook/flame-builder:${FLAME_MAJOR} AS builder
|
|
145
149
|
ENV NODE_ENV=production
|
|
146
150
|
WORKDIR /app
|
|
147
|
-
COPY package.json ${pm.lockFile} ./
|
|
148
|
-
RUN ${pm.installCmd}
|
|
149
151
|
COPY . .
|
|
150
|
-
RUN
|
|
152
|
+
RUN flame build
|
|
151
153
|
|
|
152
154
|
FROM nginx:alpine
|
|
153
155
|
COPY --from=builder /app/.docu/dist /usr/share/nginx/html
|
|
@@ -245,6 +247,43 @@ function generateWorkflowYml() {
|
|
|
245
247
|
" uses: actions/deploy-pages@v4"
|
|
246
248
|
].join("\n");
|
|
247
249
|
}
|
|
250
|
+
function generateDockerWorkflowYml() {
|
|
251
|
+
const imageName = "ghcr.io/${{ github.repository }}";
|
|
252
|
+
return [
|
|
253
|
+
`name: Build & Push Docker Image`,
|
|
254
|
+
"",
|
|
255
|
+
"on:",
|
|
256
|
+
" push:",
|
|
257
|
+
" branches: [main]",
|
|
258
|
+
" workflow_dispatch:",
|
|
259
|
+
"",
|
|
260
|
+
"permissions:",
|
|
261
|
+
" contents: read",
|
|
262
|
+
" packages: write",
|
|
263
|
+
"",
|
|
264
|
+
"jobs:",
|
|
265
|
+
" build:",
|
|
266
|
+
" runs-on: ubuntu-latest",
|
|
267
|
+
" steps:",
|
|
268
|
+
" - uses: actions/checkout@v4",
|
|
269
|
+
" with:",
|
|
270
|
+
" fetch-depth: 0",
|
|
271
|
+
"",
|
|
272
|
+
" - name: Log in to GHCR",
|
|
273
|
+
" uses: docker/login-action@v3",
|
|
274
|
+
" with:",
|
|
275
|
+
" registry: ghcr.io",
|
|
276
|
+
" username: ${{ github.actor }}",
|
|
277
|
+
" password: ${{ secrets.GITHUB_TOKEN }}",
|
|
278
|
+
"",
|
|
279
|
+
" - name: Build & push",
|
|
280
|
+
" uses: docker/build-push-action@v5",
|
|
281
|
+
" with:",
|
|
282
|
+
" context: .",
|
|
283
|
+
` tags: ${imageName}:latest`,
|
|
284
|
+
" push: true"
|
|
285
|
+
].join("\n");
|
|
286
|
+
}
|
|
248
287
|
async function writeGhaWorkflow() {
|
|
249
288
|
if (!existsSync(WORKFLOW_FILE)) {
|
|
250
289
|
await mkdir(WORKFLOW_DIR, { recursive: true });
|
|
@@ -252,6 +291,14 @@ async function writeGhaWorkflow() {
|
|
|
252
291
|
log.created("\u{1F4C4} Created .github/workflows/deploy.yml");
|
|
253
292
|
}
|
|
254
293
|
}
|
|
294
|
+
var DOCKER_WORKFLOW_FILE = join(WORKFLOW_DIR, "deploy-docker.yml");
|
|
295
|
+
async function writeDockerWorkflow() {
|
|
296
|
+
if (!existsSync(DOCKER_WORKFLOW_FILE)) {
|
|
297
|
+
await mkdir(WORKFLOW_DIR, { recursive: true });
|
|
298
|
+
await writeFile(DOCKER_WORKFLOW_FILE, generateDockerWorkflowYml());
|
|
299
|
+
log.created("\u{1F4C4} Created .github/workflows/deploy-docker.yml");
|
|
300
|
+
}
|
|
301
|
+
}
|
|
255
302
|
async function runDeploy() {
|
|
256
303
|
log.info("\u{1F4E6} Building for production...\n");
|
|
257
304
|
await runBuild();
|
|
@@ -259,13 +306,20 @@ async function runDeploy() {
|
|
|
259
306
|
await writeFile(join(DIST_DIR, "_headers"), HEADERS_FILE);
|
|
260
307
|
if (isDocker) {
|
|
261
308
|
await writeDockerFiles();
|
|
309
|
+
if (isCi) await writeDockerWorkflow();
|
|
262
310
|
} else {
|
|
263
311
|
await writeGhaWorkflow();
|
|
264
312
|
}
|
|
265
313
|
log.ok();
|
|
266
314
|
log.out(" Output: .docu/dist/");
|
|
267
315
|
if (isDocker) {
|
|
268
|
-
log.out("
|
|
316
|
+
log.out(" Build locally: docker build -t my-docs . && docker run -p 80:80 my-docs");
|
|
317
|
+
if (isCi) {
|
|
318
|
+
log.out(" Push to GitHub \u2014 CI will build & push Docker image to GHCR");
|
|
319
|
+
log.out(" Then pull latest image on your hosting platform (Coolify, etc.)");
|
|
320
|
+
} else {
|
|
321
|
+
log.out(" For Coolify: connect repo, set build pack to Dockerfile");
|
|
322
|
+
}
|
|
269
323
|
} else {
|
|
270
324
|
log.out(" Push to GitHub and enable Pages (Settings \u2192 Pages \u2192 Source: GitHub Actions)");
|
|
271
325
|
}
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
htmlShell,
|
|
15
15
|
initSentry,
|
|
16
16
|
loadPlugins
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-B6LGUADD.js";
|
|
18
18
|
import {
|
|
19
19
|
SECURITY_HEADERS,
|
|
20
20
|
generateNonce,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
} from "./chunk-EOK6KATZ.js";
|
|
28
28
|
import {
|
|
29
29
|
logger
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-PFXUCD2U.js";
|
|
31
31
|
import {
|
|
32
32
|
DIST_DIR,
|
|
33
33
|
DOCS_DIR,
|
package/.docu/lib/clean.js
CHANGED
package/.docu/lib/deploy.deno.js
CHANGED
package/.docu/lib/deploy.node.js
CHANGED
package/.docu/lib/server.deno.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runServer
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-QPO4DS5F.js";
|
|
4
|
+
import "./chunk-B6LGUADD.js";
|
|
5
5
|
import "./chunk-EOK6KATZ.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-PFXUCD2U.js";
|
|
7
7
|
import "./chunk-4IQXHHPF.js";
|
|
8
8
|
|
|
9
9
|
// .docu/node/server.deno.ts
|
package/.docu/lib/server.node.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runServer
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-QPO4DS5F.js";
|
|
4
|
+
import "./chunk-B6LGUADD.js";
|
|
5
5
|
import "./chunk-EOK6KATZ.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-PFXUCD2U.js";
|
|
7
7
|
import "./chunk-4IQXHHPF.js";
|
|
8
8
|
|
|
9
9
|
// .docu/node/server.node.ts
|
|
@@ -9,9 +9,13 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { writeFile, mkdir } from "node:fs/promises";
|
|
12
|
-
import { existsSync } from "node:fs";
|
|
13
|
-
import { join } from "node:path";
|
|
14
|
-
import { DIST_DIR, PROJECT_ROOT } from "./paths";
|
|
12
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
13
|
+
import { join, resolve } from "node:path";
|
|
14
|
+
import { DIST_DIR, PROJECT_ROOT, FRAMEWORK_ROOT } from "./paths";
|
|
15
|
+
|
|
16
|
+
const FLAME_MAJOR = JSON.parse(
|
|
17
|
+
readFileSync(resolve(FRAMEWORK_ROOT, "package.json"), "utf-8")
|
|
18
|
+
).version.split(".")[0];
|
|
15
19
|
|
|
16
20
|
const WORKFLOW_DIR = join(PROJECT_ROOT, ".github/workflows");
|
|
17
21
|
const WORKFLOW_FILE = join(WORKFLOW_DIR, "deploy.yml");
|
|
@@ -139,6 +143,7 @@ export const HEADERS_FILE = `/*
|
|
|
139
143
|
|
|
140
144
|
const isDocker = !!process.env.FLAME_DEPLOY_DOCKER;
|
|
141
145
|
const isSilent = !!process.env.FLAME_DEPLOY_SILENT;
|
|
146
|
+
const isCi = !!process.env.FLAME_DEPLOY_CI;
|
|
142
147
|
|
|
143
148
|
/** Logger that no-ops all non-error output in silent mode. */
|
|
144
149
|
const log = isSilent
|
|
@@ -162,18 +167,15 @@ async function runBuild() {
|
|
|
162
167
|
|
|
163
168
|
async function writeDockerFiles() {
|
|
164
169
|
const dockerDir = PROJECT_ROOT;
|
|
165
|
-
const pm = detectPkgManager(dockerDir);
|
|
166
170
|
|
|
167
171
|
if (!existsSync(join(dockerDir, "Dockerfile"))) {
|
|
168
172
|
await writeFile(
|
|
169
173
|
join(dockerDir, "Dockerfile"),
|
|
170
|
-
`FROM
|
|
174
|
+
`FROM ghcr.io/docubook/flame-builder:${FLAME_MAJOR} AS builder
|
|
171
175
|
ENV NODE_ENV=production
|
|
172
176
|
WORKDIR /app
|
|
173
|
-
COPY package.json ${pm.lockFile} ./
|
|
174
|
-
RUN ${pm.installCmd}
|
|
175
177
|
COPY . .
|
|
176
|
-
RUN
|
|
178
|
+
RUN flame build
|
|
177
179
|
|
|
178
180
|
FROM nginx:alpine
|
|
179
181
|
COPY --from=builder /app/.docu/dist /usr/share/nginx/html
|
|
@@ -279,6 +281,44 @@ function generateWorkflowYml(): string {
|
|
|
279
281
|
].join("\n");
|
|
280
282
|
}
|
|
281
283
|
|
|
284
|
+
function generateDockerWorkflowYml(): string {
|
|
285
|
+
const imageName = "ghcr.io/${{ github.repository }}";
|
|
286
|
+
return [
|
|
287
|
+
`name: Build & Push Docker Image`,
|
|
288
|
+
"",
|
|
289
|
+
"on:",
|
|
290
|
+
" push:",
|
|
291
|
+
" branches: [main]",
|
|
292
|
+
" workflow_dispatch:",
|
|
293
|
+
"",
|
|
294
|
+
"permissions:",
|
|
295
|
+
" contents: read",
|
|
296
|
+
" packages: write",
|
|
297
|
+
"",
|
|
298
|
+
"jobs:",
|
|
299
|
+
" build:",
|
|
300
|
+
" runs-on: ubuntu-latest",
|
|
301
|
+
" steps:",
|
|
302
|
+
" - uses: actions/checkout@v4",
|
|
303
|
+
" with:",
|
|
304
|
+
" fetch-depth: 0",
|
|
305
|
+
"",
|
|
306
|
+
" - name: Log in to GHCR",
|
|
307
|
+
" uses: docker/login-action@v3",
|
|
308
|
+
" with:",
|
|
309
|
+
" registry: ghcr.io",
|
|
310
|
+
" username: ${{ github.actor }}",
|
|
311
|
+
" password: ${{ secrets.GITHUB_TOKEN }}",
|
|
312
|
+
"",
|
|
313
|
+
" - name: Build & push",
|
|
314
|
+
" uses: docker/build-push-action@v5",
|
|
315
|
+
" with:",
|
|
316
|
+
" context: .",
|
|
317
|
+
` tags: ${imageName}:latest`,
|
|
318
|
+
" push: true",
|
|
319
|
+
].join("\n");
|
|
320
|
+
}
|
|
321
|
+
|
|
282
322
|
async function writeGhaWorkflow() {
|
|
283
323
|
if (!existsSync(WORKFLOW_FILE)) {
|
|
284
324
|
await mkdir(WORKFLOW_DIR, { recursive: true });
|
|
@@ -287,6 +327,16 @@ async function writeGhaWorkflow() {
|
|
|
287
327
|
}
|
|
288
328
|
}
|
|
289
329
|
|
|
330
|
+
const DOCKER_WORKFLOW_FILE = join(WORKFLOW_DIR, "deploy-docker.yml");
|
|
331
|
+
|
|
332
|
+
async function writeDockerWorkflow() {
|
|
333
|
+
if (!existsSync(DOCKER_WORKFLOW_FILE)) {
|
|
334
|
+
await mkdir(WORKFLOW_DIR, { recursive: true });
|
|
335
|
+
await writeFile(DOCKER_WORKFLOW_FILE, generateDockerWorkflowYml());
|
|
336
|
+
log.created("📄 Created .github/workflows/deploy-docker.yml");
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
290
340
|
export async function runDeploy(): Promise<void> {
|
|
291
341
|
log.info("📦 Building for production...\n");
|
|
292
342
|
await runBuild();
|
|
@@ -297,6 +347,7 @@ export async function runDeploy(): Promise<void> {
|
|
|
297
347
|
|
|
298
348
|
if (isDocker) {
|
|
299
349
|
await writeDockerFiles();
|
|
350
|
+
if (isCi) await writeDockerWorkflow();
|
|
300
351
|
} else {
|
|
301
352
|
await writeGhaWorkflow();
|
|
302
353
|
}
|
|
@@ -304,7 +355,13 @@ export async function runDeploy(): Promise<void> {
|
|
|
304
355
|
log.ok();
|
|
305
356
|
log.out(" Output: .docu/dist/");
|
|
306
357
|
if (isDocker) {
|
|
307
|
-
log.out("
|
|
358
|
+
log.out(" Build locally: docker build -t my-docs . && docker run -p 80:80 my-docs");
|
|
359
|
+
if (isCi) {
|
|
360
|
+
log.out(" Push to GitHub — CI will build & push Docker image to GHCR");
|
|
361
|
+
log.out(" Then pull latest image on your hosting platform (Coolify, etc.)");
|
|
362
|
+
} else {
|
|
363
|
+
log.out(" For Coolify: connect repo, set build pack to Dockerfile");
|
|
364
|
+
}
|
|
308
365
|
} else {
|
|
309
366
|
log.out(" Push to GitHub and enable Pages (Settings → Pages → Source: GitHub Actions)");
|
|
310
367
|
}
|
package/.docu/node/deploy.ts
CHANGED
|
@@ -8,18 +8,24 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { mkdir } from "node:fs/promises";
|
|
11
|
-
import { existsSync } from "node:fs";
|
|
12
|
-
import { join } from "node:path";
|
|
13
|
-
import { DIST_DIR, PROJECT_ROOT } from "./paths";
|
|
11
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
12
|
+
import { join, resolve } from "node:path";
|
|
13
|
+
import { DIST_DIR, PROJECT_ROOT, FRAMEWORK_ROOT } from "./paths";
|
|
14
14
|
import { HEADERS_FILE, NGINX_CONF, DOCKERIGNORE } from "./deploy.shared";
|
|
15
15
|
|
|
16
|
+
const FLAME_PKG = JSON.parse(readFileSync(resolve(FRAMEWORK_ROOT, "package.json"), "utf-8"));
|
|
17
|
+
const FLAME_VERSION = FLAME_PKG.version;
|
|
18
|
+
const FLAME_MAJOR = FLAME_VERSION.split(".")[0];
|
|
19
|
+
|
|
16
20
|
export { HEADERS_FILE, NGINX_CONF, DOCKERIGNORE };
|
|
17
21
|
|
|
18
22
|
const WORKFLOW_DIR = join(PROJECT_ROOT, ".github/workflows");
|
|
19
23
|
const WORKFLOW_FILE = join(WORKFLOW_DIR, "deploy.yml");
|
|
24
|
+
const DOCKER_WORKFLOW_FILE = join(WORKFLOW_DIR, "deploy-docker.yml");
|
|
20
25
|
|
|
21
26
|
const isDocker = !!process.env.FLAME_DEPLOY_DOCKER;
|
|
22
27
|
const isSilent = !!process.env.FLAME_DEPLOY_SILENT;
|
|
28
|
+
const isCi = !!process.env.FLAME_DEPLOY_CI;
|
|
23
29
|
|
|
24
30
|
/** Logger that no-ops all non-error output in silent mode. */
|
|
25
31
|
const log = isSilent
|
|
@@ -43,13 +49,11 @@ async function runBuild() {
|
|
|
43
49
|
}
|
|
44
50
|
}
|
|
45
51
|
|
|
46
|
-
export const DOCKERFILE_BUN = `FROM
|
|
52
|
+
export const DOCKERFILE_BUN = `FROM ghcr.io/docubook/flame-builder:${FLAME_MAJOR} AS builder
|
|
47
53
|
ENV NODE_ENV=production
|
|
48
54
|
WORKDIR /app
|
|
49
|
-
COPY package.json bun.lock ./
|
|
50
|
-
RUN bun install --frozen-lockfile
|
|
51
55
|
COPY . .
|
|
52
|
-
RUN
|
|
56
|
+
RUN flame build
|
|
53
57
|
|
|
54
58
|
FROM nginx:alpine
|
|
55
59
|
COPY --from=builder /app/.docu/dist /usr/share/nginx/html
|
|
@@ -85,6 +89,52 @@ async function writeGhaWorkflow() {
|
|
|
85
89
|
}
|
|
86
90
|
}
|
|
87
91
|
|
|
92
|
+
function generateDockerWorkflowYml(): string {
|
|
93
|
+
const imageName = "ghcr.io/${{ github.repository }}";
|
|
94
|
+
return [
|
|
95
|
+
`name: Build & Push Docker Image`,
|
|
96
|
+
"",
|
|
97
|
+
"on:",
|
|
98
|
+
" push:",
|
|
99
|
+
" branches: [main]",
|
|
100
|
+
" workflow_dispatch:",
|
|
101
|
+
"",
|
|
102
|
+
"permissions:",
|
|
103
|
+
" contents: read",
|
|
104
|
+
" packages: write",
|
|
105
|
+
"",
|
|
106
|
+
"jobs:",
|
|
107
|
+
" build:",
|
|
108
|
+
" runs-on: ubuntu-latest",
|
|
109
|
+
" steps:",
|
|
110
|
+
" - uses: actions/checkout@v4",
|
|
111
|
+
" with:",
|
|
112
|
+
" fetch-depth: 0",
|
|
113
|
+
"",
|
|
114
|
+
" - name: Log in to GHCR",
|
|
115
|
+
" uses: docker/login-action@v3",
|
|
116
|
+
" with:",
|
|
117
|
+
" registry: ghcr.io",
|
|
118
|
+
" username: ${{ github.actor }}",
|
|
119
|
+
" password: ${{ secrets.GITHUB_TOKEN }}",
|
|
120
|
+
"",
|
|
121
|
+
" - name: Build & push",
|
|
122
|
+
" uses: docker/build-push-action@v5",
|
|
123
|
+
" with:",
|
|
124
|
+
" context: .",
|
|
125
|
+
` tags: ${imageName}:latest`,
|
|
126
|
+
" push: true",
|
|
127
|
+
].join("\n");
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
async function writeDockerWorkflow() {
|
|
131
|
+
if (!existsSync(DOCKER_WORKFLOW_FILE)) {
|
|
132
|
+
await mkdir(WORKFLOW_DIR, { recursive: true });
|
|
133
|
+
await Bun.write(DOCKER_WORKFLOW_FILE, generateDockerWorkflowYml());
|
|
134
|
+
log.created("📄 Created .github/workflows/deploy-docker.yml");
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
88
138
|
async function deploy() {
|
|
89
139
|
log.info("📦 Building for production...\n");
|
|
90
140
|
await runBuild();
|
|
@@ -95,6 +145,7 @@ async function deploy() {
|
|
|
95
145
|
|
|
96
146
|
if (isDocker) {
|
|
97
147
|
await writeDockerFiles();
|
|
148
|
+
if (isCi) await writeDockerWorkflow();
|
|
98
149
|
} else {
|
|
99
150
|
await writeGhaWorkflow();
|
|
100
151
|
}
|
|
@@ -102,7 +153,13 @@ async function deploy() {
|
|
|
102
153
|
log.ok();
|
|
103
154
|
log.out(" Output: .docu/dist/");
|
|
104
155
|
if (isDocker) {
|
|
105
|
-
log.out("
|
|
156
|
+
log.out(" Build locally: docker build -t my-docs . && docker run -p 80:80 my-docs");
|
|
157
|
+
if (isCi) {
|
|
158
|
+
log.out(" Push to GitHub — CI will build & push Docker image to GHCR");
|
|
159
|
+
log.out(" Then pull latest image on your hosting platform (Coolify, etc.)");
|
|
160
|
+
} else {
|
|
161
|
+
log.out(" For Coolify: connect repo, set build pack to Dockerfile");
|
|
162
|
+
}
|
|
106
163
|
} else {
|
|
107
164
|
log.out(" Push to GitHub and enable Pages (Settings → Pages → Source: GitHub Actions)");
|
|
108
165
|
}
|
package/.docu/node/hydrate.ts
CHANGED
package/bin/cli.js
CHANGED
|
@@ -58,8 +58,10 @@ if (themeIndex !== -1 && themeIndex + 1 < process.argv.length) {
|
|
|
58
58
|
}
|
|
59
59
|
const hasDocker = process.argv.includes("--docker");
|
|
60
60
|
const hasSilent = process.argv.includes("--silent");
|
|
61
|
+
const hasCi = process.argv.includes("--ci");
|
|
61
62
|
if (hasDocker) process.env.FLAME_DEPLOY_DOCKER = "1";
|
|
62
63
|
if (hasSilent) process.env.FLAME_DEPLOY_SILENT = "1";
|
|
64
|
+
if (hasCi) process.env.FLAME_DEPLOY_CI = "1";
|
|
63
65
|
|
|
64
66
|
// Production mode for build/preview/deploy — ensures minified client bundle
|
|
65
67
|
// on all platforms (Coolify, Vercel, etc.) without requiring the user to
|
|
@@ -88,7 +90,8 @@ if (!command || command === "--help" || command === "-h") {
|
|
|
88
90
|
Options:
|
|
89
91
|
--help Show this help message
|
|
90
92
|
--theme <name> Override theme preset (e.g. freshlime, coffee). Works with dev, build, preview.
|
|
91
|
-
--docker Generate Docker deployment files (Dockerfile + nginx.conf). Works with deploy.
|
|
93
|
+
--docker Generate Docker deployment files (Dockerfile + nginx.conf + .dockerignore). Works with deploy.
|
|
94
|
+
--ci Generate CI workflow (.github/workflows/deploy-docker.yml) for auto build & push to GHCR. Use with --docker.
|
|
92
95
|
--silent Suppress non-essential output. Works with deploy.
|
|
93
96
|
`);
|
|
94
97
|
process.exit(0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docubook/flame",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"description": "A blazing-fast React + MDX framework powered by Bun, built for modern documentation experiences.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
"unified": "^11.0.0",
|
|
57
57
|
"@docubook/core": "^1.8.2",
|
|
58
58
|
"@docubook/runt": "^1.0.0",
|
|
59
|
-
"@docubook/
|
|
59
|
+
"@docubook/themes-colors": "^1.0.2",
|
|
60
60
|
"@docubook/ui-react": "^1.0.0",
|
|
61
|
-
"@docubook/
|
|
61
|
+
"@docubook/mdx-content": "^3.4.5"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"@sentry/bun": "^10.0.0"
|