Skip to content

Commit f3bc4f4

Browse files
authored
Merge pull request binary-com#3843 from binary-hamedanchi/mohammad/move_logic
mohammad/move_logic
2 parents 094ff74 + a268619 commit f3bc4f4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1406
-1270
lines changed

build/babel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = {
33
options: {
44
minified : true,
55
plugins : ['transform-remove-strict-mode'],
6-
presets : ['es2015'],
6+
presets : ['env'],
77
sourceMap : true,
88
sourceType: 'script',
99
},

build/webpack.js

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const CircularDependencyPlugin = require('circular-dependency-plugin');
44
// const UnusedFilesWebpackPlugin = require('unused-files-webpack-plugin')['default'];
55

66
module.exports = function (grunt) {
7-
const isProduction = grunt.cli.tasks[0] === 'release';
7+
const is_production = grunt.cli.tasks[0] === 'release';
88
const plugins = [
99
new CircularDependencyPlugin({
1010
failOnError: true,
@@ -31,9 +31,6 @@ module.exports = function (grunt) {
3131
warnings: false,
3232
},
3333
}),
34-
new webpack.DefinePlugin({
35-
'__REACT_DEVTOOLS_GLOBAL_HOOK__': '({ isDisabled: true })'
36-
}),
3734
// new UnusedFilesWebpackPlugin({
3835
// patterns: [
3936
// 'src/javascript/**/*.*',
@@ -42,7 +39,18 @@ module.exports = function (grunt) {
4239
// }),
4340
];
4441

45-
if (!isProduction) {
42+
if (is_production) {
43+
plugins.push(
44+
new webpack.DefinePlugin({
45+
'__REACT_DEVTOOLS_GLOBAL_HOOK__': '({ isDisabled: true })'
46+
}),
47+
new webpack.DefinePlugin({
48+
'process.env': {
49+
NODE_ENV: JSON.stringify('production'),
50+
},
51+
}),
52+
);
53+
} else {
4654
plugins.push(
4755
function() {
4856
this.plugin('watch-run', (watching, callback) => {
@@ -60,47 +68,42 @@ module.exports = function (grunt) {
6068

6169
callback();
6270
});
63-
}
71+
},
6472
);
6573
}
6674

6775
const common_options = {
6876
node: {
6977
fs: 'empty',
7078
},
71-
// devtool: isProduction ? 'source-map' : 'cheap-source-map',
79+
// devtool: is_production ? 'source-map' : 'cheap-source-map',
7280
cache: true,
7381
stats: {
7482
chunks: false,
7583
},
7684
entry: {
77-
[isProduction ? 'binary.min' :'binary']: './src/javascript',
85+
[is_production ? 'binary.min' :'binary']: './src/javascript',
7886
},
7987
output: {
8088
path : path.resolve(__dirname, `../${global.dist}/js/`),
8189
filename : '[name].js',
8290
chunkFilename: '[name]_[chunkhash].min.js',
83-
publicPath : `${isProduction || grunt.file.exists(`${process.cwd()}/scripts/CNAME`) ? '' : '/binary-static'}${global.branch ? `/${global.branch_prefix}${global.branch}` : ''}/js/`,
91+
publicPath : `${is_production || grunt.file.exists(`${process.cwd()}/scripts/CNAME`) ? '' : '/binary-static'}${global.branch ? `/${global.branch_prefix}${global.branch}` : ''}/js/`,
92+
},
93+
resolve: {
94+
extensions: ['.js', '.jsx'],
8495
},
8596
module: {
8697
loaders: [
8798
{
88-
test : /\.js$/,
89-
exclude: /node_modules/,
90-
loader : 'babel-loader',
91-
query : {
92-
presets: ['env'],
93-
compact: false,
94-
},
95-
}, {
96-
test : /\.jsx$/,
99+
test : /\.jsx?$/,
97100
exclude: /node_modules/,
98101
loader : 'babel-loader',
99102
query : {
100-
presets: ['react','env'],
103+
presets: ['env', 'react'],
101104
plugins: [
102105
'transform-object-rest-spread',
103-
'transform-class-properties'
106+
'transform-class-properties',
104107
],
105108
compact: false,
106109
},

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,13 @@
2828
"babel-core": "6.26.0",
2929
"babel-eslint": "8.0.3",
3030
"babel-loader": "7.1.2",
31-
"babel-plugin-transform-class-properties": "^6.24.1",
31+
"babel-plugin-transform-class-properties": "6.24.1",
3232
"babel-plugin-transform-es2015-modules-commonjs": "6.26.0",
33-
"babel-plugin-transform-object-rest-spread": "^6.26.0",
33+
"babel-plugin-transform-object-rest-spread": "6.26.0",
3434
"babel-plugin-transform-react-jsx": "6.24.1",
3535
"babel-plugin-transform-remove-strict-mode": "0.0.2",
36-
"babel-preset-env": "^1.6.1",
37-
"babel-preset-es2015": "6.24.1",
38-
"babel-preset-react": "^6.24.1",
36+
"babel-preset-env": "1.6.1",
37+
"babel-preset-react": "6.24.1",
3938
"babel-register": "6.26.0",
4039
"binary-live-api": "^29.0.0",
4140
"chai": "4.1.2",
@@ -51,6 +50,7 @@
5150
"eslint-config-prettier": "2.9.0",
5251
"eslint-plugin-import": "2.8.0",
5352
"eslint-plugin-react": "7.5.1",
53+
"extend": "3.0.1",
5454
"gettext-parser": "1.3.0",
5555
"grunt": "1.0.1",
5656
"grunt-babel": "7.0.0",

0 commit comments

Comments
 (0)