Skip to content

Commit

Permalink
storybook v7 (#53)
Browse files Browse the repository at this point in the history
* migrate to storybook 7.0.0-beta (#52)

* chore(migration): migrate from storybook v6 to v7

* fix: format mdx file

* fix: add missing babel plugin

---------

authored-by: Arnaud Manaranche <[email protected]>

* trigger canary

* lock

* fix: remove unnecessary builder config from main.js (#54)

* update to rc version

* chore:  update package.json to remove unused/un-needed dependencies

* remove unused peerDeps, widen sb devDeps, fix start script

* simplify sb dev deps range

---------

Co-authored-by: Natalie Rouvière <[email protected]>
Co-authored-by: Michael Shilman <[email protected]>
Co-authored-by: Jeppe Reinhold <[email protected]>
  • Loading branch information
4 people authored Mar 31, 2023
1 parent 1a908fe commit 699e40f
Show file tree
Hide file tree
Showing 8 changed files with 5,775 additions and 7,500 deletions.
14 changes: 13 additions & 1 deletion .babelrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
module.exports = {
presets: [
'@babel/preset-env',
[
'@babel/preset-env',
{
shippedProposals: true,
useBuiltIns: 'usage',
corejs: '3',
targets: { node: '14' },
},
],
'@babel/preset-typescript',
'@babel/preset-react',
],
Expand All @@ -10,7 +18,11 @@ module.exports = {
[
'@babel/preset-env',
{
shippedProposals: true,
useBuiltIns: 'usage',
corejs: '3',
modules: false,
targets: { chrome: '100' },
},
],
],
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ node_modules/
storybook-static/
build-storybook.log
.DS_Store
.env
.env!/
.yarn/
24 changes: 20 additions & 4 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,26 @@ module.exports = {
},
'@storybook/addon-essentials',
],
framework: '@storybook/react',
core: {
builder: {
name: 'webpack5',
framework: {
name: '@storybook/react-webpack5',
options: { fastRefresh: true },
},
typescript: {
check: false,
checkOptions: {},
reactDocgen: 'react-docgen-typescript',
reactDocgenTypescriptOptions: {
// speeds up storybook build time
allowSyntheticDefaultImports: false,
// speeds up storybook build time
esModuleInterop: false,
// makes union prop types like variant and size appear as select controls
shouldExtractLiteralValuesFromEnum: true,
// makes string and boolean types that can be undefined appear as inputs and switches
shouldRemoveUndefinedFromOptional: true,
},
},
docs: {
autodocs: true,
},
};
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
50 changes: 23 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,76 +32,72 @@
"build": "concurrently \"yarn buildBabel\" \"yarn buildTsc\"",
"build:watch": "concurrently \"yarn buildBabel:esm -- --watch\" \"yarn buildTsc -- --watch\"",
"test": "echo \"Error: no test specified\" && exit 1",
"storybook": "start-storybook -p 6006",
"storybook": "storybook dev -p 6006",
"prestorybook": "yarn buildBabel:cjs",
"start": "concurrently \"yarn build:watch\" \"yarn storybook -- --no-manager-cache --quiet\"",
"build-storybook": "build-storybook",
"start": "concurrently \"yarn build:watch\" \"yarn storybook -- --quiet\"",
"build-storybook": "storybook build",
"prerelease": "zx scripts/prepublish-checks.mjs",
"release": "yarn build && auto shipit",
"eject-ts": "zx scripts/eject-typescript.mjs",
"chromatic": "npx chromatic --project-token=c9eb9dda8699"
},
"devDependencies": {
"@babel/cli": "^7.17.6",
"@babel/core": "^7.17.9",
"@babel/preset-env": "^7.16.11",
"@babel/cli": "^7.20.7",
"@babel/core": "^7.20.12",
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.16.7",
"@babel/runtime": "^7.17.9",
"@babel/preset-typescript": "^7.18.6",
"@babel/runtime": "^7.20.13",
"@expo/html-elements": "^0.2.0",
"@react-native-community/eslint-config": "^3.1.0",
"@storybook/addon-actions": "^6.5.13",
"@storybook/addon-essentials": "^6.5.13",
"@storybook/builder-webpack5": "^6.5.6",
"@storybook/manager-webpack5": "^6.5.6",
"@storybook/addon-links": "^6.5.13",
"@storybook/react": "^6.5.13",
"@storybook/addon-essentials": "^7.0.0",
"@storybook/react": "^7.0.0",
"@storybook/react-webpack5": "^7.0.0",
"@types/jest": "^27.4.1",
"@types/react-native": "^0.70.6",
"@types/react-native": "^0.71.1",
"@types/react-native-vector-icons": "^6.4.12",
"@types/react-test-renderer": "^18.0.0",
"auto": "^10.36.5",
"babel-jest": "^28.0.0",
"babel-loader": "^8.2.5",
"babel-loader": "^9.1.2",
"babel-plugin-react-docgen-typescript": "^1.5.1",
"babel-plugin-react-native-web": "^0.18.9",
"boxen": "^5.0.1",
"chromatic": "^6.11.2",
"concurrently": "^7.5.0",
"dedent": "^0.7.0",
"eslint": "^8.14.0",
"eslint-plugin-ft-flow": "^2.0.3",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-storybook": "^0.6.6",
"expo-linear-gradient": "^11.4.0",
"jest": "^28.0.0",
"metro-react-native-babel-preset": "^0.73.3",
"metro-react-native-babel-preset": "^0.74.1",
"native-base": "^3.4.19",
"prettier": "^2.7.1",
"prop-types": "^15.8.1",
"react": "18.1.0",
"react-dom": "18.1.0",
"react-native": "^0.70.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "^0.71.1",
"react-native-gesture-handler": "^2.8.0",
"react-native-paper": "^4.12.5",
"react-native-reanimated": "2.9.1",
"react-native-reanimated": "2.14.4",
"react-native-safe-area-context": "^4.4.1",
"react-native-screens": "^3.18.2",
"react-native-svg": "^13.4.0",
"react-native-vector-icons": "^9.2.0",
"react-native-web": "^0.18.9",
"react-test-renderer": "18.1.0",
"rimraf": "^3.0.2",
"typescript": "^4.8.4",
"storybook": "^7.0.0",
"typescript": "^4.9.5",
"victory": "^36.6.8",
"victory-native": "^36.6.8",
"webpack": "5",
"zx": "^6.1.0"
},
"peerDependencies": {
"@babel/preset-react": "*",
"@storybook/addons": "*",
"@storybook/api": "*",
"@storybook/components": "*",
"@storybook/core-events": "*",
"@storybook/theming": "*",
"babel-plugin-react-native-web": "*",
"metro-react-native-babel-preset": "*",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
Expand Down
7 changes: 6 additions & 1 deletion src/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ const webpackFinal = async (config: any, options: Options) => {
},
],
],
plugins: [...babelPlugins, '@babel/plugin-proposal-class-properties'],
plugins: [
...babelPlugins,
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-export-namespace-from',
],
},
});

Expand All @@ -119,6 +123,7 @@ const webpackFinal = async (config: any, options: Options) => {
...config.resolve.alias,
...userAliases,
};

return config;
};

Expand Down
12 changes: 7 additions & 5 deletions stories/template/Introduction.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import Plugin from './assets/plugin.svg';
import Repo from './assets/repo.svg';
import StackAlt from './assets/stackalt.svg';

<Meta />
<Meta title='Introduction' />

<style>{`
<style>
{`
.subheading {
--mediumdark: '#999999';
font-weight: 900;
Expand Down Expand Up @@ -73,7 +74,7 @@ import StackAlt from './assets/stackalt.svg';
display: block;
margin-bottom: 2px;
}
.link-item img {
height: 40px;
width: 40px;
Expand Down Expand Up @@ -111,8 +112,9 @@ import StackAlt from './assets/stackalt.svg';
display: inline-block;
}
`}</style>
`}
</style>

# Welcome to Storybook

Expand Down
Loading

0 comments on commit 699e40f

Please sign in to comment.