stimulusreflex / stimulus_reflex

Build reactive applications with the Rails tooling you already know and love.
https://docs.stimulusreflex.com
MIT License
2.28k stars 172 forks source link

Sanity checker will fail if node_modules folder isn't present #402

Closed joshleblanc closed 3 years ago

joshleblanc commented 3 years ago

Bug Report

Describe the bug

The sanity checker relies on node_modules to verify that the stimulus_reflex npm package is installed. The node_modules folder isn't guaranteed to exist in production, because a user could pre-compile their frontend assets to public/ and never push the node_modules folder to the server (Or run yarn install on the server at all).

To Reproduce

Run assets:precompile, delete the node_modules folder, and then run rails in production mode.

Expected behavior

I would expect the sanity checker to either check the package.json, package-lock.json, or yarn.lock to determine the stimulus_reflex version, rather than checking the node_modules folder.

Screenshots or reproduction

The actual code in question is here: https://github.com/hopsoft/stimulus_reflex/blob/ede440ca931943914108f217c54b7eb300c4ab35/lib/stimulus_reflex/sanity_checker.rb#L97

Versions

StimulusReflex

External tools

hopsoft commented 3 years ago

Did #401 resolve this @leastbad ?

leastbad commented 3 years ago

No, unfortunately. @RolandStuder is going to try and do a PR to add a case where there is no node_modules folder in the production environment tomorrow. It's something to do with when/where precompilation occurs.

The code to look into yarn.lock is in the git history already, we just have to dust it off and add it as an edge case.

RolandStuder commented 3 years ago

@joshleblanc I think #403 should fix this, would be great if you could check it.