mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-14 10:52:17 +03:00
build: add contributor fast profile (#12192)
This commit is contained in:
@@ -73,6 +73,9 @@ npm run dev
|
||||
npm run build # next build → .build/next/ then assembleStandalone → dist/
|
||||
npm run start
|
||||
|
||||
# Fast backend/API-only build for contributor changes
|
||||
npm run build:contributor
|
||||
|
||||
# Release build (clean rebuild + HEAD sentinel — required for deploy)
|
||||
npm run build:release # rm -rf .build dist && build + writes dist/BUILD_SHA
|
||||
|
||||
@@ -100,6 +103,11 @@ npm run build
|
||||
`npm run build:release` additionally cleans both directories first and writes
|
||||
`dist/BUILD_SHA` (= `git rev-parse --short HEAD`) as a deploy integrity sentinel.
|
||||
|
||||
`npm run build:contributor` uses the backend-only build profile. It temporarily stubs
|
||||
dashboard UI files while building, keeps API route handlers, and restores the original files
|
||||
after the build. Use `npm run build` for changes that affect the dashboard UI or for full
|
||||
release validation; the contributor profile is not a replacement for the release build.
|
||||
|
||||
> **VPS deploy note:** the remote image directory `/usr/lib/node_modules/omniroute/app/`
|
||||
> is unchanged. The deploy skills rsync the contents of `dist/` into it.
|
||||
> Only the in-repo build output path moved (`app/` → `dist/`).
|
||||
|
||||
@@ -102,6 +102,7 @@
|
||||
"build": "node scripts/build/build-next-isolated.mjs",
|
||||
"build:secure": "OMNIROUTE_BUILD_PROFILE=minimal node scripts/build/build-next-isolated.mjs",
|
||||
"build:backend": "cross-env OMNIROUTE_BUILD_BACKEND_ONLY=1 node scripts/build/build-next-isolated.mjs",
|
||||
"build:contributor": "cross-env OMNIROUTE_BUILD_PROFILE=contributor node scripts/build/build-next-isolated.mjs",
|
||||
"build:cli": "node --import tsx scripts/build/prepublish.ts",
|
||||
"omniroute:verify": "node scripts/check/omniroute-verify.mjs",
|
||||
"build:release": "rm -rf .build dist && OMNIROUTE_BUILD_SHA=$(git rev-parse --short HEAD) npm run build && npm run build:cli && node scripts/build/write-build-sha.mjs",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Backend-only build helper.
|
||||
*
|
||||
* When `OMNIROUTE_BUILD_BACKEND_ONLY=1` (or `OMNIROUTE_BUILD_PROFILE=backend`) is set,
|
||||
* When `OMNIROUTE_BUILD_BACKEND_ONLY=1` (or `OMNIROUTE_BUILD_PROFILE=backend|contributor`) is set,
|
||||
* `build-next-isolated.mjs` calls `stubDashboardPages()` BEFORE `next build` and
|
||||
* `restoreDashboardPages()` in a `finally` afterward.
|
||||
*
|
||||
@@ -83,7 +83,11 @@ function stripLeadingUseServer(src) {
|
||||
|
||||
/** True when the current build should skip the dashboard frontend. */
|
||||
export function isBackendOnlyBuild(env = process.env) {
|
||||
return env.OMNIROUTE_BUILD_BACKEND_ONLY === "1" || env.OMNIROUTE_BUILD_PROFILE === "backend";
|
||||
return (
|
||||
env.OMNIROUTE_BUILD_BACKEND_ONLY === "1" ||
|
||||
env.OMNIROUTE_BUILD_PROFILE === "backend" ||
|
||||
env.OMNIROUTE_BUILD_PROFILE === "contributor"
|
||||
);
|
||||
}
|
||||
|
||||
function walkFiles(dir, out = []) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import assert from "node:assert/strict";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import * as yaml from "js-yaml";
|
||||
import { isBackendOnlyBuild } from "../../../scripts/build/backendOnlyPages.mjs";
|
||||
|
||||
interface WorkflowStep {
|
||||
name?: string;
|
||||
@@ -42,6 +43,14 @@ function isBackendOnly(step: WorkflowStep): boolean {
|
||||
return env.OMNIROUTE_BUILD_BACKEND_ONLY === "1" || env.OMNIROUTE_BUILD_PROFILE === "backend";
|
||||
}
|
||||
|
||||
test("contributor build profile enables backend-only mode", () => {
|
||||
assert.equal(isBackendOnlyBuild({ OMNIROUTE_BUILD_PROFILE: "contributor" }), true);
|
||||
});
|
||||
|
||||
test("full build remains the default when no backend-only profile is set", () => {
|
||||
assert.equal(isBackendOnlyBuild({}), false);
|
||||
});
|
||||
|
||||
// jobName: null selector means "any job" — used when a file has exactly one
|
||||
// "Build CLI bundle" step but we don't want to hardcode/duplicate the job key.
|
||||
interface Target {
|
||||
|
||||
Reference in New Issue
Block a user