Skip to content

Commit bf7c671

Browse files
authored
Release 7.0.0 (#50)
## What's changed * feat: add storybook main template (#49)
2 parents ef98939 + ee74c06 commit bf7c671

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

config/storybook.main.template.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/* eslint-disable no-param-reassign */
2+
const path = require('path');
3+
4+
/**
5+
* @param {{ name: string; dirname: string; }} param0 Options
6+
* @returns {import('@storybook/react-webpack5').StorybookConfig}
7+
*/
8+
module.exports = ({ name, dirname }) => ({
9+
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
10+
addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-interactions', '@storybook/preset-scss', 'storybook-addon-swc', '@storybook/addon-mdx-gfm'],
11+
framework: {
12+
name: '@storybook/react-webpack5',
13+
options: {
14+
builder: {
15+
useSWC: true,
16+
},
17+
},
18+
},
19+
webpackFinal: async (config) => {
20+
config.module.rules = config.module.rules.flatMap((rule) => (rule.loader?.includes('swc-loader') ? [
21+
rule,
22+
{
23+
// In addition to the swc-loader rule from storybook, add a rule which allows transforming ts and tsx files (i.e. to transform node_modules/visyn_core)
24+
...rule,
25+
test: /\.(ts|tsx)$/,
26+
exclude: [],
27+
},
28+
] : [rule]));
29+
30+
config.resolve.alias = {
31+
...(config.resolve.alias || {}),
32+
// I have no clue why this is required, but if this is missing we get a "Can't resolve '../../assets/icons/datavisyn_logo.svg' in '.../src/scss'""
33+
'../../assets': path.resolve(dirname, '../src/assets'),
34+
// Add visyn_pro/dist as alias, as we have scss/code imports like visyn_pro/dist/assets/...
35+
[`${name}/dist`]: path.resolve(dirname, '../src'),
36+
[`${name}/src`]: path.resolve(dirname, '../src'),
37+
[name]: path.resolve(dirname, '../src'),
38+
};
39+
return config;
40+
},
41+
docs: {
42+
autodocs: true,
43+
},
44+
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "visyn_scripts",
33
"description": "",
4-
"version": "6.0.0",
4+
"version": "7.0.0",
55
"author": {
66
"name": "datavisyn GmbH",
77
"email": "[email protected]",

0 commit comments

Comments
 (0)