Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .changeset/thick-seas-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@opennextjs/cloudflare": patch
---

refactor: do not create a wrangler config when a custom one is passed
5 changes: 0 additions & 5 deletions packages/cloudflare/src/cli/build/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { compileInit } from "./open-next/compile-init.js";
import { compileSkewProtection } from "./open-next/compile-skew-protection.js";
import { compileDurableObjects } from "./open-next/compileDurableObjects.js";
import { createServerBundle } from "./open-next/createServerBundle.js";
import { createWranglerConfigIfNotExistent } from "./utils/index.js";
import { getVersion } from "./utils/version.js";

/**
Expand Down Expand Up @@ -87,10 +86,6 @@ export async function build(

await bundleServer(options, projectOpts);

if (!projectOpts.skipWranglerConfigCheck) {
await createWranglerConfigIfNotExistent(projectOpts);
}

logger.info("OpenNext build complete.");
}

Expand Down
17 changes: 11 additions & 6 deletions packages/cloudflare/src/cli/commands/build.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type yargs from "yargs";

import { build as buildImpl } from "../build/build.js";
import { createWranglerConfigIfNotExistent } from "../build/utils/index.js";
import type { WithWranglerArgs } from "./utils.js";
import {
compileConfig,
Expand Down Expand Up @@ -30,14 +31,18 @@ async function buildCommand(
const { config, buildDir } = await compileConfig(args.openNextConfigPath);
const options = getNormalizedOptions(config, buildDir);

const projectOpts = { ...args, minify: !args.noMinify, sourceDir: nextAppDir };

// Ask whether a `wrangler.jsonc` should be created when no config file exists.
// Note: We don't ask when a custom config file is specified via `--config`
// nor when `--skipWranglerConfigCheck` is used.
if (!projectOpts.wranglerConfigPath && !args.skipWranglerConfigCheck) {
await createWranglerConfigIfNotExistent(projectOpts);
}

const wranglerConfig = readWranglerConfig(args);

await buildImpl(
options,
config,
{ ...args, minify: !args.noMinify, sourceDir: nextAppDir },
wranglerConfig
);
await buildImpl(options, config, projectOpts, wranglerConfig);
}

/**
Expand Down