MCPcopy
hub / github.com/angular/angular-cli / addServerFile

Function addServerFile

packages/schematics/angular/ssr/index.ts:337–366  ·  view source on GitHub ↗
(
  projectSourceRoot: string,
  options: ServerOptions,
  isStandalone: boolean,
)

Source from the content-addressed store, hash-verified

335}
336
337function addServerFile(
338 projectSourceRoot: string,
339 options: ServerOptions,
340 isStandalone: boolean,
341): Rule {
342 return async (host) => {
343 const projectName = options.project;
344 const workspace = await readWorkspace(host);
345 const project = workspace.projects.get(projectName);
346 if (!project) {
347 throw new SchematicsException(`Invalid project name (${projectName})`);
348 }
349 const usingApplicationBuilder = isUsingApplicationBuilder(project);
350 const browserDistDirectory = usingApplicationBuilder
351 ? (await getApplicationBuilderOutputPaths(host, projectName)).browser
352 : await getLegacyOutputPaths(host, projectName, 'build');
353
354 return mergeWith(
355 apply(url(`./files/${usingApplicationBuilder ? 'application-builder' : 'server-builder'}`), [
356 applyTemplates({
357 ...strings,
358 ...options,
359 browserDistDirectory,
360 isStandalone,
361 }),
362 move(projectSourceRoot),
363 ]),
364 );
365 };
366}
367
368const ssrSchematic: RuleFactory<SSROptions> = createProjectSchematic(
369 async (options, { project, tree, context }) => {

Callers 1

index.tsFile · 0.85

Calls 10

mergeWithFunction · 0.90
applyFunction · 0.90
urlFunction · 0.90
applyTemplatesFunction · 0.90
moveFunction · 0.90
readWorkspaceFunction · 0.85
getLegacyOutputPathsFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected