Skip to content

Commit ceeb292

Browse files
committed
refactor(@angular/cli): remove chalk dependency
1 parent 894e008 commit ceeb292

File tree

22 files changed

+1887
-424
lines changed

22 files changed

+1887
-424
lines changed

package-lock.json

Lines changed: 1820 additions & 340 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
"@angular-devkit/schematics": "github:angular/angular-devkit-schematics-builds",
4848
"@schematics/angular": "github:angular/schematics-angular-builds",
4949
"@schematics/update": "github:angular/schematics-update-builds",
50-
"chalk": "~2.2.0",
5150
"opn": "~5.1.0",
5251
"resolve": "^1.1.7",
5352
"rxjs": "^6.0.0",

packages/@angular/cli/bin/ng

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@
55
// Due to an obscure Mac bug, do not start this title with any symbol.
66
process.title = 'ng';
77

8-
var red = require('chalk').red;
9-
108
var version = process.version.substr(1).split('.');
119
if (Number(version[0]) < 8 || (Number(version[0]) === 8 && Number(version[1]) < 9)) {
12-
process.stderr.write(red(
10+
process.stderr.write(
1311
'You are running version ' + process.version + ' of Node.js, which is not supported by Angular CLI v6.\n' +
1412
'The official Node.js version that is supported is 8.9 and greater.\n\n' +
1513
'Please visit https://nodejs.org/en/ to find instructions on how to update Node.js.\n'
16-
));
14+
);
1715

1816
process.exit(3);
1917
}

packages/@angular/cli/commands/add.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { tags } from '@angular-devkit/core';
1+
import { tags, terminal } from '@angular-devkit/core';
22
import { NodePackageDoesNotSupportSchematics } from '@angular-devkit/schematics/tools';
3-
import chalk from 'chalk';
43
import { CommandScope, Option } from '../models/command';
54
import { parseOptions } from '../models/command-runner';
65
import { getPackageManager } from '../utilities/config';
@@ -36,7 +35,7 @@ export default class AddCommand extends SchematicCommand {
3635
if (!collectionName) {
3736
throw new SilentError(
3837
`The "ng ${this.name}" command requires a name argument to be specified eg. `
39-
+ `${chalk.yellow('ng add [name] ')}. For more details, use "ng help".`
38+
+ `${terminal.yellow('ng add [name] ')}. For more details, use "ng help".`
4039
);
4140
}
4241

@@ -49,7 +48,7 @@ export default class AddCommand extends SchematicCommand {
4948
if (!collectionName) {
5049
throw new SilentError(
5150
`The "ng ${this.name}" command requires a name argument to be specified eg. `
52-
+ `${chalk.yellow('ng add [name] ')}. For more details, use "ng help".`
51+
+ `${terminal.yellow('ng add [name] ')}. For more details, use "ng help".`
5352
);
5453
}
5554

packages/@angular/cli/commands/easter-egg.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Command, Option } from '../models/command';
2-
import chalk from 'chalk';
2+
import { terminal } from '@angular-devkit/core';
33

44
function pickOne(of: string[]): string {
55
return of[Math.floor(Math.random() * of.length)];
@@ -23,6 +23,6 @@ export default class AwesomeCommand extends Command {
2323
`I spy with my little eye a great developer!`,
2424
`Noop... already awesome.`
2525
]);
26-
this.logger.info(chalk.green(phrase));
26+
this.logger.info(terminal.green(phrase));
2727
}
2828
}

packages/@angular/cli/commands/generate.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import { CommandScope, Option } from '../models/command';
2-
import chalk from 'chalk';
32
import { getDefaultSchematicCollection } from '../utilities/config';
43
import {
54
getCollection,
65
getEngineHost
76
} from '../utilities/schematics';
8-
import { tags } from '@angular-devkit/core';
7+
import { tags, terminal } from '@angular-devkit/core';
98
import { SchematicCommand } from '../models/schematic-command';
109

11-
const { cyan } = chalk;
1210

1311
export default class GenerateCommand extends SchematicCommand {
1412
public readonly name = 'generate';
@@ -106,7 +104,7 @@ export default class GenerateCommand extends SchematicCommand {
106104
});
107105

108106
this.logger.warn(`\nTo see help for a schematic run:`);
109-
this.logger.info(cyan(` ng generate <schematic> --help`));
107+
this.logger.info(terminal.cyan(` ng generate <schematic> --help`));
110108
}
111109
}
112110
}

packages/@angular/cli/commands/help.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Command, Option } from '../models/command';
2-
import chalk from 'chalk';
2+
import { terminal } from '@angular-devkit/core';
33

4-
const { cyan } = chalk;
54

65
export default class HelpCommand extends Command {
76
public readonly name = 'help';
@@ -23,7 +22,7 @@ export default class HelpCommand extends Command {
2322
}));
2423
this.logger.info(`Available Commands:`);
2524
commands.forEach(cmd => {
26-
this.logger.info(` ${cyan(cmd.name)} ${cmd.description}`);
25+
this.logger.info(` ${terminal.cyan(cmd.name)} ${cmd.description}`);
2726
});
2827

2928
this.logger.info(`\nFor more detailed help run "ng [command name] --help"`);

packages/@angular/cli/lib/init.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const packageJson = require('../package.json');
1414
const path = require('path');
1515
const resolve = require('resolve');
1616
const stripIndents = require('@angular-devkit/core').tags.stripIndents;
17-
const yellow = require('chalk').yellow;
17+
const yellow = require('@angular-devkit/core').terminal.yellow;
1818
const SemVer = require('semver').SemVer;
1919
const events = require('events');
2020

packages/@angular/cli/models/command.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { logging } from '@angular-devkit/core';
2-
const { cyan } = require('chalk');
1+
import { logging, terminal } from '@angular-devkit/core';
32

43
export interface CommandConstructor {
54
new(context: CommandContext, logger: logging.Logger): Command;
@@ -66,7 +65,7 @@ export abstract class Command<T = any> {
6665
const aliases = o.aliases && o.aliases.length > 0
6766
? '(' + o.aliases.map(a => `-${a}`).join(' ') + ')'
6867
: '';
69-
this.logger.info(` ${cyan('--' + o.name)} ${aliases}`);
68+
this.logger.info(` ${terminal.cyan('--' + o.name)} ${aliases}`);
7069
this.logger.info(` ${o.description}`);
7170
});
7271
}

packages/@angular/cli/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
"@angular-devkit/schematics": "0.5.10",
3636
"@schematics/angular": "0.5.10",
3737
"@schematics/update": "0.5.10",
38-
"chalk": "~2.2.0",
3938
"opn": "~5.1.0",
4039
"resolve": "^1.1.7",
4140
"rxjs": "^6.0.0",

0 commit comments

Comments
 (0)