From 73a471a7e8147d74a44b44ba6e2b2cb140a72088 Mon Sep 17 00:00:00 2001 From: mmahalwy Date: Sat, 6 Aug 2016 14:09:51 -0700 Subject: [PATCH 1/4] Babel fixes --- package.json | 24 +++++++++++------------- webpack/dev.config.js | 2 +- webpack/prod.config.js | 2 +- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index d288c694e..522776ba7 100644 --- a/package.json +++ b/package.json @@ -2,15 +2,14 @@ "name": "quran", "version": "1.0.0", "private": false, + "repository": "https://github.com/quran/quran.com-frontend", "scripts": { "test": "npm run test:dev:unit", - "test:ci:unit": "./node_modules/karma/bin/karma start --browsers PhantomJS --single-run; npm run test:ci:lint", + "test:ci:unit": "karma start --browsers PhantomJS --single-run; npm run test:ci:lint", "test:ci:functional": "BROWSER=phantomjs bash tests/functional/test.sh start-ci", "posttest:ci:functional": "bash tests/functional/test.sh stop", - "test:ci:unit": "karma start --browsers PhantomJS --single-run; npm run test:ci:lint", - "test:dev:unit": "karma start", - "test:ci:lint": "eslint ./src/**/*.js", "test:dev:unit": "./node_modules/karma/bin/karma start", + "test:ci:lint": "eslint ./src/**/*.js", "test:dev:functional": "BROWSER=chrome bash tests/functional/test.sh start", "posttest:dev:functional": "bash tests/functional/test.sh stop", "test:dev:lint": "eslint ./src/scripts/**/*.js", @@ -29,6 +28,7 @@ "app-module-path": "^1.0.2", "autoprefixer-loader": "^3.1.0", "babel": "^6.5.2", + "babel-core": "^6.13.2", "babel-loader": "^6.2.4", "babel-plugin-add-module-exports": "^0.1.4", "babel-plugin-system-import-transformer": "^2.0.0", @@ -37,12 +37,11 @@ "babel-plugin-transform-runtime": "^6.7.5", "babel-plugin-typecheck": "^3.8.0", "babel-polyfill": "^6.7.4", - "babel-preset-es2015": "~6.9.0", - "babel-preset-es2015-webpack": "^6.4.1", + "babel-preset-es2015": "^6.13.2", "babel-preset-react": "^6.5.0", "babel-preset-stage-0": "^6.5.0", - "babel-register": "^6.7.2", - "babel-runtime": "^6.6.1", + "babel-register": "^6.11.6", + "babel-runtime": "^6.11.6", "body-parser": "^1.14.1", "bootstrap-loader": "^1.0.10", "bootstrap-sass": "~3.3.1", @@ -62,7 +61,7 @@ "express": "^4.3.2", "express-state": "^1.2.0", "express-useragent": "^0.2.0", - "extract-text-webpack-plugin": "^1.0.1", + "extract-text-webpack-plugin": "2.0.0-beta.3", "file-loader": "^0.8.4", "fontfaceobserver": "^1.7.1", "html-webpack-plugin": "^1.4.0", @@ -107,17 +106,16 @@ "superagent": "^1.2.0", "url": "^0.11.0", "url-loader": "~0.5.5", - "webpack": "2.1.0-beta.7", + "webpack": "2.1.0-beta.20", "webpack-isomorphic-tools": "^2.2.41", "winston": "^1.1.2" }, "devDependencies": { - "babel-core": "^6.7.7", "babel-eslint": "^6.0.4", "babel-plugin-react-transform": "^2.0.2", "babel-preset-react-hmre": "^1.1.1", "chai": "^3.0.0", - "chromedriver": "^2.19.0", + "chromedriver": "^2.22.2", "del": "^2.0.2", "enzyme": "^2.2.0", "eslint": "^2.13.0", @@ -127,7 +125,7 @@ "eslint-plugin-jsx-a11y": "^1.5.3", "eslint-plugin-react": "^5.2.2", "jscs": "^2.1.1", - "karma": "^0.13.9", + "karma": "^1.1.2", "karma-chai": "^0.1.0", "karma-chai-sinon": "^0.1.5", "karma-chrome-launcher": "^0.2.0", diff --git a/webpack/dev.config.js b/webpack/dev.config.js index 168b58f14..617712bfc 100644 --- a/webpack/dev.config.js +++ b/webpack/dev.config.js @@ -39,7 +39,7 @@ module.exports = { 'transform-react-display-name', 'typecheck', ], - presets: ['react', 'es2015-webpack', 'stage-0', 'react-hmre'], + presets: ['react', ['es2015', {'modules': false}], 'stage-0', 'react-hmre'], cacheDirectory: true } }, diff --git a/webpack/prod.config.js b/webpack/prod.config.js index 5bc91ef91..6da54c4e2 100644 --- a/webpack/prod.config.js +++ b/webpack/prod.config.js @@ -48,7 +48,7 @@ module.exports = { { loader: 'babel', query: { - 'presets': ['react', 'es2015-webpack', 'stage-0'], + 'presets': ['react', ['es2015', {'modules': false}], 'stage-0'], 'plugins': [ 'transform-runtime', 'add-module-exports', From b991953c88805b16b59cd43e5a7fa42f9a62a75d Mon Sep 17 00:00:00 2001 From: Mohamed El Mahallawy Date: Sat, 6 Aug 2016 14:16:45 -0700 Subject: [PATCH 2/4] extract problem --- bootstrap.config.prod.js | 2 +- package.json | 5 +++-- webpack/prod.config.js | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bootstrap.config.prod.js b/bootstrap.config.prod.js index e8ef41741..cb1b2a36d 100644 --- a/bootstrap.config.prod.js +++ b/bootstrap.config.prod.js @@ -1,4 +1,4 @@ const bootstrapConfig = require('./bootstrap.config.js'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); -bootstrapConfig.styleLoader = ExtractTextPlugin.extract('style-loader', 'css-loader!sass-loader'); +bootstrapConfig.styleLoader = ExtractTextPlugin.extract('style-loader!css-loader!sass-loader'); module.exports = bootstrapConfig; diff --git a/package.json b/package.json index 522776ba7..912a071bd 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,8 @@ "test:ci:lint": "eslint ./src/**/*.js", "test:dev:functional": "BROWSER=chrome bash tests/functional/test.sh start", "posttest:dev:functional": "bash tests/functional/test.sh stop", - "test:dev:lint": "eslint ./src/scripts/**/*.js", - "test:stylelint": "stylelint './src/**/*.scss' --config webpack/.stylelintrc", + "test:dev:lint": "node_modules/eslint/bin/eslint.js ./src/scripts/**/*.js", + "test:stylelint": "node_modules/stylelint/dist/cli.js './src/**/*.scss' --config webpack/.stylelintrc", "dev": "node webpack/dev-server.js & PORT=8000 node start.js", "start": "NODE_PATH=\"./src\" node ./start", "build": "node ./node_modules/webpack/bin/webpack.js --config webpack/prod.config.js", @@ -153,6 +153,7 @@ "selenium-server": "^2.48.2", "sinon": "^1.15.3", "sinon-chai": "^2.8.0", + "stylelint": "^7.1.0", "stylelint-webpack-plugin": "^0.2.0", "wdio-mocha-framework": "^0.3.7", "wdio-spec-reporter": "0.0.3", diff --git a/webpack/prod.config.js b/webpack/prod.config.js index 6da54c4e2..3c944932f 100644 --- a/webpack/prod.config.js +++ b/webpack/prod.config.js @@ -59,7 +59,7 @@ module.exports = { } ]}, { test: /\.json$/, loader: 'json-loader'}, - { test: /\.scss$/, loader: ExtractTextPlugin.extract('style', 'css?modules&importLoaders=2&sourceMap!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap=true&sourceMapContents=true') }, + { test: /\.scss$/, loader: ExtractTextPlugin.extract('style!css?modules&importLoaders=2&sourceMap!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap=true&sourceMapContents=true') }, { test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "url?name=fonts/[name].[ext]&limit=10000&mimetype=application/font-woff" }, { test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: "url?name=fonts/[name].[ext]&limit=10000&mimetype=application/font-woff" }, { test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?name=fonts/[name].[ext]&limit=10000&mimetype=application/octet-stream" }, From 291dd62f5fa645a3961250fcef651ec6e5f80a77 Mon Sep 17 00:00:00 2001 From: Mohamed El Mahallawy Date: Sat, 6 Aug 2016 14:19:30 -0700 Subject: [PATCH 3/4] fix this time --- bootstrap.config.prod.js | 2 +- webpack/prod.config.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bootstrap.config.prod.js b/bootstrap.config.prod.js index cb1b2a36d..e4735b2e0 100644 --- a/bootstrap.config.prod.js +++ b/bootstrap.config.prod.js @@ -1,4 +1,4 @@ const bootstrapConfig = require('./bootstrap.config.js'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); -bootstrapConfig.styleLoader = ExtractTextPlugin.extract('style-loader!css-loader!sass-loader'); +bootstrapConfig.styleLoader = ExtractTextPlugin.extract({fallbackLoader: 'style-loader', loader: 'css-loader!sass-loader'}); module.exports = bootstrapConfig; diff --git a/webpack/prod.config.js b/webpack/prod.config.js index 3c944932f..7698b2c21 100644 --- a/webpack/prod.config.js +++ b/webpack/prod.config.js @@ -59,7 +59,10 @@ module.exports = { } ]}, { test: /\.json$/, loader: 'json-loader'}, - { test: /\.scss$/, loader: ExtractTextPlugin.extract('style!css?modules&importLoaders=2&sourceMap!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap=true&sourceMapContents=true') }, + { test: /\.scss$/, loader: ExtractTextPlugin.extract({ + fallbackLoader: 'style', + loader: 'css?modules&importLoaders=2&sourceMap!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap=true&sourceMapContents=true' + }) }, { test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "url?name=fonts/[name].[ext]&limit=10000&mimetype=application/font-woff" }, { test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: "url?name=fonts/[name].[ext]&limit=10000&mimetype=application/font-woff" }, { test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?name=fonts/[name].[ext]&limit=10000&mimetype=application/octet-stream" }, From e3b5340ca5832b2d06e6fd068506810bf7e11241 Mon Sep 17 00:00:00 2001 From: Mohamed El Mahallawy Date: Sat, 6 Aug 2016 14:23:59 -0700 Subject: [PATCH 4/4] Okay now. --- webpack/prod.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webpack/prod.config.js b/webpack/prod.config.js index 7698b2c21..515e8af7b 100644 --- a/webpack/prod.config.js +++ b/webpack/prod.config.js @@ -80,7 +80,7 @@ module.exports = { jQuery: "jquery", "windows.jQuery": "jquery" }), - new ExtractTextPlugin("[name]-[hash].css", {allChunks: true}), + new ExtractTextPlugin({ filename: '[name]-[hash].css', allChunks: true }), new webpack.DefinePlugin({ 'process.env.BROWSER': true, 'process.env.API_URL': JSON.stringify(process.env.API_URL),