Skip to content

Commit

Permalink
Release 7.0.0 (#50)
Browse files Browse the repository at this point in the history
## What's changed

* feat: add storybook main template
(#49)
  • Loading branch information
puehringer authored Dec 14, 2023
2 parents ef98939 + ee74c06 commit bf7c671
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
44 changes: 44 additions & 0 deletions config/storybook.main.template.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/* eslint-disable no-param-reassign */
const path = require('path');

/**
* @param {{ name: string; dirname: string; }} param0 Options
* @returns {import('@storybook/react-webpack5').StorybookConfig}
*/
module.exports = ({ name, dirname }) => ({
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-interactions', '@storybook/preset-scss', 'storybook-addon-swc', '@storybook/addon-mdx-gfm'],
framework: {
name: '@storybook/react-webpack5',
options: {
builder: {
useSWC: true,
},
},
},
webpackFinal: async (config) => {
config.module.rules = config.module.rules.flatMap((rule) => (rule.loader?.includes('swc-loader') ? [
rule,
{
// 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)
...rule,
test: /\.(ts|tsx)$/,
exclude: [],
},
] : [rule]));

config.resolve.alias = {
...(config.resolve.alias || {}),
// 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'""
'../../assets': path.resolve(dirname, '../src/assets'),
// Add visyn_pro/dist as alias, as we have scss/code imports like visyn_pro/dist/assets/...
[`${name}/dist`]: path.resolve(dirname, '../src'),
[`${name}/src`]: path.resolve(dirname, '../src'),
[name]: path.resolve(dirname, '../src'),
};
return config;
},
docs: {
autodocs: true,
},
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "visyn_scripts",
"description": "",
"version": "6.0.0",
"version": "7.0.0",
"author": {
"name": "datavisyn GmbH",
"email": "[email protected]",
Expand Down

0 comments on commit bf7c671

Please sign in to comment.