-
Notifications
You must be signed in to change notification settings - Fork 27.5k
feat(Grunt) Switch from Rake to Grunt #1544
Conversation
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 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 --in=[Firefox,Safari] rake test[Safari] --> grunt test --in=[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 #199
Replaces Rake documentation with Grunt documentation.
Not sure why Travis is choking. |
Instructs Travis to remove the local grunt executable placeholder. Should prevent Travis build from breaking.
@IgorMinar @mhevery let's do this. |
+1 |
Runs closure compiler in parallel, which speeds up minification.
Great work! |
I've tried to test your work on Windows and run into some problems:
|
Another thing, build outputs 'Done, without errors' even if there are failing tests |
thanks @Mischi & @ffesseler, improvements in the works. |
+1 On Tue, Nov 13, 2012 at 9:40 PM, Dave Geddes [email protected]:
|
Make grunt tasks fail & abort on errors, failing tests, etc. No longer catch uncaughtException in docs/src/gen-docs.js so Grunt can catch it and abort Also use spawn instead of exec where appropriate to avoid hitting node's buffer size limit.
@ffesseler Grunt now aborts on errors and failing tests, thanks for catching that. Support for Windows merits more discussion. Currently the gen-docs.js tool also breaks in Windows because of its use of symlinks. Also @IgorMinar added that -d32 flag to speed up closure compiler. I recommend we open a separate issue for Windows build support, as it's beyond the scope of this issue. In any case, I believe this is now ready to go. Thanks everybody for pointing out the things I had overlooked. @IgorMinar & @mhevery let me know if there's anything else you'd like for this before merging. |
Excellent! I'll have a look at it today |
The build currently doesn't run in Windows. This creates a problem when a developer using Windows tries to contribute to Angular, but can't run the end-to-end tests. Fix the few things that prevented the build from working in Windows: Windows doesn't have "zip", that would be too intuitive. Solution: Use grunt-contrib-compress instead This speeds things up, but breaks for Windows 64bit users Solution: Remove flag Node can create symlinks in Windows, but you have to pass an extra "dir" option to fs. gen-docs.js uses q-fs.js to create symlinks, which doesn't pass this needed type argument. Solution: Add this third type option to qfs#symbolicLink, and pass the option in from gen-docs.js and writer.js q-fs.js Pull Request #7 pending that adds this feature (kriskowal/q-fs#7) In the meantime, specify geddesign's fork as the dependency in package.json. Will switch back once merged. fix(gen-docs) handle symlinks correctly in Windows
Chancho, when you are a man, sometimes you support Windows in your code. It's for fun. It's now possible to run the build and end-to-end tests in Windows. @ffesseler @Mischi give it a spin, let me know if you run into any snags. You may have to run command prompt as administrator (right click > run as Administrator) @IgorMinar @mhevery I know you guys have been crazy busy speaking at conferences. Looking forward to your review when you get a chance. |
@GEDDesign Good Work! Build and tests run now successfully if they where executed as Administrator. (By the way, I think it has something to do with the read only flag on angular.js folder that prevent from successfull build under normal user but i do not know how to remove that flag xD ) Now builds on WIndows run as smooth as on *unix like systems! |
The grunt build is failing on my Win7 machine. I have installed grunt-cli globally and run npm install locally.
From looking at the source, it seems like the version of grunt-contrib-clean is at fault. There is a line that says:
But there is no Any thoughts on this? Should I be modifying my npm install in some way? Pete |
@petebacondarwin try deleting your node_modules folder, running "npm cache clear" then "npm install". Lemme know. |
Same error here, even after clearing the cache |
@ffesseler @petebacondarwin sounds like npm is still hanging on to an older version of grunt. Try this:
|
i run into the same problem i think and i solved the problem by executing npm uninstall grunt -g maybe that will help |
ah yeah, you want to uninstall the old global grunt. |
I love this idea. Lets merge it. |
My pull request to q-fs was merged (kriskowal/q-fs#7) So q-fs now supports the "type" option for symlinks, neccessary for Windows support. Switching back to the official repo of q-fs.
When the build runs, it needs to use the global grunt-cli. But since node_modules/.bin is in the path on that server, the grunt command defaults to the local grunt, which is just a placeholder that gives a warning to use the global grunt-cli. So we rm the local one, but the build shouldn't fail if it's already been deleted.
[email protected] introduced a regression with symlink creation. fixed in [email protected]
@ffesseler @petebacondarwin did you get it working on your windows machines? When going from grunt 0.3 to 0.4 you do need to uninstall the global grunt (manually deleting the global node_modules/grunt if |
Using spawn instead of exec shaves a couple seconds off the grunt docs task.
This speeds up the build again on non-Windows platforms by serveral seconds, while maintaining Windows compat. Win-win.
@IgorMinar thanks for the response mate! The grunt docs task was being slowed down by the use of exec instead of spawn, thanks for catching that. Exec is more concise but speed is a priority there I think. Fixed in 3c0989c. I'm with you, I don't like the speed tradeoff for Windows support. In 51c4a1f I only drop the As for the server, I think it's a bit of a codesmell to depend on a specific custom webserver, but I'll look and see if there are options for those requirements using Connect, if that's the way you'd like to go. Might be a good opportunity to rethink that dependency. Would be trivial to use the old webserver again if we need. I'll do some digging and update soon. |
@GEDDesign the perf is much better now. can we paralelize the build task as well? that will shave off another 0.5sec, which would bring is almost to the time it takes to build angular with rake wrt the webserver - no code smell. any app that uses html5 history api needs to have url rewriting rule on the server. the CSP customization is nothing special either - just extra headers that are sent with http responses. |
On Windows 7 I see three problems: jsdoc won't build for reasons unknown
testacular doesn't look for Chrome's SECOND default location Manually setting of CHROME_BIN gets Chrome fired up on my machine. Testacular really should look in the Chrome .msi-installer default directories when the per-user install is not found:
end2end test fails
|
@arbitrix thanks for sharing your findings. Windows 7 does support symlinks, but depending on your setup you may run into permissions issues. The solution is to run your command prompt as Administrator (right click, run as Administrator). Not ideal I know, but it works. You've already found the correct testacular workaround for running the tests in Chrome. That's a testacular bug we should open an issue for. You can also run the tests in IE without any extra setup: grunt test:e2e --in=[IE] And finally the connection refused error is because the tests depend on the docs building successfully. Running as administrator will take care of that. Let me know how it goes! |
Executes each build in parallel for greater performance.
@IgorMinar done, good suggestion. Looking at the webserver stuff now. |
Makes the grunt webserver task handle the extras that the old nodeserver used to: - optional CSP headers - rewrite rules for the docs - favicon
@IgorMinar the connect webserver now supports CSP and the rewrites. Thanks for all your excellent feedback on this! Let me know if there's anything else you'd like to see before the merge. |
@IgorMinar this is ready, let's get it in before too much more work (like #1710) is done on the previous build. |
@GEDDesign I love the recent cleanup! this PR is quite awesome now. we are tracking the grunt development and see that it is still quite unstable. I don't feel confortable about switching over and dealing the grunt undergoing development. I want to wait until it's stable before we hop on. I'm sorry that this is taking so long, but the build script is a very crucial part of the project, so I want to get it right. |
@IgorMinar thanks. I hear you. I'll keep a close eye on any progress/updates made on the current build system, and keep this one up to date so that once Grunt 0.4 stable lands we can merge this in seamlessly (current version is 0.4.0rc5). Deal? |
@GEDDesign yes! |
+1 |
@IgorMinar Grunt 0.4 stable was released yesterday, I'm working on updating this PR. Here's my plan of attack to make this easy to merge, tell me if there's anything you'd recommend doing differently:
I'm not sure how the Github PR UI is going to handle the squash... let me know if you'd rather do that on your end. |
I'll squash on my end in this case. Please ping this PR when you are ready. |
I'm planing on making more Rakefile changes within the next week. When do you think that this PR will be ready? No pressure... I just want to coordinate the conflicting work... |
@IgorMinar sorry for the delay, I was pretty focused on my Angular workshop. Now that that's done I'll try to get this wrapped up this weekend. |
Ready. I opened a new pull request #2094 for my updated Grunt branch - pretty sure Github would have choked on the massive rebase onto master. Closing this PR. Thanks everyone for your input! @IgorMinar fire at will, commander. |
Migrates the Angular project from Rake to Grunt.
Benefits:
BREAKING CHANGE:
Rake is completely replaced by Grunt. Below are the deprecated Rake tasks and their Grunt equivalents:
NOTES:
Use grunt test:end2end if you already have the webserver running.
character for git revisions (using --short) and a couple minor whitespace differences
Closes #199