-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
92 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
export async function upgrader(config: { | ||
packageName: string; | ||
currentVersion: string; | ||
denoLand?: boolean; | ||
nestLand?: boolean; | ||
}) { | ||
// try to find the install script | ||
console.log('Run ONE of the below commands') | ||
if (config.denoLand) { | ||
const versions = await ( | ||
await fetch( | ||
`https://cdn.deno.land/${config.packageName}/meta/versions.json` | ||
) | ||
).json(); | ||
if (config.currentVersion !== versions.latest) { | ||
console.log( | ||
`deno.land: deno install --unstable --allow-run --allow-net https://deno.land/x/${config.packageName}@${versions.latest}/cli.ts -f` | ||
); | ||
} else { | ||
console.log("Already up to date from deno.land"); | ||
} | ||
} | ||
if (config.nestLand) { | ||
const res = await fetch("https://nest.land/api/package-client", { | ||
method: "POST", | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify({ data: { name: config.packageName } }), | ||
}); | ||
const info = await res.json(); | ||
// { | ||
// "body": { | ||
// "name": "dkill", | ||
// "normalizedName": "dkill", | ||
// "owner": "scau", | ||
// "description": "Deno cli to kill processes and ports", | ||
// "repository": "https://github.com/sylc/dkill", | ||
// "latestVersion": "dkill@0.5.0", | ||
// "latestStableVersion": "dkill@0.5.0", | ||
// "packageUploadNames": [ | ||
// "dkill@0.2.0", | ||
// "dkill@0.2.1", | ||
// "dkill@0.2.2", | ||
// "dkill@0.2.3", | ||
// "dkill@0.3.0", | ||
// "dkill@0.4.0", | ||
// "dkill@0.5.0" | ||
// ], | ||
// "locked": null, | ||
// "malicious": null, | ||
// "unlisted": false, | ||
// "updatedAt": "2021-02-21T06:06:18.931Z", | ||
// "createdAt": "2021-02-06T12:40:59.473Z" | ||
// } | ||
// } | ||
if (`${config.packageName}@${config.currentVersion}` !== info.body.latestVersion) { | ||
console.log( | ||
`nest.land: deno install --unstable --allow-run --allow-net https://x.nest.land/${info.body.latestVersion}/cli.ts -f` | ||
); | ||
} else { | ||
console.log("Already up to date from nest.land"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export const version = "0.5.0"; | ||
export const version = "v0.5.1"; |