Conversation
src/lib/utils.ts
Outdated
|
|
||
| // Collect all .gitignore files sorted by depth (root first) and apply each one scoped to its directory | ||
| const gitignoreFiles = paths | ||
| .filter((p) => p === '.gitignore' || p.endsWith('/.gitignore')) |
There was a problem hiding this comment.
I wouldn't use / as a check because of Windows and \\ in paths (assuming the module returns the path like that
There was a problem hiding this comment.
should be safe with tinyglobby https://github.com/SuperchupuDev/tinyglobby/blob/main/CHANGELOG.md#021
src/lib/utils.ts
Outdated
| // Collect all .gitignore files sorted by depth (root first) and apply each one scoped to its directory | ||
| const gitignoreFiles = paths | ||
| .filter((p) => p === '.gitignore' || p.endsWith('/.gitignore')) | ||
| .sort((a, b) => a.split('/').length - b.split('/').length); |
src/lib/utils.ts
Outdated
| }); | ||
|
|
||
| // Collect all .gitignore files sorted by depth (root first) and apply each one scoped to its directory | ||
| const gitignoreFiles = paths |
There was a problem hiding this comment.
This won't find the git root and fetch all gitignores from the root down, so if I run it in a nested folder, it won't propagate right? idk if thats an ISSUE or not, but something to consider
There was a problem hiding this comment.
yep, experimenting with that now and it is so ugly I will go for the git ls-files approach from migration guide
…' into 1007-swap-globby-with-tinyglobby
| writeFileSync(joinPath(file), Math.random().toString(36).substring(7), { flag: 'w' }), | ||
| writeFileSync(joinPath(file), Math.random().toString(36).substring(7), { | ||
| flag: 'w', | ||
| }), |
There was a problem hiding this comment.
interesting, this diff should not be here 🤔
There was a problem hiding this comment.
Possibly just formatter being formatters, depends if you've setup biome as the preferred one!
There was a problem hiding this comment.
there is a hook for it, it should be always formatted the same way, no matter what I am using in editor (I use biome also in editor) 🤔
| } catch { | ||
| warning({ | ||
| message: | ||
| 'Unable to read .gitignore rules — git is not installed or the directory is not in a git repository.', |
There was a problem hiding this comment.
Like I said, I personally do not want .gitignore to be ignored (pun intended) when there is no git installed... @B4nan thoughts?
I understand it would be more of a pain (function to find git root -> glob from there for all .gitignore files -> throw em all in ignore)...
There was a problem hiding this comment.
then I would throw an error for user and force him to install git. Do you think there is many users in this situation? probably all gitcloned our template already 🤔
There was a problem hiding this comment.
Our templates are not git cloned but written on the FS from the archive we manually download 👀. We should support gitignore even without git installed imo
There was a problem hiding this comment.
what do you suggest? I personally believe more in ls-files than custom logic. Maybe we can use primary git and if not available then some custom solution? This traverse and inspect of file tree is not as straightforward as I thought.
Does it make sense to swap the globby for tinyglobby and introduce this gitignore problem? I just can't evaluate it with my current view into CLI. @B4nan
Replaces
globbywithtinyglobbyand theignorepackage. Sincetinyglobbylacks built-in gitignore support,.gitignoreprocessing is now handled manually -- reading all.gitignorefiles sorted by depth and applying each one scoped to its directory.Scope of Changes
globby; addedtinyglobbyandignoregetActorLocalFilePathswith manual.gitignoreprocessingcheckIfStorageIsEmptyto useglobfromtinyglobby.gitignorescopingBehavior Changes
None expected. The public API is unchanged; only the internal gitignore mechanism differs.
Risks & Considerations
tinyglobbyandglobbyin edge cases (symlinks, brace expansion) are possible but unlikely to surface in practice.Testing
Added tests covering: no
.gitignore, various patterns (wildcards, negation, comments, empty), and nested.gitignorescoping across directories.Closes #1007