本文整理汇总了TypeScript中@angular-devkit/schematics.externalSchematic函数的典型用法代码示例。如果您正苦于以下问题:TypeScript externalSchematic函数的具体用法?TypeScript externalSchematic怎么用?TypeScript externalSchematic使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了externalSchematic函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: 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
示例2: return
return (host: Tree, context: SchematicContext) => {
context.logger.debug('Adding service worker...');
const swOptions = {
...options,
};
delete swOptions.title;
return externalSchematic('@schematics/angular', 'service-worker', swOptions);
};
开发者ID:rexebin,项目名称:angular-cli,代码行数:10,代码来源:index.ts
示例3: 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
示例4: 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
示例5: 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
示例6: externalSchematic
const rules = schematicsToRun.map(x => externalSchematic(options.collection, x.name, {}));
开发者ID:fmalcher,项目名称:angular-cli,代码行数:1,代码来源:index.ts
示例7: return
return (host: Tree, context: SchematicContext) => {
context.logger.debug('Adding service worker...');
return externalSchematic('@schematics/angular', 'service-worker', options)(host, context);
};
开发者ID:iwe7,项目名称:devkit,代码行数:5,代码来源:index.ts
示例8: return
return (host: Tree, context: SchematicContext) => {
if (!options.title) {
options.title = options.project;
}
const {path: workspacePath, workspace } = getWorkspace(host);
if (!options.project) {
throw new SchematicsException('Option "project" is required.');
}
const project = workspace.projects[options.project];
if (!project) {
throw new SchematicsException(`Project is not defined in this workspace.`);
}
if (project.projectType !== 'application') {
throw new SchematicsException(`PWA requires a project type of "application".`);
}
// Find all the relevant targets for the project
const projectTargets = project.targets || project.architect;
if (!projectTargets || Object.keys(projectTargets).length === 0) {
throw new SchematicsException(`Targets are not defined for this project.`);
}
const buildTargets = [];
const testTargets = [];
for (const targetName in projectTargets) {
const target = projectTargets[targetName];
if (!target) {
continue;
}
if (target.builder === '@angular-devkit/build-angular:browser') {
buildTargets.push(target);
} else if (target.builder === '@angular-devkit/build-angular:karma') {
testTargets.push(target);
}
}
// Add manifest to asset configuration
const assetEntry = join(normalize(project.root), 'src', 'manifest.webmanifest');
for (const target of [...buildTargets, ...testTargets]) {
if (target.options) {
if (target.options.assets) {
target.options.assets.push(assetEntry);
} else {
target.options.assets = [ assetEntry ];
}
} else {
target.options = { assets: [ assetEntry ] };
}
}
host.overwrite(workspacePath, JSON.stringify(workspace, null, 2));
// Find all index.html files in build targets
const indexFiles = new Set<string>();
for (const target of buildTargets) {
if (target.options && target.options.index) {
indexFiles.add(target.options.index);
}
if (!target.configurations) {
continue;
}
for (const configName in target.configurations) {
const configuration = target.configurations[configName];
if (configuration && configuration.index) {
indexFiles.add(configuration.index);
}
}
}
// Setup sources for the assets files to add to the project
const sourcePath = join(normalize(project.root), 'src');
const assetsPath = join(sourcePath, 'assets');
const rootTemplateSource = apply(url('./files/root'), [
template({ ...options }),
move(getSystemPath(sourcePath)),
]);
const assetsTemplateSource = apply(url('./files/assets'), [
template({ ...options }),
move(getSystemPath(assetsPath)),
]);
// Setup service worker schematic options
const swOptions = { ...options };
delete swOptions.title;
// Chain the rules and return
return chain([
externalSchematic('@schematics/angular', 'service-worker', swOptions),
mergeWith(rootTemplateSource),
mergeWith(assetsTemplateSource),
...[...indexFiles].map(path => updateIndexFile(path)),
])(host, context);
};
开发者ID:DevIntent,项目名称:angular-cli,代码行数:97,代码来源:index.ts
注:本文中的@angular-devkit/schematics.externalSchematic函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论