Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DownloadPackageV1] replace decompress-zip with extract-zip #19570

79 changes: 79 additions & 0 deletions Tasks/DownloadPackageV1/_buildConfigs/Node20/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Tasks/DownloadPackageV1/_buildConfigs/Node20/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"azure-pipelines-tasks-packaging-common": "3.206.0",
"azure-pipelines-tasks-utility-common": "^3.198.1",
"decompress-zip": "0.3.3",
"tar-fs": "1.16.3"
"tar-fs": "1.16.3",
"extract-zip": "2.0.1"
},
"devDependencies": {
"typescript": "5.1.6"
Expand Down
18 changes: 16 additions & 2 deletions Tasks/DownloadPackageV1/packagefile.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import * as tl from "azure-pipelines-task-lib/task";
import * as path from "path";
import * as fs from "fs";
#if NODE20
import * as extract from 'extract-zip'
#else
var DecompressZip = require('decompress-zip');
#endif

var tar = require("tar-fs");
var zlib = require("zlib");
var DecompressZip = require('decompress-zip');


export class PackageFile {
public readonly win: boolean;
Expand Down Expand Up @@ -62,7 +68,14 @@ export class PackageFile {
private async unzip(zipLocation: string, unzipLocation: string): Promise<void> {
return new Promise<void>(function(resolve, reject) {
tl.debug("Extracting " + zipLocation + " to " + unzipLocation);

#if NODE20
tl.debug(`Using extract-zip package for extracting archive`);
extract(zipLocation, { dir: unzipLocation }).then(() => {
resolve();
}).catch((error) => {
reject(error);
});
#else
var unzipper = new DecompressZip(zipLocation);
unzipper.on("error", err => {
return reject(tl.loc("ExtractionFailed", err));
Expand All @@ -75,6 +88,7 @@ export class PackageFile {
unzipper.extract({
path: path.normalize(unzipLocation)
});
#endif
});
}
}
2 changes: 1 addition & 1 deletion Tasks/DownloadPackageV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "ms-vscs-rm",
"version": {
"Major": 1,
"Minor": 231,
"Minor": 236,
"Patch": 0
},
"demands": [],
Expand Down
2 changes: 1 addition & 1 deletion Tasks/DownloadPackageV1/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "ms-vscs-rm",
"version": {
"Major": 1,
"Minor": 231,
"Minor": 236,
"Patch": 0
},
"demands": [],
Expand Down
4 changes: 2 additions & 2 deletions _generated/DownloadPackageV1.versionmap.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Default|1.231.0
Node20_229_1|1.231.1
Default|1.236.0
Node20_229_1|1.236.1
5 changes: 3 additions & 2 deletions _generated/DownloadPackageV1/packagefile.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import * as tl from "azure-pipelines-task-lib/task";
import * as path from "path";
import * as fs from "fs";
var DecompressZip = require('decompress-zip');

var tar = require("tar-fs");
var zlib = require("zlib");
var DecompressZip = require('decompress-zip');


export class PackageFile {
public readonly win: boolean;
Expand Down Expand Up @@ -62,7 +64,6 @@ export class PackageFile {
private async unzip(zipLocation: string, unzipLocation: string): Promise<void> {
return new Promise<void>(function(resolve, reject) {
tl.debug("Extracting " + zipLocation + " to " + unzipLocation);

var unzipper = new DecompressZip(zipLocation);
unzipper.on("error", err => {
return reject(tl.loc("ExtractionFailed", err));
Expand Down
6 changes: 3 additions & 3 deletions _generated/DownloadPackageV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "ms-vscs-rm",
"version": {
"Major": 1,
"Minor": 231,
"Minor": 236,
"Patch": 0
},
"demands": [],
Expand Down Expand Up @@ -195,7 +195,7 @@
"Info_ResolvedLatestVersion": "Resolved latest package version: %s"
},
"_buildConfigMapping": {
"Default": "1.231.0",
"Node20_229_1": "1.231.1"
"Default": "1.236.0",
"Node20_229_1": "1.236.1"
}
}
6 changes: 3 additions & 3 deletions _generated/DownloadPackageV1/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "ms-vscs-rm",
"version": {
"Major": 1,
"Minor": 231,
"Minor": 236,
"Patch": 0
},
"demands": [],
Expand Down Expand Up @@ -195,7 +195,7 @@
"Info_ResolvedLatestVersion": "ms-resource:loc.messages.Info_ResolvedLatestVersion"
},
"_buildConfigMapping": {
"Default": "1.231.0",
"Node20_229_1": "1.231.1"
"Default": "1.236.0",
"Node20_229_1": "1.236.1"
}
}
Loading