本文整理汇总了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),
]));
};
示例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),
}),
]));
};
示例3: return
return (host: Tree) => {
validateProjectName(options.name);
return chain([
externalSchematic('@schematics/angular', 'ng-new', options),
schematic('ng-add', options, {
scope: options.name,
}),
]);
};
示例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),
]);
};
示例5: return
return (host: Tree) => {
validateProjectName(options.name);
return chain([
addFilesRequiredByBazel(options),
addDevDependenciesToPackageJson(options),
addPostinstallToGenerateNgSummaries(),
backupAngularJson(),
backupTsconfigJson(),
updateAngularJsonToUseBazelBuilder(options),
updateGitignore(),
updateTsconfigJson(),
upgradeRxjs(),
]);
};
示例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,
}),
]);
};
示例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),
]);
};