Comparing version
@@ -18,3 +18,3 @@ #!/usr/bin/env node | ||
if (process.env.FORCE_FROM_SOURCE) { | ||
await buildBinary(); | ||
await buildBinary(version); | ||
} else { | ||
@@ -55,3 +55,3 @@ await downloadBinary(version); | ||
const url = binaryUrl(version); | ||
console.log(`Downloading ${NAME} ${version} to ${targetPath}...`); | ||
console.log(`Downloading ${NAME} ${version} to ${targetPath}`); | ||
const resp = await fetch(url); | ||
@@ -155,6 +155,7 @@ resolve(resp.body); | ||
async function buildBinary() { | ||
async function buildBinary(version) { | ||
const repoDir = cacheDir("build", NAME); | ||
try { | ||
console.log(`Downloading ${NAME}'s source code...`); | ||
fs.rmSync(repoDir, { recursive: true }); | ||
childProcess.execSync( | ||
@@ -178,4 +179,4 @@ `git clone https://github.com/${REPO} ${repoDir}` | ||
path.join(repoDir, "target", "release", NAME), | ||
binaryPath() | ||
binaryPath(version) | ||
); | ||
} |
{ | ||
"name": "javy-cli", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,6 +11,6 @@ # Javy npm package | ||
# Install javy globally | ||
$ npm install -g javy | ||
$ npm install -g javy-cli | ||
# Directly invoke it via npm | ||
$ npx javy | ||
$ npx javy-cli@latest | ||
``` | ||
@@ -20,8 +20,12 @@ | ||
The npm package won't download Javy again once its downloaded. If a new | ||
version of the javy npm package has been published, you can use the following | ||
invocation to update to the latest release: | ||
The npm package will automatically download the newest version of Javy if a | ||
newer version is available. | ||
## Using a specific version of javy | ||
To use a specific version of Javy, set the environment variable | ||
`FORCE_RELEASE` to the version you would like to use. | ||
``` | ||
REFRESH_JAVY=1 npx javy | ||
FORCE_RELEASE=v1.1.0 npx javy-cli@latest | ||
``` | ||
@@ -36,3 +40,3 @@ | ||
``` | ||
BUILD_JAVY=1 npx javy | ||
FORCE_FROM_SOURCE=1 npx javy-cli@latest | ||
``` | ||
@@ -39,0 +43,0 @@ |
6593
2.76%163
0.62%48
9.09%