本文整理汇总了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);
}
}
示例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('.'));
});
示例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;
}
示例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;
}