How to use the @angular-devkit/schematics.branchAndMerge 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 / web-angular / src / schematics / xplat / index.ts View on Github external
(tree: Tree, context: SchematicContext) => {
      const xplatFolderName = XplatHelpers.getXplatFoldername('web', 'angular');
      if (tree.exists(`/xplat/${xplatFolderName}/scss/_index.scss`)) {
        // may have already generated vanilla web support
        return noop()(tree, context);
      } else {
        return branchAndMerge(
          mergeWith(
            apply(url(`./_scss_files`), [
              template({
                ...(options as any),
                ...getDefaultTemplateOptions()
              }),
              move(`xplat/${xplatFolderName}/scss`)
            ])
          )
        )(tree, context);
      }
    },
    (tree: Tree, context: SchematicContext) => {
github nayfin / tft-library / projects / tft-library / schematics / copy / index.ts View on Github external
// needs a function
      `containers/${singular(parsedPath.name)}-copy`
    );

    options.name = parsedPath.name;
    options.path = parsedPath.path;
    options.selector = options.selector || buildSelector(options, project.prefix);

    const templateSource = apply(url("./files"), [
      template({
        ...stringUtils,
        ...(options as object)
      } as any),
      move(parsedPath.path)
    ]);
    return chain([branchAndMerge(chain([mergeWith(templateSource)]))])(
      host,
      context
    );
  };
}
github nayfin / tft-library / projects / tft-library / schematics / list / index.js View on Github external
options.path = utils_1.getProjectPath(host, options);
        const parsedPath = utils_1.parseName(options);
        parsedPath.path = parsedPath.path.replace(`${options.dirName}`, 
        // TODO: the path to respond to the circumstances calling it
        // - generating a feature with --withContentManagement
        // - generating the list
        // needs a function
        `containers/${parsedPath.name}-list`);
        options.name = parsedPath.name;
        options.path = parsedPath.path;
        options.selector = options.selector || buildSelector(options, project.prefix);
        const templateSource = schematics_1.apply(schematics_1.url("./files"), [
            schematics_1.template(Object.assign({}, utils_1.stringUtils, options)),
            schematics_1.move(parsedPath.path)
        ]);
        return schematics_1.chain([schematics_1.branchAndMerge(schematics_1.chain([schematics_1.mergeWith(templateSource)]))])(host, context);
    };
}
github nayfin / tft-library / projects / tft-library / schematics / form / index.ts View on Github external
`components/${singular(parsedPath.name)}-form/`
    );

    options.name = parsedPath.name;
    options.path = parsedPath.path;
    options.selector =
      options.selector || buildSelector(options, project.prefix);

    const templateSource = apply(url("./files"), [
      template({
        ...stringUtils,
        ...(options as object)
      } as any),
      move(parsedPath.path)
    ]);
    return chain([branchAndMerge(chain([mergeWith(templateSource)]))])(
      host,
      context
    );
  };
}
github nrwl / nx / packages / schematics / src / collection / lib / index.ts View on Github external
return wrapIntoFormat(() => {
    const {options, templateSource, routingRules} = validateLibSchema(schema);

    return chain([
      branchAndMerge(chain([mergeWith(templateSource)])),
      addLibToAngularCliJson(options), ...routingRules
    ]);
  });
}
github nrwl / nx / packages / bazel / src / collection / lib / index.ts View on Github external
export default function(schema: Schema): Rule {
  const { templateSource, routingRules } = validateLibSchema(schema);

  return chain([
    branchAndMerge(chain([mergeWith(templateSource)])),
    ...routingRules,
    formatFiles(schema)
  ]);
}
github nstudio / xplat / src / app.ionic / index.ts View on Github external
function addAppFiles(options: ApplicationOptions, appPath: string, sample: string = ''): Rule {
  sample = '';
  const appname = getAppName(options, 'ionic');
  return branchAndMerge(
    mergeWith(apply(url(`./_${sample}files`), [
      template({
        ...options as any,
        appname,
        utils: stringUtils,
        npmScope: getNpmScope(),
        prefix: getPrefix(),
        dot: '.',
      }),
      move(`apps/${appPath}`)
    ]))
  );
}
github nestjs / schematics / src / lib / sub-app / sub-app.factory.ts View on Github external
export function main(options: SubAppOptions): Rule {
  const appName = getAppNameFromPackageJson();
  options = transform(options);
  return chain([
    updateTsConfig(),
    updatePackageJson(options, appName),
    (tree, context) =>
      isMonorepo(tree)
        ? noop()(tree, context)
        : chain([
            branchAndMerge(mergeWith(generateWorkspace(options, appName))),
            moveDefaultAppToApps(options.path, appName, options.sourceRoot),
          ])(tree, context),
    addAppsToCliOptions(options.path, options.name, appName),
    branchAndMerge(mergeWith(generate(options))),
  ]);
}
github nayfin / tft-library / projects / tft-library / schematics / model / index.ts View on Github external
return (host: Tree, context: SchematicContext) => {
    options.path = getProjectPath(host, options);

    const parsedPath = parseName(options);
    options.name = parsedPath.name;
    options.path = parsedPath.path;

    const templateSource = apply(url('./files'), [
      template({
        ...stringUtils,
        ...(options as object)
      } as any),
      move(parsedPath.path)
    ]);

    return chain([branchAndMerge(chain([mergeWith(templateSource)]))])(
      host,
      context
    );
  };
}
github nstudio / xplat / packages / angular / src / schematics / elements / index.ts View on Github external
function addFiles(options: ElementsOptions, extra: string = ''): Rule {
  extra = extra ? `${extra}_` : '';
  const xplatFolderName = XplatHelpers.getXplatFoldername('web', 'angular');
  return branchAndMerge(
    mergeWith(
      apply(url(`./_${extra}files`), [
        template({
          ...(options as any),
          ...getDefaultTemplateOptions(),
          name: options.name.toLowerCase(),
          xplatFolderName,
          customElementList,
          componentSymbolList,
          componentSymbols,
          htmlElements
        }),
        move(`xplat/${xplatFolderName}/elements`)
      ])
    )
  );