From 69e06d6275e43b3805669e95fe2308ebdf3d8b1e Mon Sep 17 00:00:00 2001 From: Zack Yang Date: Fri, 30 Sep 2016 06:23:22 +0800 Subject: [PATCH 1/6] build(package): modify for webpack 2 breaking changes --- package.json | 44 ++++---------------------------------------- server/dev-server.js | 15 ++++++--------- webpack.build.js | 19 +++++++++---------- webpack.config.js | 19 +++++-------------- webpack.dev.js | 25 ++++++++++++------------- 5 files changed, 36 insertions(+), 86 deletions(-) diff --git a/package.json b/package.json index 259acaa..a9d42a5 100644 --- a/package.json +++ b/package.json @@ -26,46 +26,10 @@ "devDependencies": { "angular-mocks": "~1.5.0", "autoprefixer": "^6.4.0", - "babel-core": "^6.0.0", - "babel-eslint": "^6.0.4", - "babel-loader": "^6.0.0", - "babel-plugin-__coverage__": "^11.0.0", - "babel-plugin-lodash": "^3.2.4", - "babel-preset-es2015": "^6.9.0", "codecov.io": "~0.1.6", - "commitizen": "^2.8.0", - "css-loader": "^0.24.0", - "cz-conventional-changelog": "^1.1.5", - "eslint": "^3.3.0", - "eslint-loader": "^1.3.0", - "extract-text-webpack-plugin": "^2.0.0-beta.3", - "file-loader": "~0.9.0", - "ghooks": "^1.2.0", - "html-webpack-plugin": "~2.22.0", - "karma": "~1.2.0", - "karma-chai-plugins": "~0.7.0", - "karma-chrome-launcher": "~2.0.0", - "karma-coverage": "~1.1.0", - "karma-mocha": "~1.1.1", - "karma-sourcemap-loader": "~0.3.7", - "karma-spec-reporter": "0.0.26", - "karma-webpack": "~1.8.0", - "lodash-webpack-plugin": "^0.10.0", - "mocha": "^3.0.0", - "ng-annotate-loader": "~0.1.0", - "ng-cache-loader": "~0.0.15", - "node-bourbon": "~4.2.3", - "node-sass": "^3.8.0", - "postcss-loader": "^0.11.0", - "progress-bar-webpack-plugin": "^1.9.0", "publish-latest": "~1.1.2", - "raw-loader": "~0.5.1", - "sass-loader": "~4.0.0", - "semantic-release": "^4.3.5", - "style-loader": "~0.13.0", - "url-loader": "~0.5.7", - "webpack": "^2.1.0-beta.20", - "webpack-dev-server": "^2.1.0-beta.0" + "sanji-common-devs-ui": "~1.0.2", + "semantic-release": "^4.3.5" }, "repository": { "type": "git", @@ -83,8 +47,8 @@ "homepage": "https://github.com/Sanji-IO/angular-sanji-window", "dependencies": { "angular": "~1.5.0", - "angular-animate": "~1.5.8", - "angular-aria": "~1.5.8", + "angular-animate": "~1.5.0", + "angular-aria": "~1.5.0", "angular-busy": "~4.1.3", "angular-material": "~1.1.0", "angular-material-icons": "^0.7.1" diff --git a/server/dev-server.js b/server/dev-server.js index c18a587..e12b1be 100644 --- a/server/dev-server.js +++ b/server/dev-server.js @@ -1,19 +1,16 @@ -'use strict'; - -var webpack = require('webpack'); -var WebpackDevServer = require('webpack-dev-server'); -var config = require('../webpack.dev'); +const webpack = require('webpack'); +const WebpackDevServer = require('webpack-dev-server'); +const config = require('../webpack.dev'); new WebpackDevServer(webpack(config), { - hot: true, historyApiFallback: true, stats: { - colors: true, + colors: true } }) -.listen(config.port, config.ip, function(err) { +.listen(8080, 'localhost', function(err) { if (err) { throw err; } - console.log('Listening at ' + config.ip + ':' + config.port); + console.log('Listening at localhost:8080'); }); diff --git a/webpack.build.js b/webpack.build.js index 3c84e54..473ef68 100644 --- a/webpack.build.js +++ b/webpack.build.js @@ -1,5 +1,3 @@ -'use strict'; - const webpack = require('webpack'); const LodashModuleReplacementPlugin = require('lodash-webpack-plugin'); const autoprefixer = require('autoprefixer'); @@ -40,7 +38,8 @@ config.externals = { } }; -config.module.loaders = [ +config.module.rules = [ + {test: /\.js$/, loader: 'ng-annotate', exclude: /(node_modules)/, enforce: 'post'}, { test: /\.scss$/, loader: ExtractTextPlugin.extract({ @@ -48,12 +47,7 @@ config.module.loaders = [ loader: 'css!postcss!sass?includePaths[]=' + bourbon }) } -].concat(config.module.loaders); - -config.module.postLoaders = [ - {test: /\.js$/, loader: 'ng-annotate', exclude: /(node_modules)/} -]; -config.postcss = [ autoprefixer({ browsers: ['last 2 versions'] }) ]; +].concat(config.module.rules); config.plugins.push( new ExtractTextPlugin('angular-sanji-window.css'), @@ -62,7 +56,12 @@ config.plugins.push( new webpack.LoaderOptionsPlugin({ minimize: true, debug: false, - quiet: true + quiet: true, + options:{ + postcss: [ + autoprefixer({ browsers: ['last 2 versions'] }) + ] + } }), new webpack.optimize.UglifyJsPlugin({ compress: { diff --git a/webpack.config.js b/webpack.config.js index df4596a..d93bc51 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,5 +1,3 @@ -'use strict'; - const path = require('path'); const webpack = require('webpack'); const ProgressBarPlugin = require('progress-bar-webpack-plugin'); @@ -13,25 +11,19 @@ const config = { filename: 'angular-sanji-window.js' }, resolve: { - root: [nodeRoot], - // npm-linked packages can locate missing dependencies in app's node_modules - fallback: nodeRoot, alias: { 'angular-material.css': nodeRoot + '/angular-material/angular-material.css', 'angular-material-icons.css': nodeRoot + '/angular-material-icons/angular-material-icons.css', 'angular-busy.css': nodeRoot + '/angular-busy/angular-busy.css' }, - extensions: ['', '.js', '.json', 'html', 'scss', 'css'] + extensions: ['.js', '.json', 'html', 'scss', 'css'] }, module: { - preLoaders: [ - {test: /\.js$/, loader: "eslint", exclude: /(node_modules)/} - ], - loaders: [ + 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')] } - ], - noParse: [] + ] }, plugins: [ new ProgressBarPlugin(), @@ -39,8 +31,7 @@ const config = { __TEST__: 'test' === NODE_ENV, __DEV__: 'development' === NODE_ENV, __RELEASE__: 'production' === NODE_ENV - }), - new webpack.NoErrorsPlugin() + }) ] }; diff --git a/webpack.dev.js b/webpack.dev.js index 745d918..ea6706e 100644 --- a/webpack.dev.js +++ b/webpack.dev.js @@ -1,37 +1,36 @@ -'use strict'; - const webpack = require('webpack'); const autoprefixer = require('autoprefixer'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const bourbon = require('node-bourbon').includePaths; const config = require('./webpack.config.js'); -config.ip = 'localhost'; -config.port = 8080; -config.debug = true; config.devtool = 'eval'; config.entry = { 'angular-module': [ 'webpack/hot/dev-server', - 'webpack-dev-server/client?http://' + config.ip + ':' + config.port, + 'webpack-dev-server/client?http://localhost:8080', './app.js' ] }; -config.module.loaders = [ +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/} -].concat(config.module.loaders); - -config.module.postLoaders = [ - {test: /\.js$/, loader: 'ng-annotate', exclude: /(node_modules)/} -]; -config.postcss = [ autoprefixer({ browsers: ['last 2 versions'] }) ]; +].concat(config.module.rules); config.plugins.push( new webpack.HotModuleReplacementPlugin(), + new webpack.LoaderOptionsPlugin({ + debug: true, + options: { + postcss: [ + autoprefixer({ browsers: ['last 2 versions'] }) + ] + } + }), new HtmlWebpackPlugin({ template: 'index.html', hash: true From 2d4244c3869a4fd669cadb727953b1f2f70af970 Mon Sep 17 00:00:00 2001 From: Zack Yang Date: Fri, 30 Sep 2016 09:25:52 +0800 Subject: [PATCH 2/6] fix(style): modify indicator and icon style --- app/sanji-window/sanji-window-loading.tpl.html | 2 +- app/sanji-window/sanji-window.scss | 2 +- app/sanji-window/sanji-window.tpl.html | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/sanji-window/sanji-window-loading.tpl.html b/app/sanji-window/sanji-window-loading.tpl.html index 5741bfe..75c5ba3 100644 --- a/app/sanji-window/sanji-window-loading.tpl.html +++ b/app/sanji-window/sanji-window-loading.tpl.html @@ -1,6 +1,6 @@ diff --git a/app/sanji-window/sanji-window.scss b/app/sanji-window/sanji-window.scss index ba10074..9a95070 100644 --- a/app/sanji-window/sanji-window.scss +++ b/app/sanji-window/sanji-window.scss @@ -46,7 +46,7 @@ $card-header-color: #5e5e5e; .sj-spinner-bg { background-color: #fff; - padding: 5px !important; + border: 5px solid #fff; border-radius: 50%; } diff --git a/app/sanji-window/sanji-window.tpl.html b/app/sanji-window/sanji-window.tpl.html index 0fb7a34..41770b2 100644 --- a/app/sanji-window/sanji-window.tpl.html +++ b/app/sanji-window/sanji-window.tpl.html @@ -6,13 +6,13 @@

- + - + From ed679564ff767ec07e782bb414a84896b57827bd Mon Sep 17 00:00:00 2001 From: Zack Yang Date: Fri, 30 Sep 2016 10:03:59 +0800 Subject: [PATCH 3/6] build(task): modify task --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index a9d42a5..45f051f 100644 --- a/package.json +++ b/package.json @@ -12,14 +12,14 @@ } }, "scripts": { - "test": "NODE_ENV=test BABEL_ENV=test karma start", - "test:once": "BABEL_ENV=test karma start", - "prebuild": "rm -rf dist && mkdir dist", - "build": "NODE_ENV=production webpack --config webpack.build.js --display-modules", + "test": "cross-env NODE_ENV=test BABEL_ENV=test karma start", + "test:once": "cross-env BABEL_ENV=test karma start", + "prebuild": "rimraf dist && mkdir dist", + "build": "cross-env NODE_ENV=production webpack --config webpack.build.js --display-modules", "commit": "git-cz", "check-coverage": "istanbul check-coverage --statements 90 --branches 90 --functions 90 --lines 90", "report-coverage": "cat ./coverage/lcov.info | codecov", - "start": "NODE_ENV=development node server/dev-server.js", + "start": "cross-env NODE_ENV=development node server/dev-server.js", "publish-latest": "publish-latest", "semantic-release": "semantic-release pre && npm publish && npm run publish-latest && semantic-release post" }, From a02ff7f9c06c32c774e560c18b0a24ae735e15a9 Mon Sep 17 00:00:00 2001 From: Zack Yang Date: Fri, 30 Sep 2016 14:29:46 +0800 Subject: [PATCH 4/6] ci(cache): clear cache --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index fae59be..7d1dcaf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ branches: - master before_install: - npm i -g npm@^3.0.0 + - npm cache clean - export CHROME_BIN=/usr/bin/google-chrome - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start From 6b106bfca2e0b4a9ac4d36ba52011ede4e08a5c4 Mon Sep 17 00:00:00 2001 From: Zack Yang Date: Fri, 30 Sep 2016 14:33:18 +0800 Subject: [PATCH 5/6] remove node_modules --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 7d1dcaf..e7e9256 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ branches: before_install: - npm i -g npm@^3.0.0 - npm cache clean + - rm -rf node_modules - export CHROME_BIN=/usr/bin/google-chrome - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start From badc7c8b4718c1f9eee435ced4e54fa53faade64 Mon Sep 17 00:00:00 2001 From: Zack Yang Date: Fri, 30 Sep 2016 06:37:14 +0000 Subject: [PATCH 6/6] v2.1.11 --- dist/angular-sanji-window.css | 2 ++ dist/angular-sanji-window.css.map | 1 + dist/angular-sanji-window.js | 1 + package.json | 5 +++-- 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 dist/angular-sanji-window.css create mode 100644 dist/angular-sanji-window.css.map create mode 100644 dist/angular-sanji-window.js diff --git a/dist/angular-sanji-window.css b/dist/angular-sanji-window.css new file mode 100644 index 0000000..a3df825 --- /dev/null +++ b/dist/angular-sanji-window.css @@ -0,0 +1,2 @@ +.sj-window{position:relative}.sj-window>.sj-window-header{padding-top:0;padding-bottom:0;background-color:#f7f7f7;color:#5e5e5e}.sj-window>.sj-window-header .sj-window-btn-group{text-align:right}.sj-window-loading{position:absolute;padding-top:50px;top:0;bottom:0;left:0;right:0;background-color:#fff;opacity:.7;z-index:1001}.animate-if.ng-leave,.sj-window-loading.ng-enter{transition:all .5s cubic-bezier(.25,.46,.45,.94)}.sj-window-loading.ng-enter,.sj-window-loading.ng-leave.ng-leave-active{opacity:0}.sj-window-loading.ng-enter.ng-enter-active,.sj-window-loading.ng-leave{opacity:.7}.sj-spinner-bg{background-color:#fff;border:5px solid #fff;border-radius:50%} +/*# sourceMappingURL=angular-sanji-window.css.map*/ \ No newline at end of file diff --git a/dist/angular-sanji-window.css.map b/dist/angular-sanji-window.css.map new file mode 100644 index 0000000..63746e9 --- /dev/null +++ b/dist/angular-sanji-window.css.map @@ -0,0 +1 @@ +{"version":3,"sources":[],"names":[],"mappings":"","file":"angular-sanji-window.css","sourceRoot":""} \ No newline at end of file diff --git a/dist/angular-sanji-window.js b/dist/angular-sanji-window.js new file mode 100644 index 0000000..5be906b --- /dev/null +++ b/dist/angular-sanji-window.js @@ -0,0 +1 @@ +!function(n,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("angular"),require("angular-busy"),require("angular-material"),require("angular-material-icons")):"function"==typeof define&&define.amd?define(["angular","angular-busy","angular-material","angular-material-icons"],e):"object"==typeof exports?exports.sjWindow=e(require("angular"),require("angular-busy"),require("angular-material"),require("angular-material-icons")):n.sjWindow=e(n.angular,n.ngBusy,n.ngMaterial,n.ngMdIcons)}(this,function(n,e,t,i){return function(n){function e(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return n[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var t={};return e.m=n,e.c=t,e.i=function(n){return n},e.d=function(n,e,t){Object.defineProperty(n,e,{configurable:!1,enumerable:!0,get:t})},e.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(t,"a",t),t},e.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},e.p="",e(e.s=12)}([function(n,e){},function(n,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t={transclude:!0,require:{parent:"^sanjiWindow"},bindings:{defaultState:"@",stateName:"@",linkName:"@",icon:"@"},template:'
',controller:"SanjiWindowStateController",controllerAs:"vm"};e.default=t},function(n,e){"use strict";function t(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function n(n,e){for(var t=0;t\n \n \n

\n
\n \n \n \n \n \n \n \n \n \n \n
\n

\n \n
\n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n \n',a="sanji-window.tpl.html",o=i.element(window.document).injector();o?o.get("$templateCache").put(a,r):t.run(["$templateCache",function(n){n.put(a,r)}]),n.exports=r},function(e,t){e.exports=n},function(n,t){n.exports=e},function(n,e){n.exports=t},function(n,e){n.exports=i},function(n,e,t){"use strict";function i(n){return n&&n.__esModule?n:{default:n}}Object.defineProperty(e,"__esModule",{value:!0});var r=t(8),a=i(r),o=t(10),u=i(o),s=t(11),l=i(s);t(9),t(0),t(7),t(6);var c=t(5),d=i(c),f=t(4),m=i(f),g=t(2),h=i(g),p=t(3),w=i(p),v=t(1),y=i(v),j=a.default.module("sanji.window",[u.default,l.default,"cgBusy"]);j.factory("sanjiWindowService",d.default.factory),j.controller("SanjiWindowController",m.default),j.controller("SanjiWindowStateController",h.default),j.component("sanjiWindow",w.default),j.component("sanjiWindowState",y.default),e.default=j=j.name}])}); \ No newline at end of file diff --git a/package.json b/package.json index 45f051f..c3f128c 100644 --- a/package.json +++ b/package.json @@ -52,5 +52,6 @@ "angular-busy": "~4.1.3", "angular-material": "~1.1.0", "angular-material-icons": "^0.7.1" - } -} + }, + "version": "2.1.11" +} \ No newline at end of file