How to use the @angular-devkit/architect.Architect 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 angular / angular-cli / packages / angular_devkit / architect_cli / bin / architect.ts View on Github external
async function _executeTarget(
  parentLogger: logging.Logger,
  workspace: workspaces.WorkspaceDefinition,
  root: string,
  argv: minimist.ParsedArgs,
  registry: schema.SchemaRegistry,
) {
  const architectHost = new WorkspaceNodeModulesArchitectHost(workspace, root);
  const architect = new Architect(architectHost, registry);

  // Split a target into its parts.
  const targetStr = argv._.shift() || '';
  const [project, target, configuration] = targetStr.split(':');
  const targetSpec = { project, target, configuration };

  delete argv['help'];
  delete argv['_'];

  const logger = new logging.Logger('jobs');
  const logs: logging.LogEntry[] = [];
  logger.subscribe(entry => logs.push({ ...entry, message: `${entry.name}: ` + entry.message }));

  const run = await architect.scheduleTarget(targetSpec, argv, { logger });
  const bars = new MultiProgressBar(':name :bar (:current/:total) :status');
github alan-agius4 / speedy-build-angular / test / index.spec.ts View on Github external
registry.addPostTransform(schema.transforms.addUndefinedDefaults);

		const { workspace } = await workspaces.readWorkspace(
			workspaceRoot,
			workspaces.createWorkspaceHost(host)
		);

		await host.initialize().toPromise();

		testArchitectHost = new TestingArchitectHost(
			getSystemPath(host.root()),
			getSystemPath(host.root()),
			new WorkspaceNodeModulesArchitectHost(workspace, workspaceRoot)
		);

		architect = new Architect(testArchitectHost, registry);
	});
github nrwl / nx / packages / node / src / utils / testing.ts View on Github external
export async function getTestArchitect() {
  const architectHost = new TestingArchitectHost('/root', '/root');
  const registry = new schema.CoreSchemaRegistry();
  registry.addPostTransform(schema.transforms.addUndefinedDefaults);

  const architect = new Architect(architectHost, registry);

  await architectHost.addBuilderFromPackage(join(__dirname, '../..'));

  return [architect, architectHost] as [Architect, TestingArchitectHost];
}
github angular / angular-cli / packages / angular_devkit / build_webpack / src / tslint / index_spec_big.ts View on Github external
it('runs', (done) => {
    const architect = new Architect(normalize(root), host);
    architect.loadWorkspaceFromJson(getWorkspace()).pipe(
      concatMap((architect) => architect.run(architect.getTarget())),
      toArray(),
      tap(events => expect(events.length).toBe(0)),
    ).subscribe(done, done.fail);
  }, 30000);
});
github angular / angular-cli / packages / angular_devkit / build_webpack / src / protractor / index_spec_big.ts View on Github external
it('runs', (done) => {
    const architect = new Architect(normalize(root), host);
    architect.loadWorkspaceFromJson(getWorkspace()).pipe(
      concatMap((architect) => architect.run(architect.getTarget())),
      take(1),
    ).subscribe(done, done.fail);
  }, 30000);
});
github angular / angular-cli / packages / angular_devkit / build_webpack / src / karma / index_spec_big.ts View on Github external
it('runs', (done) => {
    const architect = new Architect(normalize(root), host);
    architect.loadWorkspaceFromJson(getWorkspace()).pipe(
      concatMap((architect) => architect.run(architect.getTarget())),
      toArray(),
      tap(events => expect(events.length).toBe(0)),
    ).subscribe(done, done.fail);
  }, 30000);
});
github angular / angular-cli / packages / angular_devkit / build_webpack / src / webpack-dev-server / index_spec_large.ts View on Github external
async function createArchitect(workspaceRoot: string) {
    vfHost = new NodeJsSyncHost();

    const registry = new schema.CoreSchemaRegistry();
    registry.addPostTransform(schema.transforms.addUndefinedDefaults);

    const { workspace } = await workspaces.readWorkspace(
      workspaceRoot,
      workspaces.createWorkspaceHost(vfHost),
    );

    testArchitectHost = new TestingArchitectHost(workspaceRoot, workspaceRoot,
      new WorkspaceNodeModulesArchitectHost(workspace, workspaceRoot));
    architect = new Architect(testArchitectHost, registry);
  }
github enten / udk / angular / lib / serve / devContainer.ts View on Github external
const root = path.dirname(this.angularConfigPath);

    this.registry = new schema.CoreSchemaRegistry();
    this.registry.addPostTransform(schema.transforms.addUndefinedDefaults);

    this.host = new NodeJsSyncHost();

    const { workspace } = await workspaces.readWorkspace(
      this.angularConfigPath,
      workspaces.createWorkspaceHost(this.host),
    );
    this.workspace = workspace;

    this.architectHost = new WorkspaceNodeModulesArchitectHost(this.workspace, root);
    this.architect = new Architect(this.architectHost, this.registry);

    const targetString = this.args.target;

    if (!targetString) {
      throw new Error('Must either have --target');
    }

    this.universalOptions = await this.validateTargetOptions(targetString);
    this.browserOptions = await this.validateTargetOptions(
      this.universalOptions.browserTarget,
      { watch: true },
    );
    this.serverOptions = await this.validateTargetOptions(
      this.universalOptions.serverTarget,
      { watch: true },
    );
github rxweb / rxweb / rxweb.io / node_modules / @angular / cli / models / architect-command.js View on Github external
return workspaceLoader.loadWorkspace(this.project.root).pipe(operators_1.tap((workspace) => this._workspace = workspace), operators_1.concatMap((workspace) => {
            return new architect_1.Architect(workspace).loadArchitect();
        }), operators_1.tap((architect) => this._architect = architect));
    }
github angular / angular-cli / packages / angular_devkit / build_ng_packagr / src / build / index_spec_large.ts View on Github external
const registry = new schema.CoreSchemaRegistry();
    registry.addPostTransform(schema.transforms.addUndefinedDefaults);

    const workspaceSysPath = getSystemPath(host.root());
    const { workspace } = await workspaces.readWorkspace(
      workspaceSysPath,
      workspaces.createWorkspaceHost(host),
    );
    const architectHost = new TestingArchitectHost(
      workspaceSysPath,
      workspaceSysPath,
      new WorkspaceNodeModulesArchitectHost(workspace, workspaceSysPath),
    );

    architect = new Architect(architectHost, registry);
  });