From 869e52b60422419d9f47d546062ff63151eaebab Mon Sep 17 00:00:00 2001 From: Jeff Charles Date: Wed, 14 Aug 2024 15:35:48 -0400 Subject: [PATCH] Remove almost all references to javy-cli --- .github/dependabot.yml | 6 - .github/workflows/ci-npm-javy-cli.yml | 30 ----- docs/contributing-architecture.md | 4 - npm/javy-cli/CHANGELOG.md | 26 ----- npm/javy-cli/index.js | 136 ---------------------- npm/javy-cli/package-lock.json | 161 -------------------------- npm/javy-cli/package.json | 19 --- 7 files changed, 382 deletions(-) delete mode 100644 .github/workflows/ci-npm-javy-cli.yml delete mode 100644 npm/javy-cli/CHANGELOG.md delete mode 100755 npm/javy-cli/index.js delete mode 100644 npm/javy-cli/package-lock.json delete mode 100644 npm/javy-cli/package.json diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 8dadeb30..57ee0457 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -17,12 +17,6 @@ updates: interval: "monthly" open-pull-requests-limit: 100 - - package-ecosystem: npm - directory: "/npm/javy-cli" - schedule: - interval: "monthly" - open-pull-requests-limit: 100 - - package-ecosystem: "github-actions" directory: "/" schedule: diff --git a/.github/workflows/ci-npm-javy-cli.yml b/.github/workflows/ci-npm-javy-cli.yml deleted file mode 100644 index 1142ce3f..00000000 --- a/.github/workflows/ci-npm-javy-cli.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: javy-cli NPM package CI - -on: - push: - branches: - - main - pull_request: - -jobs: - test: - name: npm_test-${{ matrix.os }}-${{ matrix.node }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - node: [16, 18, 20] - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - - - run: npm install - working-directory: npm/javy-cli - - - run: npm test - working-directory: npm/javy-cli diff --git a/docs/contributing-architecture.md b/docs/contributing-architecture.md index f66491db..daf0fc5a 100644 --- a/docs/contributing-architecture.md +++ b/docs/contributing-architecture.md @@ -324,7 +324,3 @@ We do not anticipate changes to this library requiring a new cargo feature. Plea ### `javy` A JS library providing ergonomic helpers around the lower level APIs for I/O exposed by `javy-apis`. - -### `javy-cli` - -The package that enables using the `javy-cli` through NPM. You can use `npx javy-cli` to run various Javy commands. diff --git a/npm/javy-cli/CHANGELOG.md b/npm/javy-cli/CHANGELOG.md deleted file mode 100644 index b0e02514..00000000 --- a/npm/javy-cli/CHANGELOG.md +++ /dev/null @@ -1,26 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## Unreleased - -## [3.0.1] - 2024-08-13 - -### Changed - -- Download version 3.0.1 of Javy instead of the latest released version of Javy. - -## [0.2.0] - 2023-08-17 - -### Removed - -- Building Javy from source code by using the `FORCE_FROM_SOURCE` environment variable is no longer supported. - -## [0.1.8] - 2023-07-28 - -### Fixed - -- HTTP response status codes other than 200 when downloading Javy binary now throws an error. diff --git a/npm/javy-cli/index.js b/npm/javy-cli/index.js deleted file mode 100755 index a1184730..00000000 --- a/npm/javy-cli/index.js +++ /dev/null @@ -1,136 +0,0 @@ -#!/usr/bin/env node - -import * as path from "path"; -import * as fs from "fs"; -import * as childProcess from "child_process"; -import * as gzip from "zlib"; -import * as stream from "stream"; -import fetch from "node-fetch"; -import cachedir from "cachedir"; - -const REPO = "bytecodealliance/javy"; -const NAME = "javy"; -const VERSION = "v3.0.1"; - -async function main() { - try { - if (!(await isBinaryDownloaded(VERSION))) { - await downloadBinary(VERSION); - } - const result = childProcess.spawnSync(binaryPath(VERSION), getArgs(), { - stdio: "inherit", - }); - process.exitCode = result.status === null ? 1 : result.status; - if (result.error?.code === "ENOENT") { - console.error("Failed to start Javy. If on Linux, check if glibc is installed."); - } else if (result.error?.code === "EACCES") { - // This can happen if a previous version of javy-cli did not successfully download the binary. - // It would have created an empty file at `binaryPath(version)` without the execute bit set, - // which would result in an `EACCES` error code. - // We delete the cached binary because that cached binary will never run successfully and - // stops `javy-cli` from redownloading the binary. - console.error(`${NAME} was not downloaded correctly. Please retry.`); - fs.unlinkSync(binaryPath(VERSION)); - } - } catch (e) { - console.error(e); - process.exitCode = 2; - } -} -main(); - -function cacheDir(...suffixes) { - const cacheDir = path.join(cachedir("binarycache"), ...suffixes); - fs.mkdirSync(cacheDir, { recursive: true }); - return cacheDir; -} - -function binaryPath(version) { - return path.join(cacheDir(), `${NAME}-${version}`); -} - -async function isBinaryDownloaded(version) { - return fs.promises - .stat(binaryPath(version)) - .then(() => true) - .catch(() => false); -} - -async function downloadBinary(version) { - const targetPath = binaryPath(version); - const compressedStream = await new Promise(async (resolve, reject) => { - const url = binaryUrl(version); - console.log(`Downloading ${NAME} ${version} to ${targetPath}`); - const resp = await fetch(url); - if (resp.status !== 200) { - return reject(`Downloading ${NAME} failed with status code of ${resp.status}`); - } - resolve(resp.body); - }); - const gunzip = gzip.createGunzip(); - const output = fs.createWriteStream(targetPath); - - await new Promise((resolve, reject) => { - stream.pipeline(compressedStream, gunzip, output, (err, val) => { - if (err) return reject(err); - return resolve(val); - }); - }); - - await fs.promises.chmod(binaryPath(version), 0o775); -} - -function binaryUrl(version) { - return `https://github.com/${REPO}/releases/download/${version}/${NAME}-${platarch()}-${version}.gz`; -} - -const SUPPORTED_TARGETS = [ - "arm-linux", - "arm-macos", - "x86_64-macos", - "x86_64-windows", - "x86_64-linux", -]; - -function platarch() { - let platform, arch; - switch (process.platform.toLowerCase()) { - case "darwin": - platform = "macos"; - break; - case "linux": - platform = "linux"; - break; - case "win32": - platform = "windows"; - break; - default: - throw Error(`Unsupported platform ${process.platform}`); - } - switch (process.arch.toLowerCase()) { - case "arm": - case "arm64": - arch = "arm"; - break; - // A 32 bit arch likely needs that someone has 32bit Node installed on a - // 64 bit system, and wasmtime doesn't support 32bit anyway. - case "ia32": - case "x64": - arch = "x86_64"; - break; - default: - throw Error(`Unsupported architecture ${process.arch}`); - } - const result = `${arch}-${platform}`; - if (!SUPPORTED_TARGETS.includes(result)) { - throw Error( - `Unsupported platform/architecture combination ${platform}/${arch}` - ); - } - return result; -} - -function getArgs() { - const args = process.argv.slice(2); - return args; -} diff --git a/npm/javy-cli/package-lock.json b/npm/javy-cli/package-lock.json deleted file mode 100644 index b88f9d8c..00000000 --- a/npm/javy-cli/package-lock.json +++ /dev/null @@ -1,161 +0,0 @@ -{ - "name": "javy-cli", - "version": "3.0.1", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "javy-cli", - "version": "3.0.1", - "license": "Apache-2.0", - "dependencies": { - "cachedir": "^2.3.0", - "node-fetch": "^3.2.10" - }, - "bin": { - "javy": "index.js" - } - }, - "node_modules/cachedir": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.4.0.tgz", - "integrity": "sha512-9EtFOZR8g22CL7BWjJ9BUx1+A/djkofnyW3aOXZORNW2kxoUpx2h+uN2cOqwPmFhnpVmxg+KW2OjOSgChTEvsQ==", - "engines": { - "node": ">=6" - } - }, - "node_modules/data-uri-to-buffer": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz", - "integrity": "sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==", - "engines": { - "node": ">= 12" - } - }, - "node_modules/fetch-blob": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", - "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "paypal", - "url": "https://paypal.me/jimmywarting" - } - ], - "dependencies": { - "node-domexception": "^1.0.0", - "web-streams-polyfill": "^3.0.3" - }, - "engines": { - "node": "^12.20 || >= 14.13" - } - }, - "node_modules/formdata-polyfill": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", - "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", - "dependencies": { - "fetch-blob": "^3.1.2" - }, - "engines": { - "node": ">=12.20.0" - } - }, - "node_modules/node-domexception": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", - "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "github", - "url": "https://paypal.me/jimmywarting" - } - ], - "engines": { - "node": ">=10.5.0" - } - }, - "node_modules/node-fetch": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", - "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", - "dependencies": { - "data-uri-to-buffer": "^4.0.0", - "fetch-blob": "^3.1.4", - "formdata-polyfill": "^4.0.10" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/node-fetch" - } - }, - "node_modules/web-streams-polyfill": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", - "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", - "engines": { - "node": ">= 8" - } - } - }, - "dependencies": { - "cachedir": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.4.0.tgz", - "integrity": "sha512-9EtFOZR8g22CL7BWjJ9BUx1+A/djkofnyW3aOXZORNW2kxoUpx2h+uN2cOqwPmFhnpVmxg+KW2OjOSgChTEvsQ==" - }, - "data-uri-to-buffer": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz", - "integrity": "sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==" - }, - "fetch-blob": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", - "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", - "requires": { - "node-domexception": "^1.0.0", - "web-streams-polyfill": "^3.0.3" - } - }, - "formdata-polyfill": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", - "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", - "requires": { - "fetch-blob": "^3.1.2" - } - }, - "node-domexception": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", - "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==" - }, - "node-fetch": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", - "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", - "requires": { - "data-uri-to-buffer": "^4.0.0", - "fetch-blob": "^3.1.4", - "formdata-polyfill": "^4.0.10" - } - }, - "web-streams-polyfill": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", - "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==" - } - } -} diff --git a/npm/javy-cli/package.json b/npm/javy-cli/package.json deleted file mode 100644 index 81f036ad..00000000 --- a/npm/javy-cli/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "javy-cli", - "version": "3.0.1", - "description": "", - "main": "index.js", - "bin": { - "javy": "./index.js" - }, - "scripts": { - "test": "node index.js -V" - }, - "type": "module", - "author": "Surma ", - "license": "Apache-2.0", - "dependencies": { - "cachedir": "^2.3.0", - "node-fetch": "^3.2.10" - } -}