Add scripts/validate-structure.js validation script#3
Conversation
scripts/validate-structure.js validation script
3028209 to
ca12350
Compare
ca12350 to
f1572ca
Compare
benjie
left a comment
There was a problem hiding this comment.
Looking good; I think we should replace the find usage but other than that good to merge I think!
package.json
Outdated
| "test:format": "prettier --check . || npm run suggest:format", | ||
| "test:spelling": "cspell \"spec/**/*.md\" README.md LICENSE.md" | ||
| "test:spelling": "cspell \"spec/**/*.md\" README.md LICENSE.md", | ||
| "test:structure": "find . -type d -name 'GAP-*' -exec ./scripts/validate-structure.js {} \\;" |
There was a problem hiding this comment.
Not ideal; this would find GAP-* (unlikely currently) folders inside node_modules for example. Maybe just incorporate the finding into the validate-structure.js script? Note glob is built in to Node.js now:
https://nodejs.org/api/fs.html#fspromisesglobpattern-options
There was a problem hiding this comment.
Alterantively, could add -depth 1 to guard against nested GAP- directories (I had that originally but removed for some dumb reason)
I did it his way b/c i like the idea of the script not having the responsibility of also discovering which folders to run on, because it means we can throw a test directory at it and easily add a test suite without code changes. Then again, maybe yagni.
wdyt? happy to just go ahead and make the script use glob and discover dirs itself to keep it all self contained, I don't feel too strongly either way here.
There was a problem hiding this comment.
made the alt version here using glob #5 -- otherwise identical logic -- approve / merge whichever pr sparks more joy :)
(rip no stacked prs yet, and I didn't want to PR against my own fork)
The find command now uses -maxdepth 1 to restrict the search to the top-level directory only, preventing unintended matches in subdirectories like node_modules. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
852bbb9 to
3d5499c
Compare
benjie
left a comment
There was a problem hiding this comment.
We can optimize the tooling later!
e.g.
I didn't add a test for this - i'm happy to follow up and do so if anyone thinks it's valuable enough.