diff --git a/.eslintrc b/.eslintrc index d6e724f..e8eb590 100644 --- a/.eslintrc +++ b/.eslintrc @@ -14,19 +14,34 @@ }, "globals": { "angular": true, - "FileSaver": true, "sinon": true, "expect": true, - "__DEV__": true, - "__TEST__": true, - "__RELEASE__": true, "__BASE_PATH__": true }, "rules": { - "indent": [ 2, 2 ], - "quotes": [ 2, "single", { "avoidEscape": true, "allowTemplateLiterals": true }], - "linebreak-style": [ 2, "unix" ], - "semi": [ 2, "always" ], + "indent": [ + "error", + 2, + { + "SwitchCase": 1 + } + ], + "quotes": [ + 2, + "single", + { + "avoidEscape": true, + "allowTemplateLiterals": true + } + ], + "linebreak-style": [ + 2, + "unix" + ], + "semi": [ + 2, + "always" + ], "no-console": 0 } -} +} \ No newline at end of file diff --git a/karma.conf.js b/karma.conf.js index 449aa34..1a165ca 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,9 +1,6 @@ -// Karma configuration -'use strict'; - -var webpackConfig = require('./webpack.test'); -var test = process.env.NODE_ENV === 'test'; -var IS_TRAVIS = process.env.TRAVIS; +const webpackConfig = require('./webpack.test'); +const test = process.env.NODE_ENV === 'test'; +const IS_TRAVIS = process.env.TRAVIconst module.exports = function(config) { config.set({ @@ -43,7 +40,7 @@ module.exports = function(config) { // list of files / patterns to load in the browser files: [ - 'app/app.test.js' + 'src/app.test.js' ], @@ -51,7 +48,7 @@ module.exports = function(config) { // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor // run the bundle through the webpack and sourcemap plugins preprocessors: { - 'app/app.test.js': [ 'webpack', 'sourcemap' ] + 'src/app.test.js': [ 'webpack', 'sourcemap' ] }, diff --git a/package.json b/package.json index e35bc6a..647828b 100644 --- a/package.json +++ b/package.json @@ -37,12 +37,12 @@ "babel-plugin-lodash": "^3.2.4", "babel-preset-es2015": "^6.9.0", "codecov.io": "^0.1.6", - "commitizen": "^2.8.0", - "cross-env": "~2.0.1", - "css-loader": "^0.24.0", + "commitizen": "^2.9.0", + "cross-env": "^3.1.3", + "css-loader": "^0.26.0", "cz-conventional-changelog": "^1.1.5", - "eslint": "^3.3.0", - "eslint-loader": "^1.3.0", + "eslint": "^3.12.0", + "eslint-loader": "^1.6.0", "file-loader": "~0.9.0", "ghooks": "^1.2.0", "html-webpack-plugin": "~2.22.0", @@ -54,26 +54,26 @@ "karma-coverage": "~1.1.0", "karma-mocha": "~1.1.1", "karma-sourcemap-loader": "~0.3.7", - "karma-spec-reporter": "0.0.26", + "karma-spec-reporter": "~0.0.26", "karma-webpack": "~1.8.0", "lodash-webpack-plugin": "^0.10.0", - "mocha": "~3.0.0", + "mocha": "^3.2.0", "ng-annotate-loader": "~0.1.0", "ng-cache-loader": "~0.0.15", "node-bourbon": "~4.2.3", - "node-sass": "~3.10.0", + "node-sass": "~4.1.0", "opt-cli": "~1.5.1", "postcss-loader": "^0.11.0", "progress-bar-webpack-plugin": "^1.9.0", "raw-loader": "~0.5.1", - "rimraf": "~2.5.4", - "sass-loader": "~4.0.0", - "semantic-release": "^4.3.5", + "rimraf": "^2.5.4", + "sass-loader": "~4.1.0", + "semantic-release": "^6.3.2", "style-loader": "~0.13.0", "toastr": "~2.1.2", "url-loader": "~0.5.7", - "webpack": "^2.1.0-beta.24", - "webpack-dev-server": "^2.1.0-beta.0" + "webpack": "^2.1.0-beta.28", + "webpack-dev-server": "^2.1.0-beta.12" }, "repository": { "type": "git", @@ -89,8 +89,8 @@ "homepage": "https://github.com/Sanji-IO/sanji-auth-ui", "dependencies": { "angular": "~1.5.0", - "angular-http-auth": "~1.3.0", + "angular-http-auth": "~1.5.0", "angular-storage": "~0.0.15", - "sanji-rest-ui": "~1.3.6" + "sanji-rest-ui": "~1.3.14" } -} +} \ No newline at end of file diff --git a/server/dev-server.js b/server/dev-server.js index ec50d40..b24529e 100644 --- a/server/dev-server.js +++ b/server/dev-server.js @@ -3,9 +3,7 @@ const WebpackDevServer = require('webpack-dev-server'); const config = require('../webpack.dev'); new WebpackDevServer(webpack(config), { historyApiFallback: true, - stats: { - colors: true, - } + stats: 'minimal' }) .listen(8080, 'localhost', function(err) { if (err) { diff --git a/app/app.js b/src/app.js similarity index 100% rename from app/app.js rename to src/app.js diff --git a/app/app.scss b/src/app.scss similarity index 100% rename from app/app.scss rename to src/app.scss diff --git a/app/app.test.js b/src/app.test.js similarity index 100% rename from app/app.test.js rename to src/app.test.js diff --git a/app/component/auth.config.js b/src/component/auth.config.js similarity index 100% rename from app/component/auth.config.js rename to src/component/auth.config.js diff --git a/app/component/auth.constant.js b/src/component/auth.constant.js similarity index 100% rename from app/component/auth.constant.js rename to src/component/auth.constant.js diff --git a/app/component/auth.interceptor.js b/src/component/auth.interceptor.js similarity index 100% rename from app/component/auth.interceptor.js rename to src/component/auth.interceptor.js diff --git a/app/component/auth.provider.js b/src/component/auth.provider.js similarity index 100% rename from app/component/auth.provider.js rename to src/component/auth.provider.js diff --git a/app/component/auth.spec.js b/src/component/auth.spec.js similarity index 100% rename from app/component/auth.spec.js rename to src/component/auth.spec.js diff --git a/app/component/index.js b/src/component/index.js similarity index 100% rename from app/component/index.js rename to src/component/index.js diff --git a/app/component/session.provider.js b/src/component/session.provider.js similarity index 100% rename from app/component/session.provider.js rename to src/component/session.provider.js diff --git a/app/component/session.spec.js b/src/component/session.spec.js similarity index 100% rename from app/component/session.spec.js rename to src/component/session.spec.js diff --git a/app/index.html b/src/index.html similarity index 100% rename from app/index.html rename to src/index.html diff --git a/webpack.build.js b/webpack.build.js index 1530aec..c175964 100644 --- a/webpack.build.js +++ b/webpack.build.js @@ -43,7 +43,7 @@ config.externals = { }; config.module.rules = [ - {test: /\.js$/, loader: 'ng-annotate', exclude: /(node_modules)/, enforce: 'post'}, + {test: /\.js$/, use: 'ng-annotate-loader', exclude: /(node_modules)/, enforce: 'post'}, ].concat(config.module.rules); config.plugins.push( diff --git a/webpack.config.js b/webpack.config.js index a5e71c4..7c2bfe5 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -4,7 +4,7 @@ const ProgressBarPlugin = require('progress-bar-webpack-plugin'); const LodashModuleReplacementPlugin = require('lodash-webpack-plugin'); const NODE_ENV = process.env.NODE_ENV; const nodeRoot = path.join(__dirname, 'node_modules'); -const appRoot = path.join(__dirname, 'app'); +const appRoot = path.join(__dirname, 'src'); const config = { context: appRoot, output: { @@ -22,20 +22,19 @@ const config = { }, module: { rules: [ - {test: /\.js$/, loader: 'eslint', exclude: /node_modules/, enforce: 'pre'}, - {test: /\.js$/, loader: 'babel?cacheDirectory', exclude: /(node_modules)/}, - { test: /\.html$/, loader: 'ng-cache?prefix=[dir]/[dir]', exclude: [/node_modules/, path.join(__dirname, '/app/index.html')] } + {test: /\.js$/, use: 'eslint-loader', exclude: /node_modules/, enforce: 'pre'}, + {test: /\.js$/, use: 'babel-loader?cacheDirectory', exclude: /(node_modules)/}, + { test: /\.html$/, use: 'ng-cache-loader?prefix=[dir]/[dir]', exclude: [/node_modules/, path.join(__dirname, '/src/index.html')] } ] }, plugins: [ new ProgressBarPlugin(), new LodashModuleReplacementPlugin, new webpack.DefinePlugin({ - __TEST__: 'test' === NODE_ENV, - __DEV__: 'development' === NODE_ENV, - __RELEASE__: 'production' === NODE_ENV - }), - new webpack.NoErrorsPlugin() + 'process.env': { + 'NODE_ENV': JSON.stringify(NODE_ENV || 'development') + } + }) ] }; diff --git a/webpack.dev.js b/webpack.dev.js index b9169d5..aa654c0 100644 --- a/webpack.dev.js +++ b/webpack.dev.js @@ -4,7 +4,10 @@ const HtmlWebpackPlugin = require('html-webpack-plugin'); const bourbon = require('node-bourbon').includePaths; const config = require('./webpack.config.js'); -config.devtool = 'eval'; +config.devtool = 'cheap-module-eval-source-map'; +config.performance = { + hints: false +}; config.entry = { 'sanji-ui': [ 'webpack/hot/dev-server', @@ -13,12 +16,28 @@ config.entry = { ] }; config.module.rules = [ - {test: /\.js$/, loader: 'ng-annotate', exclude: /(node_modules)/, enforce: 'post'}, - {test: /\.scss/, loader: 'style!css!postcss!sass?includePaths[]=' + bourbon}, - {test: /\.css$/, loader: 'style!css!postcss?browsers=last 2 versions'}, - {test: /\.(png|jpg|gif|jpeg)$/, loader: 'url-loader?limit=8192', exclude: /node_modules/}, - {test: /\.(woff|woff2)$/, loader: 'url?limit=10000&minetype=application/font-woff', exclude: /node_modules/}, - {test: /\.(ttf|eot|svg)$/, loader: 'file', exclude: /node_modules/} + {test: /\.js$/, use: 'ng-annotate-loader', exclude: /(node_modules)/, enforce: 'post'}, + { + test: /\.scss/, + use: ['style-loader', 'css-loader', 'postcss-loader', { + loader: 'sass-loader', + options: { + includePaths: bourbon + } + }] + }, + { + test: /\.css$/, + use: ['style-loader', 'css-loader', { + loader: 'postcss-loader', + options: { + browsers: 'last 2 versions' + } + }] + }, + {test: /\.(png|jpg|gif|jpeg)$/, use: 'url-loader?limit=8192', exclude: /node_modules/}, + {test: /\.(woff|woff2)$/, use: 'url-loader?limit=10000&minetype=application/font-woff', exclude: /node_modules/}, + {test: /\.(ttf|eot|svg)$/, use: 'file-loader', exclude: /node_modules/} ].concat(config.module.rules); config.plugins.push( diff --git a/webpack.test.js b/webpack.test.js index 2bd0319..ac216c3 100644 --- a/webpack.test.js +++ b/webpack.test.js @@ -12,11 +12,27 @@ config.entry = {}; config.output = {}; config.module.rules = [ - {test: /\.scss/, loader: 'style!css!postcss!sass?includePaths[]=' + bourbon}, - {test: /\.css$/, loader: 'style!css!postcss'}, - {test: /\.(png|jpg|gif|jpeg)$/, loader: 'url-loader?limit=8192'}, - {test: /\.(woff|woff2)$/, loader: 'url?limit=10000&minetype=application/font-woff'}, - {test: /\.(ttf|eot|svg)$/, loader: 'file'} + { + test: /\.scss/, + use: ['style-loader', 'css-loader', 'postcss-loader', { + loader: 'sass-loader', + options: { + includePaths: bourbon + } + }] + }, + { + test: /\.css$/, + use: ['style-loader', 'css-loader', { + loader: 'postcss-loader', + options: { + browsers: 'last 2 versions' + } + }] + }, + {test: /\.(png|jpg|gif|jpeg)$/, use: 'url-loader?limit=8192'}, + {test: /\.(woff|woff2)$/, use: 'url-loader?limit=10000&minetype=application/font-woff'}, + {test: /\.(ttf|eot|svg)$/, use: 'file-loader'} ].concat(config.module.rules); config.plugins.push(