Skip to content
This repository was archived by the owner on Apr 1, 2020. It is now read-only.

Reduce app folder size. #2392

Merged
merged 4 commits into from
Jul 4, 2018
Merged

Conversation

CrossR
Copy link
Member

@CrossR CrossR commented Jul 3, 2018

Currently, we are packing some folders that I don't think we need to into the final installers.

This includes ui-tests, the main src folder, .github folder, but the worst offender is the .oni_build_cache folder. On my machine with just ripgrep in it, its 2MB, but I think on Mac where nvim is also cached, it could be almost 50MB, which is a big chunk of the total size of that folder. I'm basing that on the fact nvim for Windows is about 45MB.

Assuming this doesn't break everything, is there anything else we can remove? The README.md etc is also included and so forth...is it worth swapping from an "Everything but ..." to specifying the individual folders we need? We currently include the .map files, which I'm not sure how much value they add.

Setting up this PR to test the CI builds, since that cache is only added for them. Its potentially also worth us adding some size constraints? Or maybe warnings if the installer size deviates from some set value?

@codecov
Copy link

codecov bot commented Jul 3, 2018

Codecov Report

Merging #2392 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #2392   +/-   ##
======================================
  Coverage    38.2%   38.2%           
======================================
  Files         300     300           
  Lines       12518   12518           
  Branches     1649    1649           
======================================
  Hits         4782    4782           
  Misses       7481    7481           
  Partials      255     255

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d0e8898...65a6f6e. Read the comment docs.

@bryphe
Copy link
Member

bryphe commented Jul 3, 2018

Great catch @CrossR ! Thanks for cleaning this up 😄

but the worst offender is the .oni_build_cache folder. On my machine with just ripgrep in it, its 2MB, but I think on Mac where nvim is also cached, it could be almost 50MB, which is a big chunk of the total size of that folder. I'm basing that on the fact nvim for Windows is about 45MB.

Wow, that's massive - really glad you caught that! 💯 I noticed the Mac dmg was significantly larger than the other platforms last release... this explains it.

The README.md etc is also included and so forth...is it worth swapping from an "Everything but ..." to specifying the individual folders we need? We currently include the .map files, which I'm not sure how much value they add.

I like this idea - it's definitely the right strategy - the 'everything but...' strategy is clunky and unreliable (and makes it easy for some of these issues to sneak in!).

We shouldn't need the .map files for release - they're only used for debugging. The only challenge I see with the 'whitelist' is specifying the set of node_modules we need - but I think we can just use the dependencies in our package.json. Would be awesome to switch over to explicitly specifying what we pack for our release packages.

Setting up this PR to test the CI builds, since that cache is only added for them. Its potentially also worth us adding some size constraints? Or maybe warnings if the installer size deviates from some set value?

That's a great idea! I like the idea of having a test that validates that the installer isn't greater than a certain size - it builds up our safety net to keeps issues like this from popping in later, unexpectedly.

@CrossR
Copy link
Member Author

CrossR commented Jul 3, 2018

I like this idea - it's definitely the right strategy - the 'everything but...' strategy is clunky and unreliable (and makes it easy for some of these issues to sneak in!).

We shouldn't need the .map files for release - they're only used for debugging. The only challenge I see with the 'whitelist' is specifying the set of node_modules we need - but I think we can just use the dependencies in our package.json. Would be awesome to switch over to explicitly specifying what we pack for our release packages.

I've added this now, and it looks like just by specifying "node_modules" it has included the correct modules. I've not checked it exactly yet, but at least the modules haven't changed at all. Hasn't changed the size too much (5~MB) on my end, but does help overall, and stops issues coming up again when we add new folders.

I think I've included only what is needed, but I'd appreciate if someone else could take a quick look over it/look at your install folder and see if what I've included/excluded looks reasonable.

@@ -20,7 +20,7 @@ const packageJsonContents = fs.readFileSync(path.join(__dirname, "..", "package.
const packageMeta = JSON.parse(packageJsonContents)
const { version, name } = packageMeta
const prodName = packageMeta.build.productName
const pathVariable = "{app}\\resources\\app\\cli\\windows\\"
const pathVariable = "{app}\\resources\\app\\cli\\win\\"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I swapped this to take advantage of the ${os} variable in electron_builder, such that we only include the CLI script for the needed platform.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@bryphe
Copy link
Member

bryphe commented Jul 4, 2018

Just checked it out on Mac, @CrossR - looks great! Thank you very much for your work on this 👍

I like that we have the whitelist/include strategy now - that make something like #350 easier, as we can build the asar ourselves and whitelist it in without worrying about double-packing it.

@CrossR CrossR merged commit d218301 into onivim:master Jul 4, 2018
@CrossR CrossR deleted the CrossR/RemoveBuildFolders branch July 4, 2018 11:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants