Skip to content

Commit ea2075a

Browse files
committed
build: update dependency tar to v7
1 parent 4d466bf commit ea2075a

File tree

5 files changed

+17
-45
lines changed

5 files changed

+17
-45
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@
111111
"@types/resolve": "^1.17.1",
112112
"@types/semver": "^7.3.12",
113113
"@types/shelljs": "^0.8.11",
114-
"@types/tar": "^6.1.2",
115114
"@types/watchpack": "^2.4.4",
116115
"@types/yargs": "^17.0.20",
117116
"@types/yargs-parser": "^21.0.0",
@@ -197,7 +196,7 @@
197196
"source-map-loader": "5.0.0",
198197
"source-map-support": "0.5.21",
199198
"symbol-observable": "4.0.0",
200-
"tar": "^6.1.6",
199+
"tar": "^7.0.0",
201200
"terser": "5.36.0",
202201
"tree-kill": "1.2.2",
203202
"ts-node": "^10.9.1",

tests/legacy-cli/e2e/utils/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ ts_library(
1010
visibility = ["//visibility:public"],
1111
deps = [
1212
"@npm//@types/semver",
13-
"@npm//@types/tar",
1413
"@npm//ansi-colors",
1514
"@npm//fast-glob",
1615
"@npm//npm",

tests/legacy-cli/e2e/utils/tar.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9-
import fs from 'fs';
10-
import { normalize } from 'path';
11-
import { Parse } from 'tar';
9+
import { createReadStream } from 'node:fs';
10+
import { normalize } from 'node:path';
11+
import { Parser } from 'tar';
1212

1313
/**
1414
* Extract and return the contents of a single file out of a tar file.
@@ -17,20 +17,21 @@ import { Parse } from 'tar';
1717
* @param filePath the path of the file to extract
1818
* @returns the Buffer of file or an error on fs/tar error or file not found
1919
*/
20-
export async function extractFile(tarball: string, filePath: string): Promise<Buffer> {
20+
export function extractFile(tarball: string, filePath: string): Promise<Buffer> {
21+
const normalizedFilePath = normalize(filePath);
22+
2123
return new Promise((resolve, reject) => {
22-
fs.createReadStream(tarball)
24+
createReadStream(tarball)
2325
.pipe(
24-
new Parse({
26+
new Parser({
2527
strict: true,
26-
filter: (p) => normalize(p) === normalize(filePath),
27-
// TODO: @types/tar 'entry' does not have ReadEntry.on
28-
onentry: (entry: any) => {
28+
filter: (p) => normalize(p) === normalizedFilePath,
29+
onReadEntry: (entry) => {
2930
const chunks: Buffer[] = [];
3031

31-
entry.on('data', (chunk: any) => chunks!.push(chunk));
32+
entry.on('data', (chunk) => chunks.push(chunk));
3233
entry.on('error', reject);
33-
entry.on('finish', () => resolve(Buffer.concat(chunks!)));
34+
entry.on('finish', () => resolve(Buffer.concat(chunks)));
3435
},
3536
}),
3637
)

tests/legacy-cli/e2e_runner.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -370,16 +370,7 @@ async function findPackageTars(): Promise<{ [pkg: string]: PkgInfo }> {
370370
);
371371

372372
const pkgJsons = await Promise.all(
373-
pkgs
374-
.map((pkg) => realpathSync(pkg))
375-
.map(async (pkg) => {
376-
try {
377-
return await extractFile(pkg, './package/package.json');
378-
} catch (e) {
379-
// TODO(bazel): currently the bazel npm packaging does not contain the standard npm ./package directory
380-
return await extractFile(pkg, './package.json');
381-
}
382-
}),
373+
pkgs.map((pkg) => realpathSync(pkg)).map((pkg) => extractFile(pkg, './package.json')),
383374
);
384375

385376
return pkgs.reduce(

yarn.lock

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,6 @@ __metadata:
686686
"@types/resolve": "npm:^1.17.1"
687687
"@types/semver": "npm:^7.3.12"
688688
"@types/shelljs": "npm:^0.8.11"
689-
"@types/tar": "npm:^6.1.2"
690689
"@types/watchpack": "npm:^2.4.4"
691690
"@types/yargs": "npm:^17.0.20"
692691
"@types/yargs-parser": "npm:^21.0.0"
@@ -772,7 +771,7 @@ __metadata:
772771
source-map-loader: "npm:5.0.0"
773772
source-map-support: "npm:0.5.21"
774773
symbol-observable: "npm:4.0.0"
775-
tar: "npm:^6.1.6"
774+
tar: "npm:^7.0.0"
776775
terser: "npm:5.36.0"
777776
tree-kill: "npm:1.2.2"
778777
ts-node: "npm:^10.9.1"
@@ -5835,16 +5834,6 @@ __metadata:
58355834
languageName: node
58365835
linkType: hard
58375836

5838-
"@types/tar@npm:^6.1.2":
5839-
version: 6.1.13
5840-
resolution: "@types/tar@npm:6.1.13"
5841-
dependencies:
5842-
"@types/node": "npm:*"
5843-
minipass: "npm:^4.0.0"
5844-
checksum: 10c0/98cc72d444fa622049e86e457a64d859c6effd7c7518d36e7b40b4ab1e7aa9e2412cc868cbef396650485dae07d50d98f662e8a53bb45f4a70eb6c61f80a63c7
5845-
languageName: node
5846-
linkType: hard
5847-
58485837
"@types/tmp@npm:^0.2.1":
58495838
version: 0.2.6
58505839
resolution: "@types/tmp@npm:0.2.6"
@@ -13945,13 +13934,6 @@ __metadata:
1394513934
languageName: node
1394613935
linkType: hard
1394713936

13948-
"minipass@npm:^4.0.0":
13949-
version: 4.2.8
13950-
resolution: "minipass@npm:4.2.8"
13951-
checksum: 10c0/4ea76b030d97079f4429d6e8a8affd90baf1b6a1898977c8ccce4701c5a2ba2792e033abc6709373f25c2c4d4d95440d9d5e9464b46b7b76ca44d2ce26d939ce
13952-
languageName: node
13953-
linkType: hard
13954-
1395513937
"minipass@npm:^5.0.0":
1395613938
version: 5.0.0
1395713939
resolution: "minipass@npm:5.0.0"
@@ -17898,7 +17880,7 @@ __metadata:
1789817880
languageName: node
1789917881
linkType: hard
1790017882

17901-
"tar@npm:^6.1.11, tar@npm:^6.1.6, tar@npm:^6.2.1":
17883+
"tar@npm:^6.1.11, tar@npm:^6.2.1":
1790217884
version: 6.2.1
1790317885
resolution: "tar@npm:6.2.1"
1790417886
dependencies:
@@ -17912,7 +17894,7 @@ __metadata:
1791217894
languageName: node
1791317895
linkType: hard
1791417896

17915-
"tar@npm:^7.4.3":
17897+
"tar@npm:^7.0.0, tar@npm:^7.4.3":
1791617898
version: 7.4.3
1791717899
resolution: "tar@npm:7.4.3"
1791817900
dependencies:

0 commit comments

Comments
 (0)