Closed paluh closed 2 years ago
Uh! Everyday I learn something new about bash. Yes, that would make a lot of sense!
Uh! Everyday I learn something new about bash.
Yeah. In my case it is more like "#!/bashing head against the wall" than learning ;-)
I was thinking a bit about my PR and I want to discuss different approach.
npmCommands :: [ String ]
is possible cause of problems:
#
and our error handling won't be appliedI propose to turn this into npmCommands :: String
.
I think that we can provide patchNodeModulesSheeBang
(with better naming of course ;-)) and document this simple helper.
We can apply patchNodeModuleSheeBang
after npmCommands
by default or just inform that default npmCommands = "npm install && patchNodeModuleSheeBang"
We can preserve logging behavior by turning set -x
and set +x
before and after npmCommands
.
What do you think?
This was fixed https://github.com/nix-community/napalm/pull/38, the npmCommands
can be either string or list of string (which will be joined by newlines) and interpolated directly into the buildPhase
.
Thanks a lot for building this tool!
I've encountered some problems during my project packaging - simple patching command like
sed
failed when it was included in thenpmCommand
. It seems that the problem is related to the fact that currently commands are passed and used as shell variables by napalm. The simplest example of a similar failing flow could be:The above fails with
sed: -e expression #1, char 1: unknown command: `"'
even thoughsed
command is correct by itself (and can be run direcc I'm not sure but probably arguments are passed altogether with quotes into thesed
program when we execute it by variable expansion.This simple change is enough to fix the problem by avoiding variable usage during
npmCommand
execution.Do you think that my approach is correct and I can provide a PR with this change?