This release is a pre-release — the latest non-prerelease version of @polyseam/cliffy-provider-gh-releases is 0.3.2. Jump to this version
@polyseam/cliffy-provider-gh-releases@1.0.0-rc.11Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
Enables self-upgrading of a Cliffy CLI which is distributed through GitHub Releases
This package works with DenoIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun, Browsers
JSR Score
100%
Published
2 weeks ago (1.0.0-rc.11)
cliffy-provider-github-releases
This is a provider for cliffy which enables the updating of a CLI tool via GitHub Releases.
usage
for a complete example, see the polyseam/cliffy-ghr-demo repo
The following snippet instantiates an GithubReleasesUpgradeCommand
, it is
configured by passing an instance of GithubReleasesProvider
to it.
The GithubReleasesProvider
takes:
repository
a string in the formatowner/repo
which points to the repository to fetch releases from.osAssetMap
a map ofDeno.build.os
entries to corresponding asset tarballsdestinationDir
a string which points to the directory where the tarball contents should be extracted to
and optionally, for more fine-grained control over how error and success events are handled:
onError
a function which is called when an error occurs, it is passed an instance ofGHRError
onComplete
a function which is called when the upgrade process completes, it is passed the version string of the release that was installed
import { GHRError, GithubReleasesProvider, GithubReleasesUpgradeCommand, } from "jsr:@polyseam/cliffy-provider-github-releases"; // This UpgradeCommand can be used in place of the default Cliffy UpgradeCommand const upgradeCommand = new GithubReleasesUpgradeCommand({ provider: new GithubReleasesProvider({ repository: "polyseam/cndi", destinationDir: "~/.cndi/bin", osAssetMap: { windows: "cndi-win.tar.gz", linux: "cndi-linux.tar.gz", darwin: "cndi-mac.tar.gz", }, onError: (error: GHRError) => { const exit_code = parseInt(`8${error.code}`); Deno.exit(exit_code); }, onComplete: (_info) => { Deno.exit(0); }, }), });
Built and signed on
View transparency logGitHub Actions
Add Package
deno add jsr:@polyseam/cliffy-provider-gh-releases
Import symbol
import * as mod from "@polyseam/cliffy-provider-gh-releases";
---- OR ----
Import directly with a jsr specifier
import * as mod from "jsr:@polyseam/cliffy-provider-gh-releases";
Add Package
npx jsr add @polyseam/cliffy-provider-gh-releases
Import symbol
import * as mod from "@polyseam/cliffy-provider-gh-releases";
Add Package
yarn dlx jsr add @polyseam/cliffy-provider-gh-releases
Import symbol
import * as mod from "@polyseam/cliffy-provider-gh-releases";
Add Package
pnpm dlx jsr add @polyseam/cliffy-provider-gh-releases
Import symbol
import * as mod from "@polyseam/cliffy-provider-gh-releases";
Add Package
bunx jsr add @polyseam/cliffy-provider-gh-releases
Import symbol
import * as mod from "@polyseam/cliffy-provider-gh-releases";