-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Better Win support: correct resolving of node/npm/npx & prisma, no ANSI codes on Win #3258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
prismaExecutableAbs = | ||
waspProjectDir | ||
</> nodeModulesDirInWaspProjectDir | ||
</> SP.castRel (getPathToExecutableInNodeModules "prisma") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are now being system-agnostic here, when figuring out abs path to prisma binary.
{-# NOINLINE nodeExec #-} | ||
nodeExec :: ExecName | ||
nodeExec = | ||
-- NOTE: We are taking whole resolved absolute path here because just using the resolved exec name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This I am not super happy with.
So basically just resolving npm
to npm.cmd
was not enough, we were still getting errors on Windows. Not the same ones, we moved forward, but different kind, I wish I wrote them down, something about not being able to find some .js files in node_modules.
But maybe it is for the best to have absolute paths to executables we use? Not 100% sure, I think if npm.cmd
was working I woudl have stuck with it.
Interested in discussion here. Maybe I should try I again and write down the errors, that might help us make a decision.
nodeExec = | ||
-- NOTE: We are taking whole resolved absolute path here because just using the resolved exec name | ||
-- was still flaky on Windows in some situations. | ||
fromAbsFile $ snd $ unsafePerformIO $ resolveExecNameIO "node" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of doing unsaferPerformIO, we could have actually obtained these in real IO, somweher at the start of our app, and then propagated them through the code, likely via our monad stack.
While that would be the "best" way to do it, I didn't think it makes much sense to bother with such big refactoring at the moment, for no real gain. We can do it if it turns out it is needed.
TODO: