Skip to content

Commit c6f6aef

Browse files
committed
Updated Next.js version preBuild
1 parent bcb8823 commit c6f6aef

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

scripts/preBuild.cjs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,15 @@ const t = d.getTime();
2525
// }
2626

2727
const output = execSync("yarn info next --name-only").toString().trim();
28+
29+
console.log('yarn info next output:');
30+
console.log(output);
31+
2832
const versionRegex = new RegExp(":(?<version>(?:\\d+|\\.)+)");
2933
const result = versionRegex.exec(output.toString());
30-
const nextJsVersion = result ? result.groups.version : "Unknown";
34+
const nextJsVersion = result ? result[1] : "Unknown";
35+
36+
console.log(`Extracted Next.js version: ${nextJsVersion}`);
3137

3238
const envContent = `
3339
NEXT_PUBLIC_BUILD_DATETIME="${buildDate} ${buildTime}"
@@ -41,6 +47,9 @@ NEXT_PUBLIC_NODE_VERSION="${process.version}"
4147
NEXT_PUBLIC_NEXTJS_VERSION="${nextJsVersion}"
4248
`;
4349

50+
console.log('.env file contents:');
51+
console.log(envContent);
52+
4453
fs.writeFileSync('.env', envContent.trim());
4554

4655
console.log('Created .env file successfully');

0 commit comments

Comments
 (0)