Repository navigation
refactor(cli): find .sql files with node's own glob - #48
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Important
I compared Node's fs.glob with tinyglobby@0.2.17 on Node 24.21, using the CLI's own patterns. It finds the same files for the default globs, .server, dot directories, ./ and ../ patterns, and a bare-directory exclude. It also differs in two ways the description doesn't mention: it yields directories, and it drops tinyglobby's directory expansion and negation for cli.include. Both are inline.
Reviewed changes
Reviewed the swap from tinyglobby to node:fs/promises glob in reylo generate's file discovery.
sqlFileson Node's glob:src/cli.tsnow calls Node'sglobwithexcludeand resolves each relative result againstdir. A new comment notes the symlink and case behavior.- No runtime dependencies: the
dependenciesblock inpackage.jsonis gone. The rootpnpm-lock.yamlno longer liststinyglobby,fdirorpicomatch.
claude-opus-5-5 | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed 5e9d9a2, which fixes both concerns from the previous review. I ran the new sqlFiles on Node 24.21 against a fixture: it gives the expected files for the default globs, .server, a directory named x.sql, ["src/"], ["src", "!src/legacy"], a literal file include, a bare-directory exclude and ./ patterns. Files matched by both **/*.sql and its expanded **/*.sql/** come back only once.
- Directories dropped:
globnow runs withwithFileTypes, skips directories and resolves each file againstparentPath, so a directory namedx.sqlis searched instead of passed toreadFileSync. - Old
cli.includemeaning kept: a pattern that doesn't end in*also matches<pattern>/**, and an include starting with!(but not!() moves toexclude, as withtinyglobby. - Regression test:
tests/cli.test.tscovers thex.sqldirectory, a bare-directory include and a negated include.
claude-opus-5-5 | 𝕏

reylo generatefound a project's.sqlfiles withtinyglobby, the package's only runtime dependency. Reylo requires Node 24, whosefs/promiseshas a stableglobwith pattern arrays andexcludeglobs, so the CLI now uses that andreylohas no dependencies.Checked against
tinyglobbywith the CLI's own patterns on Node 24 and 26: the same files on a fixture coveringnode_modules, build output, dot directories,.serverdirectories andcli.include/cli.exclude(including../patterns and an exclude without/**), and the same 2,327.sqlfiles on this repository's checkout, withtarget/and everynode_modulespruned.One difference: Node's glob does not descend into a symlinked directory, where
tinyglobbydid, so a query reached only through one is no longer found byreylo generatewith no paths; naming it still works. Matching is case-insensitive on macOS and Windows, which the existing.sqlextension check already covers.