Add NPM clean script to restore project & remove sizeable pkg deps#213
Add NPM clean script to restore project & remove sizeable pkg deps#213jgaehring wants to merge 2 commits intofarmOS:mainfrom
Conversation
Cleans up environment, restoring it to more or less the same state as a fresh git clone before running `npm install` and `npm run build`. This applies to the examples, too, which can be 2+GB in total since they include Puppeteer, which in turn includes separate versions of Chromium.
|
Looks reasonable. I guess the next step is to check if the examples that are failing were already failing without your changes. We don't have a workflow to check them here on GitHub so it's possible they were actually broken by a previous change and we didn't notice... The other thing of interest with this change is that I believe the new |
Yea I wondered that too but had to putit down at that point. Seems unlikely my changes would effect that, unless it was that first commit of updates (via npm audit fix), which could be omitted.
This is correct, which is fine imo, can't expect any script to run before deps are installed, but probably could be better named, "clean" usually just means remove build artifacts, so maybe "uninstall-all-deps" or something of that effect. Or something more targeted on the example pkgs since the big chromium binaries all live in their node_modules. |
Oh and I guess that could correspond with the "install-all" script: https://github.com/farmOS/farmOS-map/blob/main/examples%2Fpackage.json#L22-L26 |
This cleans up the environment, targeting
dist/andnode_modulesdirectories in particular and restoring the project to more or less the same state as a fresh git clone (i.e., after runninggit clone <url>but before runningnpm installornpm run build. This applies to theexamples/subdirs, too, which can be 2+GB in total since they include Puppeteer, which in turn includes separate versions of Chromium.I just happened to catch this today b/c I was clearing space on my hard drive and realized my local version of this repo was using up 2.5GB all on its own. After running the clean script it went down to 17.4MB.
I've also installed rimraf ("
rm -rffor node in a cross-platform implementation") and updated all the other NPM deps.I just ran the tests, however, for the example projects, which appear to be failing. So with that in mind, I'm opening this as a draft for now, since I don't have time to test more thoroughly, will update if I get more time to come back to this....