Skip to content

Commit

Permalink
Merge pull request #1 from BlackFenix2/Babel/Webpack-upgrades
Browse files Browse the repository at this point in the history
upgraded Babel/Webpack packages
  • Loading branch information
BlackFenix2 authored Feb 3, 2019
2 parents e734330 + 312f45a commit bdda096
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"presets": ["es2015-loose", "stage-0", "react"]
"presets": ["@babel/preset-env", "@babel/preset-react"]
}
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# settings for JavaScript files
[*.{js,jsx,ts,tsx,json,md,css}]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true
quote_type = single
12 changes: 5 additions & 7 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "eslint-config-airbnb",
"extends": ["eslint-config-airbnb", "eslint-config-prettier"],
"env": {
"mocha": true,
"browser": true,
Expand All @@ -13,8 +13,8 @@
"react/jsx-quotes": 0,
"block-scoped-var": 0,
"padded-blocks": 0,
"quotes": [ 1, "single" ],
"comma-style": [ 2, "last" ],
"quotes": [1, "single"],
"comma-style": [2, "last"],
"eol-last": 0,
"no-unused-vars": 0,
"no-console": 0,
Expand All @@ -23,11 +23,9 @@
"prefer-arrow-callback": 0,
"comma-dangle": 0,
"id-length": 0,
"indent": [2, 2, {"SwitchCase": 1}],
"indent": [2, 2, { "SwitchCase": 1 }],
"default-case": 0,
"no-underscore-dangle": 0
},
"plugins": [
"react"
]
"plugins": ["react"]
}
6 changes: 3 additions & 3 deletions examples/todomvc/src/stores/ViewStore.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {observable} from 'mobx';
import { observable } from 'mobx';
import { ALL_TODOS } from '../constants';
import remotedev from 'mobx-remotedev/lib/dev';

class ViewStore {
@observable todoBeingEdited = null;
@observable todoFilter= ALL_TODOS;
@observable todoBeingEdited = null;
@observable todoFilter = ALL_TODOS;
}

export default remotedev(ViewStore, { name: 'ViewStore' });
27 changes: 14 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"dist"
],
"scripts": {
"clean": "rimraf lib",
"clean": "rimraf lib dist",
"build:lib": "babel src --out-dir lib",
"build:umd": "webpack src/index.js dist/mobx-remotedev.js --config webpack.config.development.js",
"build:umd:min": "webpack src/index.js dist/mobx-remotedev.min.js --config webpack.config.production.js",
"build:umd": "webpack --config webpack.config.development.js",
"build:umd:min": "webpack --config webpack.config.production.js",
"build": "npm run build:lib && npm run build:umd && npm run build:umd:min",
"lint": "eslint src test",
"prepublish": "npm run lint && npm run clean && npm run build"
Expand All @@ -37,25 +37,26 @@
},
"homepage": "https://github.com/zalmoxisus/mobx-remotedev",
"devDependencies": {
"babel-cli": "^6.10.1",
"babel-core": "^6.10.4",
"babel-eslint": "^6.0.5",
"babel-loader": "^6.2.4",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-es2015": "^6.9.0",
"babel-preset-es2015-loose": "^7.0.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-0": "^6.5.0",
"@babel/cli": "^7.2.3",
"@babel/core": "^7.2.2",
"@babel/preset-env": "^7.3.1",
"@babel/preset-react": "^7.0.0",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.5",
"eslint": "^2.13.1",
"eslint-config-airbnb": "^9.0.1",
"eslint-config-prettier": "^4.0.0",
"eslint-plugin-import": "^1.9.2",
"eslint-plugin-jsx-a11y": "^1.5.3",
"eslint-plugin-react": "^5.2.2",
"expect": "^1.20.1",
"mobx": "^4.1.1",
"mocha": "^2.5.3",
"rimraf": "^2.5.2",
"webpack": "^1.13.1"
"terser-webpack-plugin": "^1.2.1",
"webpack": "^4.29.0",
"webpack-cli": "^3.2.1",
"webpack-merge": "^4.2.1"
},
"peerDependencies": {
"mobx": ">=4.0.0"
Expand Down
5 changes: 3 additions & 2 deletions webpack.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ module.exports = {
mobx: 'mobx'
},
module: {
loaders: [
rules: [
{ test: /\.js$/, loaders: ['babel-loader'], exclude: /node_modules/ }
]
},
entry: './src/index.js',
output: {
library: 'RemoteDev',
libraryTarget: 'umd'
},
resolve: {
extensions: ['', '.js']
extensions: ['.js']
}
};
21 changes: 13 additions & 8 deletions webpack.config.development.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@

var webpack = require('webpack');
var baseConfig = require('./webpack.config.base');
var merge = require('webpack-merge');

var config = Object.create(baseConfig);
config.plugins = [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
})
];
var devConfig = {
mode: 'development',
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
})
],
output: {
filename: 'mobx-remotedev.js'
}
};

module.exports = config;
module.exports = merge(baseConfig, devConfig);
40 changes: 26 additions & 14 deletions webpack.config.production.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,31 @@

var webpack = require('webpack');
var baseConfig = require('./webpack.config.base');
const TerserPlugin = require('terser-webpack-plugin');
var merge = require('webpack-merge');

var config = Object.create(baseConfig);
config.plugins = [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
}),
new webpack.optimize.UglifyJsPlugin({
compressor: {
screw_ie8: true,
warnings: false
}
})
];
var prodConfig = {
mode: 'development',
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
})
],
optimization: {
minimizer: [
new TerserPlugin({
// cache: true,
parallel: true,
terserOptions: {
// keep function names for Mobx Injection
keep_fnames: true
}
})
]
},
output: {
filename: 'mobx-remotedev.min.js'
}
};

module.exports = config;
module.exports = merge(baseConfig, prodConfig);

0 comments on commit bdda096

Please sign in to comment.