Skip to content

Commit

Permalink
fix(storybook): dont use swc addon on sb7 and format
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarini committed Apr 19, 2023
1 parent 1b7587f commit dfadb9b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import storiesGenerator from '../stories/stories';
import {
convertNxGenerator,
ensurePackage,
formatFiles,
logger,
readProjectConfiguration,
Tree,
Expand Down Expand Up @@ -78,6 +79,8 @@ export async function storybookConfigurationGenerator(
await generateStories(host, schema);
}

await formatFiles(host);

return installTask;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,11 +360,7 @@ exports[`@nx/storybook:configuration for Storybook v7 generate Storybook configu
exports[`@nx/storybook:configuration for Storybook v7 generate Storybook configuration for all types of projects should contain the correct configuration in "apps/react-swc/.storybook/" 1`] = `
"const config = {
stories: ['../src/app/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
addons: [
'@storybook/addon-essentials',
'@nx/react/plugins/storybook',
'storybook-addon-swc',
],
addons: ['@storybook/addon-essentials', '@nx/react/plugins/storybook'],
framework: {
name: '@storybook/react-webpack5',
options: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export async function configurationGenerator(
if (nextBuildTarget && projectType === 'application' && !storybook7) {
devDeps['storybook-addon-next'] = storybookNextAddonVersion;
devDeps['storybook-addon-swc'] = storybookSwcAddonVersion;
} else if (compiler === 'swc') {
} else if (compiler === 'swc' && !storybook7) {
devDeps['storybook-addon-swc'] = storybookSwcAddonVersion;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ const config: StorybookConfig = {
'../**/*.stories.@(js|jsx|ts|tsx|mdx)' <% } else { %>
'../<%= projectDirectory %>/**/*.stories.@(js|jsx|ts|tsx|mdx)'
<% } %>],
addons: ['@storybook/addon-essentials' <% if(uiFramework === '@storybook/react-webpack5') { %>, '@nx/react/plugins/storybook' <% } %><% if(uiFramework === '@storybook/react-native') { %>, '@storybook/addon-ondevice-actions', '@storybook/addon-ondevice-backgrounds', '@storybook/addon-ondevice-controls', '@storybook/addon-ondevice-notes' <% } %>
<% if(usesSwc) { %>, 'storybook-addon-swc' <% } %>
],
addons: ['@storybook/addon-essentials' <% if(uiFramework === '@storybook/react-webpack5') { %>, '@nx/react/plugins/storybook' <% } %><% if(uiFramework === '@storybook/react-native') { %>, '@storybook/addon-ondevice-actions', '@storybook/addon-ondevice-backgrounds', '@storybook/addon-ondevice-controls', '@storybook/addon-ondevice-notes' <% } %>],
framework: {
name: '<%= uiFramework %>',
options: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ const config = {
'../**/*.stories.@(js|jsx|ts|tsx|mdx)' <% } else { %>
'../<%= projectDirectory %>/**/*.stories.@(js|jsx|ts|tsx|mdx)'
<% } %>],
addons: ['@storybook/addon-essentials' <% if(uiFramework === '@storybook/react-webpack5') { %>, '@nx/react/plugins/storybook' <% } %><% if(uiFramework === '@storybook/react-native') { %>, '@storybook/addon-ondevice-actions', '@storybook/addon-ondevice-backgrounds', '@storybook/addon-ondevice-controls', '@storybook/addon-ondevice-notes' <% } %>
<% if(usesSwc) { %>, 'storybook-addon-swc' <% } %>
],
addons: ['@storybook/addon-essentials' <% if(uiFramework === '@storybook/react-webpack5') { %>, '@nx/react/plugins/storybook' <% } %><% if(uiFramework === '@storybook/react-native') { %>, '@storybook/addon-ondevice-actions', '@storybook/addon-ondevice-backgrounds', '@storybook/addon-ondevice-controls', '@storybook/addon-ondevice-notes' <% } %>],
framework: {
name: '<%= uiFramework %>',
options: {
Expand Down

0 comments on commit dfadb9b

Please sign in to comment.