當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。