當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript schematics.externalSchematic函數代碼示例

本文整理匯總了TypeScript中@angular-devkit/schematics.externalSchematic函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript externalSchematic函數的具體用法?TypeScript externalSchematic怎麽用?TypeScript externalSchematic使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了externalSchematic函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: return

  return (host: Tree) => {
    validateProjectName(options.name);

    return chain([
      externalSchematic('@schematics/angular', 'ng-new', options),
      schematic('ng-add', options, {
        scope: options.name,
      }),
    ]);
  };
開發者ID:BobChao87,項目名稱:angular,代碼行數:10,代碼來源:index.ts

示例2: return

  return (host: Tree, context: SchematicContext) => {
    context.logger.debug('Adding service worker...');

    const swOptions = {
      ...options,
    };
    delete swOptions.title;

    return externalSchematic('@schematics/angular', 'service-worker', swOptions);
  };
開發者ID:rexebin,項目名稱:angular-cli,代碼行數:10,代碼來源:index.ts

示例3: return

  return (host: Tree) => {
    validateProjectName(options.name);

    return chain([
      externalSchematic('@schematics/angular', 'ng-new', {
        ...options,
        skipInstall: true,
      }),
      addDevDependenciesToPackageJson(options),
      schematic('bazel-workspace', options),
      overwriteMainAndIndex(options),
      updateWorkspaceFileToUseBazelBuilder(options),
    ]);
  };
開發者ID:cyrilletuzi,項目名稱:angular,代碼行數:14,代碼來源:index.ts

示例4: return

  return (host: Tree) => {
    validateProjectName(options.name);

    return chain([
      externalSchematic('@schematics/angular', 'ng-new', options),
      schematic(
          'ng-add', {
            name: options.name,
            // skip install since `ng-new` above will schedule the task
            skipInstall: true,
          },
          {
            scope: options.name,
          }),
    ]);
  };
開發者ID:alxhub,項目名稱:angular,代碼行數:16,代碼來源:index.ts

示例5: return

  return (host: Tree) => {
    validateProjectName(options.name);

    return chain([
      externalSchematic(
          '@schematics/angular', 'ng-new',
          {
              ...options,
          }),
      addDevDependenciesToPackageJson(options),
      addDevAndProdMainForAot(options),
      schematic('bazel-workspace', options, {
        scope: options.name,
      }),
      overwriteGitignore(options),
      updateWorkspaceFileToUseBazelBuilder(options),
    ]);
  };
開發者ID:matsko,項目名稱:angular,代碼行數:18,代碼來源:index.ts

示例6: externalSchematic

 const rules = schematicsToRun.map(x => externalSchematic(options.collection, x.name, {}));
開發者ID:fmalcher,項目名稱:angular-cli,代碼行數:1,代碼來源:index.ts

示例7: return

  return (host: Tree, context: SchematicContext) => {
    context.logger.debug('Adding service worker...');

    return externalSchematic('@schematics/angular', 'service-worker', options)(host, context);
  };
開發者ID:iwe7,項目名稱:devkit,代碼行數:5,代碼來源:index.ts

示例8: return

  return (host: Tree, context: SchematicContext) => {
    if (!options.title) {
      options.title = options.project;
    }
    const {path: workspacePath, workspace } = getWorkspace(host);

    if (!options.project) {
      throw new SchematicsException('Option "project" is required.');
    }

    const project = workspace.projects[options.project];
    if (!project) {
      throw new SchematicsException(`Project is not defined in this workspace.`);
    }

    if (project.projectType !== 'application') {
      throw new SchematicsException(`PWA requires a project type of "application".`);
    }

    // Find all the relevant targets for the project
    const projectTargets = project.targets || project.architect;
    if (!projectTargets || Object.keys(projectTargets).length === 0) {
      throw new SchematicsException(`Targets are not defined for this project.`);
    }

    const buildTargets = [];
    const testTargets = [];
    for (const targetName in projectTargets) {
      const target = projectTargets[targetName];
      if (!target) {
        continue;
      }

      if (target.builder === '@angular-devkit/build-angular:browser') {
        buildTargets.push(target);
      } else if (target.builder === '@angular-devkit/build-angular:karma') {
        testTargets.push(target);
      }
    }

    // Add manifest to asset configuration
    const assetEntry = join(normalize(project.root), 'src', 'manifest.webmanifest');
    for (const target of [...buildTargets, ...testTargets]) {
      if (target.options) {
        if (target.options.assets) {
          target.options.assets.push(assetEntry);
        } else {
          target.options.assets = [ assetEntry ];
        }
      } else {
        target.options = { assets: [ assetEntry ] };
      }
    }
    host.overwrite(workspacePath, JSON.stringify(workspace, null, 2));

    // Find all index.html files in build targets
    const indexFiles = new Set<string>();
    for (const target of buildTargets) {
      if (target.options && target.options.index) {
        indexFiles.add(target.options.index);
      }

      if (!target.configurations) {
        continue;
      }
      for (const configName in target.configurations) {
        const configuration = target.configurations[configName];
        if (configuration && configuration.index) {
          indexFiles.add(configuration.index);
        }
      }
    }

    // Setup sources for the assets files to add to the project
    const sourcePath = join(normalize(project.root), 'src');
    const assetsPath = join(sourcePath, 'assets');
    const rootTemplateSource = apply(url('./files/root'), [
      template({ ...options }),
      move(getSystemPath(sourcePath)),
    ]);
    const assetsTemplateSource = apply(url('./files/assets'), [
      template({ ...options }),
      move(getSystemPath(assetsPath)),
    ]);

    // Setup service worker schematic options
    const swOptions = { ...options };
    delete swOptions.title;

    // Chain the rules and return
    return chain([
      externalSchematic('@schematics/angular', 'service-worker', swOptions),
      mergeWith(rootTemplateSource),
      mergeWith(assetsTemplateSource),
      ...[...indexFiles].map(path => updateIndexFile(path)),
    ])(host, context);
  };
開發者ID:DevIntent,項目名稱:angular-cli,代碼行數:97,代碼來源:index.ts


注:本文中的@angular-devkit/schematics.externalSchematic函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。