Skip to content

Commit

Permalink
feat(build): modify build process
Browse files Browse the repository at this point in the history
  • Loading branch information
zack9433 committed Mar 21, 2016
1 parent 55cd0a5 commit 7183a13
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 41 deletions.
6 changes: 4 additions & 2 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import 'angular-material.css';
import 'toastr.scss';
import 'angular-material-icons.css';
import 'angular-sanji-window.css';
import 'toastr.css';
import './app.scss';
import 'angular';
import angular from 'angular';
import component from './component';

let app = angular.module('webapp', [component]);
Expand Down
3 changes: 2 additions & 1 deletion app/component/component.i18n.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export default ($translateProvider) => {
export default $translateProvider => {
'ngInject';
$translateProvider.translations('en', require('./lang/en.json'));
$translateProvider.translations('zh-tw', require('./lang/zh-tw.json'));
}
1 change: 1 addition & 0 deletions app/component/form/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import angular from 'angular';
import sjCore from 'sanji-core-ui';

import './component.tpl.html';
Expand Down
1 change: 1 addition & 0 deletions app/component/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import angular from 'angular';
import sjCore from 'sanji-core-ui';
import sjCellularInfo from './info';
import sjCellularForm from './form';
Expand Down
1 change: 1 addition & 0 deletions app/component/info/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import angular from 'angular';
import sjCore from 'sanji-core-ui';

import './cellular-signal.tpl.html';
Expand Down
12 changes: 2 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"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",
"prepublish": "npm run build",
"postpublish": "publish-latest",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
Expand Down Expand Up @@ -59,6 +58,7 @@
"node-bourbon": "~4.2.3",
"node-sass": "~3.4.2",
"phantomjs": "~2.1.3",
"publish-latest": "~1.1.2",
"raw-loader": "~0.5.1",
"sass-loader": "~3.2.0",
"semantic-release": "^4.3.5",
Expand All @@ -81,14 +81,6 @@
"license": "MIT",
"homepage": "https://github.com/Sanji-IO/sanji-cellular-ui",
"dependencies": {
"angular": "~1.5.0",
"angular-material": "~1.0.5",
"angular-material-data-table": "~0.9.9",
"angular-material-icons": "~0.6.0",
"jquery": "~2.2.0",
"sanji-core-ui": "~1.13.1",
"socket.io-client": "~1.4.5",
"svg-morpheus": "alexk111/SVG-Morpheus#v0.1.8",
"toastr": "~2.1.2"
"sanji-core-ui": "~1.15.3"
}
}
15 changes: 11 additions & 4 deletions webpack.build.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

var webpack = require('webpack');
var WebpackNotifierPlugin = require('webpack-notifier');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var bourbon = require('node-bourbon').includePaths;
var config = require('./webpack.config.js');
Expand All @@ -12,7 +11,10 @@ config.entry = {
};
config.output.filename = 'sanji-cellular-ui.js';
config.output.libraryTarget = 'umd';
config.externals = ['sanji-core-ui'];
config.externals = [
'angular',
'sanji-core-ui'
];

config.module.loaders = [
{
Expand All @@ -23,7 +25,12 @@ config.module.loaders = [

config.plugins.push(
new ExtractTextPlugin('sanji-cellular-ui.css'),
new WebpackNotifierPlugin({title: 'Webpack'}),
new webpack.optimize.DedupePlugin()
new webpack.optimize.DedupePlugin(),
new webpack.optimize.AggressiveMergingPlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
);
module.exports = config;
26 changes: 5 additions & 21 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ var config = {
'angular-material.css': nodeRoot + '/angular-material/angular-material.css',
'angular-material-icons.css': nodeRoot + '/angular-material-icons/angular-material-icons.css',
'angular-material-data-table.css': nodeRoot + '/angular-material-data-table/dist/md-data-table.css',
'toastr.scss': nodeRoot + '/toastr/toastr.scss',
'svg-morpheus': nodeRoot + '/svg-morpheus/compile/unminified/svg-morpheus.js'
'angular-sanji-window.css': nodeRoot + '/angular-sanji-window/dist/angular-sanji-window.css',
'toastr.css': nodeRoot + '/toastr/build/toastr.css'
},
extensions: ['', '.js', '.json', 'html', 'scss', 'css']
},
Expand All @@ -29,25 +29,9 @@ var config = {
{test: /\.js$/, loader: "eslint", exclude: /(node_modules)/}
],
loaders: [
{test: /\.js$/, loader: 'ng-annotate!babel', exclude: /(node_modules)/},
{
test: /\.js$/,
loader: 'babel?optional[]=runtime&stage=0',
include: [
/(angular-sanji-window)/,
/(sanji-core-ui)/
]
},
{ test: /\.json$/, loader: 'json', exclude: /node_modules\/(?!sanji-core-ui)/ },
{
test: /\.html$/,
loader: 'ng-cache?prefix=[dir]/[dir]',
include: [
/(angular-sanji-window)/,
/(sanji-core-ui)/
]
},
{test: /\.html$/, loader: 'ng-cache?prefix=[dir]/[dir]', exclude: /(node_modules)/}
{ test: /\.js$/, loader: 'ng-annotate!babel', exclude: /node_modules/ },
{ test: /\.json$/, loader: 'json', exclude: /node_modules/ },
{ test: /\.html$/, loader: 'ng-cache?prefix=[dir]/[dir]', exclude: /node_modules/ }
],
noParse: []
},
Expand Down
6 changes: 3 additions & 3 deletions webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ config.entry = {
config.module.loaders = [
{test: /\.scss/, loader: 'style!css!autoprefixer?browsers=last 2 versions!sass?includePaths[]=' + bourbon},
{test: /\.css$/, loader: 'style!css!autoprefixer?browsers=last 2 versions'},
{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: /\.(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.plugins.push(
Expand Down

0 comments on commit 7183a13

Please sign in to comment.