update README.md
[webi-installers/.git] / README.md
1 # packages
2
3 Primary and community-submitted packages for
4 [webinstall.dev](https://webinstall.dev)
5
6 # Guidelines
7
8 - Should install to `./local/opt/<package>-<version>`
9 - Should not need `sudo` (except perhaps for a one-time `setcap`, etc)
10 - Follow the example of
11   <https://github.com/webinstall/packages/tree/master/ripgrep>,
12   <https://github.com/webinstall/packages/tree/master/node>, or
13   <https://github.com/webinstall/packages/tree/master/golang>
14
15 ## Creating an Installer
16
17 An install consists of 4 parts:
18
19 1. Generate a list of releases by OS and ARCH
20    - For a Github releases example, see `ripgrep/releases.js` and
21      `_common/github.js`
22 2. A bash version check (to skip downloading if already installed)
23    - typically just 1 unique line of bash
24 3. A bash install (move files from the archive (zip, tar) to \$HOME/.local)
25    - also typically just 1 unique line of bash
26 4. Update PATH
27    - the `webi_path_add` bash function will work for bash, zsh, and fish
28
29 The `webinstall.dev` server uses the list of releases returned by
30 `<your-package>/releases.js` to generate a bash script with most necessary
31 variables and functions pre-defined.
32
33 You just fill in the blanks.
34
35 ## Script API
36
37 See `webi/template.bash`
38
39 These variables will be set by the server:
40
41 ```
42 WEBI_PKG=example@v1
43 WEBI_NAME=example
44 WEBI_HOST=https://webinstall.dev
45 WEBI_RELEASES=https://webinstall.dev/api/releases/example@v1?os=macos&arch=amd64&pretty=true
46 WEBI_CSV=v1.0.2,
47 WEBI_VERSION=1.0.2
48 WEBI_MAJOR=1
49 WEBI_MINOR=0
50 WEBI_PATCH=2
51 WEBI_LTS=
52 WEBI_CHANNEL=stable
53 WEBI_EXT=tar
54 WEBI_PKG_URL=https://cdn.example.com/example-macos-amd64.tar.gz
55 WEBI_PKG_FILE=example-macos-amd64.tar.gz
56 ```
57
58 ```bash
59 WEBI_TMP=${WEBI_TMP:-"$(mktemp -d -t webinstall-foobar.XXXXXXXX)"}
60 ```
61
62 ```bash
63 webi_download           # Downloads the selected release to $HOME/Downloads/<package-name>.tar.gz
64 webi_extract            # Extracts the download to /tmp/<package-name>-<random>/
65 webi_path_add /new/path # Adds /new/path to PATH for bash, zsh, and fish
66 ```
67
68 # Roadmap
69
70 - Wrap release APIs to unify and expose
71   - [x] Golang <https://golang.org/dl/?mode=json>
72   - [x] Node <https://nodejs.org/dist/index.tab>
73   - [x] Flutter
74         <https://storage.googleapis.com/flutter_infra/releases/releases_linux.json> -
75         Started at
76         <https://github.com/webinstall/packages/blob/master/flutter/versions.js>
77   - [ ] git
78     - Note: do all platforms expose tar/zip releases with the same URLs?
79   - [ ] npm
80   - [x] github (see ripgrep)
81   - [x] gitea (see serviceman)
82 - [ ] Support git urls (i.e. `@github.com/node/node`)
83   - (maybe `ghi node/node` for github specifically)