Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix remove ignored files from import #783

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

JeremyFabrikapp
Copy link

Hey !
During import from local folder, the script load all files including node_modules, env (stored in cookies) and .gitignored files.
As import MAX_FILES is 1000 it may quickly get stuck.

I've made a quick fix to avoid this, that would allow to upload folder more efficiently, by removing npm/git/ignored files from import.

JeremyFabrikapp and others added 3 commits December 16, 2024 23:35
- Added functionality to read and process .gitignore files from selected folders.
- Implemented logic to filter out files based on patterns defined in .gitignore.
- Improved file selection by ignoring specified directories and files during import.
@thecodacus
Copy link
Collaborator

this is nice but why not use the ignore library to ignore the paths that match the pattern, I am not confident on the glob to regex conversion. I recommend using https://www.npmjs.com/package/ignore

@aliasfoxkde
Copy link
Collaborator

aliasfoxkde commented Dec 21, 2024

My suggestion would be to maintain your project on GitHub and just pull in the repo with the latest changes. That way best practice is to use .gitignore (by default) and that would resolve this issue. I think the idea behind importing a folder is for prototyping something really quick, not uploading Gigs of data to the Web Container. And while it's not a horrible idea (maybe make bolt use the same .gitignore file when importing), I'm not sure we can support this. I think it's more or a procedure and maybe provide a warning, than really a thing to fix in code. Just my two cents. Thanks

@wonderwhy-er
Copy link
Collaborator

Ignore is already used here

return !ig.ignores(path);

Its imported into
https://github.com/stackblitz-labs/bolt.diy/blob/main/app/components/chat/ImportFolderButton.tsx#L38

I remember testing that it was filtered out.
Need to retest.
But your regex code is not needed, as @aliasfoxkde said ignore library and existing code should be used.

@JeremyFabrikapp
Copy link
Author

JeremyFabrikapp commented Dec 23, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants