Skip to content

Commit 9d84529

Browse files
clydinfilipesilva
authored andcommitted
refactor(@angular/cli): remove common-tags usage
1 parent c84f19b commit 9d84529

File tree

9 files changed

+24
-22
lines changed

9 files changed

+24
-22
lines changed

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
"@schematics/angular": "0.5.0",
4848
"@schematics/update": "0.5.0",
4949
"chalk": "~2.2.0",
50-
"common-tags": "^1.3.1",
5150
"ember-cli-string-utils": "^1.0.0",
5251
"fs-extra": "^4.0.0",
5352
"lodash": "^4.11.1",
@@ -73,6 +72,7 @@
7372
"@types/request": "~2.0.0",
7473
"@types/semver": "^5.3.30",
7574
"ajv": "^6.1.1",
75+
"common-tags": "^1.3.1",
7676
"conventional-changelog": "1.1.0",
7777
"eslint": "^3.11.0",
7878
"express": "^4.14.0",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
getCollection,
66
getEngineHost
77
} from '../utilities/schematics';
8-
import { oneLine } from 'common-tags';
8+
import { tags } from '@angular-devkit/core';
99
import { SchematicCommand } from '../models/schematic-command';
1010

1111
const { cyan } = chalk;
@@ -41,7 +41,7 @@ export default class GenerateCommand extends SchematicCommand {
4141

4242
validate(options: any): boolean | Promise<boolean> {
4343
if (!options._[0]) {
44-
this.logger.error(oneLine`
44+
this.logger.error(tags.oneLine`
4545
The "ng generate" command requires a
4646
schematic name to be specified.
4747
For more details, use "ng help".`);

packages/@angular/cli/commands/version.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 { stripIndents } from 'common-tags';
2+
import { tags } from '@angular-devkit/core';
33
import * as fs from 'fs';
44
import * as path from 'path';
55
import * as child_process from 'child_process';
@@ -66,7 +66,7 @@ export default class VersionCommand extends Command {
6666
|___/
6767
`;
6868

69-
this.logger.info(stripIndents`
69+
this.logger.info(tags.stripIndents`
7070
${chalk.red(asciiArt)}
7171
Angular CLI: ${ngCliVersion}
7272
Node: ${process.versions.node}

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

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

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
CommandScope,
77
ArgumentStrategy
88
} from '../models/command';
9-
import { oneLine } from 'common-tags';
109
import { logging, normalize, tags } from '@angular-devkit/core';
1110
import { camelize } from '@angular-devkit/core/src/utils/strings';
1211
import { findUp } from '../utilities/find-up';
@@ -60,7 +59,7 @@ export async function runCommand(commandMap: CommandMap,
6059
}
6160

6261
if (!Cmd) {
63-
logger.error(oneLine`The specified command (${commandName}) is invalid.
62+
logger.error(tags.oneLine`The specified command (${commandName}) is invalid.
6463
For a list of available options, run \`ng help\`.`);
6564
throw '';
6665
}

packages/@angular/cli/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"@schematics/angular": "0.5.0",
3434
"@schematics/update": "0.5.0",
3535
"chalk": "~2.2.0",
36-
"common-tags": "^1.3.1",
3736
"ember-cli-string-utils": "^1.0.0",
3837
"fs-extra": "^4.0.0",
3938
"lodash": "^4.11.1",

packages/@angular/cli/upgrade/version.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { SemVer, satisfies } from 'semver';
22
import chalk from 'chalk';
3-
import { stripIndents, stripIndent } from 'common-tags';
3+
import { tags } from '@angular-devkit/core';
44
import * as path from 'path';
55
import { isWarningEnabled } from '../utilities/config';
66
import { requireProjectModule } from '../utilities/require-project-module';
@@ -64,14 +64,14 @@ export class Version {
6464
angularPkgJson = requireProjectModule(projectRoot, '@angular/core/package.json');
6565
rxjsPkgJson = requireProjectModule(projectRoot, 'rxjs/package.json');
6666
} catch {
67-
console.error(bold(red(stripIndents`
67+
console.error(bold(red(tags.stripIndents`
6868
You seem to not be depending on "@angular/core" and/or "rxjs". This is an error.
6969
`)));
7070
process.exit(2);
7171
}
7272

7373
if (!(angularPkgJson && angularPkgJson['version'] && rxjsPkgJson && rxjsPkgJson['version'])) {
74-
console.error(bold(red(stripIndents`
74+
console.error(bold(red(tags.stripIndents`
7575
Cannot determine versions of "@angular/core" and/or "rxjs".
7676
This likely means your local installation is broken. Please reinstall your packages.
7777
`)));
@@ -87,7 +87,7 @@ export class Version {
8787
}
8888

8989
if (!angularVersion.isGreaterThanOrEqualTo(new SemVer('5.0.0'))) {
90-
console.error(bold(red(stripIndents`
90+
console.error(bold(red(tags.stripIndents`
9191
This version of CLI is only compatible with Angular version 5.0.0 or higher.
9292
9393
Please visit the link below to find instructions on how to update Angular.
@@ -99,7 +99,7 @@ export class Version {
9999
&& !rxjsVersion.isGreaterThanOrEqualTo(new SemVer('5.6.0-forward-compat.0'))
100100
&& !rxjsVersion.isGreaterThanOrEqualTo(new SemVer('6.0.0-beta.0'))
101101
) {
102-
console.error(bold(red(stripIndents`
102+
console.error(bold(red(tags.stripIndents`
103103
This project uses version ${rxjsVersion} of RxJs, which is not supported by Angular v6.
104104
The official RxJs version that is supported is 5.6.0-forward-compat.0 and greater.
105105
@@ -111,7 +111,7 @@ export class Version {
111111
angularVersion.isGreaterThanOrEqualTo(new SemVer('6.0.0-rc.0'))
112112
&& !rxjsVersion.isGreaterThanOrEqualTo(new SemVer('6.0.0-beta.0'))
113113
) {
114-
console.warn(bold(red(stripIndents`
114+
console.warn(bold(red(tags.stripIndents`
115115
This project uses a temporary compatibility version of RxJs (${rxjsVersion}.
116116
117117
Please visit the link below to find instructions on how to update RxJs.
@@ -129,7 +129,7 @@ export class Version {
129129
compilerVersion = requireProjectModule(projectRoot, '@angular/compiler-cli').VERSION.full;
130130
tsVersion = requireProjectModule(projectRoot, 'typescript').version;
131131
} catch {
132-
console.error(bold(red(stripIndents`
132+
console.error(bold(red(tags.stripIndents`
133133
Versions of @angular/compiler-cli and typescript could not be determined.
134134
The most common reason for this is a broken npm install.
135135
@@ -153,7 +153,7 @@ export class Version {
153153

154154
if (currentCombo && !satisfies(tsVersion, currentCombo.typescript)) {
155155
// First line of warning looks weird being split in two, disable tslint for it.
156-
console.log((yellow('\n' + stripIndent`
156+
console.log((yellow('\n' + tags.stripIndent`
157157
@angular/compiler-cli@${compilerVersion} requires typescript@'${
158158
currentCombo.typescript}' but ${tsVersion} was found instead.
159159
Using this version can result in undefined behaviour and difficult to debug problems.

packages/@angular/cli/utilities/validate-project-name.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {oneLine, stripIndent} from 'common-tags';
1+
import { tags } from '@angular-devkit/core';
22

33
const SilentError = require('silent-error');
44

@@ -22,12 +22,12 @@ function getRegExpFailPosition(str: string): number | null {
2222
export function validateProjectName(projectName: string) {
2323
const errorIndex = getRegExpFailPosition(projectName);
2424
if (errorIndex !== null) {
25-
const firstMessage = oneLine`
25+
const firstMessage = tags.oneLine`
2626
Project name "${projectName}" is not valid. New project names must
2727
start with a letter, and must contain only alphanumeric characters or dashes.
2828
When adding a dash the segment after the dash must also start with a letter.
2929
`;
30-
const msg = stripIndent`
30+
const msg = tags.stripIndent`
3131
${firstMessage}
3232
${projectName}
3333
${Array(errorIndex + 1).join(' ') + '^'}

0 commit comments

Comments
 (0)