|
1 | 1 | #!/bin/bash |
2 | 2 | # |
3 | | -# mise version manager and Ruby setup. |
| 3 | +# mise version manager, Ruby, Node.js, and Yarn setup. |
4 | 4 | # Sourced by setup.sh — do not execute directly. |
5 | 5 | # Requires: lib/common.sh |
6 | 6 |
|
@@ -69,5 +69,43 @@ if mise which ruby > /dev/null 2>&1; then |
69 | 69 | else |
70 | 70 | fmt_install "Ruby (latest stable via mise)" |
71 | 71 | mise use --global ruby@latest |
72 | | - fmt_ok "Ruby installed: $(mise exec ruby -- ruby --version)" |
| 72 | + fmt_ok "Ruby installed: $(mise exec -- ruby --version)" |
| 73 | +fi |
| 74 | + |
| 75 | +# --------------------------------------------------------------------------- |
| 76 | +# Node.js (via mise — global default for running bin/setup scripts) |
| 77 | +# --------------------------------------------------------------------------- |
| 78 | + |
| 79 | +fmt_header "Node.js (via mise)" |
| 80 | + |
| 81 | +if mise which node > /dev/null 2>&1; then |
| 82 | + fmt_ok "Node.js already available via mise" |
| 83 | +else |
| 84 | + fmt_install "Node.js (latest LTS via mise)" |
| 85 | + mise use --global node@lts |
| 86 | + fmt_ok "Node.js installed: $(mise exec -- node --version)" |
| 87 | +fi |
| 88 | + |
| 89 | +# --------------------------------------------------------------------------- |
| 90 | +# Yarn (via corepack — ships with Node.js) |
| 91 | +# --------------------------------------------------------------------------- |
| 92 | + |
| 93 | +fmt_header "Yarn (via corepack)" |
| 94 | + |
| 95 | +if cmd_exists yarn; then |
| 96 | + fmt_ok "yarn already available ($(yarn --version 2>/dev/null))" |
| 97 | +else |
| 98 | + fmt_install "Enabling corepack for yarn" |
| 99 | + mise exec -- corepack enable |
| 100 | + |
| 101 | + # corepack installs shims to the Node prefix bin directory, which may not |
| 102 | + # be on PATH yet. Reshim mise so the yarn shim is available. |
| 103 | + mise reshim 2>/dev/null || true |
| 104 | + |
| 105 | + if cmd_exists yarn; then |
| 106 | + fmt_ok "yarn enabled via corepack" |
| 107 | + else |
| 108 | + echo " WARNING: yarn was enabled via corepack but is not yet on PATH." |
| 109 | + echo " It will be available after restarting your shell." |
| 110 | + fi |
73 | 111 | fi |
0 commit comments