Skip to content

Commit

Permalink
Integrate crna-kitchen-sink into the monorepo
Browse files Browse the repository at this point in the history
Add a metro config file to ignore undesired packages from the metro bundle. Also avoid hoisting react-native.
  • Loading branch information
benoitdion committed Mar 16, 2019
1 parent 0d7581a commit 87f21ac
Show file tree
Hide file tree
Showing 10 changed files with 1,177 additions and 11,853 deletions.
2 changes: 1 addition & 1 deletion addons/ondevice-knobs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"react-native-switch": "^1.5.0"
},
"peerDependencies": {
"@storybook/addon-knobs": "5.1.0-alpha.6",
"@storybook/addon-knobs": "5.1.0-alpha.7",
"react": "*",
"react-native": "*"
},
Expand Down
11 changes: 3 additions & 8 deletions examples-native/crna-kitchen-sink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ This project was bootstrapped wit [Expo](https://github.com/expo/expo-cli) and s

## Getting started

1. Install dependencies: `yarn install`
2. Delete node_modules/@storybook
3. Run the storybook server: `yarn storybook`
4. Run the app: `yarn start`

## Iterate on app/react-native

Changes to the yarn workspace do not currently reflect live in this app. To iterate on the react native pieces of storybook, use `scripts/update-crna-kitchen-sink`.
1. Install dependencies: `yarn install` at the root
2. Run the storybook server: `yarn storybook`
3. Run the app: `yarn start`
5 changes: 4 additions & 1 deletion examples-native/crna-kitchen-sink/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"barStyle": "light-content",
"backgroundColor": "#C2185B"
},
"assetBundlePatterns": ["**/*"]
"assetBundlePatterns": ["**/*"],
"packagerOpts": {
"config": "metro.config.js"
}
}
}
22 changes: 22 additions & 0 deletions examples-native/crna-kitchen-sink/metro.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const path = require('path');
const blacklist = require('metro-config/src/defaults/blacklist');

module.exports = {
watchFolders: [
// The monorepo
path.resolve(__dirname, '../..'),
],
resolver: {
blacklistRE: blacklist([
// exclude react-native modules outside of this package
/app\/.*\/node_modules\/react-native\/.*/,
/node_modules\/.*\/node_modules\/react-native\/.*/,
// duplicate packages in server mocks. We don't need them so it's safe to exclude.
/__mocks__\/.*/,
]),
extraNodeModules: {
// resolve react-native to this package's node_modules
'react-native': path.resolve(__dirname, 'node_modules/react-native'),
},
},
};
36 changes: 13 additions & 23 deletions examples-native/crna-kitchen-sink/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,24 @@
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/plugin-transform-react-jsx-source": "^7.2.0",
"@storybook/addon-actions": "file:../../packs/storybook-addon-actions.tgz",
"@storybook/addon-knobs": "file:../../packs/storybook-addon-knobs.tgz",
"@storybook/addon-links": "file:../../packs/storybook-addon-links.tgz",
"@storybook/addon-options": "file:../../packs/storybook-addon-options.tgz",
"@storybook/addons": "file:../../packs/storybook-addons.tgz",
"@storybook/channel-postmessage": "file:../../packs/storybook-channel-postmessage.tgz",
"@storybook/channel-websocket": "file:../../packs/storybook-channel-websocket.tgz",
"@storybook/channels": "file:../../packs/storybook-channels.tgz",
"@storybook/client-api": "file:../../packs/storybook-client-api.tgz",
"@storybook/client-logger": "file:../../packs/storybook-client-logger.tgz",
"@storybook/components": "file:../../packs/storybook-components.tgz",
"@storybook/router": "file:../../packs/storybook-router.tgz",
"@storybook/core": "file:../../lib/core",
"@storybook/core-events": "file:../../packs/storybook-core-events.tgz",
"@storybook/node-logger": "file:../../packs/storybook-node-logger.tgz",
"@storybook/react-native": "file:../../packs/storybook-react-native.tgz",
"@storybook/react-native-server": "file:../../packs/storybook-react-native-server.tgz",
"@storybook/addon-notes": "file:../../packs/storybook-addon-notes.tgz",
"@storybook/addon-ondevice-backgrounds": "file:../../packs/storybook-addon-ondevice-backgrounds.tgz",
"@storybook/addon-ondevice-knobs": "file:../../packs/storybook-addon-ondevice-knobs.tgz",
"@storybook/addon-ondevice-notes": "file:../../packs/storybook-addon-ondevice-notes.tgz",
"@storybook/ui": "file:../../packs/storybook-ui.tgz",
"@storybook/theming": "file:../../packs/storybook-theming.tgz",
"@storybook/addon-knobs": "5.1.0-alpha.7",
"@storybook/addon-ondevice-knobs": "^5.1.0-alpha.7",
"@storybook/addon-ondevice-notes": "5.1.0-alpha.7",
"@storybook/addons": "5.1.0-alpha.7",
"@storybook/react-native": "5.1.0-alpha.7",
"core-js": "^2.5.7",
"babel-loader": "^8.0.4",
"babel-preset-expo": "^5.0.0",
"babel-plugin-module-resolver": "^3.2.0",
"jest-expo": "^32.0.0",
"schedule": "^0.4.0",
"react-test-renderer": "16.5.1"
},
"workspaces": {
"nohoist": [
"react-native/**",
"**/app/react-native*",
"expo"
]
}
}
Loading

0 comments on commit 87f21ac

Please sign in to comment.