stefanrmmr / streamlit-audio-recorder

Record Audio from the User's Microphone in Apps that are Deployed to the Web. (via Browser Media-API, REACT-based, Streamlit Custom Component)
MIT License
415 stars 75 forks source link

repo is too large #4

Closed Jackiexiao closed 1 year ago

Jackiexiao commented 2 years ago

it would be great to decrease repo size

du -ah -d 1

477M    ./streamlit_audio_recorder
(base) ➜  github git clone https://github.com/stefanrmmr/streamlit_audio_recorder
Cloning into 'streamlit_audio_recorder'...
remote: Enumerating objects: 36808, done.
remote: Counting objects: 100% (234/234), done.
remote: Compressing objects: 100% (179/179), done.
remote: Total 36808 (delta 92), reused 173 (delta 49), pack-reused 36574
Receiving objects: 100% (36808/36808), 55.23 MiB | 7.80 MiB/s, done.
Resolving deltas: 100% (8315/8315), done.
Updating files: 100% (40542/40542), done.
stefanrmmr commented 2 years ago

Hi @Jackiexiao, thanks for the reminder! I removed unused npm packages, reducing the repo size by around 70 Mb. Do you have any additional suggestions on how to decrease the storage footprint of the component?

Jackiexiao commented 2 years ago

sorry, I'm not familiar with js/ts, but it seems node_modules is still very large

(base) ➜  node_modules git:(main) du -ah -d 1 | grep M
4.3M    ./@typescript-eslint
1.5M    ./react-dev-utils
2.3M    ./es5-ext
5.0M    ./webpack
1.8M    ./node-forge
5.5M    ./eslint
2.3M    ./css-tree
2.1M    ./regenerate-unicode-properties
1.2M    ./csstype
8.2M    ./apache-arrow
12M     ./@babel
12M     ./.cache
18M     ./rxjs
3.6M    ./csso
1.6M    ./node-notifier
2.7M    ./terser
1.4M    ./eslint-plugin-import
3.1M    ./expect
5.0M    ./lodash
4.9M    ./es-abstract
1.1M    ./esquery
1.2M    ./acorn
1.4M    ./terser-webpack-plugin
1.6M    ./clean-css
1.5M    ./@webassemblyjs
3.0M    ./react-dom
3.8M    ./@jest
5.1M    ./jest-environment-jsdom-fourteen
2.4M    ./resolve-url-loader
51M     ./typescript
1.7M    ./eslint-plugin-react
5.1M    ./jsdom
13M     ./core-js-pure
1.2M    ./eslint-plugin-jsx-a11y
1.2M    ./sockjs-client
1.2M    ./ajv
1.1M    ./jest-haste-map
1.9M    ./@types
8.8M    ./babel-runtime
1.3M    ./acorn-globals
2.6M    ./webpack-dev-server
1.1M    ./jest-util
1.5M    ./postcss
3.3M    ./caniuse-lite
13M     ./core-js
329M    .
Pol-Zeimet commented 1 year ago

I would recommend to either not include the node_modules in the repo or make a second repository containing only the build frontend for use as a component. Because as an end user of the component, most of the repository is bloat at this point. It might be useful to include this in your documentation aswell, since any user of the component can safely delete anything outside the build folder itself.

As a contributer on the other hand, the node_modules folder is only really necessary if:

You shouldn't really need to include the node_modules folder if:

As a contributer you will need to install npm anyways, so the package.json should be sufficient.

stefanrmmr commented 1 year ago

@Pol-Zeimet @Jackiexiao Hi everyone, thanks a lot for your advice!

I have good news 🎉, the repo size has been reduced from 393Mb down to 70Mb by removing all these node-modules, which are not required to use the streamlit component. Just in case, I have decided to keep the node modules on a local dev branch for future development.(sry that this took so long, I was busy studying for CS exams)