Skip non-directory entries when scanning the components directory - #81
Open
alistairfairweather wants to merge 1 commit into
Conversation
deploy and compileComponents both iterate fs.readdirSync(componentsDir) and immediately treat every entry as a component folder, reading <entry>/<entry>.js and <entry>/<entry>.json. A stray file directly in components/ (most commonly macOS's .DS_Store) breaks this: deploy hits ENOTDIR trying to open .DS_Store/.DS_Store.js as a path, and compileComponents fails the same way, crashing on every deploy for anyone on macOS who hasn't remembered to .gitignore it. Skip any entry that isn't a directory before treating it as a component. Adds a regression test covering this in tests/deploy.test.js. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
deployandcompileComponentsboth iteratefs.readdirSync(componentsDir)and immediately treat every entry as a component folder, reading<entry>/<entry>.jsand<entry>/<entry>.json. A stray file directly incomponents/breaks this — most commonly macOS's.DS_Store, which everyraisely deployrun on a Mac is liable to hit unless you remember to.gitignoreit (and even then, it can reappear locally between deploys via Finder).raisely deploythrowsENOTDIRtrying to open.DS_Store/.DS_Store.jscompileComponents(used byraisely start/local) fails the same wayBoth crash the whole command rather than just skipping the stray file.
Fix
Skip any entry that isn't a directory before treating it as a component, in both
src/deploy.jsandsrc/actions/components.js.Test plan
tests/deploy.test.jscovering a.DS_Store-style entry alongside a real componentENOTDIR/JSON parse error depending on mock vs real fs) and passes with itnpm test→ 85/85🤖 Generated with Claude Code
Note
Low Risk
Small filesystem guard around existing scan loops; deploy preflight already filtered directories via
getComponentNames.Overview
Deploy and local component compilation no longer treat every name under
components/as a component folder. Both loops now callfs.statSyncand continue when the entry is not a directory, so stray files like macOS.DS_Storeare ignored instead of causingENOTDIRor bad reads offile/file.js.A deploy regression test simulates
.DS_Storenext to a realherocomponent and asserts only the real component is uploaded.Reviewed by Cursor Bugbot for commit 0161b7d. Bugbot is set up for automated code reviews on this repo. Configure here.