本文整理汇总了TypeScript中@angular-devkit/core.terminal类的典型用法代码示例。如果您正苦于以下问题:TypeScript terminal类的具体用法?TypeScript terminal怎么用?TypeScript terminal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了terminal类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: switch
workflow.reporter.subscribe((event: DryRunEvent) => {
nothingDone = false;
switch (event.kind) {
case 'error':
error = true;
const desc = event.description == 'alreadyExist' ? 'already exists' : 'does not exist';
logger.warn(`ERROR! ${event.path} ${desc}.`);
break;
case 'update':
loggingQueue.push(tags.oneLine`
${terminal.white('UPDATE')} ${event.path} (${event.content.length} bytes)
`);
break;
case 'create':
loggingQueue.push(tags.oneLine`
${terminal.green('CREATE')} ${event.path} (${event.content.length} bytes)
`);
break;
case 'delete':
loggingQueue.push(`${terminal.yellow('DELETE')} ${event.path}`);
break;
case 'rename':
loggingQueue.push(`${terminal.blue('RENAME')} ${event.path} => ${event.to}`);
break;
}
});
开发者ID:cexbrayat,项目名称:angular-cli,代码行数:28,代码来源:schematics.ts
示例2: resolve
.on('close', (code: number) => {
if (code === 0) {
logger.info(terminal.green(`Installed packages for tooling via ${packageManager}.`));
resolve();
} else {
const message = 'Package install failed, see above.';
logger.info(terminal.red(message));
reject(message);
}
});
开发者ID:DevIntent,项目名称:angular-cli,代码行数:10,代码来源:npm-install.ts
示例3: tap
tap(result => {
if (result.success) {
parentLogger.info(terminal.green('SUCCESS'));
} else {
parentLogger.info(terminal.yellow('FAILURE'));
}
parentLogger.info('Result: ' + JSON.stringify({ ...result, info: undefined }, null, 4));
parentLogger.info('\nLogs:');
logs.forEach(l => parentLogger.next(l));
logs.splice(0);
}),
开发者ID:angular,项目名称:angular-cli,代码行数:12,代码来源:architect.ts
示例4: if
.then((data: Array<boolean>) => {
const [isYarnInstalled, isCNPMInstalled] = data;
if (isYarnInstalled && isCNPMInstalled) {
console.log(terminal.yellow('You can `ng config -g cli.packageManager yarn` '
+ 'or `ng config -g cli.packageManager cnpm`.'));
} else if (isYarnInstalled) {
console.log(terminal.yellow('You can `ng config -g cli.packageManager yarn`.'));
} else if (isCNPMInstalled) {
console.log(terminal.yellow('You can `ng config -g cli.packageManager cnpm`.'));
} else {
if (packageManager !== 'default' && packageManager !== 'npm') {
console.log(terminal.yellow(`Seems that ${packageManager} is not installed.`));
console.log(terminal.yellow('You can `ng config -g cli.packageManager npm`.'));
}
}
});
开发者ID:headinclouds,项目名称:angular-cli,代码行数:16,代码来源:check-package-manager.ts
示例5: printHelp
public async printHelp(options: GenerateCommandSchema & Arguments) {
await super.printHelp(options);
this.logger.info('');
// Find the generate subcommand.
const subcommand = this.description.options.filter(x => x.subcommands)[0];
if (Object.keys((subcommand && subcommand.subcommands) || {}).length == 1) {
this.logger.info(`\nTo see help for a schematic run:`);
this.logger.info(terminal.cyan(` ng generate <schematic> --help`));
}
return 0;
}
开发者ID:angular,项目名称:angular-cli,代码行数:13,代码来源:generate-impl.ts
示例6: run
async run() {
const phrase = pickOne([
`You're on it, there's nothing for me to do!`,
`Let's take a look... nope, it's all good!`,
`You're doing fine.`,
`You're already doing great.`,
`Nothing to do; already awesome. Exiting.`,
`Error 418: As Awesome As Can Get.`,
`I spy with my little eye a great developer!`,
`Noop... already awesome.`,
]);
this.logger.info(terminal.green(phrase));
}
开发者ID:DevIntent,项目名称:angular-cli,代码行数:13,代码来源:easter-egg-impl.ts
示例7: run
async run() {
this.logger.info(`Available Commands:`);
for (const name of Object.keys(Command.commandMap)) {
const cmd = Command.commandMap[name];
if (cmd.hidden) {
continue;
}
const aliasInfo = cmd.aliases.length > 0 ? ` (${cmd.aliases.join(', ')})` : '';
this.logger.info(` ${terminal.cyan(cmd.name)}${aliasInfo} ${cmd.description}`);
}
this.logger.info(`\nFor more detailed help run "ng [command name] --help"`);
}
开发者ID:DevIntent,项目名称:angular-cli,代码行数:15,代码来源:help-impl.ts
示例8: function
export default async function (packageName: string,
logger: logging.Logger,
packageManager: string,
projectRoot: string,
save = true) {
const installArgs: string[] = [];
switch (packageManager) {
case 'cnpm':
case 'pnpm':
case 'npm':
installArgs.push('install', '--silent');
break;
case 'yarn':
installArgs.push('add');
break;
default:
packageManager = 'npm';
installArgs.push('install', '--quiet');
break;
}
logger.info(terminal.green(`Installing packages for tooling via ${packageManager}.`));
if (packageName) {
installArgs.push(packageName);
}
if (!save) {
installArgs.push('--no-save');
}
await new Promise((resolve, reject) => {
spawn(packageManager, installArgs, { stdio: 'inherit', shell: true })
.on('close', (code: number) => {
if (code === 0) {
logger.info(terminal.green(`Installed packages for tooling via ${packageManager}.`));
resolve();
} else {
const message = 'Package install failed, see above.';
logger.info(terminal.red(message));
reject(message);
}
});
});
}
开发者ID:angular,项目名称:angular-cli,代码行数:47,代码来源:npm-install.ts
示例9: _exec
function _exec(options: ExecOptions, cmd: string, args: string[]): Promise<ProcessOutput> {
let stdout = '';
let stderr = '';
const cwd = process.cwd();
console.log(
`==========================================================================================`
);
args = args.filter(x => x !== undefined);
const flags = [
options.silent && 'silent',
options.waitForMatch && `matching(${options.waitForMatch})`
]
.filter(x => !!x) // Remove false and undefined.
.join(', ')
.replace(/^(.+)$/, ' [$1]'); // Proper formatting.
console.log(terminal.blue(`Running \`${cmd} ${args.map(x => `"${x}"`).join(' ')}\`${flags}...`));
console.log(terminal.blue(`CWD: ${cwd}`));
const spawnOptions: any = {cwd};
if (process.platform.startsWith('win')) {
args.unshift('/c', cmd);
cmd = 'cmd.exe';
spawnOptions['stdio'] = 'pipe';
}
const childProcess = child_process.spawn(cmd, args, spawnOptions);
childProcess.stdout.on('data', (data: Buffer) => {
stdout += data.toString('utf-8');
if (options.silent) {
return;
}
data.toString('utf-8')
.split(/[\n\r]+/)
.filter(line => line !== '')
.forEach(line => console.log(' ' + line));
});
childProcess.stderr.on('data', (data: Buffer) => {
stderr += data.toString('utf-8');
if (options.silent) {
return;
}
data.toString('utf-8')
.split(/[\n\r]+/)
.filter(line => line !== '')
.forEach(line => console.error(terminal.yellow(' ' + line)));
});
_processes.push(childProcess);
// Create the error here so the stack shows who called this function.
const err = new Error(`Running "${cmd} ${args.join(' ')}" returned error code `);
return new Promise((resolve, reject) => {
childProcess.on('exit', (error: any) => {
_processes = _processes.filter(p => p !== childProcess);
if (!error) {
resolve({ stdout, stderr });
} else {
err.message += `${error}...\n\nSTDOUT:\n${stdout}\n\nSTDERR:\n${stderr}\n`;
reject(err);
}
});
if (options.waitForMatch) {
childProcess.stdout.on('data', (data: Buffer) => {
if (data.toString().match(options.waitForMatch)) {
resolve({ stdout, stderr });
}
});
childProcess.stderr.on('data', (data: Buffer) => {
if (data.toString().match(options.waitForMatch)) {
resolve({ stdout, stderr });
}
});
}
});
}
开发者ID:fmalcher,项目名称:angular-cli,代码行数:79,代码来源:process.ts
示例10: function
export default async function (packageName: string,
logger: logging.Logger,
packageManager: string,
projectRoot: string,
save = true) {
const installArgs: string[] = [];
switch (packageManager) {
case 'cnpm':
case 'npm':
installArgs.push('install', '--quiet');
break;
case 'yarn':
installArgs.push('add');
break;
default:
packageManager = 'npm';
installArgs.push('install', '--quiet');
break;
}
logger.info(terminal.green(`Installing packages for tooling via ${packageManager}.`));
if (packageName) {
try {
// Verify if we need to install the package (it might already be there).
// If it's available and we shouldn't save, simply return. Nothing to be done.
resolve(packageName, { checkLocal: true, basedir: projectRoot });
return;
} catch (e) {
if (!(e instanceof ModuleNotFoundException)) {
throw e;
}
}
installArgs.push(packageName);
}
if (!save) {
installArgs.push('--no-save');
}
const installOptions = {
stdio: 'inherit',
shell: true,
};
await new Promise((resolve, reject) => {
spawn(packageManager, installArgs, installOptions)
.on('close', (code: number) => {
if (code === 0) {
logger.info(terminal.green(`Installed packages for tooling via ${packageManager}.`));
resolve();
} else {
const message = 'Package install failed, see above.';
logger.info(terminal.red(message));
reject(message);
}
});
});
}
开发者ID:DevIntent,项目名称:angular-cli,代码行数:61,代码来源:npm-install.ts
注:本文中的@angular-devkit/core.terminal类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论