diff --git a/.github/workflows/update_dependencies.yml b/.github/workflows/update_dependencies.yml index 6e3fd02..98692cd 100644 --- a/.github/workflows/update_dependencies.yml +++ b/.github/workflows/update_dependencies.yml @@ -25,8 +25,8 @@ jobs: cache: pnpm - run: | - pnpm self-update - pnpm up --latest + pnpm self-update + pnpm up --latest - uses: peter-evans/create-pull-request@v7 id: cpr @@ -40,4 +40,4 @@ jobs: if: ${{ steps.cpr.outputs.pull-request-number }} with: issue-number: ${{ steps.cpr.outputs.pull-request-number }} - body: "CC: @Koenkk" \ No newline at end of file + body: 'CC: @Koenkk' diff --git a/src/autodl/github.ts b/src/autodl/github.ts index 8056803..6dc7303 100644 --- a/src/autodl/github.ts +++ b/src/autodl/github.ts @@ -66,7 +66,7 @@ export async function download(manufacturer: string, releasesUrl: string, assetF const release = getLatestImage(releases, sortByPublishedAt); if (release) { - const cachedData = readCacheJson(manufacturer); + const cachedData = readCacheJson(manufacturer); const cached = cachedData?.length ? getLatestImage(cachedData, sortByPublishedAt) : undefined; for (const assetFinder of assetFinders) { diff --git a/src/autodl/ikea.ts b/src/autodl/ikea.ts index f8f0b26..8ae681c 100644 --- a/src/autodl/ikea.ts +++ b/src/autodl/ikea.ts @@ -59,7 +59,7 @@ export async function download(): Promise { const images = await getJson(NAME, PRODUCTION_FIRMWARE_URL); if (images?.length) { - const cachedData = readCacheJson(NAME); + const cachedData = readCacheJson(NAME); for (const image of images) { if (image.fw_type !== 2) { diff --git a/src/autodl/ikea_new.ts b/src/autodl/ikea_new.ts index ca40bac..3d066e2 100644 --- a/src/autodl/ikea_new.ts +++ b/src/autodl/ikea_new.ts @@ -50,7 +50,7 @@ export async function download(): Promise { const images = await getJson(NAME, FIRMWARE_URL); if (images?.length) { - const cachedData = readCacheJson(CACHE_FILENAME); + const cachedData = readCacheJson(CACHE_FILENAME); for (const image of images) { if (image.fw_type !== 2) { diff --git a/src/autodl/inovelli.ts b/src/autodl/inovelli.ts index 7207e45..2aa10a9 100644 --- a/src/autodl/inovelli.ts +++ b/src/autodl/inovelli.ts @@ -41,7 +41,7 @@ export async function download(): Promise { const models = await getJson(NAME, FIRMWARE_URL); if (models) { - const cachedData = readCacheJson(NAME); + const cachedData = readCacheJson(NAME); for (const model in models) { if (model == '') { diff --git a/src/autodl/ledvance.ts b/src/autodl/ledvance.ts index c303a3b..39e901d 100644 --- a/src/autodl/ledvance.ts +++ b/src/autodl/ledvance.ts @@ -77,7 +77,7 @@ export async function download(): Promise { const images = await getJson(NAME, FIRMWARE_URL); if (images?.firmwares?.length) { - const cachedData = readCacheJson(NAME); + const cachedData = readCacheJson(NAME); const cachedDataByProduct = cachedData?.firmwares?.length ? groupByProduct(cachedData.firmwares) : undefined; const firmwareByProduct = groupByProduct(images.firmwares); diff --git a/src/autodl/salus.ts b/src/autodl/salus.ts index 7760835..5b95a4a 100644 --- a/src/autodl/salus.ts +++ b/src/autodl/salus.ts @@ -34,7 +34,7 @@ export async function download(): Promise { const images = await getJson(NAME, FIRMWARE_URL); if (images?.versions?.length) { - const cachedData = readCacheJson(NAME); + const cachedData = readCacheJson(NAME); for (const image of images.versions) { const archiveUrl = image.url; //.replace(/^http:\/\//, 'https://'); diff --git a/src/autodl/ubisys.ts b/src/autodl/ubisys.ts index 7a931ba..db9ca04 100644 --- a/src/autodl/ubisys.ts +++ b/src/autodl/ubisys.ts @@ -71,7 +71,7 @@ export async function download(): Promise { if (pageText?.length) { const images = parseText(pageText); const imagesByType = groupByImageType(images); - const cachedData = readCacheJson(NAME); + const cachedData = readCacheJson(NAME); const cachedDataByType = cachedData ? groupByImageType(cachedData) : undefined; for (const imageType in imagesByType) { diff --git a/src/common.ts b/src/common.ts index 4b6f6cb..c10528e 100644 --- a/src/common.ts +++ b/src/common.ts @@ -93,7 +93,7 @@ export function writeCacheJson(fileName: string, contents: T, basePath: strin writeFileSync(path.join(basePath, `${fileName}.json`), JSON.stringify(contents), 'utf8'); } -export function readCacheJson(fileName: string, basePath: string = CACHE_DIR): T { +export function readCacheJson(fileName: string, basePath: string = CACHE_DIR): T | undefined { const filePath = path.join(basePath, `${fileName}.json`); return existsSync(filePath) ? JSON.parse(readFileSync(filePath, 'utf8')) : undefined;