File tree 3 files changed +19
-0
lines changed
3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -306,6 +306,12 @@ export const copyNextDependencies = async (ctx: PluginContext): Promise<void> =>
306
306
// exports map it still might be a problem in the future, so we are not breaking here
307
307
}
308
308
309
+ if ( nextVersion !== ctx . nextVersionFromVerification ) {
310
+ ctx . failBuild (
311
+ `mismatched versions detected. Version found at verification is ${ ctx . nextVersionFromVerification } but resolved version is ${ nextVersion } .` ,
312
+ )
313
+ }
314
+
309
315
if ( nextVersion ) {
310
316
verifyNextVersion ( ctx , nextVersion )
311
317
Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ export class PluginContext {
43
43
pluginVersion : string
44
44
utils : NetlifyPluginUtils
45
45
46
+ nextVersionFromVerification : string = 'n/a'
47
+
46
48
private constants : NetlifyPluginConstants
47
49
private packageJSON : { name : string ; version : string } & Record < string , unknown >
48
50
Original file line number Diff line number Diff line change 1
1
import { existsSync } from 'node:fs'
2
+ import { createRequire } from 'node:module'
2
3
import { join } from 'node:path'
4
+ import { join as posixJoin } from 'node:path/posix'
3
5
4
6
import { satisfies } from 'semver'
5
7
@@ -47,6 +49,15 @@ export function verifyPublishDir(ctx: PluginContext) {
47
49
`Your publish directory does not contain expected Next.js build output. Please make sure you are using Next.js version (${ SUPPORTED_NEXT_VERSIONS } )` ,
48
50
)
49
51
}
52
+
53
+ try {
54
+ const serverHandlerRequire = createRequire ( posixJoin ( ctx . standaloneRootDir , ':internal:' ) )
55
+ const { version } = serverHandlerRequire ( 'next/package.json' )
56
+ ctx . nextVersionFromVerification = version
57
+ console . log ( { version } )
58
+ } catch ( e ) {
59
+ console . error ( 'failed to grab next version' , e )
60
+ }
50
61
}
51
62
if ( ctx . buildConfig . output === 'export' ) {
52
63
if ( ! ctx . exportDetail ?. success ) {
You can’t perform that action at this time.
0 commit comments