kenan-rhoton / card-game

An iteratively designed card game by the members of TrollPlayingGame Discord.
MIT License
0 stars 1 forks source link

Remove HUGE Dependencies #159

Open kenan-rhoton opened 5 years ago

kenan-rhoton commented 5 years ago

Description

Our dependencies are huge. Like REALLY big. For context we are over three times the size of Windows 95

To Reproduce

  1. Clean up the repository: git clean -fdX
  2. Check disk useage: du -hs . (8.6M on aws-lambda branch mostly due to .git history which we should clean up a bit maybe)
  3. Run lein uberjar in backend and yarn install in frontend
  4. Size is 31M after lein uberjar (still big) and 194M after yarn install
  5. Cry painfully

Expected behavior

Less than 30M for everything compiled and ready. For context this is more than the size of the entire 1911 26-volume Encyclopaedia Britanicca. I'm pretty sure we can use less code than that.

Additional context

For the backend over half of the size is accounted for by the taoensso.faraday library we're using to connect to DynamoDB (again in aws-lambda)

For the frontend, we only really want 3 things:

  1. Testing (maybe use klud.js? It's half a kilobyte... or maybe Canary or something)
  2. Run a server (maybe just base http with Rlite for the routing?)
  3. Compile pug to HTML (maybe just switch to tiny-mustache like normal people)

Microjs has a bunch of good stuff we can use.

Why does this matter?

Speed, cost of storage, speed, use of memory and speed.

Especially if we're going with an AWS pricing model were CPU and Memory Usage is the basis of our billing, so this is a way to save money. I rest my case.

Masclins commented 5 years ago

Maybe we could remove the npm packages for testing from what's uploaded to AWS...?

kenan-rhoton commented 5 years ago

That might be hard to do... I would like to consider more aggresive options once frontend is functioning. (Like straight up killing npm/yarn)

kenan-rhoton commented 5 years ago

My proposal for now:

  1. Switch the web server to express (very fast and powerful one, just 2MB)
  2. Switch the testing framework to klud (1KB and lightning fast)
  3. Don't yet know what to do with pug, css, sass, less or whatever
kenan-rhoton commented 5 years ago

Oh actually, if we can move away from .pug (cringe, I know) to use mustache instead, there is a tiny implementation in 0.4KB or a full implementation in 2.2KB

And I really doubt we need to do any css treating with sass, or whatever, we can just use the standard css...

pernilsalat commented 5 years ago

well, with sass we can have styles function (not styles repetition code) and some logic (loops, etc), so i thinks it is really useful and will give us a lot of freedom

kenan-rhoton commented 5 years ago

Ok, seems reasonable!