diff --git a/lib/install.js b/lib/install.js index ddd2800..3815fe7 100644 --- a/lib/install.js +++ b/lib/install.js @@ -148,7 +148,7 @@ function extract (file) { **/ function followToAdoptium (location) { if (/api.adoptium.net/g.test(location)) { - return fetch(location, {redirect: 'manual'}) + return fetch(location, { redirect: 'manual' }) .then(response => response.headers.get('Location')) } else return location } @@ -202,7 +202,7 @@ function install (version = 8, options = {}) { else if (options.vendor === 'eclipse') endpoint = 'api.adoptium.net' else return Promise.reject(new Error('Unsupported vendor. Use adoptopenjdk (default) or eclipse')) - let version_path = (options.release === 'latest') + const versionPath = (options.release === 'latest') ? 'latest/' + version + '/ga' : 'version/' + options.release @@ -233,18 +233,18 @@ function install (version = 8, options = {}) { else return Promise.reject(new Error('Unsupported architecture')) } - let url = 'https://' + endpoint + '/v3/binary/' - + version_path + '/' - + options.os + '/' - + options.arch + '/' - + options.type + '/' - + options.openjdk_impl + '/' - + options.heap_size + '/' - + options.vendor + const url = 'https://' + endpoint + '/v3/binary/' + + versionPath + '/' + + options.os + '/' + + options.arch + '/' + + options.type + '/' + + options.openjdk_impl + '/' + + options.heap_size + '/' + + options.vendor const tmpdir = path.join(os.tmpdir(), 'njre') - return fetch(url, {redirect: 'manual'}) + return fetch(url, { redirect: 'manual' }) .then(response => response.headers.get('Location')) .then(location => followToAdoptium(location)) .then(location => downloadAll(tmpdir, location)) diff --git a/tests/test.js b/tests/test.js index 9803798..48879e5 100644 --- a/tests/test.js +++ b/tests/test.js @@ -16,7 +16,7 @@ describe('Install', () => { }).timeout(100000) it('should install JRE 14 from AdoptOpenJdk without throwing an error', () => { - return njre.install(14, { os: 'linux'}) + return njre.install(14, { os: 'linux' }) }).timeout(100000) it('should install JRE 20 from Eclipse Foundation without throwing an error', () => {