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 20, 2016
1 parent 6e46dfe commit f502fa4
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 53 deletions.
7 changes: 4 additions & 3 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import 'toastr.scss';
import 'angular-material.css';
import './app.scss';
import 'angular';
import angular from 'angular';
import ngMaterial from 'angular-material';
import component from './component';

let app = angular.module('webapp', [component]);
app.run((logger, exception, rest, socket) => {
let app = angular.module('webapp', [component, ngMaterial]);
app.run((logger, exception, rest, auth, socket) => {
exception.catcher('[EXCEPTION TEST]:')({data: {message: 'Internal Error'}});
logger.info('Hello!', 'We are sanji team');
});
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 logger from 'sanji-logger-ui';
import exception from 'sanji-exception-ui';
import socket from 'sanji-socket-ui';
Expand Down
3 changes: 0 additions & 3 deletions index.js

This file was deleted.

25 changes: 13 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author": "Zack Yang <zack9433@gmail.com> (https://github.com/zack9433)",
"description": "sanji-utils-ui",
"version": "0.0.0-semantic-released",
"main": "index",
"main": "dist/sanji-utils-ui.js",
"config": {
"commitizen": {
"path": "node_modules/cz-conventional-changelog"
Expand All @@ -14,7 +14,8 @@
"build": "NODE_ENV=production webpack --config webpack.build.js --display-modules",
"commit": "git-cz",
"start": "NODE_ENV=development node server/dev-server.js",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
"publish-latest": "publish-latest",
"semantic-release": "semantic-release pre && npm publish && npm run publish-latest && semantic-release post"
},
"devDependencies": {
"angular": "~1.5.0",
Expand All @@ -25,13 +26,13 @@
"angular-material": "~1.0.2",
"angular-animate": "~1.5.0",
"angular-aria": "~1.5.0",
"angular-sanji-window": "Sanji-IO/angular-sanji-window#webpack-sanji-window",
"angular-sanji-window": "~2.1.0",
"autoprefixer-loader": "~3.2.0",
"babel": "~5.8.34",
"babel-eslint": "~4.1.6",
"babel-loader": "~5.3.3",
"babel-runtime": "~5.8.34",
"commitizen": "~2.5.0",
"commitizen": "~2.7.0",
"css-loader": "~0.23.1",
"cz-conventional-changelog": "1.1.5",
"eslint": "~1.10.3",
Expand All @@ -45,13 +46,13 @@
"node-libs-browser": "~1.0.0",
"node-sass": "~3.4.2",
"raw-loader": "~0.5.1",
"sass-loader": "~3.1.2",
"sass-loader": "~3.2.0",
"semantic-release": "^4.3.5",
"style-loader": "~0.13.0",
"url-loader": "~0.5.7",
"webpack": "~1.12.11",
"webpack-dev-server": "~1.14.1",
"webpack-notifier": "~1.2.1"
"webpack-notifier": "~1.3.0"
},
"repository": {
"type": "git",
Expand All @@ -66,11 +67,11 @@
"license": "MIT",
"homepage": "https://github.com/Sanji-IO/sanji-utils-ui",
"dependencies": {
"sanji-exception-ui": "~1.1.1",
"sanji-logger-ui": "~1.1.1",
"sanji-rest-ui": "~1.2.2",
"sanji-router-ui": "~1.1.1",
"sanji-socket-ui": "~1.0.2",
"sanji-auth-ui": "~1.0.6"
"sanji-exception-ui": "~1.2.1",
"sanji-logger-ui": "~1.2.2",
"sanji-rest-ui": "~1.3.1",
"sanji-router-ui": "~1.2.1",
"sanji-socket-ui": "~1.1.1",
"sanji-auth-ui": "~1.1.0"
}
}
63 changes: 49 additions & 14 deletions webpack.build.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,67 @@
'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');

config.devtool = 'source-map';
config.entry = {
'sanji-ui': './component/index.js'
};
config.output.filename = 'sanji-utils-ui.js';
config.output.libraryTarget = 'umd';
config.output.library = 'sjUtils';
config.externals = {
'sanji-utils-ui': 'sjUtils'
};

config.module.loaders = [
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('style-loader', 'css!autoprefixer?browsers=last 2 versions!sass?includePaths[]=' + bourbon)
angular: {
root: 'angular',
commonjs2: 'angular',
commonjs: 'angular',
amd: 'angular'
},
'sanji-logger-ui': {
root: 'sjLogger',
commonjs2: 'sanji-logger-ui',
commonjs: 'sanji-logger-ui',
amd: 'sanji-logger-ui'
},
'sanji-exception-ui': {
root: 'sjException',
commonjs2: 'sanji-exception-ui',
commonjs: 'sanji-exception-ui',
amd: 'sanji-exception-ui'
},
'sanji-socket-ui': {
root: 'sjSocket',
commonjs2: 'sanji-socket-ui',
commonjs: 'sanji-socket-ui',
amd: 'sanji-socket-ui'
},
'sanji-router-ui': {
root: 'sjRouter',
commonjs2: 'sanji-router-ui',
commonjs: 'sanji-router-ui',
amd: 'sanji-router-ui'
},
'sanji-rest-ui': {
root: 'sjRest',
commonjs2: 'sanji-rest-ui',
commonjs: 'sanji-rest-ui',
amd: 'sanji-rest-ui'
},
'sanji-auth-ui': {
root: 'sjAuth',
commonjs2: 'sanji-auth-ui',
commonjs: 'sanji-auth-ui',
amd: 'sanji-auth-ui'
}
].concat(config.module.loaders);
};

config.plugins.push(
new ExtractTextPlugin('sanji-utils-ui.css'),
new WebpackNotifierPlugin({title: 'Webpack'}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.AggressiveMergingPlugin()
new webpack.optimize.AggressiveMergingPlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
);
module.exports = config;
18 changes: 0 additions & 18 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,6 @@ var config = {
],
loaders: [
{test: /\.js$/, loader: 'ng-annotate!babel', exclude: /(node_modules)/},
{
test: /\.js$/,
loader: 'babel?optional[]=runtime&stage=0',
include: [
/(angular-sanji-window)/,
/(sanji-logger-ui)/,
/(sanji-exception-ui)/,
/(sanji-socket-ui)/,
/(sanji-router-ui)/,
/(sanji-rest-ui)/,
/(sanji-auth-ui)/
]
},
{
test: /\.html$/,
loader: 'ng-cache?prefix=[dir]/[dir]',
include: /(angular-sanji-window)/
},
{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 f502fa4

Please sign in to comment.