From 5b302adacfdcf89de1c0206e286cbdcaf5714cfc Mon Sep 17 00:00:00 2001 From: Lukas Holzer Date: Mon, 18 Dec 2023 11:13:28 +0100 Subject: [PATCH] chore: rename to autoInstall --- packages/build-info/src/build-systems/nx.test.ts | 2 +- packages/build-info/src/frameworks/framework.ts | 2 +- packages/build-info/src/frameworks/next.test.ts | 14 +++++++------- packages/build-info/src/frameworks/next.ts | 4 ++-- .../node/__snapshots__/get-build-info.test.ts.snap | 4 ++-- .../src/settings/get-build-settings.test.ts | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/build-info/src/build-systems/nx.test.ts b/packages/build-info/src/build-systems/nx.test.ts index 6f2b6f284b..1c98e350af 100644 --- a/packages/build-info/src/build-systems/nx.test.ts +++ b/packages/build-info/src/build-systems/nx.test.ts @@ -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 }], }), ]), ) diff --git a/packages/build-info/src/frameworks/framework.ts b/packages/build-info/src/frameworks/framework.ts index a72b08b139..196b197764 100644 --- a/packages/build-info/src/frameworks/framework.ts +++ b/packages/build-info/src/frameworks/framework.ts @@ -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' } diff --git a/packages/build-info/src/frameworks/next.test.ts b/packages/build-info/src/frameworks/next.test.ts index e4dafe3eca..f4dc75f56a 100644 --- a/packages/build-info/src/frameworks/next.test.ts +++ b/packages/build-info/src/frameworks/next.test.ts @@ -38,7 +38,7 @@ 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 }) => { @@ -46,7 +46,7 @@ describe('Next.js Plugin', () => { 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 }) => { @@ -83,7 +83,7 @@ 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 }) => { @@ -91,7 +91,7 @@ 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/next-runtime@latest', alwaysInstall: true }]) + expect(frameworks?.[0].plugins).toEqual([{ name: '@netlify/next-runtime@latest', autoInstall: true }]) }) }) @@ -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 }]) }) }) @@ -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 }], }) }) }) @@ -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 }], }) }) }) diff --git a/packages/build-info/src/frameworks/next.ts b/packages/build-info/src/frameworks/next.ts index bbac82e1e2..fe4db2ab95 100644 --- a/packages/build-info/src/frameworks/next.ts +++ b/packages/build-info/src/frameworks/next.ts @@ -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 } diff --git a/packages/build-info/src/node/__snapshots__/get-build-info.test.ts.snap b/packages/build-info/src/node/__snapshots__/get-build-info.test.ts.snap index 867e432206..bba0b2d2c0 100644 --- a/packages/build-info/src/node/__snapshots__/get-build-info.test.ts.snap +++ b/packages/build-info/src/node/__snapshots__/get-build-info.test.ts.snap @@ -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", }, ], @@ -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", }, ], diff --git a/packages/build-info/src/settings/get-build-settings.test.ts b/packages/build-info/src/settings/get-build-settings.test.ts index d99d5c7cea..9a21d1fff9 100644 --- a/packages/build-info/src/settings/get-build-settings.test.ts +++ b/packages/build-info/src/settings/get-build-settings.test.ts @@ -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'], }), ]) @@ -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'], }), ])