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.
This commit is contained in:
tiennm99 committed 2026-09-18 16:23:36 +07:00
1 parent 2d35361ddd
commit a396c1fb40
5 files changed
+10 -10

No files matched your search

File renamed without changes.
@@ -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) {
@@ -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 || "");
+1 -1
View File
@@ -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: |
+1 -1
View File
@@ -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"