This Gruntfile excludes way more unnecessary files (mostly test/, doc/ and examples/), which results in a dist folder taking up way less space than before (resulting in a smaller installer).
Disk space usage analysis (using RidNacs):
That's 10MB less!
I haven't tested this at all, though.
@MarcelGerber Good to see this..
@nethip Just so you know, while most changes should be safe, in bcc4e07 I included another step to uglify all CodeMirror files. I haven't tested it all that much (things to test are using multiple modes, CM addon loading, maybe even keymap loading, CM theme loading).
If something unexpected happens, it's always easy to revert that tiny little change.
@MarcelGerber I think this is still a good change except for my doubts on having to uglify Code Mirror JS library. Can we drop off the uglify build step and proceed with the rest. I will try to unit test this today.
Do you want me to still uglify the nls (translation) files or should I drop that step as well?
Yeah nls as well. You could put up a different PR for the uglify step alone, which probably might need rigorous testing.
@nethip I've removed the extra build step.
Also, I've taken new screenshots of the savings we achieve:
On this branch (dist-exclude):
On master branch (master):
@MarcelGerber I pulled down your change and ran grunt build. I could see that test, example, docs folders, present right under extensibility/node/node_modules are getting squashed. However, If the node_modules contain further node_modules, the nested ones are not being considered for the exclusion. Is there a way we can fix this? If this is fixed, we can further bring down the foot print.
And also I built the MAC installer and I could see the size reduce by ~7MB. 😄
Hm, IIRC I didn't see this when testing (can't test right now).
Is it possible those folders are empty?
I saw that the folders were not empty.
What I meant above was that the exclusion rules get applied properly but only for extensibility/node/node_modules/*.The rule would not exclude for e.g. the following folder.
Can we have a recursive rule which would plainly eliminate all the example/test/docs folders, given the path to the root folder?
For me, the folder is actually empty:
That's also what I'd expect from the wildcard !extensibility/node/node_modules/**/examples/**/* (notice the node_modules/**/ part)
Hmm. That's interesting. Let me check and get back to you on this.
@MarcelGerber Yes! You are right. I see the files getting deleted but empty folders still being present. Is there a way we can get rid of the empty folders too?
@MarcelGerber I was not able to find documentation on how to tell grunt-contrib-copy to delete empty folders which became empty because of the exclusions. So have added one more task to Grunt(grunt-cleanempty)- . Checkout this commit. 1889c94. This would clean all the empty directories that got created in the copy phase because of file exclusions. After running the task this is the result
Running "cleanempty:src" (cleanempty) task
>> 1553 paths cleaned.
CC @ingorichter : Ingo do these changes sound good to you?
@nethip I merged the commit you mentioned (thanks!).
Please let me know when you'd like to merge so I can rebase.
Thanks @MarcelGerber I would like to hear from ingo. @ingorichter could you have a look at this.
@MarcelGerber Go ahead and push your changes to your fork. I will go ahead with the merge.
Exclude more unneeded files in dist builds
Ha, you commented the perfect time so I could quickly rebase it ;)
Just rebased, everything ready for a merge,
Thanks @MarcelGerber . Do you want to merge src/config.json as well?
Yeah, our grunt task automatically sync it with package.json every time you run grunt.
Looking good. Merged this.. Thanks @MarcelGerber !