Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: make scripts for compatibility with Node.js 18.20+ #55527

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 0 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,6 @@ jobs:
- name: Test build
run: yarn devtools:build:chrome

framework-win:
runs-on: windows-latest
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@0109d498b0f6aae418ed4924a5e5c65695f0ac61
with:
cache-node-modules: true
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@0109d498b0f6aae418ed4924a5e5c65695f0ac61
- name: Setup Bazel Remote Caching
uses: angular/dev-infra/github-actions/bazel/configure-remote@0109d498b0f6aae418ed4924a5e5c65695f0ac61
- name: Install node modules
run: yarn install --frozen-lockfile --network-timeout 100000
- name: Test all windows CI targets
run: bazel test --test_tag_filters="-browser:chromium-local" //packages/compiler-cli/...

test:
runs-on: ubuntu-latest-4core
steps:
Expand Down
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
Expand Up @@ -39,17 +39,7 @@ const FS_WINDOWS = 'Windows';
const FS_ALL = [FS_OS_X, FS_WINDOWS, FS_UNIX, FS_NATIVE];

function runInEachFileSystemFn(callback: (os: string) => void) {
const isOnCi = !!(process.env.CI || process.env.CIRCLECI || process.env.GITHUB_ACTION);

// At the time of writing, running the compiler tests on the CI on Windows is flaky and it
// appears to be related to mocking out the file system. Since we're running the mocked file
// system on the other platforms, we don't have to do so on Windows as well. This logic
// disables the mocking to try and reduce the amount of flakes.
if (isOnCi && platform() === 'win32') {
runInFileSystem(FS_NATIVE, callback, false);
} else {
FS_ALL.forEach(os => runInFileSystem(os, callback, false));
}
FS_ALL.forEach(os => runInFileSystem(os, callback, false));
}

function runInFileSystem(os: string, callback: (os: string) => void, error: boolean) {
Expand Down
3 changes: 0 additions & 3 deletions packages/compiler-cli/test/ngtsc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ jasmine_node_test(
"//packages/compiler-cli/src/ngtsc/testing/fake_common:npm_package",
"//packages/compiler-cli/src/ngtsc/testing/fake_core:npm_package",
],
# TODO: This target is flaky on Windows due to the global FS sometimes not being set/reset.
# See: https://app.circleci.com/pipelines/github/angular/angular/62261/workflows/6a4e952c-3d0b-44ab-b3db-c0a639af6bdc/jobs/1348755.
flaky = True,
shard_count = 4,
deps = [
":ngtsc_lib",
Expand Down
6 changes: 3 additions & 3 deletions packages/zone.js/test/typings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"author": "",
"license": "MIT",
"dependencies": {
"@types/node": "^16.11.7",
"domino": "https://github.com/angular/domino.git#aa8de3486307f57a518b4b0d9e5e16d9fbd998d1",
"@types/node": "file:../../../../node_modules/@types/node",
"domino": "file:../../../../node_modules/domino",
"zone.js": "file:../../../../dist/bin/packages/zone.js/npm_package"
},
"devDependencies": {
"typescript": "5.1.3"
"typescript": "file:../../../../node_modules/typescript"
}
}
3 changes: 2 additions & 1 deletion packages/zone.js/test/typings/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
"outDir": "./build",
"rootDir": ".",
"target": "es2020",
"typeRoots": [],
"module": "Node16",
"moduleResolution": "node",
"moduleResolution": "Node16",
"noEmitOnError": false,
"stripInternal": false,
"strict": true,
Expand Down
22 changes: 22 additions & 0 deletions packages/zone.js/test/typings/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


"@types/node@file:../../../../node_modules/@types/node":
version "16.18.59"

"domino@file:../../../../node_modules/domino":
version "2.1.6"

tslib@^2.3.0:
version "2.6.2"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae"
integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==

"typescript@file:../../../../node_modules/typescript":
version "5.1.3"

"zone.js@file:../../../../dist/bin/packages/zone.js/npm_package":
version "0.13.1"
dependencies:
tslib "^2.3.0"
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