diff --git a/.github/workflows/add-push-artifacts.yml b/.github/workflows/add-push-artifacts.yml index 7d352fbab583f0..f7ccb4b2c72839 100644 --- a/.github/workflows/add-push-artifacts.yml +++ b/.github/workflows/add-push-artifacts.yml @@ -19,8 +19,8 @@ jobs: node-version-file: ".nvmrc" cache: npm - run: npm ci - - run: node --loader=ts-node/esm --no-warnings=ExperimentalWarning ./scripts/enumerate-features.ts features.json - - run: node --loader=ts-node/esm --no-warnings=ExperimentalWarning ./scripts/diff-features.ts --no-github --format=json > features.diff.json + - run: npx tsx --no-warnings=ExperimentalWarning ./scripts/enumerate-features.ts features.json + - run: npx tsx --no-warnings=ExperimentalWarning ./scripts/diff-features.ts --no-github --format=json > features.diff.json - uses: actions/upload-artifact@v4 with: name: enumerate-features diff --git a/.github/workflows/update-browser-releases.yml b/.github/workflows/update-browser-releases.yml index 34dfb95cb3ddcb..031fbebff66182 100644 --- a/.github/workflows/update-browser-releases.yml +++ b/.github/workflows/update-browser-releases.yml @@ -26,7 +26,7 @@ jobs: node-version-file: ".nvmrc" cache: npm - run: npm install -D typescript - - run: npm install -D ts-node + - run: npm install -D tsx - name: Run update-browser-releases script id: ubr run: | diff --git a/.mocharc.json b/.mocharc.json index 9dc4aac9fe2a1d..262ba0c7d7612f 100644 --- a/.mocharc.json +++ b/.mocharc.json @@ -1,4 +1,3 @@ { - "loader": "ts-node/esm", "extensions": ["ts", "tsx"] } diff --git a/package.json b/package.json index cac533450bae22..99731e537e84a6 100644 --- a/package.json +++ b/package.json @@ -96,25 +96,25 @@ }, "scripts": { "postinstall": "(git rev-parse --is-inside-work-tree && npm run save-git-history) || echo 'not in Git worktree; skipping save-git-history'", - "save-git-history": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/save-git-history.ts", + "save-git-history": "tsx --no-warnings=ExperimentalWarning scripts/save-git-history.ts", "prepare": "(husky || true) && npm run gentypes && npm run build", - "diff": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/diff.ts", - "unittest": "NODE_ENV=test c8 mocha index.test.ts --recursive \"{,!(node_modules)/**}/*.test.ts\"", + "diff": "tsx --no-warnings=ExperimentalWarning scripts/diff.ts", + "unittest": "NODE_ENV=test c8 mocha index.test.ts --require tsx --recursive \"{,!(node_modules)/**}/*.test.ts\"", "coverage": "c8 report -r lcov && open-cli coverage/lcov-report/index.html", "format": "eslint . && prettier --check . && tsc --noEmit", "format:fix": "eslint --quiet --fix . && prettier --write .", - "lint": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning lint/lint.ts", - "lint:fix": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning lint/fix.ts", + "lint": "tsx --no-warnings=ExperimentalWarning lint/lint.ts", + "lint:fix": "tsx --no-warnings=ExperimentalWarning lint/fix.ts", "fix": "npm run format:fix && npm run lint:fix", - "stats": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/statistics.ts", - "build": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/build/index.ts", - "gentypes": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/generate-types.ts", - "release": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/release/index.ts", - "remove-redundant-flags": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/remove-redundant-flags.ts", + "stats": "tsx --no-warnings=ExperimentalWarning scripts/statistics.ts", + "build": "tsx --no-warnings=ExperimentalWarning scripts/build/index.ts", + "gentypes": "tsx --no-warnings=ExperimentalWarning scripts/generate-types.ts", + "release": "tsx --no-warnings=ExperimentalWarning scripts/release/index.ts", + "remove-redundant-flags": "tsx --no-warnings=ExperimentalWarning scripts/remove-redundant-flags.ts", "show-errors": "npm test 1> /dev/null", "test": "npm run format && npm run lint && npm run unittest", - "traverse": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/traverse.ts", - "update-browser-releases": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/update-browser-releases/index.ts", - "bcd": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/bulk-editor/index.ts" + "traverse": "tsx --no-warnings=ExperimentalWarning scripts/traverse.ts", + "update-browser-releases": "tsx --no-warnings=ExperimentalWarning scripts/update-browser-releases/index.ts", + "bcd": "tsx --no-warnings=ExperimentalWarning scripts/bulk-editor/index.ts" } } diff --git a/scripts/diff-features.ts b/scripts/diff-features.ts index e6b3f1e446877f..bcfdeab8f9078b 100644 --- a/scripts/diff-features.ts +++ b/scripts/diff-features.ts @@ -174,9 +174,15 @@ const enumerateFeatures = (ref = 'HEAD', quiet = false): string[] => { // If the clean install fails, proceed anyways } - execSync( - `node --loader=ts-node/esm --no-warnings=ExperimentalWarning ./scripts/enumerate-features.ts --data-from=${worktree}`, - ); + try { + execSync( + `npx tsx --no-warnings=ExperimentalWarning ./scripts/enumerate-features.ts --data-from=${worktree}`, + ); + } catch (e) { + execSync( + `node --loader=ts-node/esm --no-warnings=ExperimentalWarning ./scripts/enumerate-features.ts --data-from=${worktree}`, + ); + } return JSON.parse(fs.readFileSync('.features.json', { encoding: 'utf-8' })); } finally { diff --git a/tsconfig.json b/tsconfig.json index 5a4792eee6463d..bece8fc2fa4e34 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,10 +16,5 @@ "skipLibCheck": true }, "exclude": ["build", "**/*.test.ts"], - "typeRoots": ["./node_modules/@types", "./types"], - "ts-node": { - "esm": true, - "files": true, - "swc": true - } + "typeRoots": ["./node_modules/@types", "./types"] }