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

[DownloadPackageV0] replace decompress-zip with extract-zip #19573

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
85 changes: 85 additions & 0 deletions Tasks/DownloadPackageV0/_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/DownloadPackageV0/_buildConfigs/Node20/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"azure-pipelines-task-lib": "^4.1.0",
"azure-pipelines-tasks-packaging-common": "^3.206.0",
"azure-pipelines-tasks-utility-common": "^3.210.0",
"decompress-zip": "0.3.3"
"decompress-zip": "0.3.3",
"extract-zip": "2.0.1"
},
"devDependencies": {
"typescript": "5.1.6"
Expand Down
14 changes: 13 additions & 1 deletion Tasks/DownloadPackageV0/download.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
var fs = require('fs');
#if NODE20
import * as extract from 'extract-zip'
#else
var DecompressZip = require('decompress-zip');
#endif
var path = require('path')

import * as corem from 'azure-devops-node-api/CoreApi';
Expand Down Expand Up @@ -221,7 +225,14 @@ export async function unzip(zipLocation: string, unzipLocation: string): Promise
}

tl.debug('Extracting ' + zipLocation + ' to ' + unzipLocation);

#if NODE20
kirill-ivlev marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -234,6 +245,7 @@ export async function unzip(zipLocation: string, unzipLocation: string): Promise
unzipper.extract({
path: path.normalize(unzipLocation)
});
#endif
});
}

Expand Down
2 changes: 1 addition & 1 deletion Tasks/DownloadPackageV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "ms-vscs-rm",
"version": {
"Major": 0,
"Minor": 234,
"Minor": 236,
"Patch": 0
},
"demands": [],
Expand Down
2 changes: 1 addition & 1 deletion Tasks/DownloadPackageV0/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": 0,
"Minor": 234,
"Minor": 236,
"Patch": 0
},
"demands": [],
Expand Down
4 changes: 2 additions & 2 deletions _generated/DownloadPackageV0.versionmap.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Default|0.234.0
Node20_229_1|0.234.1
Default|0.236.0
Node20_229_1|0.236.1
1 change: 0 additions & 1 deletion _generated/DownloadPackageV0/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ export async function unzip(zipLocation: string, unzipLocation: string): Promise
}

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/DownloadPackageV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "ms-vscs-rm",
"version": {
"Major": 0,
"Minor": 234,
"Minor": 236,
"Patch": 0
},
"demands": [],
Expand Down Expand Up @@ -116,7 +116,7 @@
"DeprecatedTask": "This task is deprecated. Please switch to using DownloadPackage@1 https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/download-package-v1"
},
"_buildConfigMapping": {
"Default": "0.234.0",
"Node20_229_1": "0.234.1"
"Default": "0.236.0",
"Node20_229_1": "0.236.1"
}
}
6 changes: 3 additions & 3 deletions _generated/DownloadPackageV0/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": 0,
"Minor": 234,
"Minor": 236,
"Patch": 0
},
"demands": [],
Expand Down Expand Up @@ -116,7 +116,7 @@
"DeprecatedTask": "ms-resource:loc.messages.DeprecatedTask"
},
"_buildConfigMapping": {
"Default": "0.234.0",
"Node20_229_1": "0.234.1"
"Default": "0.236.0",
"Node20_229_1": "0.236.1"
}
}
19 changes: 6 additions & 13 deletions _generated/DownloadPackageV0_Node20/download.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var fs = require('fs');
var DecompressZip = require('decompress-zip');
import * as extract from 'extract-zip'
var path = require('path')

import * as corem from 'azure-devops-node-api/CoreApi';
Expand Down Expand Up @@ -217,18 +217,11 @@ export async function unzip(zipLocation: string, unzipLocation: string): Promise
}

tl.debug('Extracting ' + zipLocation + ' to ' + unzipLocation);

var unzipper = new DecompressZip(zipLocation);
unzipper.on('error', err => {
return reject(tl.loc("ExtractionFailed", err))
});
unzipper.on('extract', () => {
tl.debug('Extracted ' + zipLocation + ' to ' + unzipLocation + ' successfully');
return resolve();
});

unzipper.extract({
path: path.normalize(unzipLocation)
tl.debug(`Using extract-zip package for extracting archive`);
extract(zipLocation, { dir: unzipLocation }).then(() => {
resolve();
}).catch((error) => {
reject(error);
});
});
}
Expand Down
Loading