feat(dev-infra): migrate ng-dev utils to use new logging system (#37422)
Migrate the ng-dev utils to use new logging system rather than directly calling console.* to create a better experience for users. PR Close #37422
This commit is contained in:
@ -9,6 +9,8 @@
|
|||||||
import {existsSync} from 'fs';
|
import {existsSync} from 'fs';
|
||||||
import {join} from 'path';
|
import {join} from 'path';
|
||||||
import {exec} from 'shelljs';
|
import {exec} from 'shelljs';
|
||||||
|
|
||||||
|
import {error} from './console';
|
||||||
import {isTsNodeAvailable} from './ts-node';
|
import {isTsNodeAvailable} from './ts-node';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -87,10 +89,10 @@ function readConfigFile(configPath: string): object {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return require(configPath)
|
return require(configPath);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Could not read configuration file.');
|
error('Could not read configuration file.');
|
||||||
console.error(e);
|
error(e);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,9 +105,9 @@ export function assertNoErrors(errors: string[]) {
|
|||||||
if (errors.length == 0) {
|
if (errors.length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.error(`Errors discovered while loading configuration file:`);
|
error(`Errors discovered while loading configuration file:`);
|
||||||
for (const error of errors) {
|
for (const err of errors) {
|
||||||
console.error(` - ${error}`);
|
error(` - ${err}`);
|
||||||
}
|
}
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user