Skip to content

Commit 8de0669

Browse files
committed
fix(ci): update stale .mjs references after .mts rename and drop Node 20
The scripts/*.mjs to *.mts rename missed updating internal cross-references in scripts, tests, and registry build files, causing ERR_MODULE_NOT_FOUND on all CI jobs. Also removes Node 20 from the CI matrix since it cannot run .mts files natively, fixes TypeScript errors in test-imported scripts, and excludes scripts/ from tsconfig to avoid 1000+ pre-existing type errors.
1 parent 82f22a1 commit 8de0669

18 files changed

Lines changed: 43 additions & 47 deletions

.github/workflows/_local-not-for-reuse-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
fail-fast: false
2323
lint-script: 'pnpm run lint --all'
2424
lint-setup-script: 'pnpm run build'
25-
node-versions: '[20, 22, 24]'
25+
node-versions: '[22, 24]'
2626
os-versions: '["ubuntu-latest", "windows-latest"]'
2727
test-script: 'pnpm run test --all --fast'
2828
test-setup-script: 'pnpm run build'

registry/scripts/build.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import {
1818
buildConfig,
1919
watchConfig,
2020
} from '../.config/esbuild.config.mjs'
21-
import { parseArgs } from '../../scripts/utils/parse-args.mjs'
22-
import { runSequence } from '../../scripts/utils/run-command.mjs'
21+
import { parseArgs } from '../../scripts/utils/parse-args.mts'
22+
import { runSequence } from '../../scripts/utils/run-command.mts'
2323
import process from 'node:process'
2424

2525
const logger = getDefaultLogger()

scripts/check.mts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,49 +88,49 @@ async function main(): Promise<void> {
8888
},
8989
},
9090
{
91-
args: ['scripts/validation/no-link-deps.mjs'],
91+
args: ['scripts/validation/no-link-deps.mts'],
9292
command: 'node',
9393
options: {
9494
...(process.platform === 'win32' && { shell: true }),
9595
},
9696
},
9797
{
98-
args: ['scripts/validation/bundle-deps.mjs'],
98+
args: ['scripts/validation/bundle-deps.mts'],
9999
command: 'node',
100100
options: {
101101
...(process.platform === 'win32' && { shell: true }),
102102
},
103103
},
104104
{
105-
args: ['scripts/validation/esbuild-minify.mjs'],
105+
args: ['scripts/validation/esbuild-minify.mts'],
106106
command: 'node',
107107
options: {
108108
...(process.platform === 'win32' && { shell: true }),
109109
},
110110
},
111111
{
112-
args: ['scripts/validation/no-cdn-refs.mjs'],
112+
args: ['scripts/validation/no-cdn-refs.mts'],
113113
command: 'node',
114114
options: {
115115
...(process.platform === 'win32' && { shell: true }),
116116
},
117117
},
118118
{
119-
args: ['scripts/validation/markdown-filenames.mjs'],
119+
args: ['scripts/validation/markdown-filenames.mts'],
120120
command: 'node',
121121
options: {
122122
...(process.platform === 'win32' && { shell: true }),
123123
},
124124
},
125125
{
126-
args: ['scripts/validation/file-size.mjs'],
126+
args: ['scripts/validation/file-size.mts'],
127127
command: 'node',
128128
options: {
129129
...(process.platform === 'win32' && { shell: true }),
130130
},
131131
},
132132
{
133-
args: ['scripts/validation/file-count.mjs'],
133+
args: ['scripts/validation/file-count.mts'],
134134
command: 'node',
135135
options: {
136136
...(process.platform === 'win32' && { shell: true }),

scripts/constants/env.mts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/**
66
* Get environment configuration with inlined values.
77
*/
8-
function envAsBoolean(value) {
8+
function envAsBoolean(value: string | undefined): boolean {
99
if (typeof value === 'string') {
1010
const lower = value.toLowerCase()
1111
return lower === 'true' || lower === '1'
@@ -20,8 +20,8 @@ export function getEnv() {
2020
const { env } = process
2121
return Object.freeze({
2222
__proto__: null,
23-
CI: envAsBoolean(env.CI),
24-
NODE_ENV: env.NODE_ENV,
25-
VERBOSE_BUILD: envAsBoolean(env.VERBOSE_BUILD),
23+
CI: envAsBoolean(env['CI']),
24+
NODE_ENV: env['NODE_ENV'],
25+
VERBOSE_BUILD: envAsBoolean(env['VERBOSE_BUILD']),
2626
})
2727
}

scripts/cover.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ logger.log('')
4949

5050
// Rebuild with source maps enabled for coverage
5151
logger.info('Building with source maps for coverage...')
52-
const buildResult = await spawn('node', ['scripts/build.mjs'], {
52+
const buildResult = await spawn('node', ['scripts/build.mts'], {
5353
cwd: rootPath,
5454
stdio: 'inherit',
5555
env: envWithMemoryLimits,

scripts/npm/make-npm-override.mts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ async function main(): Promise<void> {
271271
const tsRefs = []
272272
if (isEsShim) {
273273
const { default: maintainedNodeVersions } =
274-
await import('../constants/node.mjs')
275-
const { PACKAGE_DEFAULT_NODE_RANGE } = await import('../constants/node.mjs')
274+
await import('../constants/node.mts')
275+
const { PACKAGE_DEFAULT_NODE_RANGE } = await import('../constants/node.mts')
276276
const parts = origPkgName
277277
.split(/[-.]/)
278278
.filter(p => p !== 'es' && p !== 'helpers')
@@ -405,7 +405,7 @@ async function main(): Promise<void> {
405405
// First copy the template directory contents to the package path.
406406
await fs.cp(templatePkgPath, pkgPath, { recursive: true })
407407
// Then modify the new package's package.json source and write to disk.
408-
const { PACKAGE_DEFAULT_NODE_RANGE } = await import('../constants/node.mjs')
408+
const { PACKAGE_DEFAULT_NODE_RANGE } = await import('../constants/node.mts')
409409
await writeAction(
410410
await getPackageJsonAction(pkgPath, {
411411
engines: {

scripts/npm/publish-npm-packages.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ async function publishAtCommit(sha) {
318318

319319
// Update manifest.json with latest published versions before publishing registry.
320320
if (registryPkgToPublish && !fails.includes(registryPkgToPublish.printName)) {
321-
await spawn('node', ['scripts/update-manifest.mjs', '--force'], {
321+
await spawn('node', ['scripts/npm/update-manifest.mts', '--force'], {
322322
shell: WIN32,
323323
})
324324

scripts/npm/test-npm-packages.mts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ async function main(): Promise<void> {
6969
scriptDir,
7070
'..',
7171
'validation',
72-
'npm-packages.mjs',
72+
'npm-packages.mts',
7373
)
74-
const installScript = path.join(scriptDir, 'install-npm-packages.mjs')
75-
const testScript = path.join(scriptDir, 'run-npm-package-tests.mjs')
74+
const installScript = path.join(scriptDir, 'install-npm-packages.mts')
75+
const testScript = path.join(scriptDir, 'run-npm-package-tests.mts')
7676

7777
// Build common arguments.
7878
const commonArgs = []

scripts/test.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ async function runTests(
281281

282282
// Use interactive runner for interactive Ctrl+O experience when appropriate
283283
if (process.stdout.isTTY) {
284-
const { runTests } = await import('./utils/interactive-runner.mjs')
284+
const { runTests } = await import('./utils/interactive-runner.mts')
285285
return runTests(vitestPath, vitestArgs, {
286286
env: spawnOptions.env,
287287
cwd: spawnOptions.cwd,

scripts/testing/reproduce-ci-locally.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ async function runUnitTests(workDir) {
200200
async function runNpmPackageTests(workDir) {
201201
logger.info('\n--- Running NPM Package Tests (CI Mode) ---')
202202

203-
const args = ['scripts/test-npm-packages.mjs']
203+
const args = ['scripts/npm/test-npm-packages.mts']
204204

205205
if (cliArgs.package?.length) {
206206
cliArgs.package.forEach(pkg => {

0 commit comments

Comments
 (0)