File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,10 +24,10 @@ const t = d.getTime();
2424// console.error(`Failed to get Next.js version: ${error.message}`);
2525// }
2626
27- const output = execSync ( "npx next --version " ) . toString ( ) . trim ( ) ;
28- const versionRegex = new RegExp ( "v[ \\d\\.]+\\b " ) ;
27+ const output = execSync ( "yarn info next --name-only " ) . toString ( ) . trim ( ) ;
28+ const versionRegex = new RegExp ( ":(?<version>(?: \\d+| \\.)+) " ) ;
2929const result = versionRegex . exec ( output . toString ( ) ) ;
30- const nextJsVersion = result ? result [ 0 ] : "Unknown" ;
30+ const nextJsVersion = result ? result . groups . version : "Unknown" ;
3131
3232const envContent = `
3333NEXT_PUBLIC_BUILD_DATETIME="${ buildDate } ${ buildTime } "
@@ -37,7 +37,7 @@ NEXT_PUBLIC_BUILD_TIME="${buildTime}"
3737NEXT_PUBLIC_BUILD_TIME_LOCAL="${ d . toLocaleTimeString ( 'en-US' , { hour12 : true } ) } "
3838NEXT_PUBLIC_TZ_LONG="${ tzLongName } "
3939NEXT_PUBLIC_TZ_SHORT="${ tzName } "
40- NEXT_PUBLIC_NODE_VERSION=${ process . version }
40+ NEXT_PUBLIC_NODE_VERSION=" ${ process . version } "
4141NEXT_PUBLIC_NEXTJS_VERSION="${ nextJsVersion } "
4242` ;
4343
You can’t perform that action at this time.
0 commit comments