Skip to content

Commit

Permalink
Merge pull request #5 from nkbt/Upgrade-to-Webpack2
Browse files Browse the repository at this point in the history
Upgrade to Webpack2
  • Loading branch information
nkbt committed Apr 20, 2017
1 parent 4cae9cc commit 661c763
Show file tree
Hide file tree
Showing 19 changed files with 105 additions and 88 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
/node_modules/
/packages/
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.4.0
7.5.0
11 changes: 6 additions & 5 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
machine:
node:
version: 7.4.0
version: 7.5.0
environment:
NODE_ENV: development

Expand All @@ -10,10 +10,11 @@ dependencies:
override:
- npm install
post:
- node_modules/.bin/lerna bootstrap
- npm run -s lerna -- bootstrap

test:
override:
- node_modules/.bin/lerna run lint
- node_modules/.bin/lerna run test
- node_modules/.bin/lerna run e2e --concurrency 1
- npm run -s lint
- npm run -s lerna -- run lint
- npm run -s lerna -- run test
- npm run -s lerna -- run e2e --concurrency 1
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"lerna": "2.0.0-beta.34",
"lerna": "2.0.0-beta.37",
"version": "independent"
}
32 changes: 23 additions & 9 deletions lib/webpack/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,24 @@ exports.PACKAGE_NAME = PACKAGE_NAME;


exports.loaders = {
json: {test: /\.json$/, loader: `json`},
babel: {
test: /\.js$/,
loader: `babel`,
include: [pathTo(`src`), pathTo(`example`)]
loader: `babel-loader`,
include: [pathTo(`src`), pathTo(`example`)],
options: {
presets: [
[`es2015`, {loose: true, modules: false}],
`react`
],
plugins: [
`transform-object-rest-spread`
],
env: {
production: {
plugins: [`transform-react-remove-prop-types`]
}
}
}
}
};

Expand All @@ -41,19 +54,20 @@ exports.plugins = {
'process.env.NODE_ENV': JSON.stringify(NODE_ENV)
}),
html: new HtmlWebpackPlugin(),
uglify: new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
}
}),
uglify: new webpack.optimize.UglifyJsPlugin(),
include: assets => new HtmlWebpackIncludeAssetsPlugin({
assets,
append: false
}),
loaderOptions: new webpack.LoaderOptionsPlugin({
minimize: true
})
};


exports.resolve = {extensions: [``, `.js`]};
exports.resolve = {
extensions: [`.js`]
};


exports.stats = {colors: true};
Expand Down
4 changes: 1 addition & 3 deletions lib/webpack/dev.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


