@@ -1,28 +1,39 @@
/* eslint-disable no-process-env */
module . exports = function ( grunt ) {
grunt . initConfig ( {
pkg : grunt . file . readJSON ( 'package.json' ) ,
clean : [ 'tmp' , 'dist' , 'lib/handlebars/compiler/parser.js' , 'integration-testing/**/node_modules' ] ,
clean : [
'tmp' ,
'dist' ,
'lib/handlebars/compiler/parser.js' ,
'integration-testing/**/node_modules'
] ,
copy : {
dist : {
options : {
processContent : function ( content ) {
return grunt . template . process ( '/**!\n\n @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat\n <%= pkg.name %> v<%= pkg.version %>\n\n<%= grunt.file.read("LICENSE") %>\n*/\n' )
+ content
+ '\n// @license-end\n' ;
return (
grunt . template . process (
'/**!\n\n @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat\n <%= pkg.name %> v<%= pkg.version %>\n\n<%= grunt.file.read("LICENSE") %>\n*/\n'
) +
content +
'\n// @license-end\n'
) ;
}
} ,
files : [
{ expand : true , cwd : 'dist/' , src : [ '*.js' ] , dest : 'dist/' }
]
files : [ { expand : true , cwd : 'dist/' , src : [ '*.js' ] , dest : 'dist/' } ]
} ,
components : {
files : [
{ expand : true , cwd : 'components/' , src : [ '**' ] , dest : 'dist/components' } ,
{ expand : true , cwd : 'dist/' , src : [ '*.js' ] , dest : 'dist/components' }
{
expand : true ,
cwd : 'components/' ,
src : [ '**' ] ,
dest : 'dist/components'
} ,
{ expand : true , cwd : 'dist/' , src : [ '*.js' ] , dest : 'dist/components' }
]
}
} ,
@@ -34,12 +45,14 @@ module.exports = function(grunt) {
auxiliaryCommentBefore : 'istanbul ignore next'
} ,
cjs : {
files : [ {
cwd : 'lib/' ,
expand : true ,
src : '**/!(index).js' ,
dest : 'dist/cjs/'
} ]
files : [
{
cwd : 'lib/' ,
expand : true ,
src : '**/!(index).js' ,
dest : 'dist/cjs/'
}
]
}
} ,
webpack : {
@@ -72,15 +85,17 @@ module.exports = function(grunt) {
preserveComments : /(?: ^ !| @(?: license| preserve| cc_on) ) /
} ,
dist : {
files : [ {
cwd : 'dist/' ,
expand : true ,
src : [ 'handlebars*.js' , '!*.min.js' ] ,
dest : 'dist/' ,
rename : function ( dest , src ) {
return dest + src . replace ( /\. js$ / , '.min.js' ) ;
files : [
{
cwd : 'dist/' ,
expand : true ,
src : [ 'handlebars*.js' , '!*.min.js' ] ,
dest : 'dist/' ,
rename : function ( dest , src ) {
return dest + src . replace ( /\. js$ / , '.min.js' ) ;
}
}
} ]
]
}
} ,
@@ -108,24 +123,39 @@ module.exports = function(grunt) {
detailedError : true ,
concurrency : 4 ,
browsers : [
{ browserName : 'chrome' } ,
{ browserName : 'firefox' , platform : 'Linux' } ,
{ browserName : 'chrome' } ,
{ browserName : 'firefox' , platform : 'Linux' } ,
// {browserName: 'safari', version: 9, platform: 'OS X 10.11'},
// {browserName: 'safari', version: 8, platform: 'OS X 10.10'},
{ browserName : 'internet explorer' , version : 11 , platform : 'Windows 8.1' } ,
{ browserName : 'internet explorer' , version : 10 , platform : 'Windows 8' }
{
browserName : 'internet explorer' ,
version : 11 ,
platform : 'Windows 8.1'
} ,
{
browserName : 'internet explorer' ,
version : 10 ,
platform : 'Windows 8'
}
]
}
} ,
sanity : {
options : {
build : process . env . TRAVIS_JOB_ID ,
urls : [ 'http://localhost:9999/spec/umd.html?headless=true' , 'http://localhost:9999/spec/umd-runtime.html?headless=true' ] ,
urls : [
'http://localhost:9999/spec/umd.html?headless=true' ,
'http://localhost:9999/spec/umd-runtime.html?headless=true'
] ,
detailedError : true ,
concurrency : 2 ,
browsers : [
{ browserName : 'chrome' } ,
{ browserName : 'internet explorer' , version : 10 , platform : 'Windows 8' }
{ browserName : 'chrome' } ,
{
browserName : 'internet explorer' ,
version : 10 ,
platform : 'Windows 8'
}
]
}
}
@@ -137,7 +167,6 @@ module.exports = function(grunt) {
bg : false ,
fail : true
}
} ,
watch : {
@@ -167,9 +196,9 @@ module.exports = function(grunt) {
grunt . task . loadTasks ( 'tasks' ) ;
this . registerTask (
'build' ,
'Builds a distributable version of the current project' ,
[ 'parser' , 'node' , 'globals' ]
'build' ,
'Builds a distributable version of the current project' ,
[ 'parser' , 'node' , 'globals' ]
) ;
this . registerTask ( 'node' , [ 'babel:cjs' ] ) ;
@@ -183,13 +212,25 @@ module.exports = function(grunt) {
] ) ;
grunt . registerTask ( 'bench' , [ 'metrics' ] ) ;
grunt . registerTask ( 'sauce' , process . env . SAUCE_USERNAME ? [ 'tests' , 'connect' , 'saucelabs-mocha' ] : [ ] ) ;
grunt . registerTask (
'sauce' ,
process . env . SAUCE_USERNAME ? [ 'tests' , 'connect' , 'saucelabs-mocha' ] : [ ]
) ;
// Requires secret properties (saucelabs-credentials etc.) from .travis.yaml
grunt . registerTask ( 'extensive-tests-and-publish-to-aws' , [ 'default' , 'bgShell:integrationTests' , 'sauce' , 'metrics' , 'publish:latest' ] ) ;
grunt . registerTask ( 'extensive-tests-and-publish-to-aws' , [
'default' ,
'bgShell:integrationTests' ,
'sauce' ,
'metrics' ,
'publish:latest'
] ) ;
grunt . registerTask ( 'on-file-change' , [ 'build' , 'concat:tests' , 'test' ] ) ;
// === Primary tasks ===
grunt . registerTask ( 'dev' , [ 'clean' , 'connect' , 'watch' ] ) ;
grunt . registerTask ( 'default' , [ 'clean' , 'build' , 'test' , 'release' ] ) ;
grunt . registerTask ( 'integration-tests' , [ 'default' , 'bgShell:integrationTests' ] ) ;
grunt . registerTask ( 'integration-tests' , [
'default' ,
'bgShell:integrationTests'
] ) ;
} ;