-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Converted to ES6.
- Loading branch information
Showing
8 changed files
with
1,020 additions
and
899 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"node": false, | ||
"browser": true, | ||
"es5": true, | ||
"esnext": true, | ||
"bitwise": true, | ||
"camelcase": true, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,18 +13,22 @@ module.exports = function (grunt) { | |
}); | ||
require('time-grunt')(grunt); | ||
|
||
var webpack = require('webpack'); | ||
var pkg = grunt.file.readJSON('package.json'); | ||
var banner = 'js-data-angular\n' + | ||
'@version ' + pkg.version + ' - Homepage <https://www.js-data.io/docs/js-data-angular/>\n' + | ||
'@author Jason Dobry <[email protected]>\n' + | ||
'@copyright (c) 2014-2015 Jason Dobry \n' + | ||
'@license MIT <https://github.com/js-data/js-data-angular/blob/master/LICENSE>\n' + | ||
'\n' + | ||
'@overview Angular wrapper for js-data.'; | ||
|
||
// Project configuration. | ||
grunt.initConfig({ | ||
pkg: pkg, | ||
clean: { | ||
dist: ['dist/'] | ||
}, | ||
jshint: { | ||
all: ['Gruntfile.js', 'src/**/*.js'], | ||
jshintrc: '.jshintrc' | ||
}, | ||
watch: { | ||
dist: { | ||
files: ['src/**/*.js'], | ||
|
@@ -36,10 +40,10 @@ module.exports = function (grunt) { | |
options: { | ||
sourceMap: true, | ||
sourceMapName: 'dist/js-data-angular.min.map', | ||
banner: '/**\n' + | ||
banner: '/*!\n' + | ||
'* js-data-angular\n' + | ||
'* @version <%= pkg.version %> - Homepage <https://www.js-data.io/docs/js-data-angular/>\n' + | ||
'* @author Jason Dobry <[email protected]>\n' + | ||
'* @file js-data-angular.min.js\n' + | ||
'* @version <%= pkg.version %> - Homepage <https://www.js-data.io/js-data-angular/>\n' + | ||
'* @copyright (c) 2014-2015 Jason Dobry <https://github.com/jmdobry/>\n' + | ||
'* @license MIT <https://github.com/js-data/js-data-angular/blob/master/LICENSE>\n' + | ||
'*\n' + | ||
|
@@ -80,6 +84,40 @@ module.exports = function (grunt) { | |
options: { | ||
coverage_dir: 'coverage' | ||
} | ||
}, | ||
webpack: { | ||
dist: { | ||
entry: './src/index.js', | ||
output: { | ||
filename: './dist/js-data-angular.js', | ||
libraryTarget: 'umd', | ||
library: 'jsDataAngularModuleName' | ||
}, | ||
externals: { | ||
'js-data': { | ||
amd: 'js-data', | ||
commonjs: 'js-data', | ||
commonjs2: 'js-data', | ||
root: 'JSData' | ||
}, | ||
'angular': 'angular' | ||
}, | ||
module: { | ||
loaders: [ | ||
{ test: /(src)(.+)\.js$/, exclude: /node_modules/, loader: 'babel-loader?blacklist=useStrict' } | ||
], | ||
preLoaders: [ | ||
{ | ||
test: /(src)(.+)\.js$|(test)(.+)\.js$/, // include .js files | ||
exclude: /node_modules/, // exclude any and all files in the node_modules folder | ||
loader: "jshint-loader?failOnHint=true" | ||
} | ||
] | ||
}, | ||
plugins: [ | ||
new webpack.BannerPlugin(banner) | ||
] | ||
} | ||
} | ||
}); | ||
|
||
|
@@ -91,28 +129,9 @@ module.exports = function (grunt) { | |
grunt.file.write(filePath, file); | ||
}); | ||
|
||
grunt.registerTask('banner', function () { | ||
var file = grunt.file.read('./src/index.js'); | ||
|
||
var banner = '/**\n' + | ||
'* @author Jason Dobry <[email protected]>\n' + | ||
'* @file js-data-angular.js\n' + | ||
'* @version ' + pkg.version + ' - Homepage <http://www.js-data.io/docs/js-data-angular/>\n' + | ||
'* @copyright (c) 2014-2015 Jason Dobry <https://github.com/jmdobry/>\n' + | ||
'* @license MIT <https://github.com/js-data/js-data-angular/blob/master/LICENSE>\n' + | ||
'*\n' + | ||
'* @overview Angular wrapper for js-data.js.\n' + | ||
'*/\n'; | ||
|
||
file = banner + file; | ||
|
||
grunt.file.write('./dist/js-data-angular.js', file); | ||
}); | ||
|
||
grunt.registerTask('build', [ | ||
'clean', | ||
'jshint', | ||
'banner', | ||
'webpack', | ||
'uglify' | ||
]); | ||
grunt.registerTask('go', ['build', 'watch:dist']); | ||
|
Oops, something went wrong.