Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use CLI-given config file #449

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/vinxi/bin/cli.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ const command = defineCommand({
}
process.env.NODE_ENV = "production";
const { createBuild } = await import("../lib/build.js");
await createBuild(app, { preset: args.preset, router: args.router });
await createBuild(app, { preset: args.preset, router: args.router }, configFile);
},
},
start: {
Expand Down
9 changes: 5 additions & 4 deletions packages/vinxi/lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ const require = createRequire(import.meta.url);
*
* @param {import('./app.js').App} app
* @param {BuildConfig} buildConfig
* @param {string} configFile
*/
export async function createBuild(app, buildConfig) {
export async function createBuild(app, buildConfig, configFile) {
const { existsSync, promises: fsPromises, readFileSync } = await import("fs");
const { join } = await import("./path.js");
const { fileURLToPath } = await import("url");
Expand Down Expand Up @@ -90,7 +91,7 @@ export async function createBuild(app, buildConfig) {
for (const router of app.config.routers) {
if (router.type !== "static" && router.build !== false) {
await withLogger({ router, requestId: "build" }, async () => {
await createRouterBuildInWorker(app, router);
await createRouterBuildInWorker(app, router, configFile);
});
}
}
Expand Down Expand Up @@ -396,12 +397,12 @@ async function createViteBuild(config) {
return output;
}

async function createRouterBuildInWorker(app, router) {
async function createRouterBuildInWorker(app, router, configFile) {
const sh = await import("../runtime/sh.js");
const { fileURLToPath } = await import("url");
await sh.default`node ${fileURLToPath(
new URL("../bin/cli.mjs", import.meta.url).href,
)} build --router=${router.name}`;
)} build --router=${router.name} ${configFile ? `--config=${configFile}` : ""}`;
}
/**
*
Expand Down