Skip to content

Commit 27ed8ce

Browse files
committed
build: use Node.js built-in TypeScript support for dev-infra scripts
This change removes the use of `tsx` to execute both `ng-dev` and the repo level development scripts.
1 parent e5a7eb3 commit 27ed8ce

File tree

12 files changed

+33
-21
lines changed

12 files changed

+33
-21
lines changed

.ng-dev/release.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const release = {
2727
buildPackages: async () => {
2828
// The buildTargetPackages function is loaded at runtime as the loading the script
2929
// causes an invocation of Bazel.
30-
const {performNpmReleaseBuild} = await import('../scripts/build/package-builder.mjs');
30+
const {performNpmReleaseBuild} = await import('../scripts/build/package-builder.mts');
3131
return performNpmReleaseBuild();
3232
},
3333
releaseNotes: {

.ng-dev/tsconfig.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
"module": "Node16",
66
"noEmit": true,
77
"skipLibCheck": true,
8-
"types": ["node"]
8+
"types": ["node"],
9+
"allowJs": true,
10+
"rewriteRelativeImportExtensions": true,
11+
"erasableSyntaxOnly": true,
12+
"verbatimModuleSyntax": true
913
}
1014
}

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
},
1919
"scripts": {
2020
"prepare": "husky",
21-
"ng-dev": "tsx --tsconfig .ng-dev/tsconfig.json node_modules/@angular/ng-dev/bundles/cli.mjs",
22-
"build": "tsx --tsconfig scripts/tsconfig.json scripts/build/build-packages-dist.mts",
21+
"ng-dev": "ng-dev",
22+
"build": "node scripts/build/build-packages-dist.mts",
2323
"test": "bazelisk test",
2424
"test:ci": "bazelisk test -- //... -//integration/... -//adev/... -//vscode-ng-language-service/... -//devtools/... -//modules/ssr-benchmarks/...",
2525
"integration-tests:ci": "bazelisk test -- //integration/...",
@@ -30,7 +30,7 @@
3030
"public-api:update": "node goldens/public-api/manage.js accept",
3131
"symbol-extractor:check": "node tools/symbol-extractor/run_all_symbols_extractor_tests.js test",
3232
"symbol-extractor:update": "node tools/symbol-extractor/run_all_symbols_extractor_tests.js accept",
33-
"ts-circular-deps:check": "pnpm -s ng-dev ts-circular-deps check --config ./packages/circular-deps-test.conf.js",
33+
"ts-circular-deps:check": "pnpm -s ng-dev ts-circular-deps check --config ./packages/circular-deps-test.conf.cjs",
3434
"check-tooling-setup": "tsc --project scripts/tsconfig.json",
3535
"devtools:devserver": "ibazel run //devtools/src:devserver",
3636
"devtools:test:e2e": "cypress run --project ./devtools/cypress",
@@ -41,14 +41,14 @@
4141
"devtools:build:firefox:release": "pnpm run -s devtools:build:firefox --jobs 4",
4242
"devtools:test": "bazelisk test --//devtools/projects/shell-browser/src:flag_browser=chrome -- //devtools/...",
4343
"devtools:test:unit": "bazelisk test -- //devtools/...",
44-
"devtools:release": "tsx --tsconfig=devtools/tsconfig.json devtools/tools/release.mts",
44+
"devtools:release": "node devtools/tools/release.mts",
4545
"adev": "[[ -n $CI ]] && echo 'Cannot run this pnpm script on CI' && exit 1 || ibazel run //adev:build.serve",
4646
"adev:build": "[[ -n $CI ]] && echo 'Cannot run this pnpm script on CI' && exit 1 || bazel build //adev:build",
4747
"dev": "pnpm --filter=dev-app dev",
4848
"dev:prod": "pnpm --filter=dev-app dev:prod",
4949
"dev:build": "pnpm --filter=dev-app dev:build",
50-
"benchmarks": "tsx --tsconfig=scripts/tsconfig.json scripts/benchmarks/index.mts",
51-
"diff-release-package": "tsx --tsconfig=scripts/tsconfig.json scripts/diff-release-package.mts"
50+
"benchmarks": "node scripts/benchmarks/index.mts",
51+
"diff-release-package": "node scripts/diff-release-package.mts"
5252
},
5353
"// 1": "dependencies are used locally and by bazel",
5454
"dependencies": {

scripts/benchmarks/index.mts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@ import {setOutput} from '@actions/core';
1010
import {GitClient, Log, bold, green, yellow} from '@angular/ng-dev';
1111
import {select} from '@inquirer/prompts';
1212
import yargs from 'yargs';
13-
import {collectBenchmarkResults} from './results.mjs';
14-
import {ResolvedTarget, findBenchmarkTargets, getTestlogPath, resolveTarget} from './targets.mjs';
15-
import {exec} from './utils.mjs';
13+
import {collectBenchmarkResults} from './results.mts';
14+
import {
15+
type ResolvedTarget,
16+
findBenchmarkTargets,
17+
getTestlogPath,
18+
resolveTarget,
19+
} from './targets.mts';
20+
import {exec} from './utils.mts';
1621

1722
const benchmarkTestFlags = [
1823
'--cache_test_results=no',

scripts/benchmarks/targets.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import path from 'path';
10-
import {exec} from './utils.mjs';
10+
import {exec} from './utils.mts';
1111

1212
/** Branded string representing a resolved Bazel benchmark target. */
1313
export type ResolvedTarget = string & {

scripts/build/angular-in-memory-web-api.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import {join} from 'path';
1010

11-
import {bazelCmd, exec} from './package-builder.mjs';
11+
import {bazelCmd, exec} from './package-builder.mts';
1212

1313
/**
1414
* Build the `angular-in-memory-web-api` npm package and copies it into the release

scripts/build/build-packages-dist.mts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
* found in the LICENSE file at https://angular.dev/license
99
*/
1010

11-
import {buildAngularInMemoryWebApiPackage} from './angular-in-memory-web-api.mjs';
12-
import {performDefaultSnapshotBuild} from './package-builder.mjs';
13-
import {buildZoneJsPackage} from './zone-js-builder.mjs';
11+
import {buildAngularInMemoryWebApiPackage} from './angular-in-memory-web-api.mts';
12+
import {performDefaultSnapshotBuild} from './package-builder.mts';
13+
import {buildZoneJsPackage} from './zone-js-builder.mts';
1414

1515
// Build the legacy (view engine) npm packages into `dist/packages-dist/`.
1616
performDefaultSnapshotBuild();

scripts/build/package-builder.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import {execSync} from 'child_process';
1010
import {join, dirname} from 'path';
11-
import {BuiltPackage} from '@angular/ng-dev';
11+
import type {BuiltPackage} from '@angular/ng-dev';
1212
import {fileURLToPath} from 'url';
1313
import {existsSync, lstatSync} from 'fs';
1414

scripts/build/zone-js-builder.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import {join} from 'path';
1010

11-
import {bazelCmd, exec} from './package-builder.mjs';
11+
import {bazelCmd, exec} from './package-builder.mts';
1212

1313
/**
1414
* Build the `zone.js` npm package into `dist/bin/packages/zone.js/npm_package/` and copy it to

0 commit comments

Comments
 (0)