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
1 change: 0 additions & 1 deletion packages/angular_devkit/schematics_cli/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ ts_project(
":node_modules/@angular-devkit/core",
":node_modules/@angular-devkit/schematics",
":node_modules/@inquirer/prompts",
":node_modules/ansi-colors",
"//:node_modules/@types/node",
],
)
Expand Down
20 changes: 8 additions & 12 deletions packages/angular_devkit/schematics_cli/bin/schematics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ import { JsonValue, logging, schema } from '@angular-devkit/core';
import { ProcessOutput, createConsoleLogger } from '@angular-devkit/core/node';
import { UnsuccessfulWorkflowExecution, strings } from '@angular-devkit/schematics';
import { NodeWorkflow } from '@angular-devkit/schematics/tools';
import ansiColors from 'ansi-colors';
import { existsSync } from 'node:fs';
import * as path from 'node:path';
import { parseArgs } from 'node:util';
import { parseArgs, styleText } from 'node:util';

/**
* Parse the name of schematic passed in argument, and return a {collection, schematic} named
Expand Down Expand Up @@ -223,16 +222,13 @@ export async function main({
}: MainOptions): Promise<0 | 1> {
const { cliOptions, schematicOptions, _ } = parseOptions(args);

// Create a separate instance to prevent unintended global changes to the color configuration
const colors = ansiColors.create();

/** Create the DevKit Logger used through the CLI. */
const logger = createConsoleLogger(!!cliOptions.verbose, stdout, stderr, {
info: (s) => s,
debug: (s) => s,
warn: (s) => colors.bold.yellow(s),
error: (s) => colors.bold.red(s),
fatal: (s) => colors.bold.red(s),
warn: (s) => styleText(['bold', 'yellow'], s),
error: (s) => styleText(['bold', 'red'], s),
fatal: (s) => styleText(['bold', 'red'], s),
});

if (cliOptions.help) {
Expand Down Expand Up @@ -315,21 +311,21 @@ export async function main({
case 'update':
loggingQueue.push(
// TODO: `as unknown` was necessary during TS 5.9 update. Figure out a long-term solution.
`${colors.cyan('UPDATE')} ${eventPath} (${(event.content as unknown as Buffer).length} bytes)`,
`${styleText(['cyan'], 'UPDATE')} ${eventPath} (${(event.content as unknown as Buffer).length} bytes)`,
);
break;
case 'create':
loggingQueue.push(
// TODO: `as unknown` was necessary during TS 5.9 update. Figure out a long-term solution.
`${colors.green('CREATE')} ${eventPath} (${(event.content as unknown as Buffer).length} bytes)`,
`${styleText(['green'], 'CREATE')} ${eventPath} (${(event.content as unknown as Buffer).length} bytes)`,
);
break;
case 'delete':
loggingQueue.push(`${colors.yellow('DELETE')} ${eventPath}`);
loggingQueue.push(`${styleText(['yellow'], 'DELETE')} ${eventPath}`);
break;
case 'rename':
loggingQueue.push(
`${colors.blue('RENAME')} ${eventPath} => ${removeLeadingSlash(event.to)}`,
`${styleText(['blue'], 'RENAME')} ${eventPath} => ${removeLeadingSlash(event.to)}`,
);
break;
}
Expand Down
3 changes: 1 addition & 2 deletions packages/angular_devkit/schematics_cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"dependencies": {
"@angular-devkit/core": "workspace:0.0.0-PLACEHOLDER",
"@angular-devkit/schematics": "workspace:0.0.0-PLACEHOLDER",
"@inquirer/prompts": "7.10.1",
"ansi-colors": "4.1.3"
"@inquirer/prompts": "7.10.1"
}
}
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

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