This repository has been archived by the owner on Feb 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split tasks used by gruntfile into separate files
Also, updated some dev dependencies
- Loading branch information
Showing
15 changed files
with
204 additions
and
180 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
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = function(grunt){ | ||
|
||
// Construct a banner containing package and build information | ||
grunt.config('banner', | ||
'/*! <%= filename %>.js | <%= pkg.url %> | <%= pkg.license %>\n' + | ||
'* <%= pkg.author %> | <%= pkg.contact %> */\n' | ||
//'* Built on <%= timestamp %> */\n', | ||
); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module.exports = function(grunt){ | ||
/** | ||
* Concatenation setup. Concatenated files are built to the path defined by the d variable | ||
* Includes closure banner and footer. Keep these in if you want to wrap concatenated code in closures | ||
*/ | ||
grunt.config('concat', { | ||
options: { | ||
banner: '<%= banner %>' + | ||
'\n;(function(window, document, undefined) {\n\n "use strict";\n\n', | ||
footer: '\n})(window, window.document);\n' | ||
}, | ||
dist: { | ||
src: ['<%= s %>js/_scaffolding.js', '<%= s %>js/**/*.js', '<%= s %>js/main-address.js'], // Define specific files in dependency order if required | ||
dest: '<%= d %>js/<%= filename %>.js' | ||
} | ||
}); | ||
|
||
grunt.loadNpmTasks('grunt-contrib-concat'); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module.exports = function(grunt){ | ||
|
||
/** | ||
* Copy setup | ||
*/ | ||
grunt.config('copy',{ | ||
fonts: { | ||
files: [ | ||
{ | ||
expand: true, | ||
flatten: true, | ||
src: ['<%= s %>fonts/**/*'], | ||
dest: '<%= d %>fonts', | ||
filter: 'isFile' | ||
} | ||
] | ||
}, | ||
images: { | ||
files: [ | ||
{ | ||
expand: true, | ||
flatten: true, | ||
src: ['<%= s %>/images/**/*', '!<%= s %>images/**/*.db'], // Include all files in images folder, excluding .db | ||
dest: '<%= d %>images', | ||
filter: 'isFile' | ||
} | ||
] | ||
} | ||
}); | ||
|
||
grunt.loadNpmTasks('grunt-contrib-copy'); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = function(grunt){ | ||
/** | ||
* Coveralls setup. Tells Coveralls where to find code coverage information | ||
*/ | ||
grunt.config('coveralls', { | ||
options: { | ||
force: true | ||
}, | ||
src: 'coverage/lcov.info' | ||
}); | ||
|
||
grunt.loadNpmTasks('grunt-coveralls'); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module.exports = function(grunt){ | ||
/** | ||
* CSS min setup | ||
*/ | ||
grunt.config('cssmin', { | ||
target: { | ||
files: [{ | ||
expand: true, | ||
cwd: '<%= d %>css', | ||
src: ['*.css', '!*.min.css'], | ||
dest: '<%= d %>css', | ||
ext: '.min.css' | ||
}] | ||
} | ||
}); | ||
|
||
grunt.loadNpmTasks('grunt-contrib-cssmin'); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = function(grunt){ | ||
grunt.config('filename', 'contact-data-services'); // Construct a filename from package vars | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module.exports = function(grunt){ | ||
/** | ||
* Jasmine unit test setup. Includes Istanbul code coverage setup with Coveralls-friendly output | ||
*/ | ||
grunt.config('jasmine', { | ||
src: ['<%= s %>js/_scaffolding.js', '<%= s %>js/**/*.js', '<%= s %>js/main-address.js'], // Define specific files in dependency order if required | ||
options: { | ||
specs: '<%= t %>**/*.js', | ||
template: require('grunt-template-jasmine-istanbul'), | ||
templateOptions: { | ||
coverage: 'coverage/coverage.json', | ||
report: [ | ||
{ type: 'lcov', options: { dir: 'coverage' }}, // Create .lcov report, required by Coveralls | ||
{ type: 'html', options: { dir: 'coverage/html' }}, // Create an html report, readable by humans | ||
{ type: 'text-summary' } // Output results to console post-build | ||
], | ||
thresholds: { | ||
// Test result thresholds all set to 0 to begin with. Commented values are suggestions | ||
lines: 0, // 75 | ||
statements: 0, // 75 | ||
branches: 0, // 75 | ||
functions: 0 // 75 | ||
} | ||
} | ||
} | ||
}); | ||
|
||
grunt.loadNpmTasks('grunt-contrib-jasmine'); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module.exports = function(grunt){ | ||
/** | ||
* JSHint static analysis setup | ||
*/ | ||
grunt.config('jshint', { | ||
files: ['gruntfile.js', '<%= s %>**/*.js', '<%= t %>**/*.js'], // Analyse this file and all source and test files for errors | ||
options: { | ||
browser: true, // Assume general browser globals | ||
globals: { | ||
predef: ['ContactDataServices'] // Any global variables go here, if required | ||
} | ||
}, | ||
}); | ||
|
||
grunt.loadNpmTasks('grunt-contrib-jshint'); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module.exports = function(grunt){ | ||
/** | ||
* Less setup | ||
*/ | ||
grunt.config('less', { | ||
dev: { | ||
options: { | ||
paths: ['<%= s %>less/**/*.less'], // Process all Less files in Less folder | ||
}, | ||
files: { | ||
"<%= d %>css/styles.css": "<%= s %>less/_styles.less" // Build styles.css based on _styles.less | ||
} | ||
} | ||
}); | ||
|
||
grunt.loadNpmTasks('grunt-contrib-less'); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = function(grunt){ | ||
|
||
grunt.config('s', 'src/'); // The source directory | ||
grunt.config('d', 'dist/'); // The distributable directory, where built files will end up | ||
grunt.config('t', 'test/'); // The test directory, for unit test files/specs | ||
|
||
}; |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module.exports = function(grunt){ | ||
/** | ||
* Uglification (minification) setup. Uglified files are built to the path defined by the d variable and get a .min suffix | ||
*/ | ||
grunt.config('uglify', { | ||
options: { | ||
banner: '<%= banner %>' | ||
}, | ||
dist: { | ||
files: { | ||
'<%= d %>js/<%= filename %>.min.js': ['<%= concat.dist.dest %>'] // Each concatenated file will get an uglified version | ||
} | ||
} | ||
}); | ||
|
||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = function(grunt){ | ||
/** | ||
* Watch setup. The configured tasks will run when and of the files tested by JSHint are changed | ||
*/ | ||
grunt.config('watch', { | ||
files: ['<%= jshint.files %>', '<%= less.dev.options.paths %>'], | ||
tasks: ['jshint', 'jasmine', 'less'] | ||
}); | ||
|
||
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
}; |
Oops, something went wrong.