Skip to content

Commit b8336b2

Browse files
committed
refactor(@angular/cli): use ES6 imports instead of require
Main benefit is to use type definitions.
1 parent 29f8241 commit b8336b2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/angular/cli/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ ts_library(
6969
"//packages/angular_devkit/core/node",
7070
"//packages/angular_devkit/schematics",
7171
"//packages/angular_devkit/schematics/tools",
72+
"@npm//@angular/core",
7273
"@npm//@types/debug",
7374
"@npm//@types/inquirer",
7475
"@npm//@types/node",
@@ -79,6 +80,7 @@ ts_library(
7980
"@npm//@types/uuid",
8081
"@npm//ansi-colors",
8182
"@npm//jsonc-parser",
83+
"@npm//open",
8284
"@npm//ora",
8385
],
8486
)

packages/angular/cli/commands/doc-impl.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9+
import * as open from 'open';
910
import { Command } from '../models/command';
1011
import { Arguments } from '../models/interface';
1112
import { Schema as DocCommandSchema } from './doc';
1213

13-
const open = require('open');
14-
1514
export class DocCommand extends Command<DocCommandSchema> {
1615
public async run(options: DocCommandSchema & Arguments) {
1716
if (!options.keyword) {
@@ -39,7 +38,7 @@ export class DocCommand extends Command<DocCommandSchema> {
3938
// and use it if we can find it
4039
try {
4140
/* tslint:disable-next-line:no-implicit-dependencies */
42-
const currentNgVersion = require('@angular/core').VERSION.major;
41+
const currentNgVersion = (await import('@angular/core')).VERSION.major;
4342
domain = `v${currentNgVersion}.angular.io`;
4443
} catch (e) { }
4544
}

0 commit comments

Comments
 (0)