refactor: finish moving ssh-* scripts to own installers
[webi-installers/.git] / README.md
index a1b27897c8e737590b2f6aa868fb630480bfb96e..376623e462d43529322e40c49669c03e5d839f0b 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,6 +1,13 @@
-# @webinstall/packages
+# [webi-installers](https://github.com/webinstall/webi-installers)
 
-> WebInstall is how developers install their tools
+> [webi](https://webinstall.dev) is how developers install their tools
+
+[![webinstall-dev-ogimage-github](https://user-images.githubusercontent.com/122831/129465590-136b5a8a-f8f5-4e8d-a010-784eaa9f21bb.png)](https://webinstall.dev)
+
+- no `sudo`
+- no package manager
+- no messing with system permissions
+- in short: no nonsense
 
 ```bash
 curl https://webinstall.dev/webi | bash
@@ -9,49 +16,54 @@ curl https://webinstall.dev/webi | bash
 This repository contains the primary and community-submitted packages for
 [webinstall.dev](https://webinstall.dev).
 
-# Installer Guidelines
-
-- Should install to `$HOME/.local/opt/<package>-<version>` or `$HOME/.local/bin`
-- Should not need `sudo` (except perhaps for a one-time `setcap`, etc)
-- Examples:
-    - Full Packages:
-        - Node.js: <https://github.com/webinstall/packages/tree/master/node>
-        - Golang: <https://github.com/webinstall/packages/tree/master/golang>
-        - PostgreSQL: <https://github.com/webinstall/packages/tree/master/postgres>
-    - Single-Binary Installers:
-        - Caddy: <https://github.com/webinstall/packages/tree/master/caddy>
-        - Ripgrep: <https://github.com/webinstall/packages/tree/master/ripgrep>
-        - Gitea: <https://github.com/webinstall/packages/tree/master/gitea>
-    - Convenience Scripts:
-        - Prettier: <https://github.com/webinstall/packages/tree/master/prettier>
-        - Rust-lang: <https://github.com/webinstall/packages/tree/master/rustlang>
-        - Rust-lang: <https://github.com/webinstall/packages/tree/master/vim-sensible>
-
-# How it works
+# How webi works
 
 - Contacts official release APIs for download URLs
 - Selects the appropriate package version and archive format
-- Installs to `$HOME/.local/`
+- Installs to `$HOME/.local/opt` or `$HOME/.local/bin`, as appropriate.
 - Updates `PATH` via `$HOME/.config/envman/PATH.env`
 - Symlinks or copies current selected version
 
 More technically:
 
-1. `<package>/releases.js` transforms the package's release API into a common formatt
-    - (i.e. HTML, CSV, TAB, or JSON into a specific JSON format)
-    - common release APIs are in `_common/` (i.e. `_common/github.js`)
-2. `_webi/bootstrap.sh` is a template that exchanges system information for a correct installer
-    - contructs a user agent with os, cpu, and utility info (i.e. `macos`, `amd64`, can unpack `tar,zip,xz`)
+1. `<package>/releases.js` transforms the package's release API into a common
+   format
+   - (i.e. HTML, CSV, TAB, or JSON into a specific JSON format)
+   - common release APIs are in `_common/` (i.e. `_common/github.js`)
+2. `_webi/bootstrap.sh` is a template that exchanges system information for a
+   correct installer
+   - contructs a user agent with os, cpu, and utility info (i.e. `macos`,
+     `amd64`, can unpack `tar,zip,xz`)
 3. `_webi/template.sh` is the base installer template with common functions for
-    - checking versions
-    - downloading & unpacking
-    - updating PATH
-    - (re-)linking directories
+   - checking versions
+   - downloading & unpacking
+   - updating PATH
+   - (re-)linking directories
 4. `<package>/install.sh` may provide functions to override `_webi/template.sh`
 5. Recap:
-    - `curl https://webinstall.dev/<pkg>` => `bootstrap-<pkg>.sh`
-    - `bash bootstrap-<pkg>.sh` => `https://webinstall.dev/api/installers/<pkg>@<ver>.sh?formats=zip,tar`
-    - `bash install-<pkg>.sh` => download, unpack, move, link, update PATH
+   - `curl https://webinstall.dev/<pkg>` => `bootstrap-<pkg>.sh`
+   - `bash bootstrap-<pkg>.sh` =>
+     `https://webinstall.dev/api/installers/<pkg>@<ver>.sh?formats=zip,tar`
+   - `bash install-<pkg>.sh` => download, unpack, move, link, update PATH
+
+# Philosophy (for package authors / maintainers publishing with webi)
+
+- Should install to `$HOME/.local/opt/<package>-<version>` or `$HOME/.local/bin`
+- Should not need `sudo` (except perhaps for a one-time `setcap`, etc)
+- Examples:
+  - Full Packages:
+    - Node.js: <https://github.com/webinstall/packages/tree/master/node>
+    - Golang: <https://github.com/webinstall/packages/tree/master/golang>
+    - PostgreSQL: <https://github.com/webinstall/packages/tree/master/postgres>
+  - Single-Binary Installers:
+    - Caddy: <https://github.com/webinstall/packages/tree/master/caddy>
+    - Ripgrep: <https://github.com/webinstall/packages/tree/master/ripgrep>
+    - Gitea: <https://github.com/webinstall/packages/tree/master/gitea>
+  - Convenience Scripts:
+    - Prettier: <https://github.com/webinstall/packages/tree/master/prettier>
+    - Rust-lang: <https://github.com/webinstall/packages/tree/master/rustlang>
+    - vim-sensible:
+      <https://github.com/webinstall/packages/tree/master/vim-sensible>
 
 ## Creating an Installer
 
@@ -59,10 +71,10 @@ An install consists of 5 parts in 4 files:
 
 ```
 my-new-package/
-  - package.yash
+  - README.md (package info in frontmatter)
   - releases.js
-  - install.sh
-  - install.bat
+  - install.sh (bash)
+  - install.ps1 (PowerShell)
 ```
 
 1. Create Description
@@ -100,27 +112,22 @@ node _webi/test.js ./new-package/
 
 Just copy the format from any of the existing packages. It's like this:
 
-`package.yash`:
+`README.md`:
 
-````
-# title: Node.js
-# homepage: https://nodejs.org
-# tagline: JavaScript V8 runtime
-# description: |
-#   Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine
-# examples: |
-#   ```bash
-#   node -e 'console.log("Hello, World!")'
-#   > Hello, World!
-#   ```
-
-END
-````
+````md
+---
+title: Node.js
+homepage: https://nodejs.org
+tagline: JavaScript V8 runtime
+description: |
+  Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine
+---
 
-This is a dumb format. We know. Historical accident (originally these were in
-bash comments).
-
-It's in the TODOs to replace this with either YAML or Markdown.
+```bash
+node -e 'console.log("Hello, World!")'
+> Hello, World!
+```
+````
 
 ### 1. Fetch Releases
 
@@ -159,13 +166,13 @@ pkg_cmd_name="foobar"
 
 # These are used for symlinks, PATH, and test commands
 pkg_dst="$HOME/.local/opt/foobar"
-pkg_dst_bin="$HOME/.local/opt/foobar/bin"
 pkg_dst_cmd="$HOME/.local/opt/foobar/bin/foobar"
+#pkg_dst_bin="$(dirname "$pkg_dst_cmd")"
 
 # These are the _real_ locations for the above
 pkg_src="$HOME/.local/opt/foobar-v$WEBI_VERSION"
-pkg_src_bin="$HOME/.local/opt/foobar-v$WEBI_VERSION/bin"
 pkg_src_cmd="$HOME/.local/opt/foobar-v$WEBI_VERSION/bin/foobar"
+#pkg_src_bin="$(dirname "$pkg_src_cmd")"
 ```
 
 (required) A version check function that strips all non-version junk
@@ -206,9 +213,8 @@ See `webi/template.sh`
 
 These variables will be set by the server:
 
-```
+```bash
 WEBI_PKG=example@v1
-WEBI_NAME=example
 WEBI_TAG=v1
 WEBI_HOST=https://webinstall.dev
 WEBI_RELEASES=https://webinstall.dev/api/releases/example@v1?os=macos&arch=amd64&pretty=true
@@ -224,6 +230,13 @@ WEBI_PKG_URL=https://cdn.example.com/example-macos-amd64.tar.gz
 WEBI_PKG_FILE=example-macos-amd64.tar.gz
 ```
 
+```bash
+PKG_NAME=example
+PKG_OSES=macos,linux,windows
+PKG_ARCHES=amd64,arm64,x86
+PKG_FORMATS=zip,xz
+```
+
 ```bash
 WEBI_TMP=${WEBI_TMP:-"$(mktemp -d -t webinstall-foobar.XXXXXXXX)"}
 WEBI_SINGLE=""
@@ -231,18 +244,52 @@ WEBI_SINGLE=""
 
 ```bash
 webi_check              # Checks to see if the selected version is already installed (and re-links if so)
-webi_download           # Downloads the selected release to $HOME/Downloads/<package-name>.tar.gz
+webi_download           # Downloads the selected release to $HOME/Downloads/webi/<package-name>.tar.gz
 webi_extract            # Extracts the download to /tmp/<package-name>-<random>/
 webi_path_add /new/path # Adds /new/path to PATH for bash, zsh, and fish
 webi_pre_install        # Runs webi_check, webi_download, and webi_extract
 webi_install            # Moves extracted files from $WEBI_TMP to $pkg_src
 webi_link               # replaces any existing symlink with the currently selected version
-webi_post_install       # Runs `webi_add_path $pkg_dst_bin`
+webi_post_install       # Runs `webi_path_add $pkg_dst_bin`
 ```
 
 # Roadmap
 
 - Wrap release APIs to unify and expose
+- [ ] Support more Windows packages
 - [ ] Support arbitrary git urls (i.e. `@github.com/node/node`)
   - (maybe `ghi node/node` for github specifically)
 - [ ] Support git as an archive format
+
+<!--
+
+# Windows Notes
+
+```bat
+set WEBI_HOST=https://webinstall.dev
+```
+
+Windows 10 has curl too!?
+
+```bat
+curl.exe -sL -A "MS" https://webinstall.dev/node | powershell
+```
+
+And it's easy enough to ignore the execution policy
+
+```bat
+powershell -ExecutionPolicy Bypass install.ps1
+```
+
+And if we want something that looks as complicated as we expect Windows to be,
+historically, we have options:
+
+```bat
+powershell "Invoke-Expression ( Invoke-WebRequest -UseBasicParsing https://webinstall.dev/node ).Contents"
+```
+
+```bat
+powershell ( Invoke-WebRequest -UseBasicParsing https://webinstall.dev/node ).Contents | powershell
+```
+
+-->