本文整理匯總了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),
]);
};