Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade dependencies + Handle java 8 exception on mac #68

Merged
merged 10 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"language": "en",
"version": "0.1",
"words": [
"GHSA",
"GRYPE",
"MARKDOWNLINT",
"Rapha",
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
name: Test
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ${{ matrix.os }}
Expand All @@ -28,3 +29,5 @@ jobs:
run: yarn install --frozen-lockfile
- name: Run tests
run: yarn test
env:
DEBUG: njre
2 changes: 2 additions & 0 deletions .grype.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ignore:
- vulnerability: GHSA-p6mc-m468-83gw
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

- Add your updates here !

## [v1.2.0] - 2024-05-08

- Fix issue with Mac with default values
- Add debug trace "njre"
- Upgrade all npm dependencies

## [v1.1.0] - 2023-11-26

- Handle compatibility with Mac M1
Expand Down
7 changes: 7 additions & 0 deletions lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const crypto = require("crypto");
const fetch = require("node-fetch");
const yauzl = require("yauzl");
const tar = require("tar");
const debug = require("debug")("njre");

function createDir(dir) {
return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -196,6 +197,11 @@ function install(version = 8, options = {}) {

options = { ...options, openjdk_impl, release, type, heap_size, vendor };

// Java 8 not supported by Api
if (os.platform() === "darwin") {
version = 11;
}

let endpoint = null;
if (options.vendor === "adoptopenjdk") endpoint = "api.adoptopenjdk.net";
else if (options.vendor === "eclipse") endpoint = "api.adoptium.net";
Expand Down Expand Up @@ -265,6 +271,7 @@ function install(version = 8, options = {}) {

const tmpdir = path.join(os.tmpdir(), "njre");

debug("Java URL: " + url);
return fetch(url, { redirect: "manual" })
.then((response) => response.headers.get("Location"))
.then((location) => followToAdoptium(location))
Expand Down
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,18 @@
"private": false,
"dependencies": {
"command-exists-promise": "^2.0.2",
"node-fetch": "^2.5.0",
"tar": "^6.0.0",
"yauzl": "^2.10.0"
"debug": "^4.3.4",
"node-fetch": "2.7.0",
"tar": "^7.1.0",
"yauzl": "^3.1.3"
},
"devDependencies": {
"eslint": "^8.49.0",
"husky": "^9.0.0",
"jsdoc-to-markdown": "^8.0.0",
"lint-staged": "^14.0.1",
"markdown-table-formatter": "^1.3.0",
"mocha": "^10.2.0",
"eslint": "^9.2.0",
"husky": "^9.0.11",
"jsdoc-to-markdown": "^8.0.1",
"lint-staged": "^15.2.2",
"markdown-table-formatter": "^1.6.0",
"mocha": "^10.4.0",
"nyc": "^15.0.0",
"standard": "^17.0.0"
}
Expand Down
4 changes: 4 additions & 0 deletions tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ describe("Install", () => {
it("should install JRE 20 from Eclipse Foundation without throwing an error", () => {
return njre.install(20, { vendor: "eclipse" });
}).timeout(100000);

it("should install JRE 21 from Eclipse Foundation without throwing an error", () => {
return njre.install(21, { vendor: "eclipse" });
}).timeout(100000);
});
Loading