本文整理汇总了TypeScript中@ionic/cli-framework/utils/format.columnar函数的典型用法代码示例。如果您正苦于以下问题:TypeScript columnar函数的具体用法?TypeScript columnar怎么用?TypeScript columnar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了columnar函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: run
async run(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void> {
const registry = await this.getRegistry();
const rows = registry.ailments.map(ailment => {
const tags: string[] = [];
const ignored = this.env.config.get(`doctor.issues.${ailment.id}.ignored` as any);
if (ignored) {
tags.push('ignored');
}
if (isTreatableAilment(ailment)) {
tags.push('treatable');
}
if (!ailment.implicit) {
tags.push('explicit-detection');
}
return [
input(ailment.id),
ailment.projects ? ailment.projects.map(t => strong(t)).join(', ') : 'all',
tags.map(t => strong(t)).join(', '),
];
});
rows.sort((row1, row2) => strcmp(row1[0], row2[0]));
this.env.log.rawmsg(columnar(rows, { headers: ['id', 'affected projects', 'tags'] }));
}
开发者ID:driftyco,项目名称:ionic-cli,代码行数:30,代码来源:list.ts
示例2: run
async run(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void> {
if (!this.project) {
throw new FatalException(`Cannot run ${input('ionic deploy build')} outside a project directory.`);
}
const token = this.env.session.getUserToken();
const appflowId = await this.project.requireAppflowId();
if (!options.commit) {
options.commit = (await this.env.shell.output('git', ['rev-parse', 'HEAD'], { cwd: this.project.directory })).trim();
debug(`Commit hash: ${strong(options.commit)}`);
}
let build = await this.createDeployBuild(appflowId, token, options);
const buildId = build.job_id;
const details = columnar([
['App ID', strong(appflowId)],
['Build ID', strong(buildId.toString())],
['Commit', strong(`${build.commit.sha.substring(0, 6)} ${build.commit.note}`)],
['Environment', build.environment_name ? strong(build.environment_name) : weak('not set')],
['Channels', build.pending_channels.length ? build.pending_channels.map(v => strong(`"${v}"`)).join(', ') : weak('not set')],
], { vsep: ':' });
this.env.log.ok(
`Build created\n` +
details + '\n\n'
);
build = await this.tailBuildLog(appflowId, buildId, token);
if (build.state !== 'success') {
throw new Error('Build failed');
}
}
开发者ID:driftyco,项目名称:ionic-cli,代码行数:35,代码来源:build.ts
示例3: verifyOptions
export function verifyOptions(options: CommandLineOptions, { log }: { log: ILogger; }): void {
// If the action is list then lets just end here.
if (options['list']) {
const headers = ['name', 'description'];
const typeOption = options['type'] ? String(options['type']) : undefined;
if (typeOption && !PROJECT_TYPES.includes(typeOption as ProjectType)) {
throw new FatalException(
`${input(typeOption)} is not a valid project type.\n` +
`Valid project types are: ${getStarterProjectTypes().map(type => input(type)).join(', ')}`
);
}
const starterTypes = typeOption ? [typeOption] : getStarterProjectTypes();
for (const starterType of starterTypes) {
const starters = STARTER_TEMPLATES.filter(template => template.projectType === starterType);
log.rawmsg(`\n${strong(`Starters for ${prettyProjectName(starterType)}`)} (${input(`--type=${starterType}`)})\n\n`);
log.rawmsg(columnar(starters.map(({ name, description }) => [input(name), description || '']), { headers }));
log.rawmsg('\n');
}
throw new FatalException('', 0);
}
if (options['skip-deps']) {
log.warn(`The ${input('--skip-deps')} option has been deprecated. Please use ${input('--no-deps')}.`);
options['deps'] = false;
}
if (options['skip-link']) {
log.warn(`The ${input('--skip-link')} option has been deprecated. Please use ${input('--no-link')}.`);
options['link'] = false;
}
if (options['pro-id']) {
log.warn(`The ${input('--pro-id')} option has been deprecated. Please use ${input('--id')}.`);
options['id'] = options['pro-id'];
}
if (options['id']) {
if (options['link'] === false) {
log.warn(`The ${input('--no-link')} option has no effect with ${input('--id')}. App must be linked.`);
}
options['link'] = true;
if (!options['git']) {
log.warn(`The ${input('--no-git')} option has no effect with ${input('--id')}. Git must be used.`);
}
options['git'] = true;
}
}
开发者ID:driftyco,项目名称:ionic-cli,代码行数:55,代码来源:start.ts
示例4: run
async run(): Promise<void> {
const data = [
[`${indent(4)}${input('ionic cordova platform save')}`, `save existing installed platforms to ${strong('config.xml')}`],
[`${indent(4)}${input('ionic cordova plugin save')}`, `save existing installed plugins to ${strong('config.xml')}`],
[`${indent(4)}${input('ionic cordova platform --help')}`, `view help page for managing Cordova platforms`],
[`${indent(4)}${input('ionic cordova plugin --help')}`, `view help page for managing Cordova plugins`],
[`${indent(4)}${input('ionic cordova prepare')}`, `install platforms and plugins listed in ${strong('config.xml')}`],
];
throw new FatalException(
`${input('ionic state')} has been removed.\n\n` +
`We recommend using Cordova directly to manage Cordova plugins and platforms.\n` +
`The following commands fulfill the old ${input('ionic state')} functionality:\n\n` +
`${columnar(data, {})}\n\n` +
`See ${strong('https://cordova.apache.org/docs/en/latest/platform_plugin_versioning_ref/')} for detailed information.\n`
);
}
开发者ID:driftyco,项目名称:ionic-cli,代码行数:17,代码来源:state.ts
示例5: printConfig
printConfig(ctx: ConfigContext, v: any): void {
const { global, json } = ctx;
if (json) {
process.stdout.write(this.jsonStringify(v));
} else {
if (global && v && typeof v === 'object') {
const columns = lodash.entries(v)
.map(([k, v]) => [k, this.sanitizeEntry(k, v)])
.map(([k, v]) => [strong(k), util.inspect(v, { colors: chalk.enabled })]);
columns.sort((a, b) => strcmp(a[0], b[0]));
this.env.log.rawmsg(columnar(columns, {}));
} else {
this.env.log.rawmsg(util.inspect(v, { depth: Infinity, colors: chalk.enabled }));
}
}
}
开发者ID:driftyco,项目名称:ionic-cli,代码行数:19,代码来源:get.ts
示例6: run
async run(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void> {
const { loadConfigXml } = await import('../../lib/integrations/cordova/config');
if (!this.project) {
throw new FatalException(`Cannot run ${input('ionic monitoring syncmaps')} outside a project directory.`);
}
const token = this.env.session.getUserToken();
const appflowId = await this.project.requireAppflowId();
const [ snapshotId ] = inputs;
const doBuild = options.build ? true : false;
const cordova = this.project.requireIntegration('cordova');
const conf = await loadConfigXml(cordova);
const cordovaInfo = conf.getProjectInfo();
const appVersion = cordovaInfo.version;
const commitHash = (await this.env.shell.output('git', ['rev-parse', 'HEAD'], { cwd: this.project.directory })).trim();
debug(`Commit hash: ${strong(commitHash)}`);
const sourcemapsDir = path.resolve(this.project.directory, SOURCEMAP_DIRECTORY);
let sourcemapsExist = await pathExists(sourcemapsDir);
if (doBuild || !sourcemapsExist) {
// TODO: use runner directly
await build({ config: this.env.config, log: this.env.log, shell: this.env.shell, prompt: this.env.prompt, project: this.project }, [], { _: [], prod: true });
}
sourcemapsExist = await pathExists(sourcemapsDir);
if (sourcemapsExist) {
this.env.log.msg(`Using existing sourcemaps in ${strong(prettyPath(sourcemapsDir))}`);
} else { // TODO: this is hard-coded for ionic-angular, make it work for all project types
throw new FatalException(
`Cannot find directory: ${strong(prettyPath(sourcemapsDir))}.\n` +
`Make sure you have the latest ${strong('@ionic/app-scripts')}. Then, re-run this command.`
);
}
let count = 0;
const tasks = this.createTaskChain();
const syncTask = tasks.next('Syncing sourcemaps');
const sourcemapFiles = (await readdirSafe(sourcemapsDir)).filter(f => f.endsWith('.js.map'));
debug(`Found ${sourcemapFiles.length} sourcemap files: ${sourcemapFiles.map(f => strong(f)).join(', ')}`);
await Promise.all(sourcemapFiles.map(async f => {
await this.syncSourcemap(path.resolve(sourcemapsDir, f), snapshotId, appVersion, commitHash, appflowId, token);
count += 1;
syncTask.msg = `Syncing sourcemaps: ${strong(`${count} / ${sourcemapFiles.length}`)}`;
}));
syncTask.msg = `Syncing sourcemaps: ${strong(`${sourcemapFiles.length} / ${sourcemapFiles.length}`)}`;
tasks.end();
const details = columnar([
['App ID', strong(appflowId)],
['Version', strong(appVersion)],
['Package ID', strong(cordovaInfo.id)],
['Snapshot ID', snapshotId ? strong(snapshotId) : weak('not set')],
], { vsep: ':' });
this.env.log.ok(
`Sourcemaps synced!\n` +
details + '\n\n' +
`See the Error Monitoring docs for usage information and next steps: ${strong('https://ionicframework.com/docs/appflow/monitoring')}`
);
}
开发者ID:driftyco,项目名称:ionic-cli,代码行数:69,代码来源:syncmaps.ts
示例7: columnar
const format = (details: [string, string][]) => columnar(details, { vsep: ':' });
开发者ID:driftyco,项目名称:ionic-cli,代码行数:1,代码来源:info.ts
注:本文中的@ionic/cli-framework/utils/format.columnar函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论