From 8d471fe3cdf4ea02c2ce3500fa1fbe9de110db8a Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Mon, 9 Jan 2023 16:37:24 +1100 Subject: [PATCH 1/2] Add test for preact-vite --- .../automigrate/fixes/new-frameworks.test.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/code/lib/cli/src/automigrate/fixes/new-frameworks.test.ts b/code/lib/cli/src/automigrate/fixes/new-frameworks.test.ts index c0f46684d844..db4c33492620 100644 --- a/code/lib/cli/src/automigrate/fixes/new-frameworks.test.ts +++ b/code/lib/cli/src/automigrate/fixes/new-frameworks.test.ts @@ -252,6 +252,33 @@ describe('new-frameworks fix', () => { }) ); }); + + it('should update to @storybook/preact-vite', async () => { + const packageJson = { + dependencies: { + '@storybook/preact': '^7.0.0-alpha.0', + '@storybook/builder-vite': '^0.0.2', + vite: '3.0.0', + }, + }; + await expect( + checkNewFrameworks({ + packageJson, + main: { + framework: '@storybook/preact', + core: { + builder: '@storybook/builder-vite', + }, + }, + }) + ).resolves.toEqual( + expect.objectContaining({ + frameworkPackage: '@storybook/preact-vite', + dependenciesToAdd: ['@storybook/preact-vite'], + dependenciesToRemove: ['@storybook/builder-vite'], + }) + ); + }); }); }); }); From 59b97e91e5d89cf530e3dc0c97730680aa0148a1 Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Tue, 10 Jan 2023 15:20:52 +1100 Subject: [PATCH 2/2] Ok, we actually should match the new framework too. --- code/lib/cli/src/automigrate/fixes/new-frameworks.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/code/lib/cli/src/automigrate/fixes/new-frameworks.ts b/code/lib/cli/src/automigrate/fixes/new-frameworks.ts index dee016f57808..d6935e92c703 100644 --- a/code/lib/cli/src/automigrate/fixes/new-frameworks.ts +++ b/code/lib/cli/src/automigrate/fixes/new-frameworks.ts @@ -18,6 +18,7 @@ const packagesMap: Record = { }, '@storybook/preact': { webpack5: '@storybook/preact-webpack5', + vite: '@storybook/preact-vite', }, '@storybook/server': { webpack5: '@storybook/server-webpack5',