Skip to content

Commit cb40632

Browse files
pjcdawkinsclaude
andauthored
docs: document npm installs; installer: accept brew, reject unknown methods (#221)
* feat(installer): fall back to npm when no other package manager is available When INSTALL_METHOD is unset, use npm instead of the raw method on macOS without Homebrew, and on Linux without apt, yum or apk (outside CI and without a pinned VERSION). npm is used only if it is on PATH, its global prefix is writable without sudo, and Node.js is not managed by a version manager (nvm, fnm, Volta, asdf, mise), whose global packages disappear when the Node.js version changes. INSTALL_DIR keeps the raw method. INSTALL_METHOD=npm forces npm, and installs upsun@VERSION if VERSION is set. Also: - accept "brew" as an alias for "homebrew", as documented in the README - reject unknown install methods, which previously installed nothing - make call_user return the command's exit status, not that of indent Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: document npm installs and the installer's npm fallback - README: npm install and upgrade sections, all INSTALL_METHOD values, and how the installer chooses a method by default. - Release notes: the npm upgrade command. - Installer tests: npm fallback jobs on Linux (Arch, with Node.js and no apt, yum or apk) and on macOS (with Homebrew hidden from PATH), and an Arch case in scripts/test/installer.sh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(installer): require Node.js 18 for the npm fallback The npm package's wrapper needs Node.js 18 or later, and npm only warns about an unsupported engine, so the installer falls back to the raw method with older Node.js versions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(installer): keep raw installs, and install optional npm dependencies Rerunning the installer keeps the raw method if the CLI is already installed other than by npm: npm cannot replace that binary, and two copies would be left. npm installs the platform binary as an optional dependency, so --include=optional overrides user config that omits them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(installer): address review of the npm fallback - call_user streams output again, and still returns the command's status. - The Node.js version check fails closed on non-numeric output. - After an npm install, check that the CLI runs, as npm skips the platform binary (an optional dependency) on unsupported platforms. - Match the bin directory against PATH entries exactly, so paths with spaces or regex characters work. - README: list the conditions for the npm fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(installer): match PATH entries with a trailing slash Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(installer): keep raw with a pinned VERSION on macOS, and upgrade npm to latest The upsun npm package only has releases from 5.10.2, so a pinned VERSION on macOS without Homebrew uses the raw method, as on Linux. npm update -g keeps a global package within its major version, so the README and release notes use npm install -g upsun@latest, as the CLI's update notice does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(installer): drop the automatic npm fallback The fallback reached few users: the global prefix of a system Node.js is owned by root, so it only applied with a user-configured prefix or as root, and most Node.js developers use a version manager, which it excluded. npm is now used only with INSTALL_METHOD=npm. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(installer): drop the npm install method Users who want npm can run npm install -g upsun directly. The README and release notes keep the npm install and upgrade commands. The installer keeps the brew alias and rejects unknown install methods, which previously installed nothing and reported success. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent bf89bec commit cb40632

3 files changed

Lines changed: 35 additions & 1 deletion

File tree

‎.goreleaser.yaml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ release:
129129
curl -fsSL https://raw.githubusercontent.com/upsun/cli/main/installer.sh | bash
130130
```
131131
132+
### npm
133+
134+
```console
135+
npm install -g upsun@latest
136+
```
137+
132138
archives:
133139
- id: platform
134140
name_template: "platform_{{ .Version }}_{{ .Os }}_{{ .Arch }}"

‎README.md‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ curl -fsSL https://raw.githubusercontent.com/upsun/cli/main/installer.sh | bash
3737
The installer is configurable using the following environment variables:
3838

3939
* `INSTALL_LOG` - the install log file
40-
* `INSTALL_METHOD` - force a specific installation method, possible values are `brew` and `raw`
40+
* `INSTALL_METHOD` - force a specific installation method: `apt`, `yum`, `apk`, `homebrew` (or `brew`), or `raw` (a binary download)
4141
* `INSTALL_DIR` - the installation directory for the `raw` installation method, for example you can use `INSTALL_DIR=$HOME/.local/bin` for a single user installation
4242
* `VERSION` - the version of the CLI to install, if you need a version other than the latest one
4343
* `CONFIG_URL` - the URL of an alternative CLI configuration, installed after the CLI with `upsun config:install --force`. Its executable is put next to `upsun` if that directory is writable (except with Homebrew). As root, outside the home directory, the configuration is put in `/etc/upsun/platform-alt` so that other users can run it; only root updates it
@@ -116,6 +116,16 @@ EOF
116116
sudo dnf install -y upsun-cli
117117
```
118118

119+
### npm
120+
121+
If you have Node.js 18 or later, you can install the CLI with npm:
122+
123+
```console
124+
npm install -g upsun
125+
```
126+
127+
There is no npm build for 32-bit Linux or Windows on ARM. npm installs don't set up shell completion.
128+
119129
### Manual installation
120130

121131
For manual installation, you can also [download the latest binaries](https://github.com/upsun/cli/releases/latest).
@@ -168,6 +178,12 @@ sudo apt-get update && sudo apt-get upgrade upsun-cli
168178
sudo dnf upgrade -y upsun-cli
169179
```
170180

181+
### npm
182+
183+
```console
184+
npm install -g upsun@latest
185+
```
186+
171187
### Update notifications
172188

173189
When a newer release is available, the CLI prints a short notice with the

‎installer.sh‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,10 @@ check_architecture() {
355355
}
356356

357357
check_install_method() {
358+
if [ "brew" = "${INSTALL_METHOD}" ]; then
359+
INSTALL_METHOD="homebrew"
360+
fi
361+
358362
if [ "linux" = "$kernel" ]; then
359363
if [ -z "${INSTALL_METHOD}" ]; then
360364
if is_ci; then
@@ -387,6 +391,14 @@ check_install_method() {
387391
INSTALL_METHOD="raw"
388392
fi
389393

394+
case "${INSTALL_METHOD}" in
395+
apt|yum|apk|homebrew|raw) ;;
396+
*)
397+
output " [ ] Unknown install method: ${INSTALL_METHOD} (use apt, yum, apk, homebrew or raw)" "error"
398+
exit_with_error
399+
;;
400+
esac
401+
390402
output " [*] Using ${INSTALL_METHOD} install method" "success"
391403
}
392404

0 commit comments

Comments
 (0)