Skip to content

Commit

Permalink
configure build tools
Browse files Browse the repository at this point in the history
  • Loading branch information
FreakDev committed Oct 27, 2017
1 parent c459b20 commit ae2c945
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"presets": [
"esnext",
"react"
]
}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/coverage

# production
/build/lib/*
/build/*
!/build/lib/.gitkeep

# misc
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
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
```
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
41 changes: 41 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -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: [
]
})

0 comments on commit ae2c945

Please sign in to comment.