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/unlucky-spiders-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@opennextjs/cloudflare": patch
---

update location of output path in success message
12 changes: 11 additions & 1 deletion packages/cloudflare/src/cli/build/bundle-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ globalThis.__BUILD_TIMESTAMP_MS__ = ${Date.now()};
);
}

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

/**
Expand Down Expand Up @@ -220,3 +220,13 @@ async function patchCodeWithValidations(
console.log(`All ${patches.length} patches applied\n`);
return patchedCode;
}

/**
* Gets the path of the worker.js file generated by the build process
*
* @param openNextOptions the open-next build options
* @returns the path of the worker.js file that the build process generates
*/
export function getOutputWorkerPath(openNextOptions: BuildOptions): string {
return path.join(openNextOptions.outputDir, "worker.js");
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import path from "node:path";
import type { BuildOptions } from "@opennextjs/aws/build/helper.js";

import { Config } from "../../../config.js";
import { getOutputWorkerPath } from "../../bundle-server.js";

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

fs.copyFileSync(
path.join(packageDistDir, "cli", "templates", "worker.js"),
path.join(openNextConfig.outputDir, "worker.js")
getOutputWorkerPath(openNextOptions)
);
}
Loading