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


TypeScript strings.dasherize函数代码示例

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


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

示例1: renameDirs

/**
 * Renames package directories if custom names for packages were specified.
 */
function renameDirs () {
  const config: PackageNamesConfig = getPackageNamesConfig(process.argv);

  for (const packageName of NEBULAR_PACKAGES) {
    const nbPackageDirName = dasherize(packageName);
    const fromDir = join(BUILD_DIR, nbPackageDirName);
    const toDir = join(BUILD_DIR, config.unprefixed[packageName]);
    fsRenameSync(fromDir, toDir);
  }
}
开发者ID:kevinheader,项目名称:nebular,代码行数:13,代码来源:change-prefix.ts

示例2: task

task('generate-ts-config', () => {
  const { theme }: PackageNamesConfig = getPackageNamesConfig(process.argv);
  let stream = src('tsconfig.publish.json');

  for (const packageName of NEBULAR_PACKAGES) {
    stream = stream.pipe(replace(`@nebular/${dasherize(packageName)}`, theme))
  }

  return stream
    .pipe(rename('tsconfig-custom.publish.json'))
    .pipe(dest('.'));
});
开发者ID:kevinheader,项目名称:nebular,代码行数:12,代码来源:change-prefix.ts

示例3: parseArguments

/**
 * Reads package prefix and all package names passed as command line arguments.
 * List of supported arguments:
 * --prefix    - prefix of the package. Also used as prefix in class names, selector prefixes etc.
 * --auth      - replacement for @nebular/auth
 * --bootstrap - replacement for @nebular/bootstrap
 * --date-fns  - replacement for @nebular/date-fns
 * --eva-icons - replacement for @nebular/eva-icons
 * --moment    - replacement for @nebular/moment
 * --theme     - replacement for @nebular/theme
 * --security  - replacement for @nebular/security
 * @param argv command line arguments
 * @returns ParsedArguments
 */
function parseArguments(argv: string[]): ParsedArguments {
  const args = minimist(argv.slice(2));
  const prefix = args.prefix;

  if (!prefix) {
    throwNoPrefixSpecified();
  }

  const parsedArguments = { prefix };
  for (const packageName of NEBULAR_PACKAGES) {
    parsedArguments[packageName] = args[dasherize(packageName)];
  }

  return parsedArguments;
}
开发者ID:kevinheader,项目名称:nebular,代码行数:29,代码来源:change-prefix.ts

示例4: applyDefaults

/**
 * Prefixes packages and fills config with default package names for packages
 * not passed as `--[package-name]` argument.
 * Default package name is `${prefix}/${dasherize(packageName)}`.
 * For example, with prefix set `@custom`, `@nebular/auth` would ne `@custom/auth`.
 * @param parsedArguments parsed command line arguments
 * @returns PackageNamesConfig
 */
function applyDefaults(parsedArguments: ParsedArguments): PackageNamesConfig {
  const { prefix } = parsedArguments;
  const config = {
    prefix,
    unscopedPrefix: prefix.replace(/^@/, ''),
    unprefixed: {},
  };

  for (const nbPackageName of NEBULAR_PACKAGES) {
    const packageName = parsedArguments[nbPackageName] || dasherize(nbPackageName);
    config.unprefixed[nbPackageName] = packageName;
    config[nbPackageName] = `${prefix}/${packageName}`;
  }

  return config as PackageNamesConfig;
}
开发者ID:kevinheader,项目名称:nebular,代码行数:24,代码来源:change-prefix.ts


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