-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostCreate.sh
More file actions
executable file
·53 lines (45 loc) · 1.62 KB
/
postCreate.sh
File metadata and controls
executable file
·53 lines (45 loc) · 1.62 KB
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
47
48
49
50
51
52
53
#!/usr/bin/env bash
# postCreateCommand body
set -euo pipefail
# Tools pinned by mise.toml / .tool-versions at the repo root.
mise trust -y
mise install -y
if [ ! -f package.json ]; then
echo "mise-bootstrap: no package.json — done."
exit 0
fi
detect_pm() {
[ -f pnpm-lock.yaml ] && { echo pnpm; return; }
[ -f bun.lock ] && { echo bun; return; }
[ -f bun.lockb ] && { echo bun; return; }
[ -f yarn.lock ] && { echo yarn; return; }
[ -f package-lock.json ] && { echo npm; return; }
[ -f npm-shrinkwrap.json ] && { echo npm; return; }
echo npm
}
PM="$(detect_pm)"
echo "mise-bootstrap: package manager: ${PM}"
case "${PM}" in
pnpm)
# Project-local pnpm store inside node_modules so named-volume mounts
# of node_modules don't lose the cache.
mise exec -- pnpm config set store-dir "$(pwd)/node_modules/.pnpm-store"
# PNPM_HOME holds globally-installed pnpm bins; ensure it's on PATH.
export PNPM_HOME="$HOME/.local/share/pnpm"
export PATH="$PNPM_HOME:$PATH"
mkdir -p "$PNPM_HOME"
# node-gyp globally so native deps (e.g. sqlite) can build
# against newer Node releases that ship without prebuilt binaries.
mise exec -- pnpm add -g node-gyp
mise exec -- pnpm install --config.confirm-modules-purge=false
;;
bun) mise exec -- bun install ;;
yarn) mise exec -- yarn install ;;
npm)
if [ -f package-lock.json ] || [ -f npm-shrinkwrap.json ]; then
mise exec -- npm ci
else
mise exec -- npm install
fi
;;
esac