How to use the @angular-devkit/schematics.schematic 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 angular / angular-cli / packages / schematics / angular / application / index.ts View on Github external
])),
      mergeWith(
        apply(url('./files/lint'), [
          template({
            utils: strings,
            ...options,
            tsLintRoot,
            relativePathToWorkspaceRoot,
            prefix,
          }),
          // TODO: Moving should work but is bugged right now.
          // The __tsLintRoot__ is being used meanwhile.
          // Otherwise the tslint.json file could be inside of the root folder and
          // this block and the lint folder could be removed.
        ])),
      schematic('module', {
        name: 'app',
        commonModule: false,
        flat: true,
        routing: options.routing,
        routingScope: 'Root',
        path: sourceDir,
        spec: false,
        project: options.name,
      }),
      schematic('component', {
        name: 'app',
        selector: appRootSelector,
        flat: true,
        path: sourceDir,
        skipImport: true,
        project: options.name,
github nstudio / xplat / src / app.nativescript / index.ts View on Github external
(tree: Tree, context: SchematicContext) => 
      // inside closure to ensure it uses the modifed options.name from applyAppNamingConvention
      schematic('app-resources', {
        path: `apps/${options.name}/app`,
      })(tree, context),
    // add root package dependencies
github nayfin / tft-library / projects / tft-library / schematics / feature / index.js View on Github external
function default_1(options) {
    // const plain = options.plain;
    // const withModule = options.withModule;
    // const withContentManagement = options.withContentManagement;
    const { plain, withModule, withContentManagement } = options;
    let files = [
        schematics_1.schematic(plain ? 'store' : 'entity-store', {
            flat: options.flat,
            name: options.name,
            path: options.path,
            project: options.project,
            dirName: options.dirName,
            feature: true,
            spec: options.spec
        }),
        schematics_1.schematic(plain ? 'query' : 'entity-query', {
            flat: options.flat,
            name: options.name,
            path: options.path,
            project: options.project,
            spec: options.spec,
            dirName: options.dirName,
            feature: true
github NativeScript / nativescript-schematics / src / migrate-module / index.ts View on Github external
const addCommonModuleFile = (options, modInfo) => {
  const { name } = options;
  const { modulePath } = modInfo;
  const moduleDirectory = dirname(modulePath);
  const commonModuleOptions = {
    name,
    path: moduleDirectory,
  };

  return schematic('common-module', commonModuleOptions);
};
github datorama / akita / schematics / src / ng-g / feature / index.js View on Github external
}),
        schematics_1.schematic(serviceSchematic, {
            flat: options.flat,
            module: options.module,
            name: options.name,
            path: options.path,
            project: options.project,
            spec: options.spec,
            plain,
            dirName: options.dirName,
            feature: true
        })
    ];
    if (!plain) {
        files = files.concat([
            schematics_1.schematic('model', {
                flat: options.flat,
                module: options.module,
                name: options.name,
                path: options.path,
                project: options.project,
                spec: options.spec,
                dirName: options.dirName,
                feature: true
            })
        ]);
    }
    if (withModule) {
        files = files.concat([
            schematics_1.schematic('withModule', {
                flat: options.flat,
                module: options.module,
github fossasia / susper.com / node_modules / @schematics / angular / application / index.js View on Github external
{
                inlineStyle: true,
                inlineTemplate: true,
                spec: false,
                styleext: options.style,
            };
        const sourceDir = options.sourceDir || 'src';
        return schematics_1.chain([
            schematics_1.mergeWith(schematics_1.apply(schematics_1.url('./files'), [
                options.minimal ? schematics_1.filter(minimalPathFilter) : schematics_1.noop(),
                options.skipGit ? schematics_1.filter(path => !path.endsWith('/__dot__gitignore')) : schematics_1.noop(),
                options.serviceWorker ? schematics_1.noop() : schematics_1.filter(path => !path.endsWith('/ngsw-config.json')),
                schematics_1.template(Object.assign({ utils: stringUtils }, options, { 'dot': '.', sourcedir: sourceDir })),
                schematics_1.move(options.directory),
            ])),
            schematics_1.schematic('module', {
                name: 'app',
                commonModule: false,
                flat: true,
                routing: options.routing,
                routingScope: 'Root',
                path: options.path,
                sourceDir: options.directory + '/' + sourceDir,
                spec: false,
            }),
            schematics_1.schematic('component', Object.assign({ name: 'app', selector: appRootSelector, sourceDir: options.directory + '/' + sourceDir, flat: true, path: options.path }, componentOptions)),
            addBootstrapToNgModule(options.directory, sourceDir),
            schematics_1.mergeWith(schematics_1.apply(schematics_1.url('./other-files'), [
                componentOptions.inlineTemplate ? schematics_1.filter(path => !path.endsWith('.html')) : schematics_1.noop(),
                !componentOptions.spec ? schematics_1.filter(path => !path.endsWith('.spec.ts')) : schematics_1.noop(),
                schematics_1.template(Object.assign({ utils: stringUtils }, options, { selector: appRootSelector }, componentOptions)),
                schematics_1.move(options.directory + '/' + sourceDir + '/app'),
github NativeScript / nativescript-schematics / src / generate / module / index.ts View on Github external
(tree: Tree) => shouldCreateCommonFile(platformUse, options.common) ?
      schematic('common-module', { name: moduleInfo.name, path: moduleInfo.path }) :
      tree,
  ]));
github datorama / akita / schematics / src / ng-g / feature / index.ts View on Github external
}

  if (withModule) {
    files = files.concat([
      schematic('withModule', {
        flat: options.flat,
        module: options.module,
        name: options.name,
        path: options.path,
        project: options.project,
        spec: options.spec,
        dirName: options.dirName,
        feature: true
      }),

      schematic('withComponent', {
        flat: options.flat,
        module: options.module,
        name: options.name,
        path: options.path,
        project: options.project,
        spec: options.spec,
        dirName: options.dirName,
        styleext: options.styleext,
        entity: !options.plain,
        feature: true
      })
    ]);
  }
  return (host: Tree, context: SchematicContext) => {
    return chain(files)(host, context);
  };
github mselerin / yang-schematics / src / ng-new / index.ts View on Github external
prefix: options.prefix,
            viewEncapsulation: options.viewEncapsulation,
            routing: options.routing,
            style: options.style,
            skipTests: options.skipTests
        };

        const yangInitOptions: YangInitOptions = {
            name: options.name
        };

        return chain([
            mergeWith(
                apply(empty(), [
                    externalSchematic('@schematics/angular', 'ng-new', ngNewOptions),
                    schematic('init', yangInitOptions),
                    move(options.directory),
                ]), MergeStrategy.Overwrite
            ),
            (host: Tree, context: SchematicContext) => {
                let packageTask;
                if (!options.skipInstall) {
                    packageTask = context.addTask(new NodePackageInstallTask(options.directory));
                    if (options.linkCli) {
                        packageTask = context.addTask(
                            new NodePackageLinkTask('@angular/cli', options.directory),
                            [packageTask],
                        );
                    }
                }
                if (!options.skipGit) {
                    const commit = typeof options.commit == 'object'
github NativeScript / nativescript-schematics / src / ng-new / index.ts View on Github external
() => {
      if (options.shared) {
        const sharedOptions: SharedOptions = parseToSharedOptions(options);

        return schematic('shared', sharedOptions);
      } else {
        const applicationOptions: ApplicationOptions = parseToApplicationOptions(options);

        return schematic('application', applicationOptions);
      }
    },
    (_tree: Tree, context: SchematicContext) => {