MCPcopy Create free account
hub / github.com/angular/dev-infra / handler

Function handler

ng-dev/misc/build-and-link/cli.ts:35–63  ·  view source on GitHub ↗

Yargs command handler for the command.

({projectRoot}: Arguments<BuildAndLinkOptions>)

Source from the content-addressed store, hash-verified

33
34/** Yargs command handler for the command. */
35async function handler({projectRoot}: Arguments<BuildAndLinkOptions>) {
36 try {
37 if (!lstatSync(projectRoot).isDirectory()) {
38 Log.error(` ✘ The 'projectRoot' must be a directory: ${projectRoot}`);
39 process.exit(1);
40 }
41 } catch {
42 Log.error(` ✘ Could not find the 'projectRoot' provided: ${projectRoot}`);
43 process.exit(1);
44 }
45
46 const config = await getConfig();
47 assertValidReleaseConfig(config);
48
49 const builtPackages = await BuildWorker.invokeBuild();
50
51 if (builtPackages === null) {
52 Log.error(` ✘ Could not build release output. Please check output above.`);
53 process.exit(1);
54 }
55 Log.info(green(` ✓ Built release output.`));
56
57 for (const {outputPath, name} of builtPackages) {
58 await ChildProcess.spawn('pnpm', ['--dir', outputPath, 'link', '--global']);
59 await ChildProcess.spawn('pnpm', ['--dir', projectRoot, 'link', '--global', name]);
60 }
61
62 Log.info(green(` ✓ Linked release packages in provided project.`));
63}
64
65/** CLI command module. */
66export const BuildAndLinkCommandModule: CommandModule<{}, BuildAndLinkOptions> = {

Callers

nothing calls this directly

Calls 3

getConfigFunction · 0.85
assertValidReleaseConfigFunction · 0.85
errorMethod · 0.45

Tested by

no test coverage detected