-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(storybook): choose to generate ts config
ISSUES CLOSED: nrwl#10394
- Loading branch information
Showing
14 changed files
with
109 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
packages/storybook/src/generators/configuration/project-files-ts/.storybook/main.ts__tmpl__
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const rootMain = require('<%= offsetFromRoot %>../.storybook/main'); | ||
<% if (existsRootWebpackConfig){ %>const rootWebpackConfig = require('<%= offsetFromRoot %>../.storybook/webpack.config'); <% } %> | ||
|
||
module.exports = { | ||
...rootMain, | ||
<% if (useWebpack5) { %> | ||
core: { ...rootMain.core, builder: 'webpack5' }, | ||
<% } %> | ||
stories: [ | ||
...rootMain.stories, | ||
'../src/<%= projectType %>/**/*.stories.mdx', | ||
'../src/<%= projectType %>/**/*.stories.@(js|jsx|ts|tsx)' | ||
], | ||
addons: [...rootMain.addons <% if(uiFramework === '@storybook/react') { %>, '@nrwl/react/plugins/storybook' <% } %><% if(uiFramework === '@storybook/react-native') { %>, '@storybook/addon-ondevice-actions', '@storybook/addon-ondevice-backgrounds', '@storybook/addon-ondevice-controls', '@storybook/addon-ondevice-notes' <% } %>], | ||
webpackFinal: async (config, { configType }) => { | ||
// apply any global webpack configs that might have been specified in .storybook/main.js | ||
if (rootMain.webpackFinal) { | ||
config = await rootMain.webpackFinal(config, { configType }); | ||
} | ||
|
||
<% if (existsRootWebpackConfig) { %>// for backwards compatibility call the `rootWebpackConfig` | ||
// this can be removed once that one is migrated fully to | ||
// use the `webpackFinal` property in the `main.js` file | ||
config = rootWebpackConfig({ config }); | ||
<% } %> | ||
|
||
// add your own webpack tweaks if needed | ||
|
||
return config; | ||
}, | ||
}; |
Empty file.
14 changes: 14 additions & 0 deletions
14
.../storybook/src/generators/configuration/project-files-ts/.storybook/tsconfig.json__tmpl__
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"emitDecoratorMetadata": true | ||
<% if(uiFramework === '@storybook/react') { %>, "outDir": "" <% } %> | ||
}, | ||
<% if(uiFramework === '@storybook/react') { %>"files": [ | ||
"<%= offsetFromRoot %>../node_modules/@nrwl/react/typings/styled-jsx.d.ts", | ||
"<%= offsetFromRoot %>../node_modules/@nrwl/react/typings/cssmodule.d.ts", | ||
"<%= offsetFromRoot %>../node_modules/@nrwl/react/typings/image.d.ts" | ||
],<% } %> | ||
"exclude": ["../**/*.spec.ts" <% if(uiFramework === '@storybook/react') { %>, "../**/*.spec.js", "../**/*.spec.tsx", "../**/*.spec.jsx"<% } %>], | ||
"include": ["../src/**/*", "*.js" <% if(uiFramework === '@storybook/react-native') { %>, "*.ts", "*.tsx"<% } %>] | ||
} |
11 changes: 11 additions & 0 deletions
11
packages/storybook/src/generators/configuration/root-files-ts/.storybook/main.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
stories: [], | ||
addons: ['@storybook/addon-essentials'], | ||
// uncomment the property below if you want to apply some webpack config globally | ||
// webpackFinal: async (config, { configType }) => { | ||
// // Make whatever fine-grained changes you need that should apply to all storybook configs | ||
|
||
// // Return the altered config | ||
// return config; | ||
// }, | ||
}; |
14 changes: 14 additions & 0 deletions
14
packages/storybook/src/generators/configuration/root-files-ts/.storybook/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"extends": "../<%= rootTsConfigPath %>", | ||
"exclude": [ | ||
"../**/*.spec.js", | ||
"../**/*.test.js", | ||
"../**/*.spec.ts", | ||
"../**/*.test.ts", | ||
"../**/*.spec.tsx", | ||
"../**/*.test.tsx", | ||
"../**/*.spec.jsx", | ||
"../**/*.test.jsx" | ||
], | ||
"include": ["../**/*"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters