Skip to content

Commit

Permalink
feat(storybook): move tsconfig one level up (#17749)
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarini authored Jun 26, 2023
1 parent 9c0c30e commit e58cc79
Show file tree
Hide file tree
Showing 18 changed files with 1,186 additions and 423 deletions.
2 changes: 1 addition & 1 deletion e2e/storybook/src/storybook-nested.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('Storybook generators and executors for standalone workspaces - using R
checkFilesExist(
'.storybook/main.js',
'.storybook/preview.js',
'.storybook/tsconfig.json'
'tsconfig.storybook.json'
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('react-native:storybook-configuration', () => {
appTree.exists('libs/test-ui-lib/.storybook/main.js')
).toBeTruthy();
expect(
appTree.exists('libs/test-ui-lib/.storybook/tsconfig.json')
appTree.exists('libs/test-ui-lib/tsconfig.storybook.json')
).toBeTruthy();
});

Expand Down Expand Up @@ -74,7 +74,7 @@ describe('react-native:storybook-configuration', () => {
appTree.exists('apps/test-ui-app/.storybook/main.js')
).toBeTruthy();
expect(
appTree.exists('apps/test-ui-app/.storybook/tsconfig.json')
appTree.exists('apps/test-ui-app/tsconfig.storybook.json')
).toBeTruthy();
});

Expand Down
2 changes: 1 addition & 1 deletion packages/react/plugins/storybook/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ export const webpack = async (
}

const { withNx, withWeb } = require('@nx/webpack');
const tsconfigPath = join(options.configDir, 'tsconfig.json');

const projectData = await getProjectData(options);
const tsconfigPath = join(projectData.projectRoot, 'tsconfig.storybook.json');

fixBabelConfigurationIfNeeded(storybookWebpackConfig, projectData);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('react:storybook-configuration', () => {

expect(appTree.exists('libs/test-ui-lib/.storybook/main.js')).toBeTruthy();
expect(
appTree.exists('libs/test-ui-lib/.storybook/tsconfig.json')
appTree.exists('libs/test-ui-lib/tsconfig.storybook.json')
).toBeTruthy();
expect(
appTree.exists('apps/test-ui-lib-e2e/cypress.config.ts')
Expand Down Expand Up @@ -104,7 +104,7 @@ describe('react:storybook-configuration', () => {

expect(appTree.exists('apps/test-ui-app/.storybook/main.js')).toBeTruthy();
expect(
appTree.exists('apps/test-ui-app/.storybook/tsconfig.json')
appTree.exists('apps/test-ui-app/tsconfig.storybook.json')
).toBeTruthy();

/**
Expand Down
6 changes: 6 additions & 0 deletions packages/storybook/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@
"version": "16.1.0-beta.0",
"description": "Ignore @nx/react/plugins/storybook in Storybook eslint rules.",
"factory": "./src/migrations/update-16-1-0/eslint-ignore-react-plugin"
},
"update-16-5-0": {
"cli": "nx",
"version": "16.5.0-beta.0",
"description": "Move .storybook/tsconfig.json to tsconfig.storybook.json for non-Angular projects.",
"factory": "./src/migrations/update-16-5-0/move-storybook-tsconfig"
}
},
"packageJsonUpdates": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,34 @@ export default config;

exports[`@nx/storybook:configuration for workspaces with Root project basic functionalities should generate Storybook files for nested project only 2`] = `
"{
"extends": "../tsconfig.json",
"extends": "./tsconfig.json",
"compilerOptions": {
"emitDecoratorMetadata": true,
"outDir": ""
},
"files": [
"../node_modules/@nx/react/typings/styled-jsx.d.ts",
"../node_modules/@nx/react/typings/cssmodule.d.ts",
"../node_modules/@nx/react/typings/image.d.ts"
"node_modules/@nx/react/typings/styled-jsx.d.ts",
"node_modules/@nx/react/typings/cssmodule.d.ts",
"node_modules/@nx/react/typings/image.d.ts"
],
"exclude": [
"../**/*.spec.ts",
"../**/*.spec.js",
"../**/*.spec.tsx",
"../**/*.spec.jsx"
"src/**/*.spec.ts",
"src/**/*.test.ts",
"src/**/*.spec.js",
"src/**/*.test.js",
"src/**/*.spec.tsx",
"src/**/*.test.tsx",
"src/**/*.spec.jsx",
"src/**/*.test.js"
],
"include": [
"../src/**/*.stories.ts",
"../src/**/*.stories.js",
"../src/**/*.stories.jsx",
"../src/**/*.stories.tsx",
"../src/**/*.stories.mdx",
"*.ts",
"*.js"
"src/**/*.stories.ts",
"src/**/*.stories.js",
"src/**/*.stories.jsx",
"src/**/*.stories.tsx",
"src/**/*.stories.mdx",
".storybook/*.js",
".storybook/*.ts"
]
}
"
Expand Down Expand Up @@ -79,30 +83,34 @@ export default config;

exports[`@nx/storybook:configuration for workspaces with Root project basic functionalities should generate Storybook files for nested project only 5`] = `
"{
"extends": "../tsconfig.json",
"extends": "./tsconfig.json",
"compilerOptions": {
"emitDecoratorMetadata": true,
"outDir": ""
},
"files": [
"../../../node_modules/@nx/react/typings/styled-jsx.d.ts",
"../../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../../node_modules/@nx/react/typings/image.d.ts"
"../../node_modules/@nx/react/typings/styled-jsx.d.ts",
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../node_modules/@nx/react/typings/image.d.ts"
],
"exclude": [
"../**/*.spec.ts",
"../**/*.spec.js",
"../**/*.spec.tsx",
"../**/*.spec.jsx"
"src/**/*.spec.ts",
"src/**/*.test.ts",
"src/**/*.spec.js",
"src/**/*.test.js",
"src/**/*.spec.tsx",
"src/**/*.test.tsx",
"src/**/*.spec.jsx",
"src/**/*.test.js"
],
"include": [
"../src/**/*.stories.ts",
"../src/**/*.stories.js",
"../src/**/*.stories.jsx",
"../src/**/*.stories.tsx",
"../src/**/*.stories.mdx",
"*.ts",
"*.js"
"src/**/*.stories.ts",
"src/**/*.stories.js",
"src/**/*.stories.jsx",
"src/**/*.stories.tsx",
"src/**/*.stories.mdx",
".storybook/*.js",
".storybook/*.ts"
]
}
"
Expand Down
Loading

1 comment on commit e58cc79

@vercel
Copy link

@vercel vercel bot commented on e58cc79 Jun 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-nrwl.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx-five.vercel.app
nx.dev

Please sign in to comment.