Skip to content

Commit

Permalink
log @opennextjs package versions (#324)
Browse files Browse the repository at this point in the history
  • Loading branch information
vicb authored Feb 3, 2025
1 parent 0a6191d commit 15440d8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/cloudflare/src/cli/build/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
createWranglerConfigIfNotExistent,
ensureCloudflareConfig,
} from "./utils/index.js";
import { getVersion } from "./utils/version.js";

/**
* Builds the application in a format that can be passed to workerd
Expand Down Expand Up @@ -56,7 +57,9 @@ export async function build(projectOpts: ProjectOptions): Promise<void> {
logger.info(`App directory: ${options.appPath}`);
buildHelper.printNextjsVersion(options);
ensureNextjsVersionSupported(options);
buildHelper.printOpenNextVersion(options);
const { aws, cloudflare } = getVersion();
logger.info(`@opennextjs/cloudflare version: ${cloudflare}`);
logger.info(`@opennextjs/aws version: ${aws}`);

if (projectOpts.skipNextBuild) {
logger.warn("Skipping Next.js build");
Expand Down
13 changes: 13 additions & 0 deletions packages/cloudflare/src/cli/build/utils/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { createRequire } from "node:module";
import { join } from "node:path";
import { fileURLToPath } from "node:url";

export function getVersion() {
const require = createRequire(import.meta.url);
const __dirname = fileURLToPath(new URL(".", import.meta.url));
const pkgJson = require(join(__dirname, "../../../../package.json"));
return {
cloudflare: pkgJson.version,
aws: pkgJson.dependencies["@opennextjs/aws"],
};
}

0 comments on commit 15440d8

Please sign in to comment.