schematic-command.d.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /**
  2. * @license
  3. * Copyright Google Inc. 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. */
  8. import { logging } from '@angular-devkit/core';
  9. import { workflow } from '@angular-devkit/schematics';
  10. import { FileSystemCollection, FileSystemEngine, FileSystemSchematic, NodeWorkflow } from '@angular-devkit/schematics/tools';
  11. import { BaseCommandOptions, Command } from './command';
  12. import { Arguments, CommandContext, CommandDescription, Option } from './interface';
  13. export interface BaseSchematicSchema {
  14. debug?: boolean;
  15. dryRun?: boolean;
  16. force?: boolean;
  17. interactive?: boolean;
  18. defaults?: boolean;
  19. }
  20. export interface RunSchematicOptions extends BaseSchematicSchema {
  21. collectionName: string;
  22. schematicName: string;
  23. additionalOptions?: {
  24. [key: string]: {};
  25. };
  26. schematicOptions?: string[];
  27. showNothingDone?: boolean;
  28. }
  29. export declare class UnknownCollectionError extends Error {
  30. constructor(collectionName: string);
  31. }
  32. export declare abstract class SchematicCommand<T extends BaseSchematicSchema & BaseCommandOptions> extends Command<T> {
  33. readonly allowPrivateSchematics: boolean;
  34. readonly allowAdditionalArgs: boolean;
  35. private _host;
  36. private _workspace;
  37. protected _workflow: NodeWorkflow;
  38. private readonly defaultCollectionName;
  39. protected collectionName: string;
  40. protected schematicName?: string;
  41. constructor(context: CommandContext, description: CommandDescription, logger: logging.Logger);
  42. initialize(options: T & Arguments): Promise<void>;
  43. printHelp(options: T & Arguments): Promise<number>;
  44. printHelpUsage(): Promise<void>;
  45. protected getEngine(): FileSystemEngine;
  46. protected getCollection(collectionName: string): FileSystemCollection;
  47. protected getSchematic(collection: FileSystemCollection, schematicName: string, allowPrivate?: boolean): FileSystemSchematic;
  48. protected setPathOptions(options: Option[], workingDir: string): {
  49. [name: string]: string;
  50. };
  51. protected createWorkflow(options: BaseSchematicSchema): workflow.BaseWorkflow;
  52. protected getDefaultSchematicCollection(): string;
  53. protected runSchematic(options: RunSchematicOptions): Promise<number | void>;
  54. protected parseFreeFormArguments(schematicOptions: string[]): Promise<Arguments>;
  55. protected parseArguments(schematicOptions: string[], options: Option[] | null): Promise<Arguments>;
  56. private _loadWorkspace;
  57. }