MCPcopy Index your code
hub / github.com/angular/angular-cli / findPackageTars

Function findPackageTars

tests/e2e_runner.ts:383–405  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

381
382// Collect the packages passed as arguments and return as {package-name => pkg-path}
383async function findPackageTars(): Promise<{ [pkg: string]: PkgInfo }> {
384 const pkgs: string[] = (getGlobalVariable('argv').package as string[]).flatMap((p) =>
385 glob.sync(p),
386 );
387
388 const pkgJsons = await Promise.all(
389 pkgs.map((pkg) => realpathSync(pkg)).map((pkg) => extractFile(pkg, 'npm_package/package.json')),
390 );
391
392 return pkgs.reduce(
393 (all, pkg, i) => {
394 const json = pkgJsons[i].toString('utf8');
395 const { name, version } = JSON.parse(json) as { name: string; version: string };
396 if (!name) {
397 throw new Error(`Package ${pkg} - package.json name/version not found`);
398 }
399
400 all[name] = { path: realpathSync(pkg), name, version };
401 return all;
402 },
403 {} as { [pkg: string]: PkgInfo },
404 );
405}
406
407function deleteTemporaryRoot(): void {
408 try {

Callers 1

e2e_runner.tsFile · 0.85

Calls 4

getGlobalVariableFunction · 0.90
extractFileFunction · 0.90
toStringMethod · 0.80
syncMethod · 0.45

Tested by

no test coverage detected