Skip to content

Commit 12a1f75

Browse files
update location of output path in success message (#208)
1 parent b7a0720 commit 12a1f75

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

.changeset/unlucky-spiders-lay.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@opennextjs/cloudflare": patch
3+
---
4+
5+
update location of output path in success message

packages/cloudflare/src/cli/build/bundle-server.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ globalThis.__BUILD_TIMESTAMP_MS__ = ${Date.now()};
124124
);
125125
}
126126

127-
console.log(`\x1b[35mWorker saved in \`${openNextServerBundle}\` 🚀\n\x1b[0m`);
127+
console.log(`\x1b[35mWorker saved in \`${getOutputWorkerPath(openNextOptions)}\` 🚀\n\x1b[0m`);
128128
}
129129

130130
/**
@@ -220,3 +220,13 @@ async function patchCodeWithValidations(
220220
console.log(`All ${patches.length} patches applied\n`);
221221
return patchedCode;
222222
}
223+
224+
/**
225+
* Gets the path of the worker.js file generated by the build process
226+
*
227+
* @param openNextOptions the open-next build options
228+
* @returns the path of the worker.js file that the build process generates
229+
*/
230+
export function getOutputWorkerPath(openNextOptions: BuildOptions): string {
231+
return path.join(openNextOptions.outputDir, "worker.js");
232+
}

packages/cloudflare/src/cli/build/patches/investigated/copy-package-cli-files.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ import path from "node:path";
44
import type { BuildOptions } from "@opennextjs/aws/build/helper.js";
55

66
import { Config } from "../../../config.js";
7+
import { getOutputWorkerPath } from "../../bundle-server.js";
78

89
/**
910
* Copies the template files present in the cloudflare adapter package into the standalone node_modules folder
1011
*/
11-
export function copyPackageCliFiles(packageDistDir: string, config: Config, openNextConfig: BuildOptions) {
12+
export function copyPackageCliFiles(packageDistDir: string, config: Config, openNextOptions: BuildOptions) {
1213
console.log("# copyPackageTemplateFiles");
1314
const sourceDir = path.join(packageDistDir, "cli");
1415
const destinationDir = path.join(config.paths.internal.package, "cli");
@@ -17,6 +18,6 @@ export function copyPackageCliFiles(packageDistDir: string, config: Config, open
1718

1819
fs.copyFileSync(
1920
path.join(packageDistDir, "cli", "templates", "worker.js"),
20-
path.join(openNextConfig.outputDir, "worker.js")
21+
getOutputWorkerPath(openNextOptions)
2122
);
2223
}

0 commit comments

Comments
 (0)