本文整理匯總了TypeScript中@ngtools/logger.Logger.fatal方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Logger.fatal方法的具體用法?TypeScript Logger.fatal怎麽用?TypeScript Logger.fatal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ngtools/logger.Logger
的用法示例。
在下文中一共展示了Logger.fatal方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: patch
export default function patch(args: string[], opts: any, logger: Logger): void {
const newVersion = args[0];
const incFn = opts.patch ? (v: SemVer) => v.inc('patch') : (v: SemVer) => v;
if (!newVersion) {
logger.fatal('Need to pass in a new version.');
return;
}
const { packages } = require('../../../lib/packages');
const rootPackageJson = path.join(__dirname, '../../../package.json');
for (const packageName of Object.keys(packages)) {
if (packageName == 'angular-cli') {
// Skip the main package.
continue;
}
const pkgJson = require(packages[packageName].packageJson);
const version = new SemVer(pkgJson['version']);
const oldVersion = version.toString();
pkgJson['version'] = incFn(version).toString();
fs.writeFileSync(packages[packageName].packageJson, JSON.stringify(pkgJson, null, 2) + '\n');
logger.info(`${packageName}: ${oldVersion} => ${pkgJson['version']}`);
}
// Do the main package.
const angularCliPackageJson = require(rootPackageJson);
angularCliPackageJson['version'] = newVersion;
fs.writeFileSync(rootPackageJson, JSON.stringify(angularCliPackageJson, null, 2) + '\n');
}
示例2: catch
return promise.then(() => {
toolsLogger.info(name);
try {
return npmRun.execSync(`tsc -p ${path.relative(process.cwd(), pkg.root)}`);
} catch (err) {
toolsLogger.fatal(`Compilation error.\n${err.stdout}`);
}
});
示例3: changelog
export default function changelog(args: string[], _opts: any, logger: Logger): void {
if (args.length == 0) {
logger.fatal('publish changelog <start-tag>');
return;
}
cl(config, null, {from: args[0]})
.on('error', function (err: Error) {
logger.error('Failed to generate changelog: ' + err);
})
.pipe(changelogStream)
.on('close', prependDelta);
}
示例4: build
export function build(args: string[], _opts: any, logger: Logger): void {
const inFile = args[1] as string;
const outFile = args[2] as string;
if (!inFile) {
logger.fatal('Command build-schema needs an input file.');
return;
}
const output = require('./build-schema').buildSchema(inFile, logger);
if (outFile) {
fs.writeFileSync(outFile, output, { encoding: 'utf-8' });
} else {
logger.info(output);
}
}
示例5:
.then(() => process.exit(0), (err) => {
logger.fatal(err);
});