From 7538ab752e818be38310183a73e6be33b844da10 Mon Sep 17 00:00:00 2001 From: Jeff Date: Mon, 28 Oct 2024 20:46:52 -0600 Subject: [PATCH] Use isbn package from library-pals --- actions/read/package.json | 2 +- actions/read/src/index.js | 21 +++++++++++---------- pnpm-lock.yaml | 35 +++++++++++++++++++---------------- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/actions/read/package.json b/actions/read/package.json index 4a20cb27..b382444a 100644 --- a/actions/read/package.json +++ b/actions/read/package.json @@ -14,7 +14,7 @@ "dependencies": { "@actions/core": "1.10.1", "@actions/github": "6.0.0", - "node-isbn": "1.6.1" + "@library-pals/isbn": "1.3.2" }, "devDependencies": { "@vercel/ncc": "0.38.1", diff --git a/actions/read/src/index.js b/actions/read/src/index.js index 684e62a5..a662d78c 100644 --- a/actions/read/src/index.js +++ b/actions/read/src/index.js @@ -2,7 +2,7 @@ import { readFile, writeFile } from 'node:fs/promises' import { exportVariable, getInput, setFailed } from '@actions/core' import * as github from '@actions/github' -import isbn from 'node-isbn' +import Isbn from '@library-pals/isbn' import { checkBook } from './check-book.js' @@ -39,7 +39,7 @@ export async function read() { /** @type {Array} */ let providers = getInput('providers') ? getInput('providers').split(',') - : isbn._providers + : new Isbn()._providers let thumbnailWidth = getInput('thumbnail-width') ? Number.parseInt(getInput('thumbnail-width'), 10) : undefined @@ -71,14 +71,15 @@ export async function read() { return book }) } else { - let newBook = await isbn - .provider(providers) - .resolve(bookIsbn) - .catch((error) => { - throw new Error( - `Book (${bookIsbn}) not found. ${error.message}`, - ) - }) + let newBook + + try { + newBook = await Isbn.provider(providers).resolve(bookIsbn) + } catch (error) { + throw new Error( + `Book (${bookIsbn}) not found. ${error.message}`, + ) + } newBook = checkBook(newBook, { bookIsbn, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 63f0cae8..e0fc7f5f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -59,9 +59,9 @@ importers: '@actions/github': specifier: 6.0.0 version: 6.0.0 - node-isbn: - specifier: 1.6.1 - version: 1.6.1 + '@library-pals/isbn': + specifier: 1.3.2 + version: 1.3.2 devDependencies: '@vercel/ncc': specifier: 0.38.1 @@ -3685,6 +3685,15 @@ packages: '@lezer/lr': 1.3.14 dev: false + /@library-pals/isbn@1.3.2: + resolution: {integrity: sha512-CxzG2dEr0vRb/sC4VJvzb+ktUhZcyNKwDvBoGT6CxrAjyA+GEXkxY8jzM6dhf29Lq+zl4TyUK4MBBc6dz/LJOQ==} + engines: {node: '>=20.0.0'} + dependencies: + axios: 1.7.2 + transitivePeerDependencies: + - debug + dev: false + /@nodelib/fs.scandir@2.1.5: resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -5556,18 +5565,20 @@ packages: engines: {node: '>= 0.4'} dev: true - /axios@0.21.4: - resolution: {integrity: sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==} + /axios@1.6.2: + resolution: {integrity: sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==} dependencies: follow-redirects: 1.15.3(debug@4.3.4) + form-data: 4.0.0 + proxy-from-env: 1.1.0 transitivePeerDependencies: - debug dev: false - /axios@1.6.2: - resolution: {integrity: sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==} + /axios@1.7.2: + resolution: {integrity: sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==} dependencies: - follow-redirects: 1.15.3(debug@4.3.4) + follow-redirects: 1.15.6(debug@3.2.7) form-data: 4.0.0 proxy-from-env: 1.1.0 transitivePeerDependencies: @@ -9195,14 +9206,6 @@ packages: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: true - /node-isbn@1.6.1: - resolution: {integrity: sha512-OHxpA5xfi7K0iTbqxPpeGlueRA3dasHDRwaKkCWkscLoaKvI8e4mn8yfHrYL0zCJhWq8A2cdrZNbAsHvm7ASwg==} - dependencies: - axios: 0.21.4 - transitivePeerDependencies: - - debug - dev: false - /node-machine-id@1.1.12: resolution: {integrity: sha512-QNABxbrPa3qEIfrE6GOJ7BYIuignnJw7iQ2YPbc3Nla1HzRJjXzZOiikfF8m7eAMfichLt3M4VgLOetqgDmgGQ==} dev: false