File tree 3 files changed +23
-0
lines changed
3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { supportedRuntimes } from '@netlify/framework-info'
2
+
1
3
import { getErrorInfo } from '../error/info.js'
2
4
import { startErrorMonitor } from '../error/monitor/start.js'
3
5
import { getBufferLogs , getSystemLogger } from '../log/logger.js'
@@ -77,6 +79,7 @@ const tExecBuild = async function ({
77
79
timeline,
78
80
devCommand,
79
81
quiet,
82
+ framework,
80
83
} ) {
81
84
const configOpts = getConfigOpts ( {
82
85
config,
@@ -124,6 +127,20 @@ const tExecBuild = async function ({
124
127
timers,
125
128
quiet,
126
129
} )
130
+
131
+ if ( featureFlags . build_automatic_runtime && framework ) {
132
+ const runtime = supportedRuntimes [ framework ]
133
+
134
+ if ( runtime !== undefined ) {
135
+ const skip = childEnv [ runtime . skipFlag ] === 'true'
136
+ const installed = netlifyConfig . plugins . some ( ( plugin ) => plugin . package === runtime . package )
137
+
138
+ if ( ! installed && ! skip ) {
139
+ netlifyConfig . plugins . push ( { package : runtime . package } )
140
+ }
141
+ }
142
+ }
143
+
127
144
const constants = await getConstants ( {
128
145
configPath,
129
146
buildDir,
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ export default async function buildSite(flags: Partial<BuildCLIFlags> = {}): Pro
65
65
debug,
66
66
testOpts,
67
67
errorParams,
68
+ framework,
68
69
} )
69
70
await handleBuildSuccess ( {
70
71
framework,
Original file line number Diff line number Diff line change @@ -126,3 +126,8 @@ export const getFramework = async function (frameworkId, options) {
126
126
const context = await getContext ( options )
127
127
return get ( frameworkId , context )
128
128
}
129
+
130
+ export const supportedRuntimes = {
131
+ next : { package : '@netlify/plugin-nextjs' , skipFlag : 'NETLIFY_NEXT_PLUGIN_SKIP' } ,
132
+ gatsby : { package : '@netlify/plugin-gatsby' , skipFlag : 'NETLIFY_GATSBY_PLUGIN_SKIP' } ,
133
+ }
You can’t perform that action at this time.
0 commit comments