From ae2c945f45dc5f5351baf87c0c6fc8ea64563fd4 Mon Sep 17 00:00:00 2001 From: Mathias Desloges Date: Fri, 27 Oct 2017 18:08:21 +0200 Subject: [PATCH] configure build tools --- .babelrc | 6 ++++++ .gitignore | 2 +- README.md | 7 ++++++- package.json | 11 +++++------ webpack.config.js | 41 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 59 insertions(+), 8 deletions(-) create mode 100644 .babelrc create mode 100644 webpack.config.js diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..15ad3f4 --- /dev/null +++ b/.babelrc @@ -0,0 +1,6 @@ +{ + "presets": [ + "esnext", + "react" + ] + } \ No newline at end of file diff --git a/.gitignore b/.gitignore index abc487b..6434d4f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ /coverage # production -/build/lib/* +/build/* !/build/lib/.gitkeep # misc diff --git a/README.md b/README.md index dbf8007..7dfc7bd 100644 --- a/README.md +++ b/README.md @@ -7,4 +7,9 @@ One of the main feature that make your (web)app feels like "native" is the scree This repository brings a set of React component in order to help you manage those screens transitions -Note : And because, we are on the web, each page change should be associated with a change in the page url, so be aware that this component set is shipped with "react router" (built-in). \ No newline at end of file +Note : And because, we are on the web, each page change should be associated with a change in the page url, so be aware that this component set is shipped with "react router" (built-in). + +To build examples, run +```shell +WEBPACK_TARGET='examples' webpack +``` \ No newline at end of file diff --git a/package.json b/package.json index 52a4b5c..49e6ddd 100644 --- a/package.json +++ b/package.json @@ -21,17 +21,16 @@ "babel": "^6.23.0", "babel-cli": "^6.26.0", "babel-core": "^6.26.0", + "babel-loader": "^7.1.2", "babel-preset-esnext": "^1.1.3", "babel-preset-react": "^6.24.1", "babelify": "^8.0.0", - "browserify": "^14.5.0", - "browserify-css": "^0.12.1", + "css-loader": "^0.28.7", "react": "^16.0.0", - "react-dom": "^16.0.0" + "react-dom": "^16.0.0", + "webpack": "^3.8.1" }, "scripts": { - "build-lib": "./node_modules/.bin/babel src/lib --out-dir build/lib --presets=esnext,react && cp src/lib/*.css build/lib/", - "build-examples": "./node_modules/.bin/browserify src/examples/index.js -o build/examples/index.js -t [ babelify --presets [ esnext react ] ] -t browserify-css", - "build": "npm run build-lib && npm run build-examples" + "build": "./node_modules/.bin/webpack" } } diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..07046ae --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,41 @@ + +var sourcePathConfig = {} + +if (process.env.WEBPACK_TARGET !== 'examples') { + sourcePathConfig = { + entry: './src/lib', + output: { + path: __dirname + '/build/lib', + filename: 'index.js' + } + } +} else { + sourcePathConfig = { + entry: './src/examples', + output: { + path: __dirname + '/build/examples', + filename: 'index.js' + } + } +} + +module.exports = Object.assign(sourcePathConfig, { + context: __dirname, + + devtool: 'source-map', + + module: { + loaders: [{ + test: /\.css$/, + loader: 'css-loader' + }, + { + test: /\.js$/, + exclude: /node_modules/, + loader: 'babel-loader' + }] + }, + + plugins: [ + ] +}) \ No newline at end of file