-
Notifications
You must be signed in to change notification settings - Fork 27.4k
feat(Grunt) Switch from Rake to Grunt #2094
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.
Instructs Travis to remove the local grunt executable placeholder. Should prevent Travis build from breaking.
Runs closure compiler in parallel, which speeds up minification.
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.
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
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.
no longer need to install testacular globally clear npm cache to avoid issues
Grunt 0.4 is yet to be released and is still evolving. While waiting for its release use specific, tested commits.
docs now set section and id correctly on Windows grunt docs task now works correctly in Windows
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.
Executes each build in parallel for greater performance.
Makes the grunt webserver task handle the extras that the old nodeserver used to: - optional CSP headers - rewrite rules for the docs - favicon
ok. I'm taking look at this now. if there are no major issues, I'd like to get this PR in today. |
cool, let me know if you have any questions. |
I found one issue. the i18n files are being copied into a wrong dir:
it should be:
btw it would be ideal if the output from the i18n task got silenced. I found a few other bugs and fixed those. if you could look into the i18n files issue that would be awesome. Once the issue is resolved I'm happy to merge this in. The rest of the code looks awesome. Thanks! |
I think the correct syntax for copy:i18n is
but this results in incorrect paths followed by an error:
I believe that this is a Grunt bug. |
ok, this seems to work:
there is a buggy/underdocumented behavior in grunt that requires additionally |
btw I was also wondering about the travis config file. why do you dump the cache and delete local grunt? seems odd to me |
Travis was having a strange issue where it would execute the local grunt instead of grunt-cli. Might not be necessary anymore, we can try without and see. |
What about the npm cache? |
I removed both npm cache hack and grunt hack from travis.yaml and travis seems to be happy. last question: how did you settle on the |
(btw the previous Rake syntax was due to Rake limitations) |
If I remember right Good call on |
landed as 79b51d5 many THANKS! |
Awesome work @GEDDesign ! |
Thank you! This is great news :) |
Congratulation! |
EPIC |
Woohoo! |
Since the switch, I can no longer run e2e tests: Then the browser(s) gets idle and nothing else happens. Am I the only one with this issue? |
Did you run grunt build first? |
same Problem here (Windows 8 + Chrome 25) |
Ah, you have to run your command line "as Administrator" on Windows for the ‛grunt build‛ task to correctly create the symlinks. I'm going to change that soon. Try running the build as Administrator and let me if that solves it on your box. |
You guys are running the webserver already somewhere on the same port. Grunt unlike rake will start webserver for e2e tests. |
Igor is right. You don't need to start the webserver before running the tests. If you already have the webserver running for something else, then run |
The Problem only occurs when executing tests with grunt test. When executing only e2e tests with grunt test:e2e all e2e tests pass. |
ah grunt test should never be called right?! It would exec grunt end2end which does not start the webserver..... |
Yeah, that was the problem. By default, Problem is gone if you use |
As soon as the Testacular proxy issue is resolved I'm going to update our build to use gruntacular. At that point I'll make grunt test do what you would have expected. |
sounds great 👍 |
very cool PR |
This is the updated Grunt PR rebased onto the last few months of Angular progress. It also reflects the progress made to the Rake build during that time. See the initial PR #1544 for more details, discussion, improvements, etc. The build/tests/etc verified now works on Windows.