How to use the @angular-devkit/architect.scheduleTargetAndForget function in @angular-devkit/architect

To help you get started, we’ve selected a few @angular-devkit/architect examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nrwl / nx / packages / cypress / src / builders / cypress / cypress.impl.ts View on Github external
export function startDevServer(
  devServerTarget: string,
  isWatching: boolean,
  context: BuilderContext
): Observable {
  // Overrides dev server watch setting.
  const overrides = {
    watch: isWatching
  };
  return scheduleTargetAndForget(
    context,
    targetFromTargetString(devServerTarget),
    overrides
  ).pipe(
    map(output => {
      if (!output.success && !isWatching) {
        throw new Error('Could not compile application files');
      }
      return output.baseUrl as string;
    })
  );
}
github ng-qt / ng-qt / packages / devkit / src / builders / serve / index.ts View on Github external
...options.waitUntilTargets.map(b => {
      return scheduleTargetAndForget(context, targetFromTargetString(b)).pipe(
        // @ts-ignore
        filter(e => !!e.success),
        first(),
      );
    }),
  ).pipe(map(results => ({ success: !results.some(r => !r.success) })));
github ng-qt / ng-qt / packages / devkit / src / builders / serve / index.ts View on Github external
() =>
        // @ts-ignore
        scheduleTargetAndForget(context, target, {
          watch: true,
        }) as Observable,
    ),
github bennymeg / nx-electron / src / builders / execute / execute.impl.ts View on Github external
...options.waitUntilTargets.map(b => {
      return scheduleTargetAndForget(context, targetFromTargetString(b)).pipe(
        filter(e => e.success !== undefined),
        first()
      );
    })
  ).pipe(
github nrwl / nx / packages / next / src / builders / export / export.impl.ts View on Github external
function run(
  options: NextBuildBuilderOptions,
  context: BuilderContext
): Observable {
  const buildTarget = targetFromTargetString(options.buildTarget);
  const build$ = scheduleTargetAndForget(context, buildTarget);

  return build$.pipe(
    concatMap(r => {
      if (!r.success) return of(r);
      return from(context.getTargetOptions(buildTarget)).pipe(
        concatMap((buildOptions: any) => {
          const root = path.resolve(context.workspaceRoot, buildOptions.root);
          const config = prepareConfig(
            context.workspaceRoot,
            buildOptions.root,
            buildOptions.outputPath,
            PHASE_EXPORT
          );
          return from(
            exportApp(
              root,
github nrwl / nx / packages / node / src / builders / execute / execute.impl.ts View on Github external
...options.waitUntilTargets.map(b => {
      return scheduleTargetAndForget(context, targetFromTargetString(b)).pipe(
        filter(e => e.success !== undefined),
        first()
      );
    })
  ).pipe(
github bennymeg / nx-electron / src / builders / execute / execute.impl.ts View on Github external
() =>
        scheduleTargetAndForget(context, target, {
          watch: true
        }) as Observable
    )
github briebug / cypress-schematic / src / builders / cypress / index.ts View on Github external
export function startDevServer(
  devServerTarget: string,
  watch: boolean,
  context: BuilderContext
): Observable {
  const overrides = {
    watch
  };
  return scheduleTargetAndForget(
    context,
    targetFromTargetString(devServerTarget),
    overrides
  ).pipe(
    map((output: any) => {
      if (!output.success && !watch) {
        throw new Error("Could not compile application files");
      }
      return output.baseUrl as string;
    })
  );
}
github nrwl / nx / packages / next / src / builders / dev-server / dev-server.impl.ts View on Github external
function run(
  options: NextBuildBuilderOptions,
  context: BuilderContext
): Observable {
  const buildTarget = targetFromTargetString(options.buildTarget);

  const build$ = !options.dev
    ? scheduleTargetAndForget(context, buildTarget)
    : of({ success: true });

  return build$.pipe(
    concatMap(r => {
      if (!r.success) return of(r);
      return from(context.getTargetOptions(buildTarget)).pipe(
        concatMap((buildOptions: any) => {
          const root = path.resolve(context.workspaceRoot, buildOptions.root);

          const config = prepareConfig(
            context.workspaceRoot,
            buildOptions.root,
            buildOptions.outputPath,
            options.dev ? PHASE_DEVELOPMENT_SERVER : PHASE_PRODUCTION_SERVER
          );