Skip to content
Merged
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
809 changes: 158 additions & 651 deletions .github/local-actions/branch-manager/main.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions bazel/api-golden/index_npm_packages.cts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {readFileSync} from 'fs';
import {testApiGolden} from './test_api_report.js';
import * as fs from 'fs';
import {Piscina} from 'piscina';
import {styleText} from 'util';

/** Interface describing contents of a `package.json`. */
export interface PackageJson {
Expand All @@ -36,9 +37,8 @@ async function main(
) {
/** Whether the goldenDir provided is actually pointing to a single file. */
const singleFileMode = fs.existsSync(goldenDir) && fs.statSync(goldenDir).isFile();
// TODO(ESM) This can be replaced with an actual ESM import when `ts_library` is
// guaranteed to be ESM-only and supports the `mts` extension.
const chalk = {red: (v: string) => v, yellow: (v: string) => v};
const red = styleText.bind(null, 'red');
const yellow = styleText.bind(null, 'yellow');

const packageJsonPath = path.join(npmPackageDir, 'package.json');
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')) as PackageJson;
Expand Down Expand Up @@ -124,16 +124,16 @@ async function main(
console.error(Array(80).fill('=').join(''));
if (singleFileMode) {
console.error(
chalk.red(
red(
`The golden is out of date and can be updated by running:\n - bazel run ${process.env.TEST_TARGET}.accept`,
),
);
} else {
console.error(chalk.red(`The following goldens are outdated:`));
console.error(red(`The following goldens are outdated:`));
outdatedGoldens.forEach((name) => console.info(`- ${name}`));
console.info();
console.info(
chalk.yellow(
yellow(
`The goldens can be updated by running:\n - bazel run ${process.env.TEST_TARGET}.accept`,
),
);
Expand Down
1 change: 0 additions & 1 deletion bazel/integration/test_runner/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ ts_project(
tsconfig = "//bazel:tsconfig",
deps = [
"//bazel:node_modules/@types/node",
"//bazel:node_modules/chalk",
"//bazel:node_modules/tinyglobby",
"//bazel:node_modules/true-case-path",
],
Expand Down
7 changes: 4 additions & 3 deletions bazel/integration/test_runner/size-tracking.mts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
*/

import {runCommandInChildProcess} from './process_utils.mjs';
import {styleText} from 'node:util';
import {existsSync} from 'node:fs';
import fs from 'node:fs/promises';
import path from 'node:path';
import chalk from 'chalk';
import {debug} from './debug.mjs';
import {globSync} from 'tinyglobby';

// Convience access to chalk colors.
const {red, green} = chalk;
// Convience access to colors.
export const red = styleText.bind(null, 'red');
export const green = styleText.bind(null, 'green');
/** The size discrepancy we allow in bytes. */
const THRESHOLD_BYTES = 5000;
/** The size discrepancy as a percentage. */
Expand Down
1 change: 0 additions & 1 deletion bazel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"@types/source-map-support": "0.5.10",
"@types/yargs": "17.0.35",
"browser-sync": "3.0.4",
"chalk": "5.6.2",
"get-tsconfig": "4.13.0",
"piscina": "^5.0.0",
"send": "1.2.0",
Expand Down
1 change: 0 additions & 1 deletion ng-dev/misc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ ts_project(
deps = [
"//ng-dev:node_modules/@types/node",
"//ng-dev:node_modules/@types/yargs",
"//ng-dev:node_modules/chalk",
"//ng-dev/release/build",
"//ng-dev/release/config",
"//ng-dev/utils",
Expand Down
1 change: 0 additions & 1 deletion ng-dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"@types/yarnpkg__lockfile": "1.1.9",
"@yarnpkg/lockfile": "1.1.0",
"bufferutil": "4.0.9",
"chalk": "5.6.2",
"cli-progress": "3.12.0",
"conventional-commits-filter": "5.0.0",
"conventional-commits-parser": "6.2.1",
Expand Down
1 change: 0 additions & 1 deletion ng-dev/pr/merge/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ ts_project(
"//ng-dev:node_modules/@types/node",
"//ng-dev:node_modules/@types/semver",
"//ng-dev:node_modules/@types/yargs",
"//ng-dev:node_modules/chalk",
"//ng-dev:node_modules/typed-graphqlify",
"//ng-dev/commit-message",
"//ng-dev/pr/common",
Expand Down
1 change: 0 additions & 1 deletion ng-dev/ts-circular-dependencies/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ ts_project(
deps = [
"//ng-dev:node_modules/@types/node",
"//ng-dev:node_modules/@types/yargs",
"//ng-dev:node_modules/chalk",
"//ng-dev:node_modules/fast-glob",
"//ng-dev:node_modules/typescript",
"//ng-dev/utils",
Expand Down
1 change: 0 additions & 1 deletion ng-dev/utils/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ ts_project(
"//ng-dev:node_modules/@types/yargs",
"//ng-dev:node_modules/@types/yarnpkg__lockfile",
"//ng-dev:node_modules/@yarnpkg/lockfile",
"//ng-dev:node_modules/chalk",
"//ng-dev:node_modules/semver",
"//ng-dev:node_modules/supports-color",
"//ng-dev:node_modules/typed-graphqlify",
Expand Down
23 changes: 11 additions & 12 deletions ng-dev/utils/logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import chalk, {ChalkInstance} from 'chalk';
import {styleText} from 'util';
import {createWriteStream, WriteStream, copyFileSync} from 'fs';
import {join} from 'path';
import {Arguments} from 'yargs';
Expand All @@ -30,22 +30,21 @@ export enum LogLevel {
/** Default log level for the tool. */
export const DEFAULT_LOG_LEVEL = LogLevel.INFO;

/** Reexport of chalk colors for convenient access. */
export const red = chalk.red;
export const reset = chalk.reset;
export const green = chalk.green;
export const yellow = chalk.yellow;
export const bold = chalk.bold;
export const blue = chalk.blue;
export const underline = chalk.underline;
/** Reexport of colors/styling for convenient access. */
export const red = styleText.bind(null, 'red');
export const green = styleText.bind(null, 'green');
export const yellow = styleText.bind(null, 'yellow');
export const bold = styleText.bind(null, 'bold');
export const blue = styleText.bind(null, 'blue');
export const underline = styleText.bind(null, 'underline');

/** Class used for logging to the console and to a ng-dev log file. */
export abstract class Log {
/** Write to the console for at INFO logging level */
static info = buildLogLevelFunction(() => console.info, LogLevel.INFO, null);

/** Write to the console for at ERROR logging level */
static error = buildLogLevelFunction(() => console.error, LogLevel.ERROR, chalk.red);
static error = buildLogLevelFunction(() => console.error, LogLevel.ERROR, red);

/** Write to the console for at DEBUG logging level */
static debug = buildLogLevelFunction(() => console.debug, LogLevel.DEBUG, null);
Expand All @@ -54,14 +53,14 @@ export abstract class Log {
static log = buildLogLevelFunction(() => console.log, LogLevel.LOG, null);

/** Write to the console for at WARN logging level */
static warn = buildLogLevelFunction(() => console.warn, LogLevel.WARN, chalk.yellow);
static warn = buildLogLevelFunction(() => console.warn, LogLevel.WARN, yellow);
}

/** Build an instance of a logging function for the provided level. */
function buildLogLevelFunction(
loadCommand: () => Function,
level: LogLevel,
defaultColor: ChalkInstance | null,
defaultColor: ((text: string) => string) | null,
) {
/** Write to stdout for the LOG_LEVEL. */
return (...values: unknown[]) => {
Expand Down
6 changes: 0 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading