Skip to content

Commit

Permalink
chore: rename to autoInstall
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasholzer committed Dec 18, 2023
1 parent d505403 commit 5b302ad
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/build-info/src/build-systems/nx.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ describe('nx-integrated project.json based', () => {
frameworkPort: 4200,
name: `Nx + Next.js ${join('packages/website')}`,
packagePath: join('packages/website'),
plugins: [{ name: '@netlify/plugin-nextjs', alwaysInstall: true }],
plugins: [{ name: '@netlify/plugin-nextjs', autoInstall: true }],
}),
]),
)
Expand Down
2 changes: 1 addition & 1 deletion packages/build-info/src/frameworks/framework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export type BuildPlugin = {
* automatically install the latest version without the need of the user
* managing the version plugin.
*/
alwaysInstall?: boolean
autoInstall?: boolean
source?: 'toml'
}

Expand Down
14 changes: 7 additions & 7 deletions packages/build-info/src/frameworks/next.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ describe('Next.js Plugin', () => {
const project = new Project(fs, cwd).setNodeVersion('v10.13.0')
const frameworks = await project.detectFrameworks()
expect(frameworks?.[0].id).toBe('next')
expect(frameworks?.[0].plugins).toEqual([{ name: '@netlify/plugin-nextjs', alwaysInstall: true }])
expect(frameworks?.[0].plugins).toEqual([{ name: '@netlify/plugin-nextjs', autoInstall: true }])
})

test('Should use the old runtime if the next.js version is not >= 13.5.0', async ({ fs, cwd }) => {
const project = new Project(fs, cwd).setNodeVersion('v18.0.0')
project.featureFlags = { project_ceruledge_ui: '@netlify/next-runtime' }
const frameworks = await project.detectFrameworks()
expect(frameworks?.[0].id).toBe('next')
expect(frameworks?.[0].plugins).toEqual([{ name: '@netlify/plugin-nextjs', alwaysInstall: true }])
expect(frameworks?.[0].plugins).toEqual([{ name: '@netlify/plugin-nextjs', autoInstall: true }])
})

test('Should not detect Next.js plugin for Next.js if when Node version < 10.13.0', async ({ fs, cwd }) => {
Expand Down Expand Up @@ -83,15 +83,15 @@ describe('New Next.js Runtime', () => {
project.featureFlags = { project_ceruledge_ui: '@netlify/next-runtime@latest' }
const frameworks = await project.detectFrameworks()
expect(frameworks?.[0].id).toBe('next')
expect(frameworks?.[0].plugins).toEqual([{ name: '@netlify/plugin-nextjs', alwaysInstall: true }])
expect(frameworks?.[0].plugins).toEqual([{ name: '@netlify/plugin-nextjs', autoInstall: true }])
})

test('Should use the old runtime if the next.js version is not >= 13.5.0', async ({ fs, cwd }) => {
const project = new Project(fs, cwd).setNodeVersion('v18.0.0')
project.featureFlags = { project_ceruledge_ui: '@netlify/next-runtime@latest' }
const frameworks = await project.detectFrameworks()
expect(frameworks?.[0].id).toBe('next')
expect(frameworks?.[0].plugins).toEqual([{ name: '@netlify/next-runtime@latest', alwaysInstall: true }])
expect(frameworks?.[0].plugins).toEqual([{ name: '@netlify/next-runtime@latest', autoInstall: true }])
})
})

Expand Down Expand Up @@ -136,7 +136,7 @@ describe('simple Next.js project', async () => {
test('Should detect Next.js plugin for Next.js if when Node version >= 10.13.0', async ({ fs, cwd }) => {
const detected = await new Project(fs, cwd).setEnvironment({ NODE_VERSION: '18.x' }).detectFrameworks()
expect(detected?.[0].id).toBe('next')
expect(detected?.[0].plugins).toMatchObject([{ name: '@netlify/plugin-nextjs', alwaysInstall: true }])
expect(detected?.[0].plugins).toMatchObject([{ name: '@netlify/plugin-nextjs', autoInstall: true }])
})
})

Expand Down Expand Up @@ -180,7 +180,7 @@ describe('Nx monorepo', () => {
devCommand: 'nx run website:serve',
dist: join('dist/packages/website'),
frameworkPort: 4200,
plugins: [{ name: '@netlify/plugin-nextjs', alwaysInstall: true }],
plugins: [{ name: '@netlify/plugin-nextjs', autoInstall: true }],
})
})
})
Expand All @@ -198,7 +198,7 @@ describe('Nx turborepo', () => {
devCommand: 'turbo run dev --filter web',
dist: join('apps/web/.next'),
frameworkPort: 3000,
plugins: [{ name: '@netlify/plugin-nextjs', alwaysInstall: true }],
plugins: [{ name: '@netlify/plugin-nextjs', autoInstall: true }],
})
})
})
4 changes: 2 additions & 2 deletions packages/build-info/src/frameworks/next.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ export class Next extends BaseFramework implements Framework {
gte(this.detected.package.version, '13.5.0') &&
typeof runtimeFromRollout === 'string'
) {
this.plugins.push({ name: runtimeFromRollout ?? '@netlify/plugin-nextjs', alwaysInstall: true })
this.plugins.push({ name: runtimeFromRollout ?? '@netlify/plugin-nextjs', autoInstall: true })
} else if (nodeVersion && gte(nodeVersion, '10.13.0')) {
this.plugins.push({ name: '@netlify/plugin-nextjs', alwaysInstall: true })
this.plugins.push({ name: '@netlify/plugin-nextjs', autoInstall: true })
}
return this as DetectedFramework
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ exports[`should retrieve the build info for providing a rootDir 1`] = `
"packagePath": "packages/website",
"plugins": [
{
"alwaysInstall": true,
"autoInstall": true,
"name": "@netlify/plugin-nextjs",
},
],
Expand Down Expand Up @@ -295,7 +295,7 @@ exports[`should retrieve the build info for providing a rootDir and the same pro
"packagePath": "packages/website",
"plugins": [
{
"alwaysInstall": true,
"autoInstall": true,
"name": "@netlify/plugin-nextjs",
},
],
Expand Down
4 changes: 2 additions & 2 deletions packages/build-info/src/settings/get-build-settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test('get the settings for a next project', async (ctx) => {
dist: '.next',
env: {},
frameworkPort: 3000,
plugins: [{ alwaysInstall: true, name: '@netlify/plugin-nextjs' }],
plugins: [{ autoInstall: true, name: '@netlify/plugin-nextjs' }],
pollingStrategies: ['TCP'],
}),
])
Expand All @@ -46,7 +46,7 @@ test('get the settings for a next project if a build system has no commands and
dist: '.next',
env: {},
frameworkPort: 3000,
plugins: [{ alwaysInstall: true, name: '@netlify/plugin-nextjs' }],
plugins: [{ autoInstall: true, name: '@netlify/plugin-nextjs' }],
pollingStrategies: ['TCP'],
}),
])
Expand Down

0 comments on commit 5b302ad

Please sign in to comment.