summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorDan Duvall <dduvall@wikimedia.org>2017-09-06 11:58:42 -0700
committerDan Duvall <dduvall@wikimedia.org>2017-09-07 10:07:51 -0700
commitb25e7c6b661cf614502289922671c18d70864c6e (patch)
tree0110b8a6d3516a243d6a561ab553365c8fa9e081 /config
parent62066296380d19dc77ab216cb27100e7e72ff69f (diff)
downloadblubber-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
Diffstat (limited to 'config')
-rw-r--r--config/node.go3
-rw-r--r--config/node_test.go3
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),