File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Expand file tree Collapse file tree 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+
13import { getErrorInfo } from '../error/info.js'
24import { startErrorMonitor } from '../error/monitor/start.js'
35import { getBufferLogs , getSystemLogger } from '../log/logger.js'
@@ -77,6 +79,7 @@ const tExecBuild = async function ({
7779 timeline,
7880 devCommand,
7981 quiet,
82+ framework,
8083} ) {
8184 const configOpts = getConfigOpts ( {
8285 config,
@@ -124,6 +127,20 @@ const tExecBuild = async function ({
124127 timers,
125128 quiet,
126129 } )
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+
127144 const constants = await getConstants ( {
128145 configPath,
129146 buildDir,
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ export default async function buildSite(flags: Partial<BuildCLIFlags> = {}): Pro
6565 debug,
6666 testOpts,
6767 errorParams,
68+ framework,
6869 } )
6970 await handleBuildSuccess ( {
7071 framework,
Original file line number Diff line number Diff line change @@ -126,3 +126,8 @@ export const getFramework = async function (frameworkId, options) {
126126 const context = await getContext ( options )
127127 return get ( frameworkId , context )
128128}
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