Skip to content

Skip non-directory entries when scanning the components directory - #81

Open
alistairfairweather wants to merge 1 commit into
raisely:masterfrom
alistairfairweather:fix/ignore-non-directory-entries-in-components-dir
Open

Skip non-directory entries when scanning the components directory#81
alistairfairweather wants to merge 1 commit into
raisely:masterfrom
alistairfairweather:fix/ignore-non-directory-entries-in-components-dir

Conversation

@alistairfairweather

@alistairfairweather alistairfairweather commented Aug 5, 2026

Copy link
Copy Markdown

Summary

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/ breaks this — most commonly macOS's .DS_Store, which every raisely deploy run on a Mac is liable to hit unless you remember to .gitignore it (and even then, it can reappear locally between deploys via Finder).

  • raisely deploy throws ENOTDIR trying to open .DS_Store/.DS_Store.js
  • compileComponents (used by raisely start/local) fails the same way

Both 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.js and src/actions/components.js.

Test plan

  • Added a regression test in tests/deploy.test.js covering a .DS_Store-style entry alongside a real component
  • Confirmed the new test fails without the fix (ENOTDIR/JSON parse error depending on mock vs real fs) and passes with it
  • Full suite passes: npm 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 call fs.statSync and continue when the entry is not a directory, so stray files like macOS .DS_Store are ignored instead of causing ENOTDIR or bad reads of file/file.js.

A deploy regression test simulates .DS_Store next to a real hero component 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.

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]>
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.

1 participant