1- var fs = require ( 'fs' ) ;
1+ /*eslint-env node, commonjs */
2+ /*eslint comma-dangle:0 */
3+
4+ const fs = require ( 'fs' ) ;
25
36module . exports = function ( grunt ) {
47 'use strict' ;
58
69 require ( 'load-grunt-tasks' ) ( grunt ) ;
7- var _ = require ( 'lodash' ) ;
8-
9- var karmaConfig = function ( configFile , customOptions ) {
10- var options = { configFile : configFile , keepalive : true } ;
11- var travisOptions = process . env . TRAVIS && { browsers : [ 'Firefox' ] , reporters : 'dots' } ;
12- return _ . extend ( options , customOptions , travisOptions ) ;
13- } ;
1410
1511 // Returns configuration for bower-install plugin
1612 var loadTestScopeConfigurations = function ( ) {
@@ -65,122 +61,21 @@ module.exports = function (grunt) {
6561 src : [ 'test/unit/*.js' ]
6662 }
6763 } ,
68- babel : {
69- options : {
70- sourceMap : false ,
71- sourceType : 'module'
72- } ,
73- src : {
74- expand : true ,
75- cwd : 'src/' ,
76- src : [ '**/*.js' ] ,
77- dest : 'temp/' ,
78- ext : '.js'
79- }
80- } ,
81- karma : {
82- unit : {
83- options : karmaConfig ( 'karma.conf.js' , {
84- singleRun : true
85- } )
86- } ,
87- headless : {
88- options : karmaConfig ( 'karma.conf.js' , {
89- singleRun : true ,
90- browsers : [ 'PhantomJS' ]
91- } )
92- } ,
93- server : {
94- options : karmaConfig ( 'karma.conf.js' , {
95- singleRun : false
96- } )
97- }
98- } ,
99- watch : {
100- scripts : {
101- files : [ 'Gruntfile.js' , 'src/**/*.js' , 'test/**/*.js' ] ,
102- tasks : [ 'karma:unit' ]
103- } ,
104- lint_chore : {
105- files : [ 'Gruntfile.js' ] ,
106- tasks : [ 'eslint:chore' ]
107- } ,
108- lint_src : {
109- files : [ 'src/**/*.js' ] ,
110- tasks : [ 'eslint:src' ]
111- } ,
112- lint_test : {
113- files : [ 'test/**/*.js' ] ,
114- tasks : [ 'eslint:test' ]
115- } ,
116- ngdocs : {
117- files : [ 'src/**/*.js' ] ,
118- tasks : [ 'ngdocs:api' ]
119- }
120- } ,
121- browserify : {
122- dist : {
123- options : {
124- browserifyOptions : {
125- fullPaths : false ,
126- debug : false // TODO enable sourcemaps
127- } ,
128- transform : [ 'babelify' , require ( 'browserify-ngannotate' ) ] ,
129- banner : '<%= meta.banner %>' ,
130- watch : true
131- } ,
132- files : {
133- 'dist/angular-vertxbus.js' : [
134- 'src/index.js'
135- ]
136- }
137- }
138- } ,
139- extract_sourcemap : {
140- dist : {
141- files : {
142- 'dist' : [ 'dist/angular-vertxbus.js' ]
143- }
144- } ,
145- 'dist-withpolyfill' : {
146- files : {
147- 'dist' : [ 'dist/angular-vertxbus.withpolyfill.js' ]
148- }
149- }
150- } ,
151- uglify : {
152- options : {
153- preserveComments : 'some' ,
154- sourceMap : false , // TODO enable sourcemaps
155- sourceMapIn : 'dist/angular-vertxbus.js.map'
156- } ,
157- dist : {
158- files : {
159- 'dist/angular-vertxbus.min.js' : 'dist/angular-vertxbus.js'
160- }
161- } ,
162- 'dist-withPolyfill' : {
163- files : {
164- 'dist/angular-vertxbus.withpolyfill.min.js' : 'dist/angular-vertxbus.withpolyfill.js'
165- }
166- }
167- } ,
16864 concat : {
169- options : {
170- stripBanners : true ,
171- banner : '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
172- '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
173- '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
174- '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
175- ' Licensed <%= pkg.license %> */\n'
176- } ,
177- 'dist-withPolyfill' : {
65+ 'dist.polyfill' : {
17866 src : [
17967 'node_modules/babel-polyfill/dist/polyfill.js' ,
18068 'dist/angular-vertxbus.js'
18169 ] ,
18270 dest : 'dist/angular-vertxbus.withpolyfill.js'
183- }
71+ } ,
72+ 'dist.min.polyfill' : {
73+ src : [
74+ 'node_modules/babel-polyfill/dist/polyfill.min.js' ,
75+ 'dist/angular-vertxbus.min.js'
76+ ] ,
77+ dest : 'dist/angular-vertxbus.withpolyfill.min.js'
78+ } ,
18479 } ,
18580 conventionalChangelog : {
18681 options : {
@@ -210,8 +105,6 @@ module.exports = function (grunt) {
210105
211106 } ) ;
212107
213- grunt . loadNpmTasks ( 'gruntify-eslint' ) ;
214-
215108 // Compile and test (use "build" for dist/*)
216109 grunt . registerTask ( 'default' , [
217110 'clean' ,
@@ -224,42 +117,20 @@ module.exports = function (grunt) {
224117 'eslint'
225118 ] ) ;
226119
227- // Testing
228- grunt . registerTask ( 'test' , [
229- 'eslint' ,
230- 'karma:unit'
231- ] ) ;
232120 grunt . registerTask ( 'install-test' , [
233121 'bower-install-simple'
234122 ] ) ;
235- grunt . registerTask ( 'test-server' , [
236- 'karma:server'
237- ] ) ;
238123
239124 grunt . registerTask ( 'docs' , [
240125 'ngdocs:api'
241126 ] ) ;
242127
243- grunt . registerTask ( 'watch-docs' , [
244- 'docs' , 'watch:ngdocs'
245- ] ) ;
246-
247128 // Building & releasing
248- grunt . registerTask ( 'compile' , [
249- 'browserify:dist' ,
250- 'concat:dist-withPolyfill' ,
251- // 'extract_sourcemap:dist',// TODO enable sourcemaps
252- // 'extract_sourcemap:dist-withPolyfill',// TODO enable sourcemaps
253- 'uglify:dist' ,
254- 'uglify:dist-withPolyfill'
255- ] ) ;
256- grunt . registerTask ( 'build' , [
257- 'clean' ,
258- 'test' ,
259- 'compile'
129+ grunt . registerTask ( 'build-post' , [
130+ 'concat:dist.polyfill' ,
131+ 'concat:dist.min.polyfill' ,
260132 ] ) ;
261133 grunt . registerTask ( 'release' , [
262134 'conventionalChangelog' ,
263- 'build'
264135 ] ) ;
265136} ;
0 commit comments