MCPcopy Index your code
hub / github.com/angular/angular-cli / execute

Function execute

packages/angular_devkit/schematics/src/workflow/base.ts:146–213  ·  view source on GitHub ↗
(
    options: Partial<WorkflowExecutionContext> & RequiredWorkflowExecutionContext,
  )

Source from the content-addressed store, hash-verified

144 }
145
146 execute(
147 options: Partial<WorkflowExecutionContext> & RequiredWorkflowExecutionContext,
148 ): Observable<void> {
149 const parentContext = this._context.at(-1);
150
151 if (!parentContext) {
152 this._lifeCycle.next({ kind: 'start' });
153 }
154
155 /** Create the collection and the schematic. */
156 const collection = this._engine.createCollection(options.collection);
157 // Only allow private schematics if called from the same collection.
158 const allowPrivate =
159 options.allowPrivate || (parentContext && parentContext.collection === options.collection);
160 const schematic = collection.createSchematic(options.schematic, allowPrivate);
161
162 const sinks = this._createSinks();
163
164 this._lifeCycle.next({ kind: 'workflow-start' });
165
166 const context = {
167 ...options,
168 debug: options.debug || false,
169 logger: options.logger || (parentContext && parentContext.logger) || new logging.NullLogger(),
170 parentContext,
171 };
172 this._context.push(context);
173
174 return schematic
175 .call(options.options, of(new HostTree(this._host)), { logger: context.logger })
176 .pipe(
177 concatMap((tree: Tree) => {
178 // Process all sinks.
179 return concat(
180 from(sinks).pipe(
181 concatMap((sink) => sink.commit(tree)),
182 ignoreElements(),
183 ),
184 of(tree),
185 );
186 }),
187 concatMap(() => {
188 if (this._dryRun) {
189 return EMPTY;
190 }
191
192 this._lifeCycle.next({ kind: 'post-tasks-start' });
193
194 return this._engine
195 .executePostTasks()
196 .pipe(
197 tap({ complete: () => this._lifeCycle.next({ kind: 'post-tasks-end' }) }),
198 defaultIfEmpty(undefined),
199 last(),
200 );
201 }),
202 tap({
203 complete: () => {

Callers

nothing calls this directly

Calls 8

nextMethod · 0.80
popMethod · 0.80
createCollectionMethod · 0.65
createSchematicMethod · 0.65
callMethod · 0.65
commitMethod · 0.65
executePostTasksMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected