From fdbbc5ba42c46ab438fd793c60606e6424f5048f Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Fri, 18 Sep 2026 16:23:36 +0700 Subject: [PATCH] refactor(scripts): unify module extensions on .js The root package.json already declares "type": "module", so a .js file here is ESM and the .mjs suffix only restates what the manifest states. Renames the three GitHub Actions scripts and follows every reference, including the six JSDoc import("...") type annotations that would otherwise degrade to any without throwing. --- .github/scripts/lib/{github-api.mjs => github-api.js} | 0 .../lib/{render-projects.mjs => render-projects.js} | 8 ++++---- .../{update-projects-list.mjs => update-projects-list.js} | 8 ++++---- .github/workflows/update-projects.yml | 2 +- package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) rename .github/scripts/lib/{github-api.mjs => github-api.js} (100%) rename .github/scripts/lib/{render-projects.mjs => render-projects.js} (92%) rename .github/scripts/{update-projects-list.mjs => update-projects-list.js} (94%) diff --git a/.github/scripts/lib/github-api.mjs b/.github/scripts/lib/github-api.js similarity index 100% rename from .github/scripts/lib/github-api.mjs rename to .github/scripts/lib/github-api.js diff --git a/.github/scripts/lib/render-projects.mjs b/.github/scripts/lib/render-projects.js similarity index 92% rename from .github/scripts/lib/render-projects.mjs rename to .github/scripts/lib/render-projects.js index 367e38d..4393869 100644 --- a/.github/scripts/lib/render-projects.mjs +++ b/.github/scripts/lib/render-projects.js @@ -3,7 +3,7 @@ /** * Public URL of a repo: its declared homepage, else its GitHub Pages URL when * Pages is enabled. Returns an empty string when the repo has neither. - * @param {import("./github-api.mjs").Repo} repo + * @param {import("./github-api.js").Repo} repo * @returns {string} */ export function resolveUrl(repo) { @@ -48,7 +48,7 @@ function table(headers, rows) { /** * Repos with at least one star, most-starred first. - * @param {import("./github-api.mjs").Repo[]} repos + * @param {import("./github-api.js").Repo[]} repos * @returns {string[]} */ export function renderStarred(repos) { @@ -63,7 +63,7 @@ export function renderStarred(repos) { /** * Repos with a live demo URL. - * @param {import("./github-api.mjs").Repo[]} repos + * @param {import("./github-api.js").Repo[]} repos * @returns {string[]} */ export function renderDemo(repos) { @@ -77,7 +77,7 @@ export function renderDemo(repos) { /** * Repos owned by others, by merged pull request count. - * @param {import("./github-api.mjs").Contribution[]} contributions + * @param {import("./github-api.js").Contribution[]} contributions * @returns {string[]} */ export function renderContributed(contributions) { diff --git a/.github/scripts/update-projects-list.mjs b/.github/scripts/update-projects-list.js similarity index 94% rename from .github/scripts/update-projects-list.mjs rename to .github/scripts/update-projects-list.js index 16518e5..4b70b69 100644 --- a/.github/scripts/update-projects-list.mjs +++ b/.github/scripts/update-projects-list.js @@ -15,14 +15,14 @@ import fs from "node:fs/promises"; import path from "node:path"; -import { GitHubProjects } from "./lib/github-api.mjs"; +import { GitHubProjects } from "./lib/github-api.js"; import { injectBlock, renderContributed, renderDemo, renderStarred, resolveUrl, -} from "./lib/render-projects.mjs"; +} from "./lib/render-projects.js"; const PAGE = "content/page/projects/index.md"; @@ -33,8 +33,8 @@ const UNSTABLE_OWNERS = new Set(["tiennm99dev"]); /** * Most recently pushed first; a repo with no timestamp sorts last. - * @param {import("./lib/github-api.mjs").Repo} a - * @param {import("./lib/github-api.mjs").Repo} b + * @param {import("./lib/github-api.js").Repo} a + * @param {import("./lib/github-api.js").Repo} b * @returns {number} */ const byRecentPush = (a, b) => (b.pushedAt || "").localeCompare(a.pushedAt || ""); diff --git a/.github/workflows/update-projects.yml b/.github/workflows/update-projects.yml index c2a609b..6f0b548 100644 --- a/.github/workflows/update-projects.yml +++ b/.github/workflows/update-projects.yml @@ -38,7 +38,7 @@ jobs: env: GH_TOKEN: ${{ secrets.PAGES_FETCH_TOKEN }} GH_USER: tiennm99 - run: node .github/scripts/update-projects-list.mjs + run: node .github/scripts/update-projects-list.js - name: Commit and push run: | diff --git a/package.json b/package.json index 5ecc48d..c6a8e1b 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ }, "scripts": { "lint": "eslint .", - "projects:refresh": "node .github/scripts/update-projects-list.mjs" + "projects:refresh": "node .github/scripts/update-projects-list.js" }, "dependencies": { "octokit": "^5.0.5"