in modules/common/schematics/ng-add/index.ts [41:67]
export default function (options: NgAddOptions): Rule {
return async (host, context) => {
const workspace = await getWorkspace(host);
const project = workspace.projects.get(options.project);
if (project.extensions.projectType !== 'application') {
throw new SchematicsException(`Universal requires a project type of "application".`);
}
const clientBuildTarget = project.targets.get('build');
if (!clientBuildTarget) {
throw new SchematicsException(`Project target "build" not found.`);
}
if (!options.skipInstall) {
context.addTask(new NodePackageInstallTask());
}
return chain([
augmentAppModuleRule(project, clientBuildTarget, options),
options.ssr ? addSSRRule(project, clientBuildTarget) : noop(),
options.prerender ? addPreRenderRule() : noop(),
addScriptsRule(options),
updateWorkspaceRule(options),
]);
};
}