Skip to content

Commit d208ec7

Browse files
authored
Merge pull request #4200 from github/mbg/esm/migrate-pr-checks
Fully migrate `pr-checks` to ESM
2 parents f455295 + a71b0c6 commit d208ec7

21 files changed

Lines changed: 55 additions & 29 deletions

‎.github/workflows/pr-checks.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ jobs:
128128
working-directory: pr-checks
129129
run: npx tsx --test
130130

131-
- name: Run `pr-checks/changenotes.mts` to ensure that all unreleased change notes are valid
131+
- name: Run `pr-checks/changenotes.ts` to ensure that all unreleased change notes are valid
132132
if: ${{ !cancelled() && steps.install-deps.outcome == 'success' }}
133-
run: npx tsx pr-checks/changenotes.mts validate
133+
run: npx tsx pr-checks/changenotes.ts validate
134134

135135
- name: Verify all Actions use the same Node version
136136
id: head-version

‎eslint.config.mjs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export default [
158158
},
159159
},
160160
{
161-
files: ["**/*.ts", "**/*.js", "**/*.mts"],
161+
files: ["**/*.ts", "**/*.js"],
162162

163163
rules: {
164164
"@typescript-eslint/no-explicit-any": "off",
@@ -180,7 +180,7 @@ export default [
180180
},
181181
},
182182
{
183-
files: ["pr-checks/**/*.ts", "pr-checks/**/*.mts"],
183+
files: ["pr-checks/**/*.ts"],
184184

185185
languageOptions: {
186186
parserOptions: {

‎package-lock.json‎

Lines changed: 18 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pr-checks/.nvmrc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
24

‎pr-checks/bundle-changelog.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,6 @@ function main() {
122122
}
123123

124124
// Only call `main` if this script was run directly.
125-
if (require.main === module) {
125+
if (import.meta.main) {
126126
process.exit(main());
127127
}

‎pr-checks/bundle-metadata.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ async function main() {
4343
}
4444

4545
// Only call `main` if this script was run directly.
46-
if (require.main === module) {
46+
if (import.meta.main) {
4747
void main();
4848
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
isValidChangenoteFile,
1010
isValidChangenoteFilename,
1111
VALID_CHANGE_NOTE_CATEGORIES,
12-
} from "./validate.mjs";
12+
} from "./validate";
1313

1414
await describe("isValidChangenoteContent", async () => {
1515
await it("recognizes an unordered Markdown list", () => {
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
renderChangelog,
1515
withChangelog,
1616
} from "./changelog";
17-
import { isValidChangenoteFile } from "./changelog/validate.mjs";
17+
import { isValidChangenoteFile } from "./changelog/validate";
1818
import { CHANGENOTES_DIR } from "./config";
1919

2020
/**
@@ -82,9 +82,9 @@ function main(): ExitCode {
8282

8383
function usage(): ExitCode {
8484
const message =
85-
"Usage: changenotes.mts assemble\n" +
86-
" changenotes.mts validate\n" +
87-
" changenotes.mts help";
85+
"Usage: changenotes.ts assemble\n" +
86+
" changenotes.ts validate\n" +
87+
" changenotes.ts help";
8888
console.log(message);
8989
return ExitCode.Success;
9090
}

‎pr-checks/check-repo-size.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,6 @@ async function run(): Promise<void> {
218218
}
219219
}
220220

221-
if (require.main === module) {
221+
if (import.meta.main) {
222222
void run();
223223
}

0 commit comments

Comments
 (0)