Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/local-actions/branch-manager/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ esbuild_checked_in(
":lib",
],
entry_point = "lib/main.ts",
external = [
"pnpapi",
],
format = "esm",
platform = "node",
target = "node22",
Expand Down
25,345 changes: 18,743 additions & 6,602 deletions .github/local-actions/branch-manager/main.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion bazel/integration/tests/angular-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"karma-coverage": "~2.2.0",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"ts-node": "^10.4.0",
"typescript": "~4.5.0",
"wdio-chromedriver-service": "^7.2.2"
}
Expand Down
10,342 changes: 0 additions & 10,342 deletions bazel/integration/tests/angular-cli/pnpm-lock.yaml

This file was deleted.

509 changes: 318 additions & 191 deletions bazel/integration/tests/angular-cli/yarn.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const path = require('path');
const stylelint = require('stylelint');

// Custom rule that registers all of the custom rules, written in TypeScript, with ts-node.
require('ts-node').register();
// Custom rule that registers all of the custom rules, written in TypeScript, with tsx.
require('tsx/cjs/api').register();

// Dummy rule so Stylelint doesn't complain that there aren't rules in the file.
module.exports = stylelint.createPlugin('@angular/stylelint-ts-rule-loader', () => {});
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const path = require('path');
const Lint = require('tslint');

// Custom rule that registers all of the custom rules, written in TypeScript, with ts-node.
// Custom rule that registers all of the custom rules, written in TypeScript, with tsx.
// This is necessary, because `tslint` and IDEs won't execute any rules that aren't in a .js file.
require('ts-node').register();
require('tsx/cjs/api').register();

// Add a noop rule so tslint doesn't complain.
exports.Rule = class Rule extends Lint.Rules.AbstractRule {
Expand Down
1 change: 1 addition & 0 deletions ng-dev/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ NG_DEV_EXTERNALS = [
# intend to provide interop globals for this as it could hide other significant issues.
"@yarnpkg/lockfile",
"@google-cloud/spanner",
"tsx",
]

ts_project(
Expand Down
1 change: 1 addition & 0 deletions ng-dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"semver": "7.7.2",
"supports-color": "10.2.2",
"typed-graphqlify": "3.1.6",
"tsx": "4.20.5",
"typescript": "5.9.2",
"utf-8-validate": "6.0.5",
"which": "5.0.0",
Expand Down
4 changes: 3 additions & 1 deletion ng-dev/utils/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("//tools:defaults.bzl", "ts_project")

# g3-sync-config needs to be a separate file / target so that google-internal-tests
# won't need ts-node to parse this file
# won't need tsx to parse this file
ts_project(
name = "g3_sync_config",
srcs = ["g3-sync-config.ts"],
Expand Down Expand Up @@ -60,8 +60,10 @@ ts_project(
"//ng-dev:node_modules/@types/yarnpkg__lockfile",
"//ng-dev:node_modules/@yarnpkg/lockfile",
"//ng-dev:node_modules/chalk",
"//ng-dev:node_modules/fast-glob",
"//ng-dev:node_modules/semver",
"//ng-dev:node_modules/supports-color",
"//ng-dev:node_modules/tsx",
"//ng-dev:node_modules/typed-graphqlify",
"//ng-dev:node_modules/which",
"//ng-dev:node_modules/yaml",
Expand Down
15 changes: 11 additions & 4 deletions ng-dev/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
* found in the LICENSE file at https://angular.io/license
*/

import {pathToFileURL} from 'url';
import {join} from 'path';

import glob from 'fast-glob';
import {register} from 'tsx/esm/api';
import {Assertions, MultipleAssertions} from './config-assertions.js';
import {Log} from './logging.js';
import {getCachedConfig, setCachedConfig} from './config-cache.js';
import {determineRepoBaseDirFromCwd} from './repo-directory.js';
import {pathToFileURL} from 'url';

/**
* Type describing a ng-dev configuration.
Expand Down Expand Up @@ -81,7 +82,7 @@ export interface CaretakerConfig {
* The filename expected for creating the ng-dev config, without the file
* extension to allow either a typescript or javascript file to be used.
*/
const CONFIG_FILE_PATH = '.ng-dev/config.mjs';
const CONFIG_FILE_PATH_MATCHER = '.ng-dev/config.{mjs,mts}';

/**
* The filename expected for local user config, without the file extension to allow a typescript,
Expand Down Expand Up @@ -118,9 +119,12 @@ export async function getConfig(baseDirOrAssertions?: unknown) {
baseDir = determineRepoBaseDirFromCwd();
}

/** The configuration file discovered based on a glob match. */
const [matchedFile] = await glob(CONFIG_FILE_PATH_MATCHER, {cwd: baseDir});

// If the global config is not defined, load it from the file system.
// The full path to the configuration file.
const configPath = join(baseDir, CONFIG_FILE_PATH);
const configPath = join(baseDir, matchedFile);
// Read the configuration and validate it before caching it for the future.
cachedConfig = await readConfigFile(configPath);

Expand Down Expand Up @@ -204,6 +208,7 @@ export function assertValidCaretakerConfig<T extends NgDevConfig>(
* if the configuration file cannot be read.
*/
async function readConfigFile(configPath: string, returnEmptyObjectOnError = false): Promise<{}> {
const unregister = register({tsconfig: false});
try {
// ESM imports expect a valid URL. On Windows, the disk name causes errors like:
// `ERR_UNSUPPORTED_ESM_URL_SCHEME: <..> Received protocol 'c:'`
Expand All @@ -219,5 +224,7 @@ async function readConfigFile(configPath: string, returnEmptyObjectOnError = fal
Log.error(`Could not read configuration file at ${configPath}.`);
Log.error(e);
process.exit(1);
} finally {
unregister();
}
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"jasmine-reporters": "2.5.2",
"jasmine": "5.10.0",
"prettier": "3.6.2",
"ts-node": "10.9.2",
"tslib": "^2.5.2",
"tslint": "6.1.3",
"tsx": "^4.15.7",
Expand Down
Loading
Loading