Skip to content

Commit 397f035

Browse files
authored
refactor: provision for when unstable_readConfig becomes async (#1087)
1 parent e7c92ee commit 397f035

6 files changed

Lines changed: 10 additions & 7 deletions

File tree

packages/cloudflare/src/cli/commands/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async function buildCommand(
4040
await createWranglerConfigIfNotExistent(projectOpts);
4141
}
4242

43-
const wranglerConfig = readWranglerConfig(args);
43+
const wranglerConfig = await readWranglerConfig(args);
4444

4545
await buildImpl(options, config, projectOpts, wranglerConfig);
4646
}

packages/cloudflare/src/cli/commands/deploy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export async function deployCommand(args: WithWranglerArgs<{ cacheChunkSize?: nu
2525
const { config } = await retrieveCompiledConfig();
2626
const buildOpts = getNormalizedOptions(config);
2727

28-
const wranglerConfig = readWranglerConfig(args);
28+
const wranglerConfig = await readWranglerConfig(args);
2929

3030
const envVars = await getEnvFromPlatformProxy(config, buildOpts);
3131

packages/cloudflare/src/cli/commands/populate-cache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ async function populateCacheCommand(
6464
const { config } = await retrieveCompiledConfig();
6565
const buildOpts = getNormalizedOptions(config);
6666

67-
const wranglerConfig = readWranglerConfig(args);
67+
const wranglerConfig = await readWranglerConfig(args);
6868
const envVars = await getEnvFromPlatformProxy(config, buildOpts);
6969

7070
await populateCache(

packages/cloudflare/src/cli/commands/preview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export async function previewCommand(
2525
const { config } = await retrieveCompiledConfig();
2626
const buildOpts = getNormalizedOptions(config);
2727

28-
const wranglerConfig = readWranglerConfig(args);
28+
const wranglerConfig = await readWranglerConfig(args);
2929
const envVars = await getEnvFromPlatformProxy(config, buildOpts);
3030

3131
await populateCache(

packages/cloudflare/src/cli/commands/upload.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export async function uploadCommand(args: WithWranglerArgs<{ cacheChunkSize?: nu
2525
const { config } = await retrieveCompiledConfig();
2626
const buildOpts = getNormalizedOptions(config);
2727

28-
const wranglerConfig = readWranglerConfig(args);
28+
const wranglerConfig = await readWranglerConfig(args);
2929

3030
const envVars = await getEnvFromPlatformProxy(
3131
{

packages/cloudflare/src/cli/commands/utils.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,11 @@ export function getNormalizedOptions(config: OpenNextConfig, buildDir = nextAppD
101101
* @param args Wrangler environment and config path.
102102
* @returns Wrangler config.
103103
*/
104-
export function readWranglerConfig(args: WithWranglerArgs) {
105-
return unstable_readConfig({ env: args.env, config: args.wranglerConfigPath });
104+
export async function readWranglerConfig(args: WithWranglerArgs) {
105+
// Note: `unstable_readConfig` is sync as of wrangler 4.60.0
106+
// But it will eventually become async.
107+
// See https://github.com/cloudflare/workers-sdk/pull/12031
108+
return await unstable_readConfig({ env: args.env, config: args.wranglerConfigPath });
106109
}
107110

108111
/**

0 commit comments

Comments
 (0)