Skip to content

Commit

Permalink
build: make scripts for compatibility with Node.js 18.20+
Browse files Browse the repository at this point in the history
This commit enhances the ng-dev and other local scripts to ensure compatibility with Node.js 18.20+. This adjustment is essential for releasing this branch, as it would otherwise lack compatibility with that version.

(cherry picked from commit 416d440)
  • Loading branch information
alan-agius4 committed Apr 25, 2024
1 parent 499f09a commit 0227bcb
Show file tree
Hide file tree
Showing 6 changed files with 268 additions and 45 deletions.
1 change: 1 addition & 0 deletions .pullapprove.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,7 @@ groups:
'tools/contributing-stats/**/{*,.*}',
'tools/esm-interop/**/{*,.*}',
'tools/gulp-tasks/**/{*,.*}',
'tools/npm-patches/**/{*,.*}',
'tools/legacy-saucelabs/**/{*,.*}',
'tools/rxjs/**/{*,.*}',
'tools/saucelabs/**/{*,.*}',
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"// 2": "Find the usage you are looking for with:",
"// 3": "yarn ng-dev --help",
"/ ": "",
"postinstall": "node --preserve-symlinks --preserve-symlinks-main ./tools/postinstall-patches.js && patch-package --patch-dir tools/esm-interop/patches/npm",
"postinstall": "node --preserve-symlinks --preserve-symlinks-main ./tools/postinstall-patches.js && patch-package --patch-dir tools/npm-patches && patch-package --patch-dir tools/esm-interop/patches/npm",
"prepare": "husky install",
"ng-dev": "ts-node --esm --project .ng-dev/tsconfig.json --transpile-only node_modules/@angular/ng-dev/bundles/cli.mjs",
"build": "ts-node --esm --project scripts/tsconfig.json scripts/build/build-packages-dist.mts",
"ng-dev": "tsx --tsconfig .ng-dev/tsconfig.json node_modules/@angular/ng-dev/bundles/cli.mjs",
"build": "tsx --tsconfig scripts/tsconfig.json scripts/build/build-packages-dist.mts",
"test": "bazelisk test",
"test:ci": "bazelisk test -- //... -//devtools/... -//aio/... && bazelisk test --//packages/compiler:use_template_pipeline //packages/compiler-cli/test/compliance/full",
"test-tsec": "bazelisk test //... --build_tag_filters=tsec --test_tag_filters=tsec",
Expand All @@ -43,7 +43,7 @@
"devtools:build:chrome": "bazelisk build --config snapshot-build --//devtools/projects/shell-browser/src:flag_browser=chrome -- devtools/projects/shell-browser/src:prodapp",
"devtools:build:firefox": "bazelisk build --config snapshot-build --//devtools/projects/shell-browser/src:flag_browser=firefox -- devtools/projects/shell-browser/src:prodapp",
"devtools:test": "bazelisk test --config snapshot-build --//devtools/projects/shell-browser/src:flag_browser=chrome -- //devtools/...",
"benchmarks": "ts-node --esm scripts/benchmarks/index.mts"
"benchmarks": "tsx --tsconfig=scripts/tsconfig.json scripts/benchmarks/index.mts"
},
"// 1": "dependencies are used locally and by bazel",
"dependencies": {
Expand Down Expand Up @@ -151,6 +151,7 @@
"tsickle": "0.46.3",
"tslib": "^2.3.0",
"tslint": "6.1.3",
"tsx": "^4.7.2",
"typescript": "5.1.3",
"webtreemap": "^2.0.1",
"xhr2": "0.2.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/@angular/ng-dev/bundles/chunk-K6WKGSNA.mjs b/node_modules/@angular/ng-dev/bundles/chunk-K6WKGSNA.mjs
index 4fdcf37..76cbc46 100755
--- a/node_modules/@angular/ng-dev/bundles/chunk-K6WKGSNA.mjs
+++ b/node_modules/@angular/ng-dev/bundles/chunk-K6WKGSNA.mjs
@@ -820,7 +820,7 @@ function getCachedConfig() {
}

// bazel-out/k8-fastbuild/bin/ng-dev/utils/config.js
-var CONFIG_FILE_PATH = ".ng-dev/config.mjs";
+var CONFIG_FILE_PATH = ".ng-dev/config.mts";
var USER_CONFIG_FILE_PATH = ".ng-dev.user";
var userConfig = null;
var setConfig = setCachedConfig;
4 changes: 3 additions & 1 deletion tools/tslint/tsNodeLoaderRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ const Lint = require('tslint');

// Custom rule that registers all of the custom rules, written in TypeScript, with ts-node.
// This is necessary, because `tslint` and IDEs won't execute any rules that aren't in a .js file.
require('ts-node').register();
require('ts-node').register({
project: path.join(__dirname, '../../tsconfig-tslint.json'),
});

// Add a noop rule so tslint doesn't complain.
exports.Rule = class Rule extends Lint.Rules.AbstractRule {
Expand Down
3 changes: 2 additions & 1 deletion tsconfig-tslint.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"allowJs": true
"allowJs": true,
"esModuleInterop": true
},
"include": [
"packages/**/*",
Expand Down

0 comments on commit 0227bcb

Please sign in to comment.