Skip to content

Commit

Permalink
Fix canary install
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexagon committed Sep 25, 2024
1 parent 196beec commit 5ad9050
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Full examples available at [/docs/src/examples](/docs/src/examples)
released.

- `canary`: The canary channel provides the most up-to-date and cutting-edge versions of Pup. It includes the latest changes and may not be as stable as the other channels. It is primarily intended
for developers and early adopters who want to stay on the bleeding edge of Pup's development. Based on the current state of the `main` repo of the github repository.
for developers and early adopters who want to stay on the bleeding edge of Pup's development. Based on the current state of the `dev` repo of the github repository.

> **Note** Built-in plugins, such as splunk-hec and webinterace does not work with canary versions right now.
Expand Down
4 changes: 2 additions & 2 deletions application.meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

const Application = {
name: "pup",
version: "1.0.0",
version: "1.0.1",
url: "jsr:@pup/pup@$VERSION",
description: "Powerful universal process manager, designed to keep your scripts, applications and services alive.",
canary_url: "https://raw.githubusercontent.com/Hexagon/pup/main/pup.ts",
canary_url: "https://raw.githubusercontent.com/Hexagon/pup/dev/pup.ts",
deno: "1.44.0", /* Minimum stable version of Deno required to run Pup (without --unstable-* flags) */
deno_unstable: "1.44.0", /* Minimum version of Deno required to run Pup (with --unstable-* flags) */
repository: "https://github.com/hexagon/pup",
Expand Down
4 changes: 2 additions & 2 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pup/pup",
"version": "1.0.0",
"version": "1.0.1",

"exports": {
".": "./pup.ts",
Expand Down Expand Up @@ -40,7 +40,7 @@
"@cross/env": "jsr:@cross/env@~1.0.2",
"@cross/fs": "jsr:@cross/fs@~0.1.11",
"@cross/jwt": "jsr:@cross/jwt@~0.5.0",
"@cross/kv": "jsr:@cross/kv@~0.17.0",
"@cross/kv": "jsr:@cross/kv@~0.17.1",
"@cross/runtime": "jsr:@cross/runtime@~1.1.0",
"@cross/service": "jsr:@cross/service@~1.0.3",
"@cross/test": "jsr:@cross/test@~0.0.9",
Expand Down
2 changes: 1 addition & 1 deletion docs/src/_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"description": "Universal Process Manager"
},
"substitute": {
"$PUP_VERSION": "1.0.0"
"$PUP_VERSION": "1.0.1"
},
"top_links": [
{
Expand Down
4 changes: 4 additions & 0 deletions docs/src/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ nav_order: 13

All notable changes to this project will be documented in this section.

## [1.0.1] - 2024-09-25

- fix(core): Fix `--canary` install/upgrade option

## [1.0.0] - 2024-09-18

🎉 Initial Stable Release! 🎉
Expand Down
2 changes: 1 addition & 1 deletion docs/src/contributing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Pup is an open-source project, and we welcome contributions from the community.
## Submitting code changes

- Fork the Pup repository on GitHub.
- Create a new branch for your changes and implement the desired feature or bug fix.
- Create a new branch for your changes based on the `dev` branch, and implement the desired feature or bug fix.
- Write tests to ensure your changes are reliable and maintainable.
- Update the documentation as needed to reflect your changes.
- Run `deno task build` to check format, lint and test the code.
Expand Down
5 changes: 5 additions & 0 deletions docs/src/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ The available channels are:
- `prerelease`: This channel offers pre-release versions of Pup that include new features and improvements. It is suitable for users who want to test the latest enhancements before they are officially
released.

- `canary`: The canary channel provides the most up-to-date and cutting-edge versions of Pup. It includes the latest changes and may not be as stable as the other channels. It is primarily intended
for developers and early adopters who want to stay on the bleeding edge of Pup's development. Based on the current state of the `dev` repo of the github repository.

> **Note** Built-in plugins, such as splunk-hec and webinterace does not work with canary versions right now.
Each channel serves different purposes, so choose the one that best fits your needs and requirements.

## Verifying the Installation
Expand Down
24 changes: 23 additions & 1 deletion lib/cli/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
import { Application } from "../../application.meta.ts"
import { greaterThan, lessThan, parse } from "@std/semver"
import { exit } from "@cross/utils"
import { readFile } from "@cross/fs"
import { mktempdir, readFile } from "@cross/fs"
import { join } from "@std/path/join"

// The deno.land/x-url has to be used until first stable release, or until jsr.io fixes issue
// https://github.com/jsr-io/jsr/issues/382
Expand Down Expand Up @@ -163,6 +164,24 @@ export async function upgrade(
}
}

let temporaryDenoJsonFilePath = ""
if (canaryInstall) {
const canaryDenoJsonUrl = versions.canary_url.replace("pup.ts", "deno.json")

// Create a temporary directory
const canaryDenoJsonLocation = await mktempdir("pup")

// Download the canary deno.json file to the temporary directory
const response = await fetch(canaryDenoJsonUrl)
const data = await response.text()
temporaryDenoJsonFilePath = await join(canaryDenoJsonLocation, "deno.json")

// Write the file to the temporary location
await Deno.writeTextFile(temporaryDenoJsonFilePath, data)

console.log(`Downloaded canary deno.json to ${temporaryDenoJsonFilePath}`)
}

// Install
const installCmd = []

Expand All @@ -176,6 +195,9 @@ export async function upgrade(
if (ignoreCertificateErrorsString && ignoreCertificateErrorsString !== "") {
installCmd.push(ignoreCertificateErrorsString)
}
if (canaryInstall) {
installCmd.push("-c", temporaryDenoJsonFilePath)
}
installCmd.push("-n", "pup") // Installed command name = pup
installCmd.push(canaryInstall ? versions.canary_url : (requestedVersion as Version).url)

Expand Down
17 changes: 16 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
{
"canary_url": "https://raw.githubusercontent.com/Hexagon/pup/main/pup.ts",
"canary_url": "https://raw.githubusercontent.com/Hexagon/pup/dev/pup.ts",
"stable": [
{
"version": "1.0.1",
"url": "jsr:@pup/[email protected]",
"deno": "1.44.0",
"deno_unstable": "1.44.0",
"default_permissions": [
"--allow-env",
"--allow-read",
"--allow-write",
"--allow-sys=loadavg,systemMemoryInfo,osUptime,osRelease,uid,gid",
"--allow-net",
"--allow-run",
"--allow-ffi"
]
},
{
"version": "1.0.0",
"url": "jsr:@pup/[email protected]",
Expand Down

0 comments on commit 5ad9050

Please sign in to comment.