From 664df49451a2233495ef4af14c43420577f819da Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Apr 2026 19:04:56 +0000 Subject: [PATCH 1/3] fix(ignore): bump typescript from 5.9.3 to 6.0.2 Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.9.3 to 6.0.2. - [Release notes](https://github.com/microsoft/TypeScript/releases) - [Commits](https://github.com/microsoft/TypeScript/compare/v5.9.3...v6.0.2) --- updated-dependencies: - dependency-name: typescript dependency-version: 6.0.2 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index d71e1a17..13e8d025 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "@octokit/rest": "^22.0.1", "@types/node": "^25.6.0", "@vitest/coverage-v8": "^3.2.4", - "typescript": "^5.9.3", + "typescript": "^6.0.2", "vitest": "^3.2.4" }, "pnpm": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 94f04527..f11ae4c4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -31,8 +31,8 @@ importers: specifier: ^3.2.4 version: 3.2.4(vitest@3.2.4(@types/node@25.6.0)) typescript: - specifier: ^5.9.3 - version: 5.9.3 + specifier: ^6.0.2 + version: 6.0.2 vitest: specifier: ^3.2.4 version: 3.2.4(@types/node@25.6.0) @@ -838,8 +838,8 @@ packages: resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==} engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'} - typescript@5.9.3: - resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} + typescript@6.0.2: + resolution: {integrity: sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ==} engines: {node: '>=14.17'} hasBin: true @@ -1662,7 +1662,7 @@ snapshots: tunnel@0.0.6: {} - typescript@5.9.3: {} + typescript@6.0.2: {} undici-types@7.19.2: {} From afc0bc95580fa081961c1b034b193f11afdc91aa Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Mon, 13 Apr 2026 21:10:00 +0200 Subject: [PATCH 2/3] u --- src/ghw_check_ota_pr.ts | 2 +- src/ghw_concat_cacerts.ts | 2 +- src/ghw_create_autodl_release.ts | 3 +-- src/ghw_create_pr_to_default.ts | 2 +- src/ghw_get_changed_ota_files.ts | 2 +- src/ghw_identify_stacks.ts | 2 +- src/ghw_overwrite_cache.ts | 2 +- src/ghw_process_ota_files.ts | 3 +-- src/ghw_report_ota_pr.ts | 2 +- src/ghw_reprocess_all_images.ts | 3 +-- src/ghw_run_autodl.ts | 2 +- src/ghw_update_manifests.ts | 2 +- src/process_firmware_image.ts | 2 +- src/types.ts | 5 +++++ tsconfig.json | 3 ++- 15 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/ghw_check_ota_pr.ts b/src/ghw_check_ota_pr.ts index 929cb911..40123452 100644 --- a/src/ghw_check_ota_pr.ts +++ b/src/ghw_check_ota_pr.ts @@ -1,7 +1,6 @@ import assert from "node:assert"; import {existsSync, mkdirSync, writeFileSync} from "node:fs"; import type * as CoreApi from "@actions/core"; -import type {Context} from "@actions/github/lib/context"; import type {Octokit} from "@octokit/rest"; import { @@ -17,6 +16,7 @@ import { } from "./common.js"; import {getChangedOtaFiles} from "./ghw_get_changed_ota_files.js"; import {processOtaFiles} from "./ghw_process_ota_files.js"; +import type {Context} from "./types"; function throwError(comment: string): void { writeFileSync(PR_ARTIFACT_ERROR_FILEPATH, comment); diff --git a/src/ghw_concat_cacerts.ts b/src/ghw_concat_cacerts.ts index bc886557..f234ac9d 100644 --- a/src/ghw_concat_cacerts.ts +++ b/src/ghw_concat_cacerts.ts @@ -1,8 +1,8 @@ import {readdirSync, readFileSync, writeFileSync} from "node:fs"; import path from "node:path"; import type * as CoreApi from "@actions/core"; -import type {Context} from "@actions/github/lib/context"; import type {Octokit} from "@octokit/rest"; +import type {Context} from "./types"; export const CACERTS_DIR = "cacerts"; export const CACERTS_CONCAT_FILEPATH = "cacerts.pem"; diff --git a/src/ghw_create_autodl_release.ts b/src/ghw_create_autodl_release.ts index 7e4aa099..413bc2c4 100644 --- a/src/ghw_create_autodl_release.ts +++ b/src/ghw_create_autodl_release.ts @@ -1,8 +1,7 @@ import type * as CoreApi from "@actions/core"; -import type {Context} from "@actions/github/lib/context"; import type {Octokit} from "@octokit/rest"; import {BASE_IMAGES_DIR, BASE_INDEX_MANIFEST_FILENAME, execute, PREV_IMAGES_DIR, PREV_INDEX_MANIFEST_FILENAME, readManifest} from "./common.js"; -import type {RepoImageMeta} from "./types.js"; +import type {Context, RepoImageMeta} from "./types.js"; // about 3 lines const MAX_RELEASE_NOTES_LENGTH = 380; diff --git a/src/ghw_create_pr_to_default.ts b/src/ghw_create_pr_to_default.ts index 3a4954b8..e1b675de 100644 --- a/src/ghw_create_pr_to_default.ts +++ b/src/ghw_create_pr_to_default.ts @@ -1,7 +1,7 @@ import assert from "node:assert"; import type * as CoreApi from "@actions/core"; -import type {Context} from "@actions/github/lib/context"; import type {Octokit} from "@octokit/rest"; +import type {Context} from "./types"; const IGNORE_OTA_WORKFLOW_LABEL = "ignore-ota-workflow"; diff --git a/src/ghw_get_changed_ota_files.ts b/src/ghw_get_changed_ota_files.ts index 4bc41412..f5c4ce16 100644 --- a/src/ghw_get_changed_ota_files.ts +++ b/src/ghw_get_changed_ota_files.ts @@ -1,9 +1,9 @@ import assert from "node:assert"; import type * as CoreApi from "@actions/core"; -import type {Context} from "@actions/github/lib/context"; import type {Octokit} from "@octokit/rest"; import {BASE_IMAGES_DIR} from "./common.js"; +import type {Context} from "./types"; export async function getChangedOtaFiles( github: Octokit, diff --git a/src/ghw_identify_stacks.ts b/src/ghw_identify_stacks.ts index 7ec17a8f..5b46e32d 100644 --- a/src/ghw_identify_stacks.ts +++ b/src/ghw_identify_stacks.ts @@ -1,10 +1,10 @@ import {readFileSync, writeFileSync} from "node:fs"; import {join} from "node:path"; import type * as CoreApi from "@actions/core"; -import type {Context} from "@actions/github/lib/context"; import type {Octokit} from "@octokit/rest"; import {BASE_INDEX_MANIFEST_FILENAME, BASE_REPO_URL, parseImageHeader, REPO_BRANCH, readManifest, UPGRADE_FILE_IDENTIFIER} from "./common.js"; +import type {Context} from "./types"; enum ZigbeeStackVersion { Zigbee2006 = 0x0000, diff --git a/src/ghw_overwrite_cache.ts b/src/ghw_overwrite_cache.ts index ef74368c..674212f4 100644 --- a/src/ghw_overwrite_cache.ts +++ b/src/ghw_overwrite_cache.ts @@ -1,9 +1,9 @@ import {existsSync, mkdirSync} from "node:fs"; import type * as CoreApi from "@actions/core"; -import type {Context} from "@actions/github/lib/context"; import type {Octokit} from "@octokit/rest"; import {ALL_AUTODL_MANUFACTURERS, CACHE_DIR} from "./common.js"; +import type {Context} from "./types"; export async function overwriteCache(_github: Octokit, core: typeof CoreApi, _context: Context, manufacturersCSV?: string): Promise { if (!existsSync(CACHE_DIR)) { diff --git a/src/ghw_process_ota_files.ts b/src/ghw_process_ota_files.ts index 5b213ed6..bbeb5ad4 100644 --- a/src/ghw_process_ota_files.ts +++ b/src/ghw_process_ota_files.ts @@ -2,7 +2,6 @@ import assert from "node:assert"; import {readFileSync, renameSync} from "node:fs"; import path from "node:path"; import type * as CoreApi from "@actions/core"; -import type {Context} from "@actions/github/lib/context"; import type {Octokit} from "@octokit/rest"; import { addImageToBase, @@ -17,7 +16,7 @@ import { parseImageHeader, UPGRADE_FILE_IDENTIFIER, } from "./common.js"; -import type {ExtraMetas, GHExtraMetas, RepoImageMeta} from "./types.js"; +import type {Context, ExtraMetas, GHExtraMetas, RepoImageMeta} from "./types.js"; const GLEDOPTO_MANUFACTURER_CODE = 4687; const TUYA_MANUFACTURER_CODE_1 = 4098; diff --git a/src/ghw_report_ota_pr.ts b/src/ghw_report_ota_pr.ts index 41feec72..49099d6f 100644 --- a/src/ghw_report_ota_pr.ts +++ b/src/ghw_report_ota_pr.ts @@ -1,10 +1,10 @@ import assert from "node:assert"; import {existsSync, readFileSync, writeFileSync} from "node:fs"; import type * as CoreApi from "@actions/core"; -import type {Context} from "@actions/github/lib/context"; import type {Octokit} from "@octokit/rest"; import {execute, PR_ARTIFACT_DIR, PR_DIFF_FILENAME, PR_ERROR_FILENAME, PR_NUMBER_FILENAME} from "./common.js"; +import type {Context} from "./types"; export async function reportOtaPR(github: Octokit, core: typeof CoreApi, context: Context): Promise { assert(context.payload.workflow_run, "Not a workflow run"); diff --git a/src/ghw_reprocess_all_images.ts b/src/ghw_reprocess_all_images.ts index aa6a8de3..fcb624d7 100644 --- a/src/ghw_reprocess_all_images.ts +++ b/src/ghw_reprocess_all_images.ts @@ -1,7 +1,6 @@ import {existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, writeFileSync} from "node:fs"; import path from "node:path"; import type * as CoreApi from "@actions/core"; -import type {Context} from "@actions/github/lib/context"; import type {Octokit} from "@octokit/rest"; import { addImageToBase, @@ -24,7 +23,7 @@ import { UPGRADE_FILE_IDENTIFIER, writeManifest, } from "./common.js"; -import type {RepoImageMeta} from "./types"; +import type {Context, RepoImageMeta} from "./types"; /** These are now handled by autodl */ const IGNORE_3RD_PARTIES = ["https://github.com/fairecasoimeme/", "https://github.com/xyzroe/"]; diff --git a/src/ghw_run_autodl.ts b/src/ghw_run_autodl.ts index 68ce9eeb..fc150d1c 100644 --- a/src/ghw_run_autodl.ts +++ b/src/ghw_run_autodl.ts @@ -1,9 +1,9 @@ import {existsSync, mkdirSync, rmSync} from "node:fs"; import type * as CoreApi from "@actions/core"; -import type {Context} from "@actions/github/lib/context"; import type {Octokit} from "@octokit/rest"; import {ALL_AUTODL_MANUFACTURERS, BASE_INDEX_MANIFEST_FILENAME, CACHE_DIR, PREV_INDEX_MANIFEST_FILENAME, TMP_DIR, writeManifest} from "./common.js"; +import type {Context} from "./types"; export async function runAutodl(_github: Octokit, core: typeof CoreApi, _context: Context, manufacturersCSV?: string): Promise { const manufacturers = manufacturersCSV ? manufacturersCSV.trim().split(",") : ALL_AUTODL_MANUFACTURERS; diff --git a/src/ghw_update_manifests.ts b/src/ghw_update_manifests.ts index 5457dfb3..3c456b3b 100644 --- a/src/ghw_update_manifests.ts +++ b/src/ghw_update_manifests.ts @@ -1,11 +1,11 @@ import assert from "node:assert"; import type * as CoreApi from "@actions/core"; -import type {Context} from "@actions/github/lib/context"; import type {Octokit} from "@octokit/rest"; import {BASE_INDEX_MANIFEST_FILENAME, PREV_INDEX_MANIFEST_FILENAME, readManifest, writeManifest} from "./common.js"; import {getChangedOtaFiles} from "./ghw_get_changed_ota_files.js"; import {processOtaFiles} from "./ghw_process_ota_files.js"; +import type {Context} from "./types"; export async function updateManifests(github: Octokit, core: typeof CoreApi, context: Context): Promise { assert(context.eventName === "push", "Not a push"); diff --git a/src/process_firmware_image.ts b/src/process_firmware_image.ts index 870d074b..fe478d4d 100644 --- a/src/process_firmware_image.ts +++ b/src/process_firmware_image.ts @@ -19,7 +19,7 @@ import { UPGRADE_FILE_IDENTIFIER, writeManifest, } from "./common.js"; -import type {ExtraMetas} from "./types"; +import type {ExtraMetas} from "./types.js"; export enum ProcessFirmwareImageStatus { Error = -1, diff --git a/src/types.ts b/src/types.ts index a634e3e2..f78e5397 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,3 +1,8 @@ +// Was originally imported from `@actions/github/lib/context` but this +// path is not exported by the library. +import type {context as _githubContext} from "@actions/github"; +export type Context = typeof _githubContext; + //-- Copied from ZHC export interface Version { imageType: number; diff --git a/tsconfig.json b/tsconfig.json index 7c18c232..6de366fb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,9 +3,10 @@ "rootDir": "src", "outDir": "dist", "module": "ESNext", - "moduleResolution": "node10", + "moduleResolution": "bundler", "target": "ESNext", "lib": ["ESNext"], + "types": ["node"], "esModuleInterop": true, "declaration": true, "declarationMap": true, From 1ba62d8421f42e612217936688397e6ab6135867 Mon Sep 17 00:00:00 2001 From: Nerivec <62446222+Nerivec@users.noreply.github.com> Date: Mon, 13 Apr 2026 23:35:24 +0200 Subject: [PATCH 3/3] fix: nodenext --- biome.json | 2 +- src/autodl/gammatroniques.ts | 2 +- src/check_images.ts | 2 +- src/common.ts | 2 +- src/find_matches.ts | 4 ++-- src/ghw_check_ota_pr.ts | 2 +- src/ghw_concat_cacerts.ts | 2 +- src/ghw_create_pr_to_default.ts | 2 +- src/ghw_get_changed_ota_files.ts | 2 +- src/ghw_identify_stacks.ts | 2 +- src/ghw_overwrite_cache.ts | 2 +- src/ghw_report_ota_pr.ts | 2 +- src/ghw_reprocess_all_images.ts | 2 +- src/ghw_run_autodl.ts | 2 +- src/ghw_update_manifests.ts | 2 +- src/types.ts | 7 +++---- tests/data.test.ts | 4 ++-- tests/ghw_check_ota_pr.test.ts | 9 ++++----- tests/ghw_reprocess_all_images.test.ts | 9 ++++----- tests/ghw_update_manifests.test.ts | 9 ++++----- tests/process_firmware_image.test.ts | 8 ++++---- tsconfig.json | 4 ++-- 22 files changed, 39 insertions(+), 43 deletions(-) diff --git a/biome.json b/biome.json index 6916406f..f440f3ad 100644 --- a/biome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/2.4.6/schema.json", + "$schema": "https://biomejs.dev/schemas/2.4.11/schema.json", "vcs": { "enabled": true, "clientKind": "git", diff --git a/src/autodl/gammatroniques.ts b/src/autodl/gammatroniques.ts index de1db7ae..bcbccdfe 100644 --- a/src/autodl/gammatroniques.ts +++ b/src/autodl/gammatroniques.ts @@ -64,7 +64,7 @@ export async function download(): Promise { const appUrl: ImagesJsonBuildPart | undefined = page.builds[0].parts.find((part) => part.type === "app"); - if (!appUrl || !appUrl.ota) { + if (!appUrl?.ota) { console.error(`${logPrefix} No image found.`); continue; } diff --git a/src/check_images.ts b/src/check_images.ts index 15a2b3a1..aca3fa8d 100644 --- a/src/check_images.ts +++ b/src/check_images.ts @@ -1,6 +1,6 @@ import {existsSync} from "node:fs"; import {join} from "node:path"; -import {BASE_INDEX_MANIFEST_FILENAME, BASE_REPO_URL, PREV_INDEX_MANIFEST_FILENAME, REPO_BRANCH, readManifest} from "./common"; +import {BASE_INDEX_MANIFEST_FILENAME, BASE_REPO_URL, PREV_INDEX_MANIFEST_FILENAME, REPO_BRANCH, readManifest} from "./common.js"; const baseManifest = readManifest(BASE_INDEX_MANIFEST_FILENAME); diff --git a/src/common.ts b/src/common.ts index ff692124..ffd14fa2 100644 --- a/src/common.ts +++ b/src/common.ts @@ -3,7 +3,7 @@ import {exec} from "node:child_process"; import {createHash} from "node:crypto"; import {existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync} from "node:fs"; import path from "node:path"; -import type {ExtraMetas, ExtraMetasWithFileName, ImageHeader, RepoImageMeta} from "./types"; +import type {ExtraMetas, ExtraMetasWithFileName, ImageHeader, RepoImageMeta} from "./types.js"; export const UPGRADE_FILE_IDENTIFIER = Buffer.from([0x1e, 0xf1, 0xee, 0x0b]); export const BASE_REPO_URL = "https://raw.githubusercontent.com/Koenkk/zigbee-OTA/"; diff --git a/src/find_matches.ts b/src/find_matches.ts index 130d8538..36970670 100644 --- a/src/find_matches.ts +++ b/src/find_matches.ts @@ -1,5 +1,5 @@ -import {BASE_INDEX_MANIFEST_FILENAME, PREV_INDEX_MANIFEST_FILENAME, readManifest} from "./common"; -import type {RepoImageMeta} from "./types"; +import {BASE_INDEX_MANIFEST_FILENAME, PREV_INDEX_MANIFEST_FILENAME, readManifest} from "./common.js"; +import type {RepoImageMeta} from "./types.js"; const USAGE = `Usage: tsx src/find_matches.ts [modelId] [manufacturerName] Examples: diff --git a/src/ghw_check_ota_pr.ts b/src/ghw_check_ota_pr.ts index 40123452..90a30373 100644 --- a/src/ghw_check_ota_pr.ts +++ b/src/ghw_check_ota_pr.ts @@ -16,7 +16,7 @@ import { } from "./common.js"; import {getChangedOtaFiles} from "./ghw_get_changed_ota_files.js"; import {processOtaFiles} from "./ghw_process_ota_files.js"; -import type {Context} from "./types"; +import type {Context} from "./types.js"; function throwError(comment: string): void { writeFileSync(PR_ARTIFACT_ERROR_FILEPATH, comment); diff --git a/src/ghw_concat_cacerts.ts b/src/ghw_concat_cacerts.ts index f234ac9d..b7db4bb6 100644 --- a/src/ghw_concat_cacerts.ts +++ b/src/ghw_concat_cacerts.ts @@ -2,7 +2,7 @@ import {readdirSync, readFileSync, writeFileSync} from "node:fs"; import path from "node:path"; import type * as CoreApi from "@actions/core"; import type {Octokit} from "@octokit/rest"; -import type {Context} from "./types"; +import type {Context} from "./types.js"; export const CACERTS_DIR = "cacerts"; export const CACERTS_CONCAT_FILEPATH = "cacerts.pem"; diff --git a/src/ghw_create_pr_to_default.ts b/src/ghw_create_pr_to_default.ts index e1b675de..1cdc0919 100644 --- a/src/ghw_create_pr_to_default.ts +++ b/src/ghw_create_pr_to_default.ts @@ -1,7 +1,7 @@ import assert from "node:assert"; import type * as CoreApi from "@actions/core"; import type {Octokit} from "@octokit/rest"; -import type {Context} from "./types"; +import type {Context} from "./types.js"; const IGNORE_OTA_WORKFLOW_LABEL = "ignore-ota-workflow"; diff --git a/src/ghw_get_changed_ota_files.ts b/src/ghw_get_changed_ota_files.ts index f5c4ce16..d917b3cd 100644 --- a/src/ghw_get_changed_ota_files.ts +++ b/src/ghw_get_changed_ota_files.ts @@ -3,7 +3,7 @@ import type * as CoreApi from "@actions/core"; import type {Octokit} from "@octokit/rest"; import {BASE_IMAGES_DIR} from "./common.js"; -import type {Context} from "./types"; +import type {Context} from "./types.js"; export async function getChangedOtaFiles( github: Octokit, diff --git a/src/ghw_identify_stacks.ts b/src/ghw_identify_stacks.ts index 5b46e32d..0ac98056 100644 --- a/src/ghw_identify_stacks.ts +++ b/src/ghw_identify_stacks.ts @@ -4,7 +4,7 @@ import type * as CoreApi from "@actions/core"; import type {Octokit} from "@octokit/rest"; import {BASE_INDEX_MANIFEST_FILENAME, BASE_REPO_URL, parseImageHeader, REPO_BRANCH, readManifest, UPGRADE_FILE_IDENTIFIER} from "./common.js"; -import type {Context} from "./types"; +import type {Context} from "./types.js"; enum ZigbeeStackVersion { Zigbee2006 = 0x0000, diff --git a/src/ghw_overwrite_cache.ts b/src/ghw_overwrite_cache.ts index 674212f4..3f44a3bf 100644 --- a/src/ghw_overwrite_cache.ts +++ b/src/ghw_overwrite_cache.ts @@ -3,7 +3,7 @@ import type * as CoreApi from "@actions/core"; import type {Octokit} from "@octokit/rest"; import {ALL_AUTODL_MANUFACTURERS, CACHE_DIR} from "./common.js"; -import type {Context} from "./types"; +import type {Context} from "./types.js"; export async function overwriteCache(_github: Octokit, core: typeof CoreApi, _context: Context, manufacturersCSV?: string): Promise { if (!existsSync(CACHE_DIR)) { diff --git a/src/ghw_report_ota_pr.ts b/src/ghw_report_ota_pr.ts index 49099d6f..b1a85699 100644 --- a/src/ghw_report_ota_pr.ts +++ b/src/ghw_report_ota_pr.ts @@ -4,7 +4,7 @@ import type * as CoreApi from "@actions/core"; import type {Octokit} from "@octokit/rest"; import {execute, PR_ARTIFACT_DIR, PR_DIFF_FILENAME, PR_ERROR_FILENAME, PR_NUMBER_FILENAME} from "./common.js"; -import type {Context} from "./types"; +import type {Context} from "./types.js"; export async function reportOtaPR(github: Octokit, core: typeof CoreApi, context: Context): Promise { assert(context.payload.workflow_run, "Not a workflow run"); diff --git a/src/ghw_reprocess_all_images.ts b/src/ghw_reprocess_all_images.ts index fcb624d7..8c53de20 100644 --- a/src/ghw_reprocess_all_images.ts +++ b/src/ghw_reprocess_all_images.ts @@ -23,7 +23,7 @@ import { UPGRADE_FILE_IDENTIFIER, writeManifest, } from "./common.js"; -import type {Context, RepoImageMeta} from "./types"; +import type {Context, RepoImageMeta} from "./types.js"; /** These are now handled by autodl */ const IGNORE_3RD_PARTIES = ["https://github.com/fairecasoimeme/", "https://github.com/xyzroe/"]; diff --git a/src/ghw_run_autodl.ts b/src/ghw_run_autodl.ts index fc150d1c..56603526 100644 --- a/src/ghw_run_autodl.ts +++ b/src/ghw_run_autodl.ts @@ -3,7 +3,7 @@ import type * as CoreApi from "@actions/core"; import type {Octokit} from "@octokit/rest"; import {ALL_AUTODL_MANUFACTURERS, BASE_INDEX_MANIFEST_FILENAME, CACHE_DIR, PREV_INDEX_MANIFEST_FILENAME, TMP_DIR, writeManifest} from "./common.js"; -import type {Context} from "./types"; +import type {Context} from "./types.js"; export async function runAutodl(_github: Octokit, core: typeof CoreApi, _context: Context, manufacturersCSV?: string): Promise { const manufacturers = manufacturersCSV ? manufacturersCSV.trim().split(",") : ALL_AUTODL_MANUFACTURERS; diff --git a/src/ghw_update_manifests.ts b/src/ghw_update_manifests.ts index 3c456b3b..8f5f721a 100644 --- a/src/ghw_update_manifests.ts +++ b/src/ghw_update_manifests.ts @@ -5,7 +5,7 @@ import type {Octokit} from "@octokit/rest"; import {BASE_INDEX_MANIFEST_FILENAME, PREV_INDEX_MANIFEST_FILENAME, readManifest, writeManifest} from "./common.js"; import {getChangedOtaFiles} from "./ghw_get_changed_ota_files.js"; import {processOtaFiles} from "./ghw_process_ota_files.js"; -import type {Context} from "./types"; +import type {Context} from "./types.js"; export async function updateManifests(github: Octokit, core: typeof CoreApi, context: Context): Promise { assert(context.eventName === "push", "Not a push"); diff --git a/src/types.ts b/src/types.ts index f78e5397..f26c2272 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,7 +1,6 @@ -// Was originally imported from `@actions/github/lib/context` but this -// path is not exported by the library. -import type {context as _githubContext} from "@actions/github"; -export type Context = typeof _githubContext; +// XXX: workaround, `Context` no longer exported in v9+ +import type {context as githubContext} from "@actions/github"; +export type Context = typeof githubContext; //-- Copied from ZHC export interface Version { diff --git a/tests/data.test.ts b/tests/data.test.ts index 2e26528f..c09154a1 100644 --- a/tests/data.test.ts +++ b/tests/data.test.ts @@ -8,8 +8,8 @@ import {copyFileSync, existsSync, mkdirSync} from "node:fs"; import path from "node:path"; import {it} from "vitest"; -import * as common from "../src/common"; -import type {ExtraMetas, RepoImageMeta} from "../src/types"; +import * as common from "../src/common.js"; +import type {ExtraMetas, RepoImageMeta} from "../src/types.js"; export const IMAGE_LUMI = "20240726111155_OTA_lumi.switch.n1aeu1_0.0.0_0025_20240725_8F4299.ota"; export const IMAGE_GLEDOPTO = "GL-B-008P_V17A1_OTAV7.ota"; diff --git a/tests/ghw_check_ota_pr.test.ts b/tests/ghw_check_ota_pr.test.ts index b6e2e478..302e05f5 100644 --- a/tests/ghw_check_ota_pr.test.ts +++ b/tests/ghw_check_ota_pr.test.ts @@ -1,12 +1,11 @@ import {existsSync, readFileSync, rmSync, writeFileSync} from "node:fs"; import path from "node:path"; import type * as CoreApi from "@actions/core"; -import type {Context} from "@actions/github/lib/context"; import type {Octokit} from "@octokit/rest"; import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, type MockInstance, vi} from "vitest"; -import * as common from "../src/common"; -import {checkOtaPR} from "../src/ghw_check_ota_pr"; -import type {RepoImageMeta} from "../src/types"; +import * as common from "../src/common.js"; +import {checkOtaPR} from "../src/ghw_check_ota_pr.js"; +import type {Context, RepoImageMeta} from "../src/types.js"; import { BASE_IMAGES_TEST_DIR_PATH, getAdjustedContent, @@ -29,7 +28,7 @@ import { PREV_IMAGES_TEST_DIR_PATH, useImage, withExtraMetas, -} from "./data.test"; +} from "./data.test.js"; const github = { rest: { diff --git a/tests/ghw_reprocess_all_images.test.ts b/tests/ghw_reprocess_all_images.test.ts index d7d5cfc6..5aa07033 100644 --- a/tests/ghw_reprocess_all_images.test.ts +++ b/tests/ghw_reprocess_all_images.test.ts @@ -1,16 +1,15 @@ import {copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync} from "node:fs"; import path from "node:path"; import type * as CoreApi from "@actions/core"; -import type {Context} from "@actions/github/lib/context"; import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, type MockInstance, vi} from "vitest"; -import * as common from "../src/common"; +import * as common from "../src/common.js"; import { NOT_IN_BASE_MANIFEST_IMAGES_DIR, NOT_IN_MANIFEST_FILENAME, NOT_IN_PREV_MANIFEST_IMAGES_DIR, reProcessAllImages, -} from "../src/ghw_reprocess_all_images"; -import type {RepoImageMeta} from "../src/types"; +} from "../src/ghw_reprocess_all_images.js"; +import type {Context, RepoImageMeta} from "../src/types.js"; import { BASE_IMAGES_TEST_DIR_PATH, getAdjustedContent, @@ -26,7 +25,7 @@ import { PREV_IMAGES_TEST_DIR_PATH, useImage, withExtraMetas, -} from "./data.test"; +} from "./data.test.js"; /** not used */ const github = {}; diff --git a/tests/ghw_update_manifests.test.ts b/tests/ghw_update_manifests.test.ts index 44cd797d..0893b551 100644 --- a/tests/ghw_update_manifests.test.ts +++ b/tests/ghw_update_manifests.test.ts @@ -1,11 +1,10 @@ import {rmSync} from "node:fs"; import type * as CoreApi from "@actions/core"; -import type {Context} from "@actions/github/lib/context"; import type {Octokit} from "@octokit/rest"; import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, type MockInstance, vi} from "vitest"; -import * as common from "../src/common"; -import {updateManifests} from "../src/ghw_update_manifests"; -import type {RepoImageMeta} from "../src/types"; +import * as common from "../src/common.js"; +import {updateManifests} from "../src/ghw_update_manifests.js"; +import type {Context, RepoImageMeta} from "../src/types.js"; import { BASE_IMAGES_TEST_DIR_PATH, getAdjustedContent, @@ -15,7 +14,7 @@ import { PREV_IMAGES_TEST_DIR_PATH, useImage, withExtraMetas, -} from "./data.test"; +} from "./data.test.js"; const github = { rest: { diff --git a/tests/process_firmware_image.test.ts b/tests/process_firmware_image.test.ts index 9abbf4a1..472e2049 100644 --- a/tests/process_firmware_image.test.ts +++ b/tests/process_firmware_image.test.ts @@ -1,8 +1,8 @@ import {existsSync, mkdirSync, readFileSync, rmSync} from "node:fs"; import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, type MockInstance, vi} from "vitest"; -import * as common from "../src/common"; -import {ProcessFirmwareImageStatus, processFirmwareImage} from "../src/process_firmware_image"; -import type {RepoImageMeta} from "../src/types"; +import * as common from "../src/common.js"; +import {ProcessFirmwareImageStatus, processFirmwareImage} from "../src/process_firmware_image.js"; +import type {RepoImageMeta} from "../src/types.js"; import { BASE_IMAGES_TEST_DIR_PATH, getAdjustedContent, @@ -20,7 +20,7 @@ import { PREV_IMAGES_TEST_DIR_PATH, useImage, withExtraMetas, -} from "./data.test"; +} from "./data.test.js"; describe("Process Firmware Image", () => { let baseManifest: RepoImageMeta[]; diff --git a/tsconfig.json b/tsconfig.json index 6de366fb..20fd1253 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,8 +2,8 @@ "compilerOptions": { "rootDir": "src", "outDir": "dist", - "module": "ESNext", - "moduleResolution": "bundler", + "module": "nodenext", + "moduleResolution": "nodenext", "target": "ESNext", "lib": ["ESNext"], "types": ["node"],