How to use the @angular-devkit/schematics.externalSchematic function in @angular-devkit/schematics

To help you get started, we’ve selected a few @angular-devkit/schematics 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 nstudio / xplat / packages / angular / src / schematics / application / index.ts View on Github external
(tree: Tree, context: SchematicContext) => {
      const nrwlWebOptions = {
        ...options,
        skipInstall: true
      };
      let executionOptions: Partial;
      if (options.useXplat) {
        // when generating xplat architecture, ensure:
        // 1. sass is used
        nrwlWebOptions.style = 'scss';
        // executionOptions = {
        //   interactive: false
        // };
      }
      return externalSchematic(
        '@nrwl/angular',
        'app',
        nrwlWebOptions,
        executionOptions
      )(tree, context);
    },
    (tree: Tree, context: SchematicContext) =>
github dynatrace-oss / barista / components / schematics / src / ng-add / rules / migrate-or-add-dependencies-rule.ts View on Github external
return (tree: Tree, context: SchematicContext) => {
    const rules: Rule[] = [];
    const collectionPath = join(__dirname, '../../../collection.json');
    // run external migration schematics
    rules.push(externalSchematic(collectionPath, 'update-5.0.0', {}));

    return chain(rules)(tree, context);
  };
}
github bennymeg / nx-electron / src / utils / testing.angular.ts View on Github external
export async function createTestUILib(libName: string): Promise {
  let appTree = Tree.empty();
  appTree = createEmptyWorkspace(appTree);
  appTree = await callRule(
    externalSchematic('@nrwl/angular', 'library', {
      name: libName
    }),
    appTree
  );
  appTree = await callRule(
    externalSchematic('@schematics/angular', 'component', {
      name: 'test-button',
      project: libName
    }),
    appTree
  );
  appTree.overwrite(
    `libs/${libName}/src/lib/test-button/test-button.component.ts`,
    `
import { Component, OnInit, Input } from '@angular/core';

export type ButtonStyle = 'default' | 'primary' | 'accent';

@Component({
  selector: 'proj-test-button',
  templateUrl: './test-button.component.html',
  styleUrls: ['./test-button.component.css']
github BenjaminDobler / ngtron / src / schematics / application / index.ts View on Github external
export const addRendererProject = (options: NgGenerateOptions) => {
  console.log('⚙️  addRendererProject');

  const rendererName = options.singleProject ? options.project : options.project + options.rendererPrefix;
  return externalSchematic('@schematics/angular', 'application', { name: rendererName });
}
github nrwl / nx / packages / workspace / src / schematics / preset / preset.ts View on Github external
setDefaultCollection('@nrwl/angular'),
      connectAngularAndNest(options)
    ]);
  } else if (options.preset === 'react-express') {
    return chain([
      externalSchematic(
        '@nrwl/react',
        'application',
        {
          name: options.name,
          style: options.style,
          linter
        },
        { interactive: false }
      ),
      externalSchematic(
        '@nrwl/express',
        'application',
        {
          name: 'api',
          frontendProject: options.name,
          linter
        },
        { interactive: false }
      ),
      schematic(
        'library',
        { name: 'api-interfaces', linter },
        { interactive: false }
      ),
      setDefaultCollection('@nrwl/react'),
      connectReactAndExpress(options)
github ngrx / platform / modules / schematics / src / container / index.ts View on Github external
url(options.testDepth === 'unit' ? './files' : './integration-files'),
      [
        options.spec
          ? noop()
          : filter(path => !path.endsWith('.spec.ts.template')),
        applyTemplates({
          'if-flat': (s: string) => (options.flat ? '' : s),
          ...stringUtils,
          ...(options as object),
        } as any),
        move(parsedPath.path),
      ]
    );

    return chain([
      externalSchematic('@schematics/angular', 'component', {
        ...opts,
        spec: false,
      }),
      addStateToComponent(options),
      mergeWith(templateSource),
    ])(host, context);
  };
}
github ngneat / spectator / projects / spectator / schematics / src / spectator / index.js View on Github external
function spectatorDirectiveSchematic(options) {
    return schematics_1.chain([
        schematics_1.externalSchematic('@schematics/angular', 'directive', Object.assign({}, options, { skipTests: true, spec: false })),
        (tree, _context) => {
            _ensurePath(tree, options);
            const movePath = core_1.normalize(options.path || '');
            const specTemplateRule = schematics_1.apply(schematics_1.url(`./files/directive`), [
                schematics_1.template(Object.assign({}, core_1.strings, options)),
                schematics_1.move(movePath)
            ]);
            return schematics_1.mergeWith(specTemplateRule, schematics_1.MergeStrategy.Default);
        }
    ]);
}
exports.spectatorDirectiveSchematic = spectatorDirectiveSchematic;
github nrwl / nx / packages / angular / src / schematics / stories / stories.spec.ts View on Github external
export async function createTestUILib(libName: string): Promise {
  let appTree = Tree.empty();
  appTree = createEmptyWorkspace(appTree);
  appTree = await callRule(
    externalSchematic('@nrwl/angular', 'library', {
      name: libName
    }),
    appTree
  );
  appTree = await callRule(
    externalSchematic('@schematics/angular', 'component', {
      name: 'test-button',
      project: libName
    }),
    appTree
  );
  appTree.overwrite(
    `libs/${libName}/src/lib/test-button/test-button.component.ts`,
    `
import { Component, OnInit, Input } from '@angular/core';

export type ButtonStyle = 'default' | 'primary' | 'accent';

@Component({
  selector: 'proj-test-button',
  templateUrl: './test-button.component.html',
  styleUrls: ['./test-button.component.css']
github nstudio / xplat / packages / xplat / src / schematics / ng-add / index.ts View on Github external
(tree: Tree, context: SchematicContext) =>
      externalSchematic('@nstudio/xplat', 'init', options)
  ]);
github devonfw / devon4node / packages / schematics / src / lib / guard / guard.factory.ts View on Github external
export function main(options: GuardOptions) {
  const newOptions = { ...options };
  newOptions.name = options.name.startsWith('app/') ? options.name : 'app/' + options.name;
  if (newOptions.path) {
    newOptions.path = join(options.path as Path, 'src');
  }
  newOptions.language = 'ts';
  const path = newOptions.path || './src';
  const dir = dirname(newOptions.name as Path);
  const base = strings.dasherize(basename(newOptions.name as Path));

  return chain([
    externalSchematic('@nestjs/schematics', 'guard', newOptions),
    move(
      strings.dasherize(join(path as Path, dir, base + '.guard.ts')),
      strings.dasherize(join(path as Path, dir, 'guards', base + '.guard.ts')),
    ),
    move(
      strings.dasherize(join(path as Path, dir, base + '.guard.spec.ts')),
      strings.dasherize(join(path as Path, dir, 'guards', base + '.guard.spec.ts')),
    ),
  ]);
}