From 415c9ef01ec1735198331aa3e717a39c77bae5d4 Mon Sep 17 00:00:00 2001 From: Zack Yang Date: Tue, 29 Nov 2016 00:19:13 +0800 Subject: [PATCH 1/3] refactor(webpack): update webpack config --- .travis.yml | 2 +- package.json | 8 ++++---- webpack.build.js | 5 ++--- webpack.config.js | 6 +++--- webpack.dev.js | 10 +++++----- webpack.test.js | 8 ++++---- 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index e123318..7d9f125 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ cache: notifications: email: false node_js: - - '4' + - '6' branches: only: - master diff --git a/package.json b/package.json index 7bcd709..4a8d017 100644 --- a/package.json +++ b/package.json @@ -31,11 +31,11 @@ "angular-material": "~1.1.0", "angular-material-icons": "~0.7.0", "angular-mocks": "~1.5.0", - "angular-sanji-window": "~2.1.0", + "angular-sanji-window": "~2.1.12", "codecov.io": "^0.1.6", "publish-latest": "~1.1.2", - "sanji-common-devs-ui": "~1.0.2", - "semantic-release": "^4.3.5", + "sanji-common-devs-ui": "~1.0.4", + "semantic-release": "^6.3.2", "svg-morpheus": "alexk111/SVG-Morpheus#v0.1.8", "toastr": "~2.1.2" }, @@ -55,4 +55,4 @@ "angular": "~1.5.0", "ng-file-upload": "~12.2.0" } -} +} \ No newline at end of file diff --git a/webpack.build.js b/webpack.build.js index 851e8ee..d4661c2 100644 --- a/webpack.build.js +++ b/webpack.build.js @@ -27,19 +27,18 @@ config.externals = { }; config.module.rules = [ - {test: /\.js$/, loader: 'ng-annotate', exclude: /(node_modules)/, enforce: 'post'}, + {test: /\.js$/, loader: 'ng-annotate-loader', exclude: /(node_modules)/, enforce: 'post'}, { test: /\.scss$/, loader: ExtractTextPlugin.extract({ notExtractLoader: 'style-loader', - loader: 'css!postcss!sass?includePaths[]=' + bourbon + loader: 'css-loader!postcss-loader!sass-loader?includePaths[]=' + bourbon }) } ].concat(config.module.rules); config.plugins.push( new ExtractTextPlugin('sanji-rest-ui.css'), - new webpack.optimize.DedupePlugin(), new webpack.LoaderOptionsPlugin({ minimize: true, debug: false, diff --git a/webpack.config.js b/webpack.config.js index 5c1daba..353fc07 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -23,9 +23,9 @@ 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$/, loader: 'eslint-loader', exclude: /node_modules/, enforce: 'pre' }, + {test: /\.js$/, loader: 'babel-loader?cacheDirectory', exclude: /(node_modules)/}, + { test: /\.html$/, loader: 'ng-cache-loader?prefix=[dir]/[dir]', exclude: [/node_modules/, path.join(__dirname, '/app/index.html')] } ] }, plugins: [ diff --git a/webpack.dev.js b/webpack.dev.js index b9169d5..a41bc62 100644 --- a/webpack.dev.js +++ b/webpack.dev.js @@ -13,12 +13,12 @@ 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: /\.js$/, loader: 'ng-annotate-loader', exclude: /(node_modules)/, enforce: 'post'}, + {test: /\.scss/, loader: 'style-loader!css-loader!postcss-loader!sass-loader?includePaths[]=' + bourbon}, + {test: /\.css$/, loader: 'style-loader!css-loader!postcss-loader?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: /\.(woff|woff2)$/, loader: 'url-loader?limit=10000&minetype=application/font-woff', exclude: /node_modules/}, + {test: /\.(ttf|eot|svg)$/, loader: 'file-loader', exclude: /node_modules/} ].concat(config.module.rules); config.plugins.push( diff --git a/webpack.test.js b/webpack.test.js index ede040f..d800891 100644 --- a/webpack.test.js +++ b/webpack.test.js @@ -12,11 +12,11 @@ config.entry = {}; config.output = {}; config.module.rules = [ - {test: /\.scss/, loader: 'style!css!postcss!sass?includePaths[]=' + bourbon}, - {test: /\.css$/, loader: 'style!css!postcss'}, + {test: /\.scss/, loader: 'style-loader!css-loader!postcss-loader!sass-loader?includePaths[]=' + bourbon}, + {test: /\.css$/, loader: 'style-loader!css-loader!postcss-loader'}, {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: /\.(woff|woff2)$/, loader: 'url-loader?limit=10000&minetype=application/font-woff'}, + {test: /\.(ttf|eot|svg)$/, loader: 'file-loader'} ].concat(config.module.rules); config.plugins.push( From 3beb1982b2f2898f579822184fd54fbe17e7e7ee Mon Sep 17 00:00:00 2001 From: Zack Yang Date: Mon, 19 Dec 2016 21:06:13 +0800 Subject: [PATCH 2/3] fix(webpack): upgrade webapck --- .eslintrc | 33 ++++++++++++++++------ karma.conf.js | 13 ++++----- {app => src}/app.js | 0 {app => src}/app.scss | 0 {app => src}/app.test.js | 0 {app => src}/component/http.service.js | 0 {app => src}/component/http.spec.js | 0 {app => src}/component/index.js | 0 {app => src}/component/restful.provider.js | 0 {app => src}/component/restful.spec.js | 0 {app => src}/index.html | 0 webpack.build.js | 2 +- webpack.config.js | 14 ++++----- webpack.dev.js | 33 +++++++++++++++++----- webpack.test.js | 26 +++++++++++++---- 15 files changed, 84 insertions(+), 37 deletions(-) rename {app => src}/app.js (100%) rename {app => src}/app.scss (100%) rename {app => src}/app.test.js (100%) rename {app => src}/component/http.service.js (100%) rename {app => src}/component/http.spec.js (100%) rename {app => src}/component/index.js (100%) rename {app => src}/component/restful.provider.js (100%) rename {app => src}/component/restful.spec.js (100%) rename {app => src}/index.html (100%) 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 02165db..6a7f9e7 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({ @@ -44,7 +41,7 @@ module.exports = function(config) { // list of files / patterns to load in the browser files: [ 'node_modules/jquery/dist/jquery.js', - 'app/app.test.js' + 'src/app.test.js' ], @@ -52,7 +49,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/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/http.service.js b/src/component/http.service.js similarity index 100% rename from app/component/http.service.js rename to src/component/http.service.js diff --git a/app/component/http.spec.js b/src/component/http.spec.js similarity index 100% rename from app/component/http.spec.js rename to src/component/http.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/restful.provider.js b/src/component/restful.provider.js similarity index 100% rename from app/component/restful.provider.js rename to src/component/restful.provider.js diff --git a/app/component/restful.spec.js b/src/component/restful.spec.js similarity index 100% rename from app/component/restful.spec.js rename to src/component/restful.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 d4661c2..3c3b356 100644 --- a/webpack.build.js +++ b/webpack.build.js @@ -27,7 +27,7 @@ config.externals = { }; config.module.rules = [ - {test: /\.js$/, loader: 'ng-annotate-loader', exclude: /(node_modules)/, enforce: 'post'}, + {test: /\.js$/, use: 'ng-annotate-loader', exclude: /(node_modules)/, enforce: 'post'}, { test: /\.scss$/, loader: ExtractTextPlugin.extract({ diff --git a/webpack.config.js b/webpack.config.js index 353fc07..cbfe1a6 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: { @@ -23,18 +23,18 @@ const config = { }, module: { rules: [ - { test: /\.js$/, loader: 'eslint-loader', exclude: /node_modules/, enforce: 'pre' }, - {test: /\.js$/, loader: 'babel-loader?cacheDirectory', exclude: /(node_modules)/}, - { test: /\.html$/, loader: 'ng-cache-loader?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 + 'proces.env': { + 'NODE_ENV': JSON.stringify(NODE_ENV || 'development') + } }) ] }; diff --git a/webpack.dev.js b/webpack.dev.js index a41bc62..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-loader', exclude: /(node_modules)/, enforce: 'post'}, - {test: /\.scss/, loader: 'style-loader!css-loader!postcss-loader!sass-loader?includePaths[]=' + bourbon}, - {test: /\.css$/, loader: 'style-loader!css-loader!postcss-loader?browsers=last 2 versions'}, - {test: /\.(png|jpg|gif|jpeg)$/, loader: 'url-loader?limit=8192', exclude: /node_modules/}, - {test: /\.(woff|woff2)$/, loader: 'url-loader?limit=10000&minetype=application/font-woff', exclude: /node_modules/}, - {test: /\.(ttf|eot|svg)$/, loader: 'file-loader', 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 d800891..479cc69 100644 --- a/webpack.test.js +++ b/webpack.test.js @@ -12,11 +12,27 @@ config.entry = {}; config.output = {}; config.module.rules = [ - {test: /\.scss/, loader: 'style-loader!css-loader!postcss-loader!sass-loader?includePaths[]=' + bourbon}, - {test: /\.css$/, loader: 'style-loader!css-loader!postcss-loader'}, - {test: /\.(png|jpg|gif|jpeg)$/, loader: 'url-loader?limit=8192'}, - {test: /\.(woff|woff2)$/, loader: 'url-loader?limit=10000&minetype=application/font-woff'}, - {test: /\.(ttf|eot|svg)$/, loader: 'file-loader'} + { + 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( From 515cec71823a2b00504ad6d36429e48a4d44073f Mon Sep 17 00:00:00 2001 From: Zack Yang Date: Mon, 19 Dec 2016 13:09:44 +0000 Subject: [PATCH 3/3] v1.3.14 --- dist/sanji-rest-ui.js | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 dist/sanji-rest-ui.js diff --git a/dist/sanji-rest-ui.js b/dist/sanji-rest-ui.js new file mode 100644 index 0000000..2f0c4ad --- /dev/null +++ b/dist/sanji-rest-ui.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("angular"),require("ng-file-upload")):"function"==typeof define&&define.amd?define(["angular","ng-file-upload"],t):"object"==typeof exports?exports.sjRest=t(require("angular"),require("ng-file-upload")):e.sjRest=t(e.angular,e.ngFileUpload)}(this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var u=n[r]={i:r,l:!1,exports:{}};return e[r].call(u.exports,u,u.exports,t),u.l=!0,u.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=4)}([function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n (https://github.com/zack9433)", "description": "sanji-rest-ui UI", - "version": "0.0.0-semantic-released", + "version": "1.3.14", "main": "dist/sanji-rest-ui.js", "config": { "ghooks": {