2012-10-21 06:37:59 +00:00
|
|
|
var files = require('./angularFiles').files;
|
|
|
|
|
var util = require('./lib/grunt/utils.js');
|
|
|
|
|
|
|
|
|
|
module.exports = function(grunt) {
|
|
|
|
|
//grunt plugins
|
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-clean');
|
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-connect');
|
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-compress');
|
2013-06-23 21:27:18 +00:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-jasmine-node');
|
2013-07-03 18:10:23 +00:00
|
|
|
grunt.loadNpmTasks('grunt-ddescribe-iit');
|
|
|
|
|
grunt.loadNpmTasks('grunt-merge-conflict');
|
2013-07-01 23:21:56 +00:00
|
|
|
grunt.loadNpmTasks('grunt-parallel');
|
2012-10-21 06:37:59 +00:00
|
|
|
grunt.loadTasks('lib/grunt');
|
|
|
|
|
|
|
|
|
|
var NG_VERSION = util.getVersion();
|
2013-03-06 20:43:56 +00:00
|
|
|
var dist = 'angular-'+ NG_VERSION.full;
|
2012-10-21 06:37:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
//global beforeEach
|
|
|
|
|
util.init();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//config
|
|
|
|
|
grunt.initConfig({
|
|
|
|
|
NG_VERSION: NG_VERSION,
|
|
|
|
|
|
2013-07-01 23:21:56 +00:00
|
|
|
parallel: {
|
|
|
|
|
travis: {
|
|
|
|
|
options: {
|
2013-07-07 20:33:07 +00:00
|
|
|
stream: true
|
2013-07-01 23:21:56 +00:00
|
|
|
},
|
|
|
|
|
tasks: [
|
2013-08-01 20:14:52 +00:00
|
|
|
util.parallelTask('tests:docs'),
|
|
|
|
|
util.parallelTask('tests:modules'),
|
|
|
|
|
util.parallelTask('tests:jquery'),
|
|
|
|
|
util.parallelTask('tests:jqlite'),
|
|
|
|
|
util.parallelTask('tests:end2end')
|
2013-07-01 23:21:56 +00:00
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2012-10-21 06:37:59 +00:00
|
|
|
connect: {
|
|
|
|
|
devserver: {
|
|
|
|
|
options: {
|
|
|
|
|
port: 8000,
|
2013-03-11 22:07:51 +00:00
|
|
|
hostname: '0.0.0.0',
|
2012-10-21 06:37:59 +00:00
|
|
|
base: '.',
|
|
|
|
|
keepalive: true,
|
|
|
|
|
middleware: function(connect, options){
|
|
|
|
|
return [
|
|
|
|
|
//uncomment to enable CSP
|
|
|
|
|
// util.csp(),
|
|
|
|
|
util.rewrite(),
|
|
|
|
|
connect.favicon('images/favicon.ico'),
|
|
|
|
|
connect.static(options.base),
|
|
|
|
|
connect.directory(options.base)
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2013-07-01 23:21:56 +00:00
|
|
|
testserver: {
|
|
|
|
|
options: {
|
|
|
|
|
middleware: function(connect, options){
|
|
|
|
|
return [
|
|
|
|
|
function(req, resp, next) {
|
|
|
|
|
// cache get requests to speed up tests on travis
|
|
|
|
|
if (req.method === 'GET') {
|
|
|
|
|
resp.setHeader('Cache-control', 'public, max-age=3600');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
next();
|
|
|
|
|
},
|
|
|
|
|
connect.favicon('images/favicon.ico'),
|
|
|
|
|
connect.static(options.base)
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-10-21 06:37:59 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
2013-08-01 20:14:52 +00:00
|
|
|
tests: {
|
2013-03-21 01:57:13 +00:00
|
|
|
jqlite: 'karma-jqlite.conf.js',
|
|
|
|
|
jquery: 'karma-jquery.conf.js',
|
2013-06-05 18:31:32 +00:00
|
|
|
docs: 'karma-docs.conf.js',
|
2013-03-21 01:57:13 +00:00
|
|
|
modules: 'karma-modules.conf.js',
|
2012-10-21 06:37:59 +00:00
|
|
|
//NOTE run grunt test:e2e instead and it will start a webserver for you
|
2013-03-21 01:57:13 +00:00
|
|
|
end2end: 'karma-e2e.conf.js'
|
2012-10-21 06:37:59 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
autotest: {
|
2013-03-21 01:57:13 +00:00
|
|
|
jqlite: 'karma-jqlite.conf.js',
|
2013-06-06 21:07:32 +00:00
|
|
|
jquery: 'karma-jquery.conf.js',
|
2013-06-05 18:31:32 +00:00
|
|
|
modules: 'karma-modules.conf.js',
|
2013-08-01 20:14:52 +00:00
|
|
|
docs: 'karma-docs.conf.js'
|
2012-10-21 06:37:59 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clean: {build: ['build']},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build: {
|
|
|
|
|
scenario: {
|
|
|
|
|
dest: 'build/angular-scenario.js',
|
|
|
|
|
src: [
|
2013-07-29 23:58:55 +00:00
|
|
|
'bower_components/jquery/jquery.js',
|
2012-10-21 06:37:59 +00:00
|
|
|
util.wrap([files['angularSrc'], files['angularScenario']], 'ngScenario/angular')
|
|
|
|
|
],
|
|
|
|
|
styles: {
|
|
|
|
|
css: ['css/angular.css', 'css/angular-scenario.css']
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
angular: {
|
|
|
|
|
dest: 'build/angular.js',
|
|
|
|
|
src: util.wrap([files['angularSrc']], 'angular'),
|
|
|
|
|
styles: {
|
|
|
|
|
css: ['css/angular.css'],
|
|
|
|
|
minify: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
loader: {
|
|
|
|
|
dest: 'build/angular-loader.js',
|
|
|
|
|
src: util.wrap(['src/loader.js'], 'loader')
|
|
|
|
|
},
|
2013-02-08 18:39:23 +00:00
|
|
|
mobile: {
|
|
|
|
|
dest: 'build/angular-mobile.js',
|
|
|
|
|
src: util.wrap([
|
|
|
|
|
'src/ngMobile/mobile.js',
|
2013-04-23 17:53:27 +00:00
|
|
|
'src/ngMobile/swipe.js',
|
2013-03-08 14:38:29 +00:00
|
|
|
'src/ngMobile/directive/ngClick.js',
|
|
|
|
|
'src/ngMobile/directive/ngSwipe.js'
|
2013-02-08 18:39:23 +00:00
|
|
|
], 'module')
|
|
|
|
|
},
|
2012-10-21 06:37:59 +00:00
|
|
|
mocks: {
|
|
|
|
|
dest: 'build/angular-mocks.js',
|
|
|
|
|
src: ['src/ngMock/angular-mocks.js'],
|
|
|
|
|
strict: false
|
|
|
|
|
},
|
|
|
|
|
sanitize: {
|
|
|
|
|
dest: 'build/angular-sanitize.js',
|
|
|
|
|
src: util.wrap([
|
|
|
|
|
'src/ngSanitize/sanitize.js',
|
2013-06-05 22:30:31 +00:00
|
|
|
'src/ngSanitize/filter/linky.js'
|
2012-10-21 06:37:59 +00:00
|
|
|
], 'module')
|
|
|
|
|
},
|
|
|
|
|
resource: {
|
|
|
|
|
dest: 'build/angular-resource.js',
|
|
|
|
|
src: util.wrap(['src/ngResource/resource.js'], 'module')
|
|
|
|
|
},
|
feat(ngAnimate): complete rewrite of animations
- ngAnimate directive is gone and was replaced with class based animations/transitions
- support for triggering animations on css class additions and removals
- done callback was added to all animation apis
- $animation and $animator where merged into a single $animate service with api:
- $animate.enter(element, parent, after, done);
- $animate.leave(element, done);
- $animate.move(element, parent, after, done);
- $animate.addClass(element, className, done);
- $animate.removeClass(element, className, done);
BREAKING CHANGE: too many things changed, we'll write up a separate doc with migration instructions
2013-06-18 17:59:57 +00:00
|
|
|
animate: {
|
|
|
|
|
dest: 'build/angular-animate.js',
|
|
|
|
|
src: util.wrap(['src/ngAnimate/animate.js'], 'module')
|
|
|
|
|
},
|
2013-06-05 22:30:31 +00:00
|
|
|
route: {
|
|
|
|
|
dest: 'build/angular-route.js',
|
|
|
|
|
src: util.wrap([
|
|
|
|
|
'src/ngRoute/routeUtils.js',
|
|
|
|
|
'src/ngRoute/route.js',
|
|
|
|
|
'src/ngRoute/routeParams.js',
|
|
|
|
|
'src/ngRoute/directive/ngView.js'
|
|
|
|
|
], 'module')
|
|
|
|
|
},
|
2012-10-21 06:37:59 +00:00
|
|
|
cookies: {
|
|
|
|
|
dest: 'build/angular-cookies.js',
|
|
|
|
|
src: util.wrap(['src/ngCookies/cookies.js'], 'module')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
min: {
|
|
|
|
|
angular: 'build/angular.js',
|
feat(ngAnimate): complete rewrite of animations
- ngAnimate directive is gone and was replaced with class based animations/transitions
- support for triggering animations on css class additions and removals
- done callback was added to all animation apis
- $animation and $animator where merged into a single $animate service with api:
- $animate.enter(element, parent, after, done);
- $animate.leave(element, done);
- $animate.move(element, parent, after, done);
- $animate.addClass(element, className, done);
- $animate.removeClass(element, className, done);
BREAKING CHANGE: too many things changed, we'll write up a separate doc with migration instructions
2013-06-18 17:59:57 +00:00
|
|
|
animate: 'build/angular-animate.js',
|
2012-10-21 06:37:59 +00:00
|
|
|
cookies: 'build/angular-cookies.js',
|
|
|
|
|
loader: 'build/angular-loader.js',
|
2013-02-08 18:39:23 +00:00
|
|
|
mobile: 'build/angular-mobile.js',
|
2012-10-21 06:37:59 +00:00
|
|
|
resource: 'build/angular-resource.js',
|
2013-06-05 22:30:31 +00:00
|
|
|
route: 'build/angular-route.js',
|
2013-06-04 23:05:50 +00:00
|
|
|
sanitize: 'build/angular-sanitize.js'
|
2012-10-21 06:37:59 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs: {
|
|
|
|
|
process: ['build/docs/*.html', 'build/docs/.htaccess']
|
|
|
|
|
},
|
|
|
|
|
|
2013-06-23 21:27:18 +00:00
|
|
|
"jasmine-node": {
|
|
|
|
|
run: { spec: 'docs/spec' }
|
|
|
|
|
},
|
2012-10-21 06:37:59 +00:00
|
|
|
|
2013-07-03 18:10:23 +00:00
|
|
|
"ddescribe-iit": {
|
|
|
|
|
files: [
|
|
|
|
|
'test/**/*.js',
|
|
|
|
|
'!test/ngScenario/DescribeSpec.js'
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
"merge-conflict": {
|
|
|
|
|
files: [
|
|
|
|
|
'src/**/*',
|
|
|
|
|
'test/**/*',
|
|
|
|
|
'docs/**/*',
|
|
|
|
|
'css/**/*'
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
|
2012-10-21 06:37:59 +00:00
|
|
|
copy: {
|
|
|
|
|
i18n: {
|
|
|
|
|
files: [
|
|
|
|
|
{ src: 'src/ngLocale/**', dest: 'build/i18n/', expand: true, flatten: true }
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
compress: {
|
|
|
|
|
build: {
|
2013-03-06 20:43:56 +00:00
|
|
|
options: {archive: 'build/' + dist +'.zip'},
|
2013-03-06 22:23:05 +00:00
|
|
|
src: ['**'], cwd: 'build', expand: true, dot: true, dest: dist + '/'
|
2012-10-21 06:37:59 +00:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
write: {
|
|
|
|
|
versionTXT: {file: 'build/version.txt', val: NG_VERSION.full},
|
|
|
|
|
versionJSON: {file: 'build/version.json', val: JSON.stringify(NG_VERSION)}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//alias tasks
|
2013-08-01 20:14:52 +00:00
|
|
|
grunt.registerTask('test', ['package','test:unit', 'tests:docs', 'test:e2e']);
|
|
|
|
|
grunt.registerTask('test:jqlite', ['tests:jqlite']);
|
|
|
|
|
grunt.registerTask('test:jquery', ['tests:jquery']);
|
|
|
|
|
grunt.registerTask('test:modules', ['tests:modules']);
|
|
|
|
|
grunt.registerTask('test:docs', ['package', 'tests:docs']);
|
|
|
|
|
grunt.registerTask('test:unit', ['tests:jqlite', 'tests:jquery', 'tests:modules']);
|
|
|
|
|
grunt.registerTask('test:e2e', ['connect:testserver', 'tests:end2end']);
|
2013-06-23 21:27:18 +00:00
|
|
|
grunt.registerTask('test:docgen', ['jasmine-node']);
|
2013-08-01 20:14:52 +00:00
|
|
|
|
2013-07-30 22:25:54 +00:00
|
|
|
grunt.registerTask('minify', ['bower','clean', 'build', 'minall']);
|
2012-10-21 06:37:59 +00:00
|
|
|
grunt.registerTask('webserver', ['connect:devserver']);
|
2013-07-30 22:25:54 +00:00
|
|
|
grunt.registerTask('package', ['bower','clean', 'buildall', 'minall', 'collect-errors', 'docs', 'copy', 'write', 'compress']);
|
2013-07-03 18:10:23 +00:00
|
|
|
grunt.registerTask('ci-checks', ['ddescribe-iit', 'merge-conflict']);
|
2012-10-21 06:37:59 +00:00
|
|
|
grunt.registerTask('default', ['package']);
|
|
|
|
|
};
|