Skip to content

Commit

Permalink
Added build/dev webpack configs, updated package scripts to use webpa…
Browse files Browse the repository at this point in the history
…ck for compilation, removed gulpfile dependency on bower.json
  • Loading branch information
zakhenry committed Apr 6, 2016
1 parent 69369a7 commit 4ef05c8
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 3 deletions.
3 changes: 1 addition & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ var gulpCore = require('gulp'),
gulp = plugins.help(gulpCore),
_ = require('lodash'),
path = require('path'),
bowerJson = require('./bower.json'),
packageJson = require('./package.json')
;

Expand Down Expand Up @@ -98,7 +97,7 @@ gulp.task('js:app', function () {
target: "ES5",
noExternalResolve: true,
typescript: require('typescript'),
out: path.basename(bowerJson.main),
out: path.basename(packageJson.main),
declarationFiles: true
}, undefined, plugins.typescript.reporter.longReporter()));

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
"url": "https://github.com/spira/angular-jwt-auth"
},
"scripts": {
"build": "tsc --declaration --pretty --listFiles",
"start": "webpack --config webpack/webpack.dev.js --watch --NODE_ENV=dev",
"test": "karma start --NODE_ENV=test",
"build": "webpack --config webpack/webpack.build.js --NODE_ENV=production",
"postinstall": "typings i"
},
"dependencies": {
Expand Down
30 changes: 30 additions & 0 deletions webpack/webpack.build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
var loaders = require("./loaders");
var webpack = require('webpack');

module.exports = {
entry: ['./src/index.ts'],
output: {
filename: 'ngJwtAuth.js',
path: 'dist'
},
devtool: 'source-map',
resolve: {
root: __dirname,
extensions: ['', '.ts', '.js', '.json']
},
resolveLoader: {
modulesDirectories: ["node_modules"]
},
plugins: [
new webpack.optimize.UglifyJsPlugin(
{
warning: false,
mangle: true,
comments: false
}
)
],
module:{
loaders: loaders
}
};
34 changes: 34 additions & 0 deletions webpack/webpack.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
var loaders = require("./loaders");
var BrowserSyncPlugin = require('browser-sync-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var webpack = require('webpack');
module.exports = {
entry: ['./src/index.ts'],
output: {
filename: 'build.js',
path: 'dist'
},
resolve: {
root: __dirname,
extensions: ['', '.ts', '.js', '.json']
},
resolveLoader: {
modulesDirectories: ["node_modules"]
},
devtool: "source-map",
plugins: [
new BrowserSyncPlugin({
host: 'localhost',
port: 8080,
server: {
baseDir: 'dist'
},
ui: false,
online: false,
notify: false
})
],
module:{
loaders: loaders
}
};

0 comments on commit 4ef05c8

Please sign in to comment.