How to use the @angular-devkit/core.join function in @angular-devkit/core

To help you get started, we’ve selected a few @angular-devkit/core 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 sbb-design-systems / sbb-angular / schematics / public2business / index.js View on Github external
if (tree.exists(businessDir.path)) {
        businessDir.visit(path => tree.delete(path));
    }
    publicDir.visit((path, entry) => {
        if (entry && !path.endsWith('.spec.ts')) {
            const targetPath = core.join(businessDir.path, core.relative(publicDir.path, path));
            const content = adaptFile(entry);
            if (tree.exists(targetPath)) {
                tree.overwrite(targetPath, content);
            }
            else {
                tree.create(targetPath, content);
            }
        }
    });
    const warningFile = core.join(businessDir.path, 'AUTOGENERATED_DO_NOT_MODIFY');
    if (!tree.exists(warningFile)) {
        tree.create(warningFile, 'See schematics/public2business');
    }
}
function adaptFile(entry) {
github rxweb / rxweb / rxweb.io / node_modules / @angular-devkit / build-angular / src / app-shell / index.js View on Github external
return rxjs_1.forkJoin(this.getBrowserBuilderConfig(options).pipe(operators_1.switchMap(config => {
            browserOptions = config.options;
            projectRoot = core_1.resolve(this.context.workspace.root, config.root);
            const browserIndexOutputPath = core_1.join(core_1.normalize(browserOptions.outputPath), 'index.html');
            const path = core_1.join(this.context.workspace.root, browserIndexOutputPath);
            return this.context.host.read(path).pipe(operators_1.map(x => {
                return [browserIndexOutputPath, x];
            }));
        })), this.getServerModuleBundlePath(options)).pipe(operators_1.switchMap(([[browserIndexOutputPath, indexContent], serverBundlePath]) => {
            const root = this.context.workspace.root;
github rxweb / rxweb / rxweb.io / node_modules / @schematics / angular / migrations / update-6 / index.js View on Github external
function _extraEntryMapper(extraEntry) {
            let entry;
            if (typeof extraEntry === 'string') {
                entry = core_1.join(app.root, extraEntry);
            }
            else {
                const input = core_1.join(app.root, extraEntry.input || '');
                entry = { input, lazy: extraEntry.lazy };
                if (extraEntry.output) {
                    entry.bundleName = extraEntry.output;
                }
            }
            return entry;
        }
        const projectRoot = core_1.join(core_1.normalize(appRoot), '..');
github nestjs / schematics / src / lib / sub-app / sub-app.factory.ts View on Github external
defaultAppName: string,
) {
  if (!scripts) {
    return;
  }
  const defaultFormatScriptName = 'format';
  const defaultTestScriptName = 'test:e2e';
  if (!scripts[defaultTestScriptName] && !scripts[defaultFormatScriptName]) {
    return;
  }
  if (
    scripts[defaultTestScriptName] &&
    scripts[defaultTestScriptName].indexOf(options.path as string) < 0
  ) {
    const defaultTestDir = 'test';
    const newTestDir = join(
      options.path as Path,
      defaultAppName,
      defaultTestDir,
    );
    scripts[defaultTestScriptName] = (scripts[
      defaultTestScriptName
    ] as string).replace(defaultTestDir, newTestDir);
  }
  if (
    scripts[defaultFormatScriptName] &&
    scripts[defaultFormatScriptName].indexOf(DEFAULT_PATH_NAME) >= 0
  ) {
    const defaultSourceRoot =
      options.rootDir !== undefined ? options.rootDir : DEFAULT_APPS_PATH;
    scripts[
      defaultFormatScriptName
github angular / angular-devkit-schematics-builds / src / tree / host-tree.js View on Github external
                .pipe(operators_1.mergeMap(x => x), operators_1.map(path => core_1.join(base, path)), operators_1.concatMap(path => {
                let isDirectory = false;
github nestjs / schematics / src / lib / sub-app / sub-app.factory.ts View on Github external
function addAppsToCliOptions(
  projectRoot: string,
  projectName: string,
  appName: string,
): Rule {
  const rootPath = join(projectRoot as Path, projectName);
  const project = {
    type: PROJECT_TYPE.APPLICATION,
    root: rootPath,
    entryFile: 'main',
    sourceRoot: join(rootPath, DEFAULT_PATH_NAME),
    compilerOptions: {
      tsConfigPath: join(rootPath, 'tsconfig.app.json'),
    },
  };
  return (host: Tree) => {
    const nestFileExists = host.exists('nest.json');

    let nestCliFileExists = host.exists('nest-cli.json');
    if (!nestCliFileExists && !nestFileExists) {
      host.create('nest-cli.json', '{}');
      nestCliFileExists = true;
    }
    return updateJsonFile(
      host,
      nestCliFileExists ? 'nest-cli.json' : 'nest.json',
      (optionsFile: Record) => {
github rxweb / rxweb / rxweb.io / node_modules / @schematics / angular / universal / index.js View on Github external
return (host, context) => {
        const clientProject = getClientProject(host, options);
        if (clientProject.projectType !== 'application') {
            throw new schematics_1.SchematicsException(`Universal requires a project type of "application".`);
        }
        const clientArchitect = getClientArchitect(host, options);
        const outDir = getTsConfigOutDir(host, clientArchitect);
        const tsConfigExtends = core_1.basename(clientArchitect.build.options.tsConfig);
        const rootInSrc = clientProject.root === '';
        const tsConfigDirectory = core_1.join(core_1.normalize(clientProject.root), rootInSrc ? 'src' : '');
        if (!options.skipInstall) {
            context.addTask(new tasks_1.NodePackageInstallTask());
        }
        const templateSource = schematics_1.apply(schematics_1.url('./files/src'), [
            schematics_1.template(Object.assign({}, core_1.strings, options, { stripTsExtension: (s) => { return s.replace(/\.ts$/, ''); } })),
            schematics_1.move(core_1.join(core_1.normalize(clientProject.root), 'src')),
        ]);
        const rootSource = schematics_1.apply(schematics_1.url('./files/root'), [
            schematics_1.template(Object.assign({}, core_1.strings, options, { stripTsExtension: (s) => { return s.replace(/\.ts$/, ''); }, outDir,
                tsConfigExtends,
                rootInSrc })),
            schematics_1.move(tsConfigDirectory),
        ]);
        return schematics_1.chain([
            schematics_1.mergeWith(templateSource),
            schematics_1.mergeWith(rootSource),