How to use the @angular-devkit/architect/node.WorkspaceNodeModulesArchitectHost 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 angular / angular-cli / packages / angular / cli / models / architect-command.ts View on Github external
public async initialize(options: T & Arguments): Promise {
    await super.initialize(options);

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

    const { workspace } = await workspaces.readWorkspace(
      this.workspace.root,
      workspaces.createWorkspaceHost(new NodeJsSyncHost()),
    );
    this._workspace = workspace;

    this._architectHost = new WorkspaceNodeModulesArchitectHost(workspace, this.workspace.root);
    this._architect = new Architect(this._architectHost, this._registry);

    if (!this.target) {
      if (options.help) {
        // This is a special case where we just return.
        return;
      }

      const specifier = this._makeTargetSpecifier(options);
      if (!specifier.project || !specifier.target) {
        throw new Error('Cannot determine project or target for command.');
      }

      return;
    }
github alan-agius4 / speedy-build-angular / test / index.spec.ts View on Github external
beforeEach(async () => {
		const registry = new schema.CoreSchemaRegistry();
		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 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 angular / angular-cli / packages / angular_devkit / build_ng_packagr / src / build / index_spec_large.ts View on Github external
beforeEach(async () => {
    await host.initialize().toPromise();

    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);
  });
github angular / angular-cli / packages / angular_devkit / build_webpack / src / webpack / 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 nrwl / nx / packages / tao / src / commands / run.ts View on Github external
return handleErrors(logger, isVerbose, async () => {
    const fsHost = new NodeJsSyncHost();
    const workspace = await new experimental.workspace.Workspace(
      normalize(root) as any,
      fsHost
    )
      .loadWorkspaceFromHost('workspace.json' as any)
      .toPromise();

    const opts = parseRunOpts(args, workspace.getDefaultProjectName(), logger);
    validateTargetAndConfiguration(workspace, opts);

    const registry = new json.schema.CoreSchemaRegistry();
    registry.addPostTransform(schema.transforms.addUndefinedDefaults);
    const architectHost = new WorkspaceNodeModulesArchitectHost(
      workspace,
      root
    );
    const architect = new Architect(architectHost, registry);

    const builderConf = await architectHost.getBuilderNameForTarget({
      project: opts.project,
      target: opts.target
    });
    const builderDesc = await architectHost.resolveBuilder(builderConf);
    const flattenedSchema = await registry
      .flatten(builderDesc.optionSchema! as json.JsonObject)
      .toPromise();

    if (opts.help) {
      printRunHelp(opts, flattenedSchema as any, logger);
github linnenschmidt / build-ng-packagr / packages / builders / src / build-ng-packagr / src / build / index.spec.ts View on Github external
beforeEach(async () => {
    await host.initialize().toPromise();

    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);
  });