Comparing version 0.2.2 to 0.2.3
@@ -14,2 +14,6 @@ import os from 'node:os'; | ||
const streamPipeline = promisify(pipeline); | ||
/** | ||
* run Runme CLI | ||
* @returns instance of spawned child process instance | ||
*/ | ||
export async function runme() { | ||
@@ -20,2 +24,6 @@ const binaryPath = await download(); | ||
} | ||
/** | ||
* download runme binary from GitHub | ||
* @returns file path to downloaded binary | ||
*/ | ||
export async function download() { | ||
@@ -29,4 +37,7 @@ const targetDir = path.resolve(__dirname, 'bin'); | ||
const platform = getPlatformMetadata(); | ||
if (!platform) { | ||
return; | ||
} | ||
const [version, type, target, ext] = [RUNME_VERSION, platform.TYPE.toLocaleLowerCase(), platform.TARGET, platform.EXTENSION]; | ||
const url = `https://download.stateful.com/runme/${version}/runme_${type}_${target}.${ext}`; | ||
const url = `https://download.stateful.com/runme/${version}/runme_${type}_${target}.${ext}${os.type().includes('Windows') ?? '.exe'}`; | ||
const res = await fetch(url); | ||
@@ -40,2 +51,6 @@ if (!res.body) { | ||
} | ||
/** | ||
* Determine current running platform and determine if it is supported | ||
* @returns platform information if supported, undefined otherwise | ||
*/ | ||
const getPlatformMetadata = () => { | ||
@@ -53,3 +68,2 @@ const type = os.type(); | ||
console.table(SUPPORTE_PLATFORMS); | ||
process.exit(1); | ||
}; |
{ | ||
"name": "runme", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"author": "Christian Bromann <christian@stateful.com>", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -1,2 +0,2 @@ | ||
# Runme.js | ||
# Runme.js [![Test Changes](https://github.com/stateful/runmejs/actions/workflows/test.yaml/badge.svg)](https://github.com/stateful/runmejs/actions/workflows/test.yaml) [![npm version](https://badge.fury.io/js/runme.svg)](https://badge.fury.io/js/runme) [![deno module](https://shield.deno.dev/x/runme)](https://deno.land/x/runme) | ||
@@ -3,0 +3,0 @@ > A JavaScript module to use Runme in Node.js, Deno or browser environments. |
6212367
703