11/* eslint-env node */
22
3- module . exports = function ( grunt ) {
4- 'use strict' ;
5-
6- var license =
3+ var license =
74 '/*!\n' +
85 '* jQuery Password Strength plugin for Twitter Bootstrap\n' +
96 '* Version: <%= pkg.version %>\n' +
@@ -12,79 +9,87 @@ module.exports = function(grunt) {
129 '* Copyright (c) 2013 Alejandro Blanco\n' +
1310 '* Dual licensed under the MIT and GPL licenses.\n' +
1411 '*/\n\n' +
15- '(function (jQuery) {\n' ;
16-
17- grunt . initConfig ( {
18- pkg : grunt . file . readJSON ( 'package.json' ) ,
19- eslint : {
20- target : [ 'src/*js' , 'spec/*js' , 'Gruntfile.js' ]
21- } ,
22- // eslint-disable-next-line camelcase
23- jasmine_node : {
24- options : {
25- forceExit : true ,
26- jUnit : {
27- report : false
28- }
29- } ,
30- all : [ 'spec/' ]
31- } ,
32- concat : {
33- options : {
34- banner : license ,
35- footer : '}(jQuery));' ,
36- process : function ( src , filepath ) {
37- // Remove ALL block comments, the stripBanners only removes
38- // the first one
39- src = src . replace ( / \/ \* [ \s \S ] * ?\* \/ / g, '' ) ;
40- return '// Source: ' + filepath + src ;
41- }
42- } ,
43- dist : {
44- src : [
45- 'src/i18n.js' ,
46- 'src/rules.js' ,
47- 'src/options.js' ,
48- 'src/ui.js' ,
49- 'src/ui.progressbar.js' ,
50- 'src/ui.popover.js' ,
51- 'src/methods.js'
52- ] ,
53- dest : '<%= pkg.name %>.js'
12+ '(function (jQuery) {\n' ,
13+ eslintConfig = {
14+ target : [ 'src/*js' , 'spec/*js' , 'Gruntfile.js' ]
15+ } ,
16+ jasmineConfig = {
17+ options : {
18+ forceExit : true ,
19+ jUnit : {
20+ report : false
5421 }
5522 } ,
56- uglify : {
57- options : {
58- banner :
59- '/* <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> - GPLv3 & MIT License */\n' ,
60- sourceMap : true ,
61- sourceMapName : '<%= pkg.name %>.min.map'
62- } ,
63- dist : {
64- files : {
65- '<%= pkg.name %>.min.js' : [ '<%= concat.dist.dest %>' ]
66- }
23+ all : [ 'spec/' ]
24+ } ,
25+ concatConfig = {
26+ options : {
27+ banner : license ,
28+ footer : '}(jQuery));' ,
29+ process : function ( src , filepath ) {
30+ // Remove ALL block comments, the stripBanners only removes
31+ // the first one
32+ src = src . replace ( / \/ \* [ \s \S ] * ? \* \/ / g , '' ) ;
33+ return '// Source: ' + filepath + src ;
6734 }
6835 } ,
69- shell : {
70- copyFile : {
71- command : 'cp <%= concat.dist.dest %> examples/pwstrength.js'
72- } ,
73- copyZxcvbn : {
74- command :
75- 'cp bower_components/zxcvbn/dist/zxcvbn.js examples/zxcvbn.js'
76- } ,
77- copyI18next : {
78- command :
79- 'cp bower_components/i18next/i18next.min.js examples/i18next.js'
80- } ,
81- makeDir : {
82- command : 'mkdir -p dist'
83- } ,
84- moveFiles : {
85- command : 'mv <%= pkg.name %>* dist/'
36+ dist : {
37+ src : [
38+ 'src/i18n.js' ,
39+ 'src/rules.js' ,
40+ 'src/options.js' ,
41+ 'src/ui.js' ,
42+ 'src/ui.progressbar.js' ,
43+ 'src/ui.popover.js' ,
44+ 'src/methods.js'
45+ ] ,
46+ dest : '<%= pkg.name %>.js'
47+ }
48+ } ,
49+ uglifyConfig = {
50+ options : {
51+ banner :
52+ '/* <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> - GPLv3 & MIT License */\n' ,
53+ sourceMap : true ,
54+ sourceMapName : '<%= pkg.name %>.min.map'
55+ } ,
56+ dist : {
57+ files : {
58+ '<%= pkg.name %>.min.js' : [ '<%= concat.dist.dest %>' ]
8659 }
8760 }
61+ } ,
62+ shellConfig = {
63+ copyFile : {
64+ command : 'cp <%= concat.dist.dest %> examples/pwstrength.js'
65+ } ,
66+ copyZxcvbn : {
67+ command :
68+ 'cp bower_components/zxcvbn/dist/zxcvbn.js examples/zxcvbn.js'
69+ } ,
70+ copyI18next : {
71+ command :
72+ 'cp bower_components/i18next/i18next.min.js examples/i18next.js'
73+ } ,
74+ makeDir : {
75+ command : 'mkdir -p dist'
76+ } ,
77+ moveFiles : {
78+ command : 'mv <%= pkg.name %>* dist/'
79+ }
80+ } ;
81+
82+ module . exports = function ( grunt ) {
83+ 'use strict' ;
84+
85+ grunt . initConfig ( {
86+ pkg : grunt . file . readJSON ( 'package.json' ) ,
87+ eslint : eslintConfig ,
88+ // eslint-disable-next-line camelcase
89+ jasmine_node : jasmineConfig ,
90+ concat : concatConfig ,
91+ uglify : uglifyConfig ,
92+ shell : shellConfig
8893 } ) ;
8994
9095 // Load the plugins
0 commit comments