forked from angular/angular.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(Grunt): switch from Rake to Grunt
Migrates the Angular project from Rake to Grunt. Benefits: - Drops Ruby dependency - Lowers barrier to entry for contributions from JavaScript ninjas - Simplifies the Angular project setup and build process - Adopts industry-standard tools specific to JavaScript projects - Support building angular.js on Windows platform (really?!? why?!?) BREAKING CHANGE: Rake is completely replaced by Grunt. Below are the deprecated Rake tasks and their Grunt equivalents: rake --> grunt rake package --> grunt package rake init --> N/A rake clean --> grunt clean rake concat_scenario --> grunt build:scenario rake concat --> grunt build rake concat_scenario --> grunt build:scenario rake minify --> grunt minify rake version --> grunt write:version rake docs --> grunt docs rake webserver --> grunt webserver rake test --> grunt test rake test:unit --> grunt test:unit rake test:<jqlite|jquery|modules|e2e> --> grunt test:<jqlite|jquery|modules|end2end|e2e> rake test[Firefox+Safari] --> grunt test --browsers Firefox,Safari rake test[Safari] --> grunt test --browsers Safari rake autotest --> grunt autotest NOTES: * For convenience grunt test:e2e starts a webserver for you, while grunt test:end2end doesn't. Use grunt test:end2end if you already have the webserver running. * Removes duplicate entry for Describe.js in the angularScenario section of angularFiles.js * Updates docs/src/gen-docs.js to use #done intead of the deprecated #end * Uses grunt-contrib-connect instead of lib/nodeserver (removed) * Removes nodeserver.sh, travis now uses grunt webserver * Built and minified files are identical to Rake's output, with the exception of one less character for git revisions (using --short) and a couple minor whitespace differences Closes angular#199
- Loading branch information
Showing
18 changed files
with
468 additions
and
682 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,170 @@ | ||
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'); | ||
grunt.loadTasks('lib/grunt'); | ||
|
||
var NG_VERSION = util.getVersion(); | ||
|
||
|
||
//global beforeEach | ||
util.init(); | ||
|
||
|
||
//config | ||
grunt.initConfig({ | ||
NG_VERSION: NG_VERSION, | ||
|
||
connect: { | ||
devserver: { | ||
options: { | ||
port: 8000, | ||
hostname: 'localhost', | ||
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) | ||
]; | ||
} | ||
} | ||
}, | ||
testserver: {} | ||
}, | ||
|
||
|
||
test: { | ||
jqlite: 'testacular-jqlite.conf.js', | ||
jquery: 'testacular-jquery.conf.js', | ||
modules: 'testacular-modules.conf.js', | ||
//NOTE run grunt test:e2e instead and it will start a webserver for you | ||
end2end: 'testacular-e2e.conf.js' | ||
}, | ||
|
||
|
||
autotest: { | ||
jqlite: 'testacular-jqlite.conf.js', | ||
jquery: 'testacular-jquery.conf.js' | ||
}, | ||
|
||
|
||
clean: {build: ['build']}, | ||
|
||
|
||
build: { | ||
scenario: { | ||
dest: 'build/angular-scenario.js', | ||
src: [ | ||
'lib/jquery/jquery.js', | ||
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') | ||
}, | ||
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', | ||
'src/ngSanitize/directive/ngBindHtml.js', | ||
'src/ngSanitize/filter/linky.js', | ||
], 'module') | ||
}, | ||
resource: { | ||
dest: 'build/angular-resource.js', | ||
src: util.wrap(['src/ngResource/resource.js'], 'module') | ||
}, | ||
cookies: { | ||
dest: 'build/angular-cookies.js', | ||
src: util.wrap(['src/ngCookies/cookies.js'], 'module') | ||
}, | ||
bootstrap: { | ||
dest: 'build/angular-bootstrap.js', | ||
src: util.wrap(['src/bootstrap/bootstrap.js'], 'module') | ||
}, | ||
bootstrapPrettify: { | ||
dest: 'build/angular-bootstrap-prettify.js', | ||
src: util.wrap(['src/bootstrap/bootstrap-prettify.js', 'src/bootstrap/google-prettify/prettify.js'], 'module'), | ||
styles: { | ||
css: ['src/bootstrap/google-prettify/prettify.css'], | ||
minify: true | ||
} | ||
} | ||
}, | ||
|
||
|
||
min: { | ||
angular: 'build/angular.js', | ||
cookies: 'build/angular-cookies.js', | ||
loader: 'build/angular-loader.js', | ||
resource: 'build/angular-resource.js', | ||
sanitize: 'build/angular-sanitize.js', | ||
bootstrap: 'build/angular-bootstrap.js', | ||
bootstrapPrettify: 'build/angular-bootstrap-prettify.js', | ||
}, | ||
|
||
|
||
docs: { | ||
process: ['build/docs/*.html', 'build/docs/.htaccess'] | ||
}, | ||
|
||
|
||
copy: { | ||
i18n: { | ||
files: [ | ||
{ src: 'src/ngLocale/**', dest: 'build/i18n/', expand: true, flatten: true } | ||
] | ||
} | ||
}, | ||
|
||
|
||
compress: { | ||
build: { | ||
options: {archive: 'build/angular-'+ NG_VERSION.full +'.zip'}, | ||
src: ['**'], cwd: 'build', expand: true | ||
} | ||
}, | ||
|
||
|
||
write: { | ||
versionTXT: {file: 'build/version.txt', val: NG_VERSION.full}, | ||
versionJSON: {file: 'build/version.json', val: JSON.stringify(NG_VERSION)} | ||
} | ||
}); | ||
|
||
|
||
//alias tasks | ||
grunt.registerTask('test:unit', ['test:jqlite', 'test:jquery', 'test:modules']); | ||
grunt.registerTask('minify', ['clean', 'build', 'minall']); | ||
grunt.registerTask('test:e2e', ['connect:testserver', 'test:end2end']); | ||
grunt.registerTask('webserver', ['connect:devserver']); | ||
grunt.registerTask('package', ['clean', 'buildall', 'minall', 'docs', 'copy', 'write', 'compress']); | ||
grunt.registerTask('default', ['package']); | ||
}; |
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
Oops, something went wrong.