@opennextjs/cloudflare 1.14.4 → 1.14.5
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/dist/cli/build/utils/create-config-files.js +1 -3
- package/dist/cli/commands/deploy.js +7 -0
- package/dist/cli/commands/utils.d.ts +1 -1
- package/dist/cli/utils/run-wrangler.d.ts +1 -0
- package/dist/cli/utils/run-wrangler.js +7 -2
- package/package.json +5 -5
- package/templates/wrangler.jsonc +5 -3
|
@@ -25,9 +25,7 @@ export async function createWranglerConfigIfNotExistent(projectOpts) {
|
|
|
25
25
|
}
|
|
26
26
|
let wranglerConfig = readFileSync(join(getPackageTemplatesDirPath(), "wrangler.jsonc"), "utf8");
|
|
27
27
|
const appName = getAppNameFromPackageJson(projectOpts.sourceDir) ?? "app-name";
|
|
28
|
-
|
|
29
|
-
wranglerConfig = wranglerConfig.replaceAll('"app-name"', JSON.stringify(appName.replaceAll("_", "-")));
|
|
30
|
-
}
|
|
28
|
+
wranglerConfig = wranglerConfig.replaceAll('"<WORKER_NAME>"', JSON.stringify(appName.replaceAll("_", "-")));
|
|
31
29
|
const compatDate = await getLatestCompatDate();
|
|
32
30
|
if (compatDate) {
|
|
33
31
|
wranglerConfig = wranglerConfig.replace(/"compatibility_date": "\d{4}-\d{2}-\d{2}"/, `"compatibility_date": ${JSON.stringify(compatDate)}`);
|
|
@@ -31,6 +31,13 @@ export async function deployCommand(args) {
|
|
|
31
31
|
: []),
|
|
32
32
|
], {
|
|
33
33
|
logging: "all",
|
|
34
|
+
env: {
|
|
35
|
+
// If we are running the deploy command we set this OPEN_NEXT_DEPLOY environment variable
|
|
36
|
+
// to let `wrangler deploy` know that it is being run from open-next. We do this because
|
|
37
|
+
// otherwise `wrangler deploy` run in an open-next project would call
|
|
38
|
+
// `opennextjs-cloudflare deploy` (thus causing an unwanted recursion).
|
|
39
|
+
OPEN_NEXT_DEPLOY: "true",
|
|
40
|
+
},
|
|
34
41
|
});
|
|
35
42
|
}
|
|
36
43
|
/**
|
|
@@ -65,7 +65,7 @@ export declare function getNormalizedOptions(config: OpenNextConfig, buildDir?:
|
|
|
65
65
|
* @param args Wrangler environment and config path.
|
|
66
66
|
* @returns Wrangler config.
|
|
67
67
|
*/
|
|
68
|
-
export declare function readWranglerConfig(args: WithWranglerArgs): Config;
|
|
68
|
+
export declare function readWranglerConfig(args: WithWranglerArgs): Config$1;
|
|
69
69
|
/**
|
|
70
70
|
* Adds flags for the wrangler config path and environment to the yargs configuration.
|
|
71
71
|
*/
|
|
@@ -5,6 +5,7 @@ type WranglerOptions = {
|
|
|
5
5
|
environment?: string;
|
|
6
6
|
configPath?: string;
|
|
7
7
|
logging?: "all" | "error";
|
|
8
|
+
env?: Record<string, string>;
|
|
8
9
|
};
|
|
9
10
|
export declare function runWrangler(options: BuildOptions, args: string[], wranglerOpts?: WranglerOptions): void;
|
|
10
11
|
export declare function isWranglerTarget(v: string | undefined): v is WranglerTarget;
|
|
@@ -37,6 +37,7 @@ function injectPassthroughFlagForArgs(options, args) {
|
|
|
37
37
|
return args;
|
|
38
38
|
}
|
|
39
39
|
export function runWrangler(options, args, wranglerOpts = {}) {
|
|
40
|
+
const shouldPipeLogs = wranglerOpts.logging === "error";
|
|
40
41
|
const result = spawnSync(options.packager, [
|
|
41
42
|
options.packager === "bun" ? "x" : "exec",
|
|
42
43
|
"wrangler",
|
|
@@ -49,10 +50,10 @@ export function runWrangler(options, args, wranglerOpts = {}) {
|
|
|
49
50
|
].filter((v) => !!v)),
|
|
50
51
|
], {
|
|
51
52
|
shell: true,
|
|
52
|
-
stdio:
|
|
53
|
+
stdio: shouldPipeLogs ? ["ignore", "pipe", "pipe"] : "inherit",
|
|
53
54
|
env: {
|
|
54
55
|
...process.env,
|
|
55
|
-
...
|
|
56
|
+
...wranglerOpts.env,
|
|
56
57
|
// `.env` files are handled by the adapter.
|
|
57
58
|
// Wrangler would load `.env.<wrangler env>` while we should load `.env.<process.env.NEXTJS_ENV>`
|
|
58
59
|
// See https://opennext.js.org/cloudflare/howtos/env-vars
|
|
@@ -60,6 +61,10 @@ export function runWrangler(options, args, wranglerOpts = {}) {
|
|
|
60
61
|
},
|
|
61
62
|
});
|
|
62
63
|
if (result.status !== 0) {
|
|
64
|
+
if (shouldPipeLogs) {
|
|
65
|
+
process.stdout.write(result.stdout.toString());
|
|
66
|
+
process.stderr.write(result.stderr.toString());
|
|
67
|
+
}
|
|
63
68
|
logger.error("Wrangler command failed");
|
|
64
69
|
process.exit(1);
|
|
65
70
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opennextjs/cloudflare",
|
|
3
3
|
"description": "Cloudflare builder for next apps",
|
|
4
|
-
"version": "1.14.
|
|
4
|
+
"version": "1.14.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"opennextjs-cloudflare": "dist/cli/index.js"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@ast-grep/napi": "0.40.0",
|
|
46
46
|
"@dotenvx/dotenvx": "1.31.0",
|
|
47
|
-
"@opennextjs/aws": "3.9.
|
|
47
|
+
"@opennextjs/aws": "3.9.5",
|
|
48
48
|
"cloudflare": "^4.4.1",
|
|
49
49
|
"enquirer": "^2.4.1",
|
|
50
50
|
"glob": "^12.0.0",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"eslint-plugin-unicorn": "^55.0.0",
|
|
68
68
|
"globals": "^15.9.0",
|
|
69
69
|
"mock-fs": "^5.4.1",
|
|
70
|
-
"next": "~15.5.
|
|
70
|
+
"next": "~15.5.8",
|
|
71
71
|
"picomatch": "^4.0.2",
|
|
72
72
|
"rimraf": "^6.0.1",
|
|
73
73
|
"typescript": "^5.9.3",
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"vitest": "^2.1.1"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"wrangler": "^4.
|
|
79
|
-
"next": "14
|
|
78
|
+
"wrangler": "^4.53.0",
|
|
79
|
+
"next": "^14.2.34 || ~15.0.6 || ~15.1.10 || ~15.2.7 || ~15.3.7 || ~15.4.9 || ~15.5.8 || ^16.0.9"
|
|
80
80
|
},
|
|
81
81
|
"scripts": {
|
|
82
82
|
"clean": "rimraf dist",
|
package/templates/wrangler.jsonc
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "node_modules/wrangler/config-schema.json",
|
|
3
3
|
"main": ".open-next/worker.js",
|
|
4
|
-
"name": "
|
|
5
|
-
"compatibility_date": "
|
|
4
|
+
"name": "<WORKER_NAME>",
|
|
5
|
+
"compatibility_date": "2025-12-01",
|
|
6
6
|
"compatibility_flags": ["nodejs_compat", "global_fetch_strictly_public"],
|
|
7
7
|
"assets": {
|
|
8
8
|
"directory": ".open-next/assets",
|
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
},
|
|
11
11
|
"services": [
|
|
12
12
|
{
|
|
13
|
+
// Self-reference service binding, the service name must match the worker name
|
|
14
|
+
// see https://opennext.js.org/cloudflare/caching
|
|
13
15
|
"binding": "WORKER_SELF_REFERENCE",
|
|
14
|
-
"service": "
|
|
16
|
+
"service": "<WORKER_NAME>"
|
|
15
17
|
}
|
|
16
18
|
],
|
|
17
19
|
"r2_buckets": [
|