build: update npm dependencies (#689)

## Summary

Update all direct npm dependencies and devDependencies to the current
npm latest versions and pin them exactly instead of using caret or tilde
ranges.

## Changes

- Pin all direct runtime and development package versions in
`package.json` and refresh `package-lock.json`.
- Migrate ESLint from `.eslintrc.json` to flat config for ESLint 10.
- Update Jest and TypeScript configuration and test mocks to support the
latest ESM-only packages.
- Add response status handling and typed JSON access for the latest
`node-fetch` types.

## Checklist

- [x] I have read the latest README and followed the instructions.
- [x] I have added or updated tests for behavior changes.
- [x] I have updated README.md and action.yml when inputs or runtime
behavior changed.
- [x] I have run the relevant verification commands.

## Verification

- [x] `npm --userconfig=/private/tmp/empty-npmrc outdated --json
--include=dev` returned `{}`
- [x] `npm run all`
- [x] `npm run build`


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Tests**
* Added comprehensive test mocks for Actions APIs and fetch, improved
integration tests, and updated assertions for more precise error
validation.
  * Configured Jest to map external modules to local test mocks.

* **Chores**
* Migrated ESLint to the flat config format and replaced prior ESLint
config.
* Updated project dependencies and modernized TypeScript compiler
settings.

* **Refactor**
* Adjusted exported tool constants and made error handling more explicit
in version-fetching logic.

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/peaceiris/actions-hugo/pull/689)
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Shohei Ueda
2026-05-10 23:30:59 +09:00
committed by GitHub
co-authored by Codex
parent e3c35ac635
commit 189731ef00
17 changed files with 7709 additions and 13417 deletions
+9 -9
View File
@@ -1,12 +1,12 @@
export enum Tool {
Name = 'Hugo',
Org = 'gohugoio',
Repo = 'hugo',
CmdName = 'hugo',
CmdOptVersion = 'version',
TestVersionLatest = '0.83.1',
TestVersionSpec = '0.82.1'
}
export const Tool = {
Name: 'Hugo',
Org: 'gohugoio',
Repo: 'hugo',
CmdName: 'hugo',
CmdOptVersion: 'version',
TestVersionLatest: '0.83.1',
TestVersionSpec: '0.82.1'
} as const;
export enum Action {
WorkDirName = 'actions_hugo',
+17 -3
View File
@@ -1,4 +1,14 @@
import fetch from 'node-fetch';
import fetch, {FetchError} from 'node-fetch';
interface BrewFormulaResponse {
versions: {
stable: string;
};
}
interface GitHubReleaseResponse {
tag_name: string;
}
export function getURL(org: string, repo: string, api: string): string {
let url = '';
@@ -15,12 +25,16 @@ export function getURL(org: string, repo: string, api: string): string {
export async function getLatestVersion(org: string, repo: string, api: string): Promise<string> {
const url = getURL(org, repo, api);
const response = await fetch(url);
if (!response.ok) {
throw new FetchError(`request to ${url} failed with status ${response.status}`, 'system');
}
const json = await response.json();
let latestVersion = '';
if (api === 'brew') {
latestVersion = json.versions.stable;
latestVersion = (json as BrewFormulaResponse).versions.stable;
} else if (api === 'github') {
latestVersion = json.tag_name;
latestVersion = (json as GitHubReleaseResponse).tag_name;
}
return latestVersion;
}