forked from chutney-testing/chutney-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.envrc
46 lines (31 loc) · 1.79 KB
/
.envrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Setup a working environment without hassle using nix and direnv
# For more information, visit https://direnv.net/
# Install node, npm and geckodriver by loading .env.nix expression
use_nix .env.nix
# Run npm install if needed
[[ ! -d ./ui/node_modules ]] && echo "node_modules not found. Starting npm install" && cd ui && npm install && cd ..
## Integration with external tools ##
# Some tools (ex. Intellij) might need to configure paths to node, npm etc.
# You can use following symlinks provided in .env folder
## Create .env folder
[[ ! -d .env ]] && mkdir .env && echo "Create .env folder"
## Symlink npm home
ln -sfn $(dirname "$(dirname "$(readlink -f $(which npm))")") .env/npm_home && echo "Symlink npm home dir"
## Symlink JDK
ln -sfn $JAVA_HOME .env/jdk && echo "Symlink jdk \"$JAVA_HOME\""
## Mimicking frontend-maven-plugin ##
# ui module relies on nodejs and npm
# Integration with maven is provided by the maven plugin "frontend-maven-plugin"
# This plugin installs nodejs and npm into a local directory ui/node
# But these binaries cannot be used under a system manage with nix package manager
# So, we need to mimic the setup made by frontend-maven-plugin
## Create node folder
[[ ! -d ./ui/node ]] && mkdir ui/node && echo "Create node folder into ./ui"
## Symlink node
ln -sf $(readlink -f $(which node)) ./ui/node/node && echo "Symlink node \"$(readlink -f $(which node))\" onto ./ui/node/node"
## Symlink npm
ln -sf $(readlink -f $(which npm)) ./ui/node/npm && echo "Symlink npm \"$(readlink -f $(which npm))\" onto ./ui/node/npm"
## Symlink node_modules
[[ ! -L ./ui/node/node_modules ]] && ln -s $(readlink -f ./ui/node_modules) ./ui/node && echo "Symlink node_modules onto ./ui/node/node_modules"
## Update UI maven module
sed -i "s/<node.version>.*</<node.version>$(node -v)</" ui/pom.xml