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

@leex279 leex279 self-requested a review January 18, 2025 23:32
@clintebbesen
Copy link

I also came across this issue. Tried to import a project that has about 5 files containing code, but got blocked as the total files was over 3000 in the node_modules directory

@leex279
Copy link
Collaborator

leex279 commented Jan 23, 2025

@clintebbesen can you provide this project? I just tried with my task-list-advanced project which as over 12000 files with node_modules and it importet without problems (newest version of bolt)

image

@clintebbesen
Copy link

I tried to import it again now and it's giving the same message for me, but a lot worse now haha, over 40,000 files. 40,909 files in node_modules.
image
image

@leex279
Copy link
Collaborator

leex279 commented Jan 24, 2025

@clintebbesen just to be sure. you are on the latest release 0.0.6 Version? And you are on a Mac?

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.

6 participants