Skip to content

Commit

Permalink
Merge pull request #30190 from storybookjs/danny/rnw-doesnt-require-v…
Browse files Browse the repository at this point in the history
…ite-conf

Automigrations: Skip vite config file migration for react native web
  • Loading branch information
shilman authored Jan 6, 2025
2 parents de65bec + 45e96d3 commit 4162860
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { describe, expect, it } from 'vitest';

import type { StorybookConfig } from 'storybook/internal/types';

import { viteConfigFile } from './vite-config-file';

const check = async ({
packageManager,
main: mainConfig,
storybookVersion = '8.0.0',
}: {
packageManager: any;
main: Partial<StorybookConfig> & Record<string, unknown>;
storybookVersion?: string;
}) => {
return viteConfigFile.check({
packageManager,
configDir: '',
mainConfig: mainConfig as any,
storybookVersion,
});
};

describe('no-ops', () => {
it('skips when react-native-web-vite', async () => {
await expect(
check({
packageManager: {},
main: {
framework: '@storybook/react-native-web-vite',
},
})
).resolves.toBeFalsy();
});
});

describe('continue', () => {
it('executes for vite framework', async () => {
await expect(
check({
packageManager: {},
main: {
framework: '@storybook/react-vite',
},
})
).resolves.toBeTruthy();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ export const viteConfigFile = {
return null;
}
const frameworkName = frameworkPackages[frameworkPackageName];

if (frameworkName === 'react-native-web-vite') {
// we don't expect a vite config file for this framework
return null;
}

const isUsingViteBuilder =
mainConfig.core?.builder === 'vite' ||
frameworkPackageName?.includes('vite') ||
Expand Down

0 comments on commit 4162860

Please sign in to comment.