@angular-devkit/schematics
- Version 18.2.3
- Published
- 254 kB
- 5 dependencies
- MIT license
Install
npm i @angular-devkit/schematics
yarn add @angular-devkit/schematics
pnpm add @angular-devkit/schematics
Overview
Angular Schematics - Library
Index
Variables
Functions
- apply()
- applyContentTemplate()
- applyPathTemplate()
- applyTemplates()
- applyToSubtree()
- asSource()
- branchAndMerge()
- callRule()
- callSource()
- chain()
- composeFileOperators()
- contentTemplate()
- empty()
- externalSchematic()
- filter()
- forEach()
- isContentAction()
- mergeWith()
- move()
- noop()
- partitionApplyMerge()
- pathTemplate()
- renameTemplateFiles()
- schematic()
- source()
- template()
- url()
- when()
Classes
Interfaces
Enums
Type Aliases
Namespaces
Variables
variable FileVisitorCancelToken
const FileVisitorCancelToken: Symbol;
variable TEMPLATE_FILENAME_RE
const TEMPLATE_FILENAME_RE: RegExp;
variable Tree
const Tree: TreeConstructor;
variable TreeSymbol
const TreeSymbol: Symbol;
Functions
function apply
apply: (source: Source, rules: Rule[]) => Source;
Apply multiple rules to a source, and returns the source transformed.
function applyContentTemplate
applyContentTemplate: <T>(options: T) => FileOperator;
function applyPathTemplate
applyPathTemplate: <T extends PathTemplateData>( data: T, options?: PathTemplateOptions) => FileOperator;
function applyTemplates
applyTemplates: <T extends object>(options: T) => Rule;
function applyToSubtree
applyToSubtree: (path: string, rules: Rule[]) => Rule;
function asSource
asSource: (rule: Rule) => Source;
function branchAndMerge
branchAndMerge: (rule: Rule, strategy?: MergeStrategy) => Rule;
function callRule
callRule: ( rule: Rule, input: Tree | Observable<Tree>, context: SchematicContext) => Observable<Tree>;
function callSource
callSource: (source: Source, context: SchematicContext) => Observable<Tree>;
function chain
chain: (rules: Iterable<Rule> | AsyncIterable<Rule>) => Rule;
Chain multiple rules into a single rule.
function composeFileOperators
composeFileOperators: (operators: FileOperator[]) => FileOperator;
function contentTemplate
contentTemplate: <T>(options: T) => Rule;
function empty
empty: () => Source;
A source that returns an empty tree.
function externalSchematic
externalSchematic: <OptionT extends object>( collectionName: string, schematicName: string, options: OptionT, executionOptions?: Partial<ExecutionOptions>) => Rule;
Run a schematic from a separate collection.
Parameter collectionName
The name of the collection that contains the schematic to run.
Parameter schematicName
The name of the schematic to run.
Parameter options
The options to pass as input to the RuleFactory.
function filter
filter: (predicate: FilePredicate<boolean>) => Rule;
function forEach
forEach: (operator: FileOperator) => Rule;
function isContentAction
isContentAction: ( action: Action) => action is CreateFileAction | OverwriteFileAction;
function mergeWith
mergeWith: (source: Source, strategy?: MergeStrategy) => Rule;
Merge an input tree with the source passed in.
function move
move: (from: string, to?: string) => Rule;
function noop
noop: () => Rule;
function partitionApplyMerge
partitionApplyMerge: ( predicate: FilePredicate<boolean>, ruleYes: Rule, ruleNo?: Rule) => Rule;
function pathTemplate
pathTemplate: <T extends PathTemplateData>(options: T) => Rule;
function renameTemplateFiles
renameTemplateFiles: () => Rule;
Remove every
.template
suffix from file names.
function schematic
schematic: <OptionT extends object>( schematicName: string, options: OptionT, executionOptions?: Partial<ExecutionOptions>) => Rule;
Run a schematic from the same collection.
Parameter schematicName
The name of the schematic to run.
Parameter options
The options to pass as input to the RuleFactory.
function source
source: (tree: Tree) => Source;
A Source that returns an tree as its single value.
function template
template: <T extends object>(options: T) => Rule;
function url
url: (urlString: string) => Source;
function when
when: ( predicate: FilePredicate<boolean>, operator: FileOperator) => FileOperator;
Classes
class ActionList
class ActionList implements Iterable<Action> {}
property length
readonly length: number;
method [Symbol.iterator]
[Symbol.iterator]: () => IterableIterator<Action>;
method create
create: (path: Path, content: Buffer) => void;
method delete
delete: (path: Path) => void;
method find
find: (predicate: (value: Action) => boolean) => Action | null;
method forEach
forEach: ( fn: (value: Action, index: number, array: Action[]) => void, thisArg?: {}) => void;
method get
get: (i: number) => Action;
method has
has: (action: Action) => boolean;
method optimize
optimize: () => void;
method overwrite
overwrite: (path: Path, content: Buffer) => void;
method push
push: (action: Action) => void;
method rename
rename: (path: Path, to: Path) => void;
class CircularCollectionException
class CircularCollectionException extends BaseException {}
constructor
constructor(name: string);
class CollectionImpl
class CollectionImpl<CollectionT extends object, SchematicT extends object> implements Collection<CollectionT, SchematicT> {}
constructor
constructor( _description: { readonly name: string; readonly extends?: string[] }, _engine: SchematicEngine<CollectionT, SchematicT>, baseDescriptions?: CollectionDescription<CollectionT>[]);
property baseDescriptions
readonly baseDescriptions?: CollectionDescription<CollectionT>[];
property description
readonly description: { readonly name: string; readonly extends?: string[] };
property name
readonly name: string;
method createSchematic
createSchematic: ( name: string, allowPrivate?: boolean) => Schematic<CollectionT, SchematicT>;
method listSchematicNames
listSchematicNames: (includeHidden?: boolean) => string[];
class ContentHasMutatedException
class ContentHasMutatedException extends BaseException {}
constructor
constructor(path: string);
class DelegateTree
class DelegateTree implements Tree {}
constructor
constructor(_other: Tree);
property actions
readonly actions: Action[];
property root
readonly root: DirEntry;
method apply
apply: (action: Action, strategy?: MergeStrategy) => void;
method beginUpdate
beginUpdate: (path: string) => UpdateRecorder;
method branch
branch: () => Tree;
method commitUpdate
commitUpdate: (record: UpdateRecorder) => void;
method create
create: (path: string, content: Buffer | string) => void;
method delete
delete: (path: string) => void;
method exists
exists: (path: string) => boolean;
method get
get: (path: string) => FileEntry | null;
method getDir
getDir: (path: string) => DirEntry;
method merge
merge: (other: Tree, strategy?: MergeStrategy) => void;
method overwrite
overwrite: (path: string, content: Buffer | string) => void;
method read
read: (path: string) => Buffer | null;
method readJson
readJson: (path: string) => JsonValue;
method readText
readText: (path: string) => string;
method rename
rename: (from: string, to: string) => void;
method visit
visit: (visitor: FileVisitor) => void;
class DryRunSink
class DryRunSink extends HostSink {}
constructor
constructor(host: virtualFs.Host, force?: boolean);
Parameter dir
The host to use to output. This should be scoped.
Parameter force
Whether to force overwriting files that already exist.
property reporter
readonly reporter: Observable<DryRunEvent>;
class EmptyTree
class EmptyTree extends HostTree {}
constructor
constructor();
class FileAlreadyExistException
class FileAlreadyExistException extends BaseException {}
constructor
constructor(path: string);
class FileDoesNotExistException
class FileDoesNotExistException extends BaseException {}
constructor
constructor(path: string);
class FilterHostTree
class FilterHostTree extends HostTree {}
constructor
constructor(tree: HostTree, filter?: FilePredicate<boolean>);
class HostCreateTree
class HostCreateTree extends HostTree {}
constructor
constructor(host: virtualFs.ReadonlyHost);
class HostDirEntry
class HostDirEntry implements DirEntry {}
constructor
constructor( parent: DirEntry, path: Path, _host: virtualFs.SyncDelegateHost, _tree: Tree);
property parent
readonly parent: DirEntry;
property path
readonly path: Path;
property subdirs
readonly subdirs: PathFragment[];
property subfiles
readonly subfiles: PathFragment[];
method dir
dir: (name: PathFragment) => DirEntry;
method file
file: (name: PathFragment) => FileEntry | null;
method visit
visit: (visitor: FileVisitor) => void;
class HostSink
class HostSink extends SimpleSinkBase {}
constructor
constructor(_host: virtualFs.Host, _force?: boolean);
class HostTree
class HostTree implements Tree {}
constructor
constructor(_backend?: virtualFs.ReadonlyHost<{}>);
property actions
readonly actions: Action[];
property root
readonly root: DirEntry;
method apply
apply: (action: Action, strategy?: MergeStrategy) => void;
method beginUpdate
beginUpdate: (path: string) => UpdateRecorder;
method branch
branch: () => Tree;
method commitUpdate
commitUpdate: (record: UpdateRecorder) => void;
method create
create: (path: string, content: Buffer | string) => void;
method delete
delete: (path: string) => void;
method exists
exists: (path: string) => boolean;
method get
get: (path: string) => FileEntry | null;
method getDir
getDir: (path: string) => DirEntry;
method isHostTree
static isHostTree: (tree: Tree) => tree is HostTree;
method merge
merge: (other: Tree, strategy?: MergeStrategy) => void;
method overwrite
overwrite: (path: string, content: Buffer | string) => void;
method read
read: (path: string) => Buffer | null;
method readJson
readJson: (path: string) => JsonValue;
method readText
readText: (path: string) => string;
method rename
rename: (from: string, to: string) => void;
method visit
visit: (visitor: FileVisitor) => void;
class InvalidPipeException
class InvalidPipeException extends BaseException {}
constructor
constructor(name: string);
class InvalidRuleResultException
class InvalidRuleResultException extends BaseException {}
When a rule or source returns an invalid value.
constructor
constructor(value?: {});
class InvalidSchematicsNameException
class InvalidSchematicsNameException extends BaseException {}
constructor
constructor(name: string);
class InvalidSourceResultException
class InvalidSourceResultException extends BaseException {}
constructor
constructor(value?: {});
class InvalidUpdateRecordException
class InvalidUpdateRecordException extends BaseException {}
constructor
constructor();
class MergeConflictException
class MergeConflictException extends BaseException {}
constructor
constructor(path: string);
class OptionIsNotDefinedException
class OptionIsNotDefinedException extends BaseException {}
constructor
constructor(name: string);
class PrivateSchematicException
class PrivateSchematicException extends BaseException {}
constructor
constructor( name: string, collection: { readonly name: string; readonly extends?: string[] });
class SchematicEngine
class SchematicEngine<CollectionT extends object, SchematicT extends object> implements Engine<CollectionT, SchematicT> {}
constructor
constructor(_host: EngineHost<CollectionT, SchematicT>, _workflow?: Workflow);
property defaultMergeStrategy
readonly defaultMergeStrategy: MergeStrategy;
property workflow
readonly workflow: Workflow;
method createCollection
createCollection: ( name: string, requester?: Collection<CollectionT, SchematicT>) => Collection<CollectionT, SchematicT>;
method createContext
createContext: ( schematic: Schematic<CollectionT, SchematicT>, parent?: Partial<TypedSchematicContext<CollectionT, SchematicT>>, executionOptions?: Partial<ExecutionOptions>) => TypedSchematicContext<CollectionT, SchematicT>;
method createSchematic
createSchematic: ( name: string, collection: Collection<CollectionT, SchematicT>, allowPrivate?: boolean) => Schematic<CollectionT, SchematicT>;
method createSourceFromUrl
createSourceFromUrl: ( url: Url, context: TypedSchematicContext<CollectionT, SchematicT>) => Source;
method executePostTasks
executePostTasks: () => Observable<void>;
method listSchematicNames
listSchematicNames: ( collection: Collection<CollectionT, SchematicT>, includeHidden?: boolean) => string[];
method transformOptions
transformOptions: <OptionT extends object, ResultT extends object>( schematic: Schematic<CollectionT, SchematicT>, options: OptionT, context?: TypedSchematicContext<CollectionT, SchematicT>) => Observable<ResultT>;
class SchematicEngineConflictingException
class SchematicEngineConflictingException extends BaseException {}
constructor
constructor();
class SchematicImpl
class SchematicImpl<CollectionT extends object, SchematicT extends object> implements Schematic<CollectionT, SchematicT> {}
constructor
constructor( _description: { readonly collection: CollectionDescription<CollectionT>; readonly name: string; readonly private?: boolean; readonly hidden?: boolean; }, _factory: RuleFactory<{}>, _collection: Collection<CollectionT, SchematicT>, _engine: Engine<CollectionT, SchematicT>);
property collection
readonly collection: Collection<CollectionT, SchematicT>;
property description
readonly description: { readonly collection: CollectionDescription<CollectionT>; readonly name: string; readonly private?: boolean; readonly hidden?: boolean;};
method call
call: <OptionT extends object>( options: OptionT, host: Observable<Tree>, parentContext?: Partial<TypedSchematicContext<CollectionT, SchematicT>>, executionOptions?: Partial<ExecutionOptions>) => Observable<Tree>;
class SchematicsException
class SchematicsException extends BaseException {}
class SimpleSinkBase
abstract class SimpleSinkBase implements Sink {}
property postCommit
postCommit: () => void | Observable<void>;
property postCommitAction
postCommitAction: (action: Action) => void | Observable<void>;
property preCommit
preCommit: () => void | Observable<void>;
property preCommitAction
preCommitAction: ( action: Action) => void | Action | PromiseLike<Action> | Observable<Action>;
method commit
commit: (tree: Tree) => Observable<void>;
method commitSingleAction
commitSingleAction: (action: Action) => Observable<void>;
method validateSingleAction
validateSingleAction: (action: Action) => Observable<void>;
class TaskScheduler
class TaskScheduler {}
constructor
constructor(_context: SchematicContext);
method finalize
finalize: () => ReadonlyArray<TaskInfo>;
method schedule
schedule: <T extends object>(taskConfiguration: TaskConfiguration<T>) => TaskId;
class UnimplementedException
class UnimplementedException extends BaseException {}
constructor
constructor();
class UnknownActionException
class UnknownActionException extends BaseException {}
constructor
constructor(action: Action);
class UnknownCollectionException
class UnknownCollectionException extends BaseException {}
constructor
constructor(name: string);
class UnknownPipeException
class UnknownPipeException extends BaseException {}
constructor
constructor(name: string);
class UnknownSchematicException
class UnknownSchematicException extends BaseException {}
constructor
constructor( name: string, collection: { readonly name: string; readonly extends?: string[] });
class UnknownTaskDependencyException
class UnknownTaskDependencyException extends BaseException {}
constructor
constructor(id: TaskId);
class UnknownUrlSourceProtocol
class UnknownUrlSourceProtocol extends BaseException {}
constructor
constructor(url: string);
class UnregisteredTaskException
class UnregisteredTaskException extends BaseException {}
constructor
constructor( name: string, schematic?: { readonly collection: { readonly name: string; readonly extends?: string[]; }; readonly name: string; readonly private?: boolean; readonly hidden?: boolean; });
class UnsuccessfulWorkflowExecution
class UnsuccessfulWorkflowExecution extends BaseException {}
constructor
constructor();
Interfaces
interface ActionBase
interface ActionBase {}
interface Collection
interface Collection< CollectionMetadataT extends object, SchematicMetadataT extends object> {}
A Collection as created by the Engine. This should be used by the tool to create schematics, or by rules to create other schematics as well.
property baseDescriptions
readonly baseDescriptions?: Array<CollectionDescription<CollectionMetadataT>>;
property description
readonly description: CollectionDescription<CollectionMetadataT>;
method createSchematic
createSchematic: ( name: string, allowPrivate?: boolean) => Schematic<CollectionMetadataT, SchematicMetadataT>;
method listSchematicNames
listSchematicNames: (includeHidden?: boolean) => string[];
interface CreateFileAction
interface CreateFileAction extends ActionBase {}
interface DeleteFileAction
interface DeleteFileAction extends ActionBase {}
property kind
readonly kind: 'd';
interface DirEntry
interface DirEntry {}
property parent
readonly parent: DirEntry | null;
property path
readonly path: Path;
property subdirs
readonly subdirs: PathFragment[];
property subfiles
readonly subfiles: PathFragment[];
method dir
dir: (name: PathFragment) => DirEntry;
method file
file: (name: PathFragment) => FileEntry | null;
method visit
visit: (visitor: FileVisitor) => void;
interface DryRunCreateEvent
interface DryRunCreateEvent {}
interface DryRunDeleteEvent
interface DryRunDeleteEvent {}
interface DryRunErrorEvent
interface DryRunErrorEvent {}
property description
description: 'alreadyExist' | 'doesNotExist';
property kind
kind: 'error';
property path
path: string;
interface DryRunRenameEvent
interface DryRunRenameEvent {}
interface DryRunUpdateEvent
interface DryRunUpdateEvent {}
interface Engine
interface Engine< CollectionMetadataT extends object, SchematicMetadataT extends object> {}
The root Engine for creating and running schematics and collections. Everything related to a schematic execution starts from this interface.
CollectionMetadataT is, by default, a generic Collection metadata type. This is used throughout the engine typings so that you can use a type that's merged into descriptions, while being type-safe.
SchematicMetadataT is a type that contains additional typing for the Schematic Description.
property defaultMergeStrategy
readonly defaultMergeStrategy: MergeStrategy;
property workflow
readonly workflow: Workflow | null;
method createCollection
createCollection: ( name: string, requester?: Collection<CollectionMetadataT, SchematicMetadataT>) => Collection<CollectionMetadataT, SchematicMetadataT>;
method createContext
createContext: ( schematic: Schematic<CollectionMetadataT, SchematicMetadataT>, parent?: Partial< TypedSchematicContext<CollectionMetadataT, SchematicMetadataT> >, executionOptions?: Partial<ExecutionOptions>) => TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>;
method createSchematic
createSchematic: ( name: string, collection: Collection<CollectionMetadataT, SchematicMetadataT>) => Schematic<CollectionMetadataT, SchematicMetadataT>;
method createSourceFromUrl
createSourceFromUrl: ( url: Url, context: TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>) => Source;
method executePostTasks
executePostTasks: () => Observable<void>;
method transformOptions
transformOptions: <OptionT extends object, ResultT extends object>( schematic: Schematic<CollectionMetadataT, SchematicMetadataT>, options: OptionT, context?: TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>) => Observable<ResultT>;
interface EngineHost
interface EngineHost< CollectionMetadataT extends object, SchematicMetadataT extends object> {}
The Host for the Engine. Specifically, the piece of the tooling responsible for resolving collections and schematics descriptions. The SchematicMetadataT and CollectionMetadataT type parameters contain additional metadata that you want to store while remaining type-safe.
property defaultMergeStrategy
readonly defaultMergeStrategy?: MergeStrategy;
method createCollectionDescription
createCollectionDescription: ( name: string, requester?: CollectionDescription<CollectionMetadataT>) => CollectionDescription<CollectionMetadataT>;
method createSchematicDescription
createSchematicDescription: ( name: string, collection: CollectionDescription<CollectionMetadataT>) => SchematicDescription<CollectionMetadataT, SchematicMetadataT> | null;
method createSourceFromUrl
createSourceFromUrl: ( url: Url, context: TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>) => Source | null;
method createTaskExecutor
createTaskExecutor: (name: string) => Observable<TaskExecutor<{}>>;
method getSchematicRuleFactory
getSchematicRuleFactory: <OptionT extends object>( schematic: SchematicDescription<CollectionMetadataT, SchematicMetadataT>, collection: CollectionDescription<CollectionMetadataT>) => RuleFactory<OptionT>;
method hasTaskExecutor
hasTaskExecutor: (name: string) => boolean;
method listSchematicNames
listSchematicNames: ( collection: CollectionDescription<CollectionMetadataT>, includeHidden?: boolean) => string[];
method transformContext
transformContext: ( context: TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>) => TypedSchematicContext<CollectionMetadataT, SchematicMetadataT> | void;
method transformOptions
transformOptions: <OptionT extends object, ResultT extends object>( schematic: SchematicDescription<CollectionMetadataT, SchematicMetadataT>, options: OptionT, context?: TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>) => Observable<ResultT>;
interface ExecutionOptions
interface ExecutionOptions {}
property interactive
interactive: boolean;
property scope
scope: string;
interface FileEntry
interface FileEntry {}
interface FilePredicate
interface FilePredicate<T> {}
call signature
(path: Path, entry?: Readonly<FileEntry> | null): T;
interface OverwriteFileAction
interface OverwriteFileAction extends ActionBase {}
interface PathTemplateOptions
interface PathTemplateOptions {}
property interpolationEnd
interpolationEnd: string;
property interpolationStart
interpolationStart: string;
property pipeSeparator
pipeSeparator?: string;
interface RandomOptions
interface RandomOptions {}
property multi
multi?: boolean | number;
property multiFiles
multiFiles?: boolean | number;
property root
root?: string;
interface RenameFileAction
interface RenameFileAction extends ActionBase {}
interface Schematic
interface Schematic< CollectionMetadataT extends object, SchematicMetadataT extends object> {}
A Schematic as created by the Engine. This should be used by the tool to execute the main schematics, or by rules to execute other schematics as well.
property collection
readonly collection: Collection<CollectionMetadataT, SchematicMetadataT>;
property description
readonly description: SchematicDescription< CollectionMetadataT, SchematicMetadataT>;
method call
call: <OptionT extends object>( options: OptionT, host: Observable<Tree>, parentContext?: Partial< TypedSchematicContext<CollectionMetadataT, SchematicMetadataT> >, executionOptions?: Partial<ExecutionOptions>) => Observable<Tree>;
interface TaskConfiguration
interface TaskConfiguration<T = {}> {}
property dependencies
dependencies?: Array<TaskId>;
property name
name: string;
property options
options?: T;
interface TaskConfigurationGenerator
interface TaskConfigurationGenerator<T = {}> {}
method toConfiguration
toConfiguration: () => TaskConfiguration<T>;
interface TaskExecutorFactory
interface TaskExecutorFactory<T> {}
interface TaskInfo
interface TaskInfo {}
property configuration
readonly configuration: TaskConfiguration;
property context
readonly context: SchematicContext;
property id
readonly id: number;
property priority
readonly priority: number;
interface TreeConstructor
interface TreeConstructor {}
method branch
branch: (tree: TreeInterface) => TreeInterface;
method empty
empty: () => TreeInterface;
method merge
merge: ( tree: TreeInterface, other: TreeInterface, strategy?: MergeStrategy) => TreeInterface;
method optimize
optimize: (tree: TreeInterface) => TreeInterface;
method partition
partition: ( tree: TreeInterface, predicate: FilePredicate<boolean>) => [TreeInterface, TreeInterface];
interface TypedSchematicContext
interface TypedSchematicContext< CollectionMetadataT extends object, SchematicMetadataT extends object> {}
A SchematicContext. Contains information necessary for Schematics to execute some rules, for example when using another schematics, as we need the engine and collection.
property debug
readonly debug: boolean;
property engine
readonly engine: Engine<CollectionMetadataT, SchematicMetadataT>;
property interactive
readonly interactive: boolean;
property logger
readonly logger: logging.LoggerApi;
property schematic
readonly schematic: Schematic<CollectionMetadataT, SchematicMetadataT>;
property strategy
readonly strategy: MergeStrategy;
method addTask
addTask: <T extends object>( task: TaskConfigurationGenerator<T>, dependencies?: Array<TaskId>) => TaskId;
interface UpdateRecorder
interface UpdateRecorder {}
method insertLeft
insertLeft: (index: number, content: Buffer | string) => UpdateRecorder;
method insertRight
insertRight: (index: number, content: Buffer | string) => UpdateRecorder;
method remove
remove: (index: number, length: number) => UpdateRecorder;
Enums
enum MergeStrategy
enum MergeStrategy { AllowOverwriteConflict = 2, AllowCreationConflict = 4, AllowDeleteConflict = 8, Default = 0, Error = 1, ContentOnly = 2, Overwrite = 14,}
member AllowCreationConflict
AllowCreationConflict = 4
member AllowDeleteConflict
AllowDeleteConflict = 8
member AllowOverwriteConflict
AllowOverwriteConflict = 2
member ContentOnly
ContentOnly = 2
member Default
Default = 0
member Error
Error = 1
member Overwrite
Overwrite = 14
Type Aliases
type Action
type Action = | CreateFileAction | OverwriteFileAction | RenameFileAction | DeleteFileAction;
type AsyncFileOperator
type AsyncFileOperator = (tree: FileEntry) => Observable<FileEntry | null>;
type CollectionDescription
type CollectionDescription<CollectionMetadataT extends object> = CollectionMetadataT & { readonly name: string; readonly extends?: string[]; };
The description (metadata) of a collection. This type contains every information the engine needs to run. The CollectionMetadataT type parameter contains additional metadata that you want to store while remaining type-safe.
type DryRunEvent
type DryRunEvent = | DryRunErrorEvent | DryRunDeleteEvent | DryRunCreateEvent | DryRunUpdateEvent | DryRunRenameEvent;
type FileOperator
type FileOperator = (entry: FileEntry) => FileEntry | null;
A FileOperator applies changes synchronously to a FileEntry. An async operator returns asynchronously. We separate them so that the type system can catch early errors.
type FileVisitor
type FileVisitor = FilePredicate<void>;
type PathTemplateData
type PathTemplateData = { [key: string]: PathTemplateValue | PathTemplateData | PathTemplatePipeFunction;};
type PathTemplatePipeFunction
type PathTemplatePipeFunction = (x: string) => PathTemplateValue;
type PathTemplateValue
type PathTemplateValue = boolean | string | number | undefined;
type Rule
type Rule = ( tree: Tree, context: SchematicContext) => Tree | Observable<Tree> | Rule | Promise<void | Rule> | void;
type RuleFactory
type RuleFactory<T extends object> = (options: T) => Rule;
A rule factory, which is normally the way schematics are implemented. Returned by the tooling after loading a schematic description.
type SchematicContext
type SchematicContext = TypedSchematicContext<{}, {}>;
This is used by the Schematics implementations in order to avoid needing to have typing from the tooling. Schematics are not specific to a tool.
type SchematicDescription
type SchematicDescription< CollectionMetadataT extends object, SchematicMetadataT extends object> = SchematicMetadataT & { readonly collection: CollectionDescription<CollectionMetadataT>; readonly name: string; readonly private?: boolean; readonly hidden?: boolean;};
The description (metadata) of a schematic. This type contains every information the engine needs to run. The SchematicMetadataT and CollectionMetadataT type parameters contain additional metadata that you want to store while remaining type-safe.
type Source
type Source = (context: SchematicContext) => Tree | Observable<Tree>;
A source is a function that generates a Tree from a specific context. A rule transforms a tree into another tree from a specific context. In both cases, an Observable can be returned if the source or the rule are asynchronous. Only the last Tree generated in the observable will be used though.
We obfuscate the context of Source and Rule because the schematic implementation should not know which types is the schematic or collection metadata, as they are both tooling specific.
type TaskExecutor
type TaskExecutor<T = {}> = ( options: T | undefined, context: SchematicContext) => Promise<void> | Observable<void>;
type Tree
type Tree = TreeInterface;
Namespaces
namespace formats
module 'src/formats/index.d.ts' {}
Copyright Google LLC All Rights Reserved.
Use of this source code is governed by an MIT-style license that can be found in the LICENSE file at https://angular.dev/license
variable htmlSelectorFormat
const htmlSelectorFormat: schema.SchemaFormat;
variable pathFormat
const pathFormat: schema.SchemaFormat;
variable standardFormats
const standardFormats: schema.SchemaFormat[];
namespace workflow
module 'src/workflow/index.d.ts' {}
Copyright Google LLC All Rights Reserved.
Use of this source code is governed by an MIT-style license that can be found in the LICENSE file at https://angular.dev/license
class BaseWorkflow
abstract class BaseWorkflow implements Workflow {}
Base class for workflows. Even without abstract methods, this class should not be used without surrounding some initialization for the registry and host. This class only adds life cycle and dryrun/force support. You need to provide any registry and task executors that you need to support. See implementation for how to make a specialized subclass of this. TODO: add default set of CoreSchemaRegistry transforms. Once the job refactor is done, use that as the support for tasks.
Modifiers
@public
constructor
constructor(options: BaseWorkflowOptions);
property context
readonly context: Readonly<WorkflowExecutionContext>;
property engine
readonly engine: Engine<{}, {}>;
property engineHost
readonly engineHost: EngineHost<{}, {}>;
property lifeCycle
readonly lifeCycle: Observable<LifeCycleEvent>;
property registry
readonly registry: schema.SchemaRegistry;
property reporter
readonly reporter: Observable<DryRunEvent>;
method execute
execute: ( options: Partial<WorkflowExecutionContext> & RequiredWorkflowExecutionContext) => Observable<void>;
interface BaseWorkflowOptions
interface BaseWorkflowOptions {}
property dryRun
dryRun?: boolean;
property engineHost
engineHost: EngineHost<{}, {}>;
property force
force?: boolean;
property host
host: virtualFs.Host;
property registry
registry?: schema.CoreSchemaRegistry;
interface LifeCycleEvent
interface LifeCycleEvent {}
property kind
kind: | 'start' | 'end' | 'workflow-start' | 'workflow-end' | 'post-tasks-start' | 'post-tasks-end';
interface RequiredWorkflowExecutionContext
interface RequiredWorkflowExecutionContext {}
property collection
collection: string;
property options
options: object;
property schematic
schematic: string;
interface Workflow
interface Workflow {}
interface WorkflowExecutionContext
interface WorkflowExecutionContext extends RequiredWorkflowExecutionContext {}
property allowPrivate
allowPrivate?: boolean;
property debug
debug: boolean;
property logger
logger: logging.Logger;
property parentContext
parentContext?: Readonly<WorkflowExecutionContext>;
Package Files (26)
- src/engine/engine.d.ts
- src/engine/interface.d.ts
- src/engine/schematic.d.ts
- src/exception/exception.d.ts
- src/formats/html-selector.d.ts
- src/formats/index.d.ts
- src/formats/path.d.ts
- src/index.d.ts
- src/rules/base.d.ts
- src/rules/call.d.ts
- src/rules/move.d.ts
- src/rules/random.d.ts
- src/rules/schematic.d.ts
- src/rules/template.d.ts
- src/rules/url.d.ts
- src/sink/dryrun.d.ts
- src/sink/host.d.ts
- src/sink/sink.d.ts
- src/tree/action.d.ts
- src/tree/delegate.d.ts
- src/tree/empty.d.ts
- src/tree/host-tree.d.ts
- src/tree/interface.d.ts
- src/workflow/base.d.ts
- src/workflow/index.d.ts
- src/workflow/interface.d.ts
Dependencies (5)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@angular-devkit/schematics
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@angular-devkit/schematics)
- HTML<a href="https://www.jsdocs.io/package/@angular-devkit/schematics"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3361 ms. - Missing or incorrect documentation? Open an issue for this package.