diff options
author | Dan Duvall <dduvall@wikimedia.org> | 2017-09-06 11:58:42 -0700 |
---|---|---|
committer | Dan Duvall <dduvall@wikimedia.org> | 2017-09-07 10:07:51 -0700 |
commit | b25e7c6b661cf614502289922671c18d70864c6e (patch) | |
tree | 0110b8a6d3516a243d6a561ab553365c8fa9e081 | |
parent | 62066296380d19dc77ab216cb27100e7e72ff69f (diff) | |
download | blubber-b25e7c6b661cf614502289922671c18d70864c6e.tar.gz |
Add shared lib node module bins to PATH
Summary:
For `npm run` to find executables provided by external dependencies, the
`$NODE_PATH/.bin` directory must be present in `PATH`.
Depends on D769
Test Plan:
Run `go test ./...`.
Build and run Mathoid's test variant at:
https://gerrit.wikimedia.org/r/#/c/376319/2
Reviewers: thcipriani, mobrovac, hashar, mmodell, #release-engineering-team
Reviewed By: thcipriani, mobrovac, mmodell, #release-engineering-team
Tags: #release-engineering-team
Differential Revision: https://phabricator.wikimedia.org/D770
-rw-r--r-- | config/node.go | 3 | ||||
-rw-r--r-- | config/node_test.go | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/config/node.go b/config/node.go index 5693711..e5cf763 100644 --- a/config/node.go +++ b/config/node.go @@ -40,10 +40,11 @@ func (nc NodeConfig) InstructionsForPhase(phase build.Phase) []build.Instruction } } case build.PhasePostInstall: - if nc.Env != "" { + if nc.Env != "" || nc.Dependencies.True { return []build.Instruction{build.Env{map[string]string{ "NODE_ENV": nc.Env, "NODE_PATH": path.Join(LocalLibPrefix, "node_modules"), + "PATH": path.Join(LocalLibPrefix, "node_modules", ".bin") + ":${PATH}", }}} } } diff --git a/config/node_test.go b/config/node_test.go index 7ce66fc..13949de 100644 --- a/config/node_test.go +++ b/config/node_test.go @@ -81,6 +81,7 @@ func TestNodeConfigInstructionsNonProduction(t *testing.T) { build.Env{map[string]string{ "NODE_ENV": "foo", "NODE_PATH": "/opt/lib/node_modules", + "PATH": "/opt/lib/node_modules/.bin:${PATH}", }}, }, cfg.InstructionsForPhase(build.PhasePostInstall), @@ -119,6 +120,7 @@ func TestNodeConfigInstructionsProduction(t *testing.T) { build.Env{map[string]string{ "NODE_ENV": "production", "NODE_PATH": "/opt/lib/node_modules", + "PATH": "/opt/lib/node_modules/.bin:${PATH}", }}, }, cfg.InstructionsForPhase(build.PhasePostInstall), @@ -147,6 +149,7 @@ func TestNodeConfigInstructionsEnvironmentOnly(t *testing.T) { build.Env{map[string]string{ "NODE_ENV": "production", "NODE_PATH": "/opt/lib/node_modules", + "PATH": "/opt/lib/node_modules/.bin:${PATH}", }}, }, cfg.InstructionsForPhase(build.PhasePostInstall), |