Skip to content

Commit

Permalink
Merge pull request #4 from n0izn0iz/dev/no/storybook-web-babel
Browse files Browse the repository at this point in the history
storybook-web use @berty-tech/babel-preset + linux find packages fix
  • Loading branch information
90dy committed Sep 25, 2019
2 parents a30b78f + f8abc0a commit 9994061
Show file tree
Hide file tree
Showing 4 changed files with 340 additions and 843 deletions.
5 changes: 3 additions & 2 deletions js/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ endif
ifeq ($(UNAME_S),Linux)
export SHELL = /usr/bin/bash
npm := /usr/bin/npm
pkg := $(shell find $(PWD)/packages -maxdepth 1 -type d)
pkg := $(filter-out $(PWD)/packages, $(shell find $(PWD)/packages -maxdepth 1 -type d))
else
endif
npm_flags := --no-progress

Expand All @@ -25,7 +26,7 @@ lerna_exec := $(lerna) $(lerna_flags) exec --stream --parallel --scope=$1 --

eslint := $(bin)/eslint

pkg := $(shell find $(PWD)/packages -depth 1 -type d)
pkg ?= $(shell find $(PWD)/packages -depth 1 -type d)
pkg_mod := $(patsubst %, %/node_modules, $(pkg))

include packages/berty-app/Makefile
Expand Down
6 changes: 4 additions & 2 deletions js/packages/storybook-web/lib/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const path = require('path')
// const webpack = require("webpack")

module.exports = ({ config: storybookBaseConfig }) => {
storybookBaseConfig.resolve.alias['^react-native$'] = 'react-native-web'
Expand All @@ -8,6 +7,9 @@ module.exports = ({ config: storybookBaseConfig }) => {
// TODO: replace by find
const babelRule = storybookBaseConfig.module.rules[0]

// Override test because storybook ignores tsx
babelRule.test = /\.(mjs|jsx?|tsx?)/

babelRule.include = [
path.resolve(__dirname, 'config.js'),
path.resolve(__dirname, '../node_modules/@berty-tech/berty-storybook'),
Expand All @@ -20,7 +22,7 @@ module.exports = ({ config: storybookBaseConfig }) => {
...babelConfig,
options: {
...babelConfig.options,
presets: ['module:metro-react-native-babel-preset'],
presets: ['@berty-tech/babel-preset'],
plugins: ['react-native-web'],
},
}
Expand Down

0 comments on commit 9994061

Please sign in to comment.