karakeep-app / karakeep-app/karakeep
Be able to remove node_modules after building the app
- Dominant language
- TypeScript
- Stars
- 29.1k
- Forks
- 1.5k
- Avg merge
- 3d 11h
- Merged PRs (30d)
- 5
Description
Hello all!
This app [has been packaged](https://github.com/YunoHost-Apps/karakeep_ynh) for [YunoHost](https://yunohost.org/).
YunoHost doesn’t use docker. So we have to build the package from source.
The installation goes well, but the result is quite heavy:
```
du -h --max-depth=1 /var/www/karakeep | sort -h
32K /var/www/karakeep/.config
36K /var/www/karakeep/.cache
76K /var/www/karakeep/.pki
556K /var/www/karakeep/db
13M /var/www/karakeep/packages
370M /var/www/karakeep/apps
1.8G /var/www/karakeep/node_modules
2.2G /var/www/karakeep
```
As we are building the app, I thought we could remove the `node_modules`. In fact, the karakeep service keeps working, which is great. But the workers service fails as it rely on the `node_modules` (module not found error).
The workers directory was built like this ([as suggested by the Dockerfile](https://github.com/karakeep-app/karakeep/blob/main/docker/Dockerfile#L30)):
```
pushd "$install_dir/apps/workers"
pnpm build
pnpm deploy --node-linker=isolated --filter @karakeep/workers --prod $install_dir/apps/prod/workers
popd
```
If I try to run the service either from `/apps/workers/dist/index.js` or `/apps/prod/workers/dist/index.js`, the service will fail if I removed the main `node_modules` directory.
Would it be possible to make the workers service independent from the main `node_modules` (as it is already possible with the web service) so we can remove it and reduce by 6x the final install size?
Thanks :D
Contributor guide
Assessment
This issue has not been assessed yet.