Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
"@types/resolve": "^1.17.1",
"@types/semver": "^7.3.12",
"@types/shelljs": "^0.8.11",
"@types/tar": "^6.1.2",
"@types/watchpack": "^2.4.4",
"@types/yargs": "^17.0.20",
"@types/yargs-parser": "^21.0.0",
Expand Down Expand Up @@ -197,7 +196,7 @@
"source-map-loader": "5.0.0",
"source-map-support": "0.5.21",
"symbol-observable": "4.0.0",
"tar": "^6.1.6",
"tar": "^7.0.0",
"terser": "5.36.0",
"tree-kill": "1.2.2",
"ts-node": "^10.9.1",
Expand Down
1 change: 0 additions & 1 deletion tests/legacy-cli/e2e/utils/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ ts_library(
visibility = ["//visibility:public"],
deps = [
"@npm//@types/semver",
"@npm//@types/tar",
"@npm//ansi-colors",
"@npm//fast-glob",
"@npm//npm",
Expand Down
23 changes: 12 additions & 11 deletions tests/legacy-cli/e2e/utils/tar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* found in the LICENSE file at https://angular.dev/license
*/

import fs from 'fs';
import { normalize } from 'path';
import { Parse } from 'tar';
import { createReadStream } from 'node:fs';
import { normalize } from 'node:path';
import { Parser } from 'tar';

/**
* Extract and return the contents of a single file out of a tar file.
Expand All @@ -17,20 +17,21 @@ import { Parse } from 'tar';
* @param filePath the path of the file to extract
* @returns the Buffer of file or an error on fs/tar error or file not found
*/
export async function extractFile(tarball: string, filePath: string): Promise<Buffer> {
export function extractFile(tarball: string, filePath: string): Promise<Buffer> {
const normalizedFilePath = normalize(filePath);

return new Promise((resolve, reject) => {
fs.createReadStream(tarball)
createReadStream(tarball)
.pipe(
new Parse({
new Parser({
strict: true,
filter: (p) => normalize(p) === normalize(filePath),
// TODO: @types/tar 'entry' does not have ReadEntry.on
onentry: (entry: any) => {
filter: (p) => normalize(p) === normalizedFilePath,
onReadEntry: (entry) => {
const chunks: Buffer[] = [];

entry.on('data', (chunk: any) => chunks!.push(chunk));
entry.on('data', (chunk) => chunks.push(chunk));
entry.on('error', reject);
entry.on('finish', () => resolve(Buffer.concat(chunks!)));
entry.on('finish', () => resolve(Buffer.concat(chunks)));
},
}),
)
Expand Down
11 changes: 1 addition & 10 deletions tests/legacy-cli/e2e_runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,16 +370,7 @@ async function findPackageTars(): Promise<{ [pkg: string]: PkgInfo }> {
);

const pkgJsons = await Promise.all(
pkgs
.map((pkg) => realpathSync(pkg))
.map(async (pkg) => {
try {
return await extractFile(pkg, './package/package.json');
} catch (e) {
// TODO(bazel): currently the bazel npm packaging does not contain the standard npm ./package directory
return await extractFile(pkg, './package.json');
}
}),
pkgs.map((pkg) => realpathSync(pkg)).map((pkg) => extractFile(pkg, './package.json')),
);

return pkgs.reduce(
Expand Down
24 changes: 3 additions & 21 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,6 @@ __metadata:
"@types/resolve": "npm:^1.17.1"
"@types/semver": "npm:^7.3.12"
"@types/shelljs": "npm:^0.8.11"
"@types/tar": "npm:^6.1.2"
"@types/watchpack": "npm:^2.4.4"
"@types/yargs": "npm:^17.0.20"
"@types/yargs-parser": "npm:^21.0.0"
Expand Down Expand Up @@ -772,7 +771,7 @@ __metadata:
source-map-loader: "npm:5.0.0"
source-map-support: "npm:0.5.21"
symbol-observable: "npm:4.0.0"
tar: "npm:^6.1.6"
tar: "npm:^7.0.0"
terser: "npm:5.36.0"
tree-kill: "npm:1.2.2"
ts-node: "npm:^10.9.1"
Expand Down Expand Up @@ -5706,16 +5705,6 @@ __metadata:
languageName: node
linkType: hard

"@types/tar@npm:^6.1.2":
version: 6.1.13
resolution: "@types/tar@npm:6.1.13"
dependencies:
"@types/node": "npm:*"
minipass: "npm:^4.0.0"
checksum: 10c0/98cc72d444fa622049e86e457a64d859c6effd7c7518d36e7b40b4ab1e7aa9e2412cc868cbef396650485dae07d50d98f662e8a53bb45f4a70eb6c61f80a63c7
languageName: node
linkType: hard

"@types/tmp@npm:^0.2.1":
version: 0.2.6
resolution: "@types/tmp@npm:0.2.6"
Expand Down Expand Up @@ -13798,13 +13787,6 @@ __metadata:
languageName: node
linkType: hard

"minipass@npm:^4.0.0":
version: 4.2.8
resolution: "minipass@npm:4.2.8"
checksum: 10c0/4ea76b030d97079f4429d6e8a8affd90baf1b6a1898977c8ccce4701c5a2ba2792e033abc6709373f25c2c4d4d95440d9d5e9464b46b7b76ca44d2ce26d939ce
languageName: node
linkType: hard

"minipass@npm:^5.0.0":
version: 5.0.0
resolution: "minipass@npm:5.0.0"
Expand Down Expand Up @@ -17682,7 +17664,7 @@ __metadata:
languageName: node
linkType: hard

"tar@npm:^6.1.11, tar@npm:^6.1.6, tar@npm:^6.2.1":
"tar@npm:^6.1.11, tar@npm:^6.2.1":
version: 6.2.1
resolution: "tar@npm:6.2.1"
dependencies:
Expand All @@ -17696,7 +17678,7 @@ __metadata:
languageName: node
linkType: hard

"tar@npm:^7.4.3":
"tar@npm:^7.0.0, tar@npm:^7.4.3":
version: 7.4.3
resolution: "tar@npm:7.4.3"
dependencies:
Expand Down