luckyframework / luckyframework/lucky_cli

System check script issues on Windows

Open
#910 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Windows
Dominant language
HTML
Stars
92
Forks
48
PR merge metrics
No merged PRs in 30d

Description

In a generated app, you get a script/system_check.cr which helps to ensure your app is setup and bootstrapped properly in development before booting. (e.g. if you need yarn to run your app, then ensure yarn is installed before trying to boot the app).

However, speaking of yarn, there's an issue on Windows.

The system_check runs this

https://github.com/luckyframework/lucky_cli/blob/0d67c0a444ea1838a88927e9bcb27c00a6f6d478/src/web_app_skeleton/script/system_check.cr.ecr#L14-L16

which checks for the existence of an executable yarn.

https://github.com/luckyframework/lucky_cli/blob/0d67c0a444ea1838a88927e9bcb27c00a6f6d478/src/web_app_skeleton/script/helpers/function_helpers.cr.ecr#L20-L22

This find_executable method will automatically append .exe to whatever command you pass in

https://github.com/crystal-lang/crystal/blob/bcff68af7e503648edcdfdea9ae6be1fa09b7c6b/src/process/executable_path.cr#L70-L79

This means it's actually looking for yarn.exe which doesn't exist. When you install node and yarn, yarn (as well as some other node related commands like pnpm, etc...) are just shell scripts. Even if yarn is installed properly, this will fail.

An alternate way to solve this could be to just run yarn -v and then check $?. That value seems to return 0 on Linux and True on Windows. I'd assume Process.run("yarn -v").normal_exit? would work, but it does feel a little hacky. I'm open to other ideas if anyone has any.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated script/system_check.cr and the helper in script/helpers/function_helpers.cr.ecr, especially the referenced executable check. Reproduce the system check on Windows with yarn installed and compare its behavior with the reported executable lookup. Done means a generated app recognizes an installed yarn and proceeds through the check.

Written by the indexing model from the issue text.

Assessment

Tech stack
crystal
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.