{"id":13496202,"url":"https://github.com/webinstall/webi-installers","last_synced_at":"2025-05-14T02:04:49.068Z","repository":{"id":37533368,"uuid":"258859734","full_name":"webinstall/webi-installers","owner":"webinstall","description":"Primary and community-submitted packages for webinstall.dev","archived":false,"fork":false,"pushed_at":"2025-03-06T20:59:05.000Z","size":2657,"stargazers_count":2278,"open_issues_count":66,"forks_count":253,"subscribers_count":26,"default_branch":"main","last_synced_at":"2025-04-26T20:49:58.730Z","etag":null,"topics":["brew","hacktoberfest","linux","macos","windows-10","wsl","wsl-ubuntu","wsl2"],"latest_commit_sha":null,"homepage":"https://webinstall.dev","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webinstall.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-04-25T19:43:56.000Z","updated_at":"2025-04-26T10:58:48.000Z","dependencies_parsed_at":"2024-01-16T01:04:10.400Z","dependency_job_id":"7ffaacbe-b885-4c11-8510-14802e81ae4f","html_url":"https://github.com/webinstall/webi-installers","commit_stats":{"total_commits":1223,"total_committers":97,"mean_commits":"12.608247422680412","dds":"0.28699918233851185","last_synced_commit":"976602236b434be17c218b39387496d99216a40b"},"previous_names":["webinstall/packages"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webinstall%2Fwebi-installers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webinstall%2Fwebi-installers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webinstall%2Fwebi-installers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webinstall%2Fwebi-installers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webinstall","download_url":"https://codeload.github.com/webinstall/webi-installers/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254052669,"owners_count":22006716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["brew","hacktoberfest","linux","macos","windows-10","wsl","wsl-ubuntu","wsl2"],"created_at":"2024-07-31T19:01:43.729Z","updated_at":"2025-05-14T02:04:49.011Z","avatar_url":"https://github.com/webinstall.png","language":"Shell","funding_links":[],"categories":["Shell","wsl","hacktoberfest"],"sub_categories":[],"readme":"# [webi-installers](https://github.com/webinstall/webi-installers)\n\n\u003e [webi](https://webinstall.dev) is how developers install their tools\n\n[![webinstall-dev-ogimage-github](https://user-images.githubusercontent.com/122831/129465590-136b5a8a-f8f5-4e8d-a010-784eaa9f21bb.png)](https://webinstall.dev)\n\n- no `sudo`\n- no package manager\n- no messing with system permissions\n- in short: no nonsense\n\n```sh\ncurl https://webi.sh/webi | sh\n```\n\nThis repository contains the primary and community-submitted packages for\n[webinstall.dev](https://webinstall.dev).\n\n# How webi works\n\n- Contacts official release APIs for download URLs\n- Selects the appropriate package version and archive format\n- Installs to `$HOME/.local/opt` or `$HOME/.local/bin`, as appropriate.\n- Updates `PATH` via `$HOME/.config/envman/PATH.env`\n- Symlinks or copies current selected version\n\nMore technically:\n\n1. `\u003cpackage\u003e/releases.js` transforms the package's release API into a common\n   format\n   - (i.e. HTML, CSV, TAB, or JSON into a specific JSON format)\n   - common release APIs are in `_common/` (i.e. `_common/github.js`)\n2. `_webi/bootstrap.sh` is a template that exchanges system information for a\n   correct installer\n   - constructs a user agent with os, cpu, and utility info (i.e. `macos`,\n     `amd64`, can unpack `tar,zip,xz`)\n3. `_webi/template.sh` is the base installer template with common functions for\n   - checking versions\n   - downloading \u0026 unpacking\n   - updating PATH\n   - (re-)linking directories\n4. `\u003cpackage\u003e/install.sh` may provide functions to override `_webi/template.sh`\n5. Recap:\n   - `curl https://webi.sh/\u003cpkg\u003e` =\u003e `bootstrap-\u003cpkg\u003e.sh`\n   - `sh bootstrap-\u003cpkg\u003e.sh` =\u003e\n     `https://webinstall.dev/api/installers/\u003cpkg\u003e@\u003cver\u003e.sh?formats=zip,tar`\n   - `sh install-\u003cpkg\u003e.sh` =\u003e download, unpack, move, link, update PATH\n\n# Philosophy (for package authors / maintainers publishing with webi)\n\n- Should install to `$HOME/.local/opt/\u003cpackage\u003e-\u003cversion\u003e` or `$HOME/.local/bin`\n- Should not need `sudo` (except perhaps for a one-time `setcap`, etc)\n- Examples:\n  - Full Packages:\n    - Node.js: \u003chttps://github.com/webinstall/packages/tree/master/node\u003e\n    - Golang: \u003chttps://github.com/webinstall/packages/tree/master/golang\u003e\n    - PostgreSQL: \u003chttps://github.com/webinstall/packages/tree/master/postgres\u003e\n  - Single-Binary Installers:\n    - Caddy: \u003chttps://github.com/webinstall/packages/tree/master/caddy\u003e\n    - Ripgrep: \u003chttps://github.com/webinstall/packages/tree/master/ripgrep\u003e\n    - Gitea: \u003chttps://github.com/webinstall/packages/tree/master/gitea\u003e\n  - Convenience Scripts:\n    - Prettier: \u003chttps://github.com/webinstall/packages/tree/master/prettier\u003e\n    - Rust-lang: \u003chttps://github.com/webinstall/packages/tree/master/rustlang\u003e\n    - vim-sensible:\n      \u003chttps://github.com/webinstall/packages/tree/master/vim-sensible\u003e\n\n## Creating an Installer\n\nAn install consists of 5 parts in 4 files:\n\n```\nmy-new-package/\n  - README.md (package info in frontmatter)\n  - releases.js\n  - install.sh (POSIX Shell)\n  - install.ps1 (PowerShell)\n```\n\n1. Create Description\n2. Fetch Releases\n3. Version Check (semi-optional)\n4. Update PATH\n\nSee these **examples**:\n\n- https://github.com/webinstall/packages/blob/master/rg/\n- https://github.com/webinstall/packages/blob/master/golang/\n\nThe `webinstall.dev` server uses the list of releases returned by\n`\u003cyour-package\u003e/releases.js` to generate a shell script with most necessary\nvariables and functions pre-defined.\n\nYou just fill in the blanks.\n\n### TL;DR\n\nJust create an empty directory and run the tests until you get a good result.\n\n```sh\ngit clone git@github.com:webinstall/webi-installers.git\npushd ./webi-installers/\ngit submodule update --init\nnpm clean-install\n```\n\n```sh\nmkdir -p ./new-package/\nnode _webi/test.js ./new-package/\n```\n\n### 1. Create Description\n\nJust copy the format from any of the existing packages. It's like this:\n\n`README.md`:\n\n````md\n---\ntitle: Node.js\nhomepage: https://nodejs.org\ntagline: |\n  JavaScript V8 runtime\ndescription: |\n  Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine\n---\n\n```sh\nnode -e 'console.log(\"Hello, World!\")'\n\u003e Hello, World!\n```\n````\n\n### 1. Fetch Releases\n\nAll you're doing in this step is just translating from one form of JSON or CSV\nor TAB or whatever, to a format understood by `webi`.\n\n- Using Github releases? See `ripgrep/releases.js` (which uses\n  `_common/github.js`)\n- Have a special format? See `golang/releases.js` or `node/releases.js`.\n\nIt looks like this:\n\n`releases.js`:\n\n```js\nmodule.exports = function () {\n  return github(null, owner, repo).then(function (all) {\n    // if you need to do something special, you can do it here\n    // ...\n    return all;\n  });\n};\n```\n\n### 2. Bash Installer\n\n1. Variables _you_ can set\n2. Functions _you_ must define\n3. Convenience / Helper Functions\n\n(optional, if needed) Bash variables that you _may_ define:\n\n```sh\n# Define this if the package name is different from the command name (i.e. golang =\u003e go)\npkg_cmd_name=\"foobar\"\n\n# These are used for symlinks, PATH, and test commands\npkg_dst=\"$HOME/.local/opt/foobar\"\npkg_dst_cmd=\"$HOME/.local/opt/foobar/bin/foobar\"\n#pkg_dst_bin=\"$(dirname \"$pkg_dst_cmd\")\"\n\n# These are the _real_ locations for the above\npkg_src=\"$HOME/.local/opt/foobar-v$WEBI_VERSION\"\npkg_src_cmd=\"$HOME/.local/opt/foobar-v$WEBI_VERSION/bin/foobar\"\n#pkg_src_bin=\"$(dirname \"$pkg_src_cmd\")\"\n```\n\n(required) A version check function that strips all non-version junk\n\n```sh\npkg_get_current_version() {\n    # foobar-v1.1.7 =\u003e 1.1.7\n    echo \"$(foobar --version | head -n 1 | sed 's:foobar-v::')\"\n}\n```\n\nFor the rest of the functions you can copy/paste from the examples:\n\n```sh\npkg_format_cmd_version() {}         # Override, pretty prints version\n\npkg_link                            # Override, replaces webi_link()\n\npkg_pre_install() {                 # Override, runs any webi_* commands\n    webi_check                          # for $HOME/.local/opt tools\n    webi_download                       # for things that have a releases.js\n    webi_extract                        # for .xz, .tar.*, and .zip files\n}\n\npkg_install() {}                    # Override, usually just needs to rename extracted folder to\n                                    # \"$HOME/.local/opt/$pkg_cmd_name-v$WEBI_VERSION\"\n\npkg_post_install() {                # Override\n    webi_path_add \"$pkg_dst_bin\"        # should probably update PATH\n}\n\npkg_done_message() {}               # Override, pretty print a success message\n```\n\n## Script API\n\nSee `webi/template.sh`\n\nThese variables will be set by the server:\n\n```sh\nWEBI_PKG=example@v1\nWEBI_TAG=v1\nWEBI_HOST=https://webinstall.dev\nWEBI_RELEASES=https://webinstall.dev/api/releases/example@v1?os=macos\u0026arch=amd64\u0026pretty=true\nWEBI_CSV=v1.0.2,\nWEBI_VERSION=1.0.2\nWEBI_MAJOR=1\nWEBI_MINOR=0\nWEBI_PATCH=2\nWEBI_LTS=\nWEBI_CHANNEL=stable\nWEBI_EXT=tar\nWEBI_PKG_URL=https://cdn.example.com/example-macos-amd64.tar.gz\nWEBI_PKG_FILE=example-macos-amd64.tar.gz\n```\n\n```sh\nPKG_NAME=example\nPKG_OSES=macos,linux,windows\nPKG_ARCHES=amd64,arm64,x86\nPKG_FORMATS=zip,xz\n```\n\n```sh\nWEBI_TMP=${WEBI_TMP:-\"$(mktemp -d -t webinstall-foobar.XXXXXXXX)\"}\nWEBI_SINGLE=\"\"\n```\n\n```sh\nwebi_check              # Checks to see if the selected version is already installed (and re-links if so)\nwebi_download           # Downloads the selected release to $HOME/Downloads/webi/\u003cpackage-name\u003e.tar.gz\nwebi_extract            # Extracts the download to /tmp/\u003cpackage-name\u003e-\u003crandom\u003e/\nwebi_path_add /new/path # Adds /new/path to PATH for bash, zsh, and fish\nwebi_pre_install        # Runs webi_check, webi_download, and webi_extract\nwebi_install            # Moves extracted files from $WEBI_TMP to $pkg_src\nwebi_link               # replaces any existing symlink with the currently selected version\nwebi_post_install       # Runs `webi_path_add $pkg_dst_bin`\n```\n\n# Roadmap\n\n- Wrap release APIs to unify and expose\n- [ ] Support more Windows packages\n- [ ] Support arbitrary git urls (i.e. `@github.com/node/node`)\n  - (maybe `ghi node/node` for github specifically)\n- [ ] Support git as an archive format\n\n\u003c!--\n\n# Windows Notes\n\n```bat\nset WEBI_HOST=https://webinstall.dev\n```\n\nWindows has curl too!?\n\n```bat\ncurl.exe -sL https://webi.ms/node | powershell\n```\n\nAnd it's easy enough to ignore the execution policy\n\n```bat\npowershell -ExecutionPolicy Bypass install.ps1\n```\n\nAnd if we want something that looks as complicated as we expect Windows to be,\nhistorically, we have options:\n\n```bat\npowershell \"Invoke-Expression ( Invoke-WebRequest -UseBasicParsing https://webi.ms/node ).Contents\"\n```\n\n```bat\npowershell ( Invoke-WebRequest -UseBasicParsing https://webi.ms/node ).Contents | powershell\n```\n\n--\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebinstall%2Fwebi-installers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebinstall%2Fwebi-installers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebinstall%2Fwebi-installers/lists"}