当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript validation.validateProjectName函数代码示例

本文整理汇总了TypeScript中@schematics/angular/utility/validation.validateProjectName函数的典型用法代码示例。如果您正苦于以下问题:TypeScript validateProjectName函数的具体用法?TypeScript validateProjectName怎么用?TypeScript validateProjectName使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了validateProjectName函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: return

  return (host: Tree, context: SchematicContext) => {
    if (!options.name) {
      throw new SchematicsException(`Invalid options, "name" is required.`);
    }
    validateProjectName(options.name);
    let newProjectRoot = '';
    try {
      const workspace = getWorkspace(host);
      newProjectRoot = workspace.newProjectRoot || '';
    } catch {
    }
    const appDir = `${newProjectRoot}/${options.name}`;

    // If user already has angular installed, Bazel should use that version
    const existingAngularVersion = findAngularVersion(options, host);

    const workspaceVersions = {
      'ANGULAR_VERSION': existingAngularVersion || '7.1.1',
      'RULES_SASS_VERSION': '1.14.1',
      'RXJS_VERSION': '6.3.3',
    };

    return mergeWith(apply(url('./files'), [
      applyTemplates({
        utils: strings,
        ...options,
        'dot': '.', ...workspaceVersions,
      }),
      move(appDir),
    ]));
  };
开发者ID:felixfbecker,项目名称:angular,代码行数:31,代码来源:index.ts

示例2: return

  return (host: Tree, context: SchematicContext) => {
    const name = options.name || getWorkspace(host).defaultProject;
    if (!name) {
      throw new Error('Please provide a name for Bazel workspace');
    }
    validateProjectName(name);

    if (!host.exists('yarn.lock')) {
      host.create('yarn.lock', '');
    }

    const workspaceVersions = {
      'RULES_NODEJS_VERSION': '0.18.6',
      'RULES_NODEJS_SHA256': '1416d03823fed624b49a0abbd9979f7c63bbedfd37890ddecedd2fe25cccebc6',
      'RULES_SASS_VERSION': '1.17.0',
    };

    return mergeWith(apply(url('./files'), [
      applyTemplates({
        utils: strings,
        name,
        'dot': '.', ...workspaceVersions,
        routing: hasRoutingModule(host),
        sass: hasSassStylesheet(host),
      }),
    ]));
  };
开发者ID:bestao,项目名称:angular,代码行数:27,代码来源:index.ts

示例3: 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

示例4: 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

示例5: return

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

    return chain([
      addFilesRequiredByBazel(options),
      addDevDependenciesToPackageJson(options),
      addPostinstallToGenerateNgSummaries(),
      backupAngularJson(),
      backupTsconfigJson(),
      updateAngularJsonToUseBazelBuilder(options),
      updateGitignore(),
      updateTsconfigJson(),
      upgradeRxjs(),
    ]);
  };
开发者ID:StephenFluin,项目名称:angular,代码行数:15,代码来源:index.ts

示例6: 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

示例7: 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


注:本文中的@schematics/angular/utility/validation.validateProjectName函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。