UNPKG

2.51 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { logging } from '@angular-devkit/core';
9import { workflow } from '@angular-devkit/schematics';
10import { FileSystemCollection, FileSystemEngine, FileSystemSchematic, NodeWorkflow } from '@angular-devkit/schematics/tools';
11import { BaseCommandOptions, Command } from './command';
12import { Arguments, CommandContext, CommandDescription, Option } from './interface';
13export interface BaseSchematicSchema {
14 debug?: boolean;
15 dryRun?: boolean;
16 force?: boolean;
17 interactive?: boolean;
18 defaults?: boolean;
19 packageRegistry?: string;
20}
21export interface RunSchematicOptions extends BaseSchematicSchema {
22 collectionName: string;
23 schematicName: string;
24 additionalOptions?: {
25 [key: string]: {};
26 };
27 schematicOptions?: string[];
28 showNothingDone?: boolean;
29}
30export declare class UnknownCollectionError extends Error {
31 constructor(collectionName: string);
32}
33export declare abstract class SchematicCommand<T extends BaseSchematicSchema & BaseCommandOptions> extends Command<T> {
34 protected readonly allowPrivateSchematics: boolean;
35 protected readonly useReportAnalytics = false;
36 protected _workflow: NodeWorkflow;
37 protected defaultCollectionName: string;
38 protected collectionName: string;
39 protected schematicName?: string;
40 constructor(context: CommandContext, description: CommandDescription, logger: logging.Logger);
41 initialize(options: T & Arguments): Promise<void>;
42 printHelp(): Promise<number>;
43 printHelpUsage(): Promise<void>;
44 protected getEngine(): FileSystemEngine;
45 protected getCollection(collectionName: string): FileSystemCollection;
46 protected getSchematic(collection: FileSystemCollection, schematicName: string, allowPrivate?: boolean): FileSystemSchematic;
47 protected setPathOptions(options: Option[], workingDir: string): {
48 [name: string]: string;
49 };
50 protected createWorkflow(options: BaseSchematicSchema): Promise<workflow.BaseWorkflow>;
51 protected getDefaultSchematicCollection(): Promise<string>;
52 protected runSchematic(options: RunSchematicOptions): Promise<number | void>;
53 protected parseFreeFormArguments(schematicOptions: string[]): Promise<Arguments>;
54 protected parseArguments(schematicOptions: string[], options: Option[] | null): Promise<Arguments>;
55}