const {
pathTo,
plugins,
Expand All @@ -25,7 +23,7 @@ module.exports = {
plugins.define
],
module: {
loaders: [
rules: [
loaders.babel
]
},
Expand Down
6 changes: 2 additions & 4 deletions lib/webpack/dist.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


const {
pathTo,
PACKAGE_NAME,
Expand All @@ -13,7 +11,7 @@ const {


module.exports = {
devtool: null,
devtool: false,
entry: pathTo(`src`, `index.js`),
output: {
filename: `${PACKAGE_NAME}.js`,
Expand All @@ -25,7 +23,7 @@ module.exports = {
plugins.define
],
module: {
loaders: [
rules: [
loaders.babel
]
},
Expand Down
7 changes: 4 additions & 3 deletions lib/webpack/min.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const {


module.exports = {
devtool: null,
devtool: false,
entry: pathTo(`src`, `index.js`),
output: {
filename: `${PACKAGE_NAME}.min.js`,
Expand All @@ -23,10 +23,11 @@ module.exports = {
},
plugins: [
plugins.define,
plugins.uglify
plugins.uglify,
plugins.loaderOptions
],
module: {
loaders: [
rules: [
loaders.babel
]
},
Expand Down
4 changes: 2 additions & 2 deletions lib/webpack/pub.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const {


module.exports = {
devtool: null,
devtool: false,
entry: pathTo(`example`, `index.js`),
output: {
filename: `bundle.js`,
Expand All @@ -26,7 +26,7 @@ module.exports = {
])
],
module: {
loaders: [
rules: [
loaders.babel
]
},
Expand Down
21 changes: 10 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,29 @@
"babel-cli": "6.22.2",
"babel-loader": "6.2.10",
"babel-plugin-transform-object-rest-spread": "6.22.0",
"babel-plugin-transform-react-remove-prop-types": "0.2.11",
"babel-plugin-transform-react-remove-prop-types": "0.3.2",
"babel-preset-es2015": "6.22.0",
"babel-preset-node7": "1.4.0",
"babel-preset-node7": "1.5.0",
"babel-preset-react": "6.22.0",
"babel-register": "6.22.0",
"eslint": "3.14.1",
"eslint-config-airbnb": "14.0.0",
"eslint": "3.15.0",
"eslint-config-airbnb": "14.1.0",
"eslint-plugin-import": "2.2.0",
"eslint-plugin-jsx-a11y": "3.0.2",
"eslint-plugin-jsx-a11y": "4.0.0",
"eslint-plugin-react": "6.9.0",
"gh-pages": "0.12.0",
"glob": "7.1.1",
"html-webpack-include-assets-plugin": "0.0.2",
"html-webpack-plugin": "2.26.0",
"json-loader": "0.5.4",
"lerna": "2.0.0-beta.34",
"html-webpack-include-assets-plugin": "0.0.3",
"html-webpack-plugin": "2.28.0",
"lerna": "2.0.0-beta.37",
"nightwatch-autorun": "3.1.0",
"react": "15.4.2",
"react-dom": "15.4.2",
"rimraf": "2.5.4",
"sinon": "1.17.7",
"tap-xunit": "1.7.0",
"tape": "4.6.3",
"webpack": "1.14.0",
"webpack-dev-server": "1.16.2"
"webpack": "2.2.1",
"webpack-dev-server": "2.3.0"
}
}
14 changes: 14 additions & 0 deletions packages/bulkhead/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"presets": [
["es2015", {"loose": true}],
"react"
],
"plugins": [
"transform-object-rest-spread"
],
"env": {
"production": {
"plugins": ["transform-react-remove-prop-types"]
}
}
}
9 changes: 5 additions & 4 deletions packages/bulkhead/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build/
lib/
pub/
reports/
/node_modules/
/build/
/lib/
/pub/
/reports/
2 changes: 1 addition & 1 deletion packages/bulkhead/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.4.0
7.5.0
16 changes: 1 addition & 15 deletions packages/bulkhead/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,5 @@
"LICENSE",
"package.json",
"README.md"
],
"babel": {
"presets": [
["es2015", {"loose": true}],
"react"
],
"plugins": [
"transform-object-rest-spread"
],
"env": {
"production": {
"plugins": ["transform-react-remove-prop-types"]
}
}
}
]
}
14 changes: 14 additions & 0 deletions packages/swap/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"presets": [
["es2015", {"loose": true}],
"react"
],
"plugins": [
"transform-object-rest-spread"
],
"env": {
"production": {
"plugins": ["transform-react-remove-prop-types"]
}
}
}
9 changes: 5 additions & 4 deletions packages/swap/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build/
lib/
pub/
reports/
/node_modules/
/build/
/lib/
/pub/
/reports/
2 changes: 1 addition & 1 deletion packages/swap/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.4.0
7.5.0
16 changes: 1 addition & 15 deletions packages/swap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,5 @@
"LICENSE",
"package.json",
"README.md"
],
"babel": {
"presets": [
["es2015", {"loose": true}],
"react"
],
"plugins": [
"transform-object-rest-spread"
],
"env": {
"production": {
"plugins": ["transform-react-remove-prop-types"]
}
}
}
]
}
19 changes: 11 additions & 8 deletions scripts/e2e.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
#!/usr/bin/env node


const nightwatchAutorun = require(`nightwatch-autorun`);
const webpack = require(`webpack`);
const WebpackDevServer = require(`webpack-dev-server`);


const {npm, CWD} = require(`../lib/bash`);
const {output_folder: REPORT_DIR} = require(`../lib/nightwatch.json`);
const webpackConfig = require(`../lib/webpack/dev.config.js`);


npm(`rimraf reports/e2e`, {cwd: CWD});
npm(`nightwatch-autorun `, {
cwd: CWD,
env: {
NIGHTWATCH_CONFIG: require.resolve(`../lib/nightwatch.json`),
WEBPACK_CONFIG: require.resolve(`../lib/webpack/dev.config.js`),
REPORT_DIR,
LOG_DIR: REPORT_DIR
}
nightwatchAutorun({
server: new WebpackDevServer(webpack(webpackConfig)),
nightwatchConfig: require.resolve(`../lib/nightwatch.json`),
reportDir: REPORT_DIR,
logDir: REPORT_DIR
});

0 comments on commit 661c763

Please sign in to comment.