-
Notifications
You must be signed in to change notification settings - Fork 1
/
.envrc
35 lines (25 loc) · 925 Bytes
/
.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
# hide warnings from direnv
# see https://github.com/direnv/direnv/issues/419#issuecomment-442005962
# see: https://direnv.net/man/direnv.toml.1.html#codewarntimeoutcode
export DIRENV_WARN_TIMEOUT=876000h # 100 years in hours
export NVM_DIR="$HOME/.nvm"
# Check if nvm is installed, install if not
if [ ! -d "$NVM_DIR" ] || [ ! -s "$NVM_DIR/nvm.sh" ]; then
echo "nvm is not installed. Installing nvm..."
# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
fi
# ensure nvm is in the path
export PATH="$NVM_DIR:$PATH"
# load nvm
\. $NVM_DIR/nvm.sh
# install node version from .nvmrc
nvm install
# enable pnpm in corepack
corepack enable pnpm
# install package manager with corepack (from package.json#packageManager)
corepack install
# install dependencies
pnpm install
pnpm_version=$(pnpm --version)
echo -e "\nEnvironment is ready.\nUsing pnpm version: $pnpm_version\n"