azure-pipelines-tasks-azurermdeploycommon 3.235.0 → 3.236.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "azure-pipelines-tasks-azurermdeploycommon",
3
- "version": "3.235.0",
3
+ "version": "3.236.0",
4
4
  "description": "Common Lib for Azure ARM REST apis",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,7 +21,6 @@
21
21
  "@types/q": "1.0.7",
22
22
  "archiver": "2.1.1",
23
23
  "azure-pipelines-task-lib": "^3.1.0",
24
- "decompress-zip": "^0.3.3",
25
24
  "jsonwebtoken": "^8.5.1",
26
25
  "ltx": "2.6.2",
27
26
  "node-stream-zip": "1.7.0",
@@ -1,5 +1,5 @@
1
1
  import Q = require('q');
2
- export declare function unzip(zipLocation: any, unzipLocation: any): Promise<unknown>;
2
+ export declare function unzip(zipLocation: any, unzipLocation: any): Promise<void>;
3
3
  export declare function archiveFolder(folderPath: any, targetPath: any, zipName: any): Promise<unknown>;
4
4
  /**
5
5
  * Returns array of files present in archived package
@@ -14,8 +14,7 @@ const tl = require("azure-pipelines-task-lib/task");
14
14
  const path = require("path");
15
15
  const Q = require("q");
16
16
  const fs = require("fs");
17
- const StreamZip = require("node-stream-zip");
18
- var DecompressZip = require('decompress-zip');
17
+ const node_stream_zip_1 = require("node-stream-zip");
19
18
  var archiver = require('archiver');
20
19
  function unzip(zipLocation, unzipLocation) {
21
20
  return __awaiter(this, void 0, void 0, function* () {
@@ -23,19 +22,15 @@ function unzip(zipLocation, unzipLocation) {
23
22
  if (tl.exist(unzipLocation)) {
24
23
  tl.rmRF(unzipLocation);
25
24
  }
26
- var unzipper = new DecompressZip(zipLocation);
27
- tl.debug('extracting ' + zipLocation + ' to ' + unzipLocation);
28
- unzipper.on('error', function (error) {
25
+ tl.mkdirP(unzipLocation);
26
+ const zip = new node_stream_zip_1.default.async({ file: zipLocation });
27
+ zip.extract(null, unzipLocation).then(() => {
28
+ zip.close();
29
+ defer.resolve();
30
+ }).catch((error) => {
31
+ console.log(`error extracting ${zipLocation}: ${error}`);
29
32
  defer.reject(error);
30
33
  });
31
- unzipper.on('extract', function (log) {
32
- tl.debug('extracted ' + zipLocation + ' to ' + unzipLocation + ' Successfully');
33
- defer.resolve(unzipLocation);
34
- });
35
- unzipper.extract({
36
- path: unzipLocation
37
- });
38
- return defer.promise;
39
34
  });
40
35
  }
41
36
  exports.unzip = unzip;
@@ -66,17 +61,16 @@ exports.archiveFolder = archiveFolder;
66
61
  function getArchivedEntries(archivedPackage) {
67
62
  return __awaiter(this, void 0, void 0, function* () {
68
63
  var deferred = Q.defer();
69
- var unzipper = new DecompressZip(archivedPackage);
70
- unzipper.on('error', function (error) {
71
- deferred.reject(error);
72
- });
73
- unzipper.on('list', function (files) {
74
- var packageComponent = {
75
- "entries": files
64
+ const zip = new node_stream_zip_1.default.async({ file: archivedPackage });
65
+ zip.entries().then(entries => {
66
+ var packageConmponent = {
67
+ 'entries': Object.keys(entries)
76
68
  };
77
- deferred.resolve(packageComponent);
69
+ zip.close();
70
+ deferred.resolve(packageConmponent);
71
+ }).catch(error => {
72
+ deferred.reject(error);
78
73
  });
79
- unzipper.list();
80
74
  return deferred.promise;
81
75
  });
82
76
  }
@@ -86,7 +80,7 @@ function checkIfFilesExistsInZip(archivedPackage, files) {
86
80
  for (let i = 0; i < files.length; i++) {
87
81
  files[i] = files[i].toLowerCase();
88
82
  }
89
- const zip = new StreamZip({
83
+ const zip = new node_stream_zip_1.default({
90
84
  file: archivedPackage,
91
85
  storeEntries: true,
92
86
  skipEntryNameValidation: true
@@ -2,8 +2,7 @@ import tl = require('azure-pipelines-task-lib/task');
2
2
  import path = require('path');
3
3
  import Q = require('q');
4
4
  import fs = require('fs');
5
- import StreamZip = require('node-stream-zip');
6
- var DecompressZip = require('decompress-zip');
5
+ import StreamZip from 'node-stream-zip';
7
6
  var archiver = require('archiver');
8
7
 
9
8
  export async function unzip(zipLocation, unzipLocation) {
@@ -11,19 +10,15 @@ export async function unzip(zipLocation, unzipLocation) {
11
10
  if(tl.exist(unzipLocation)) {
12
11
  tl.rmRF(unzipLocation);
13
12
  }
14
- var unzipper = new DecompressZip(zipLocation);
15
- tl.debug('extracting ' + zipLocation + ' to ' + unzipLocation);
16
- unzipper.on('error', function (error) {
17
- defer.reject(error);
18
- });
19
- unzipper.on('extract', function (log) {
20
- tl.debug('extracted ' + zipLocation + ' to ' + unzipLocation + ' Successfully');
21
- defer.resolve(unzipLocation);
22
- });
23
- unzipper.extract({
24
- path: unzipLocation
25
- });
26
- return defer.promise;
13
+ tl.mkdirP(unzipLocation);
14
+ const zip = new StreamZip.async({ file: zipLocation});
15
+ zip.extract(null, unzipLocation).then(() => {
16
+ zip.close();
17
+ defer.resolve();
18
+ }).catch((error) => {
19
+ console.log(`error extracting ${zipLocation}: ${error}`);
20
+ defer.reject(error);
21
+ })
27
22
  }
28
23
 
29
24
  export async function archiveFolder(folderPath, targetPath, zipName) {
@@ -53,17 +48,16 @@ export async function archiveFolder(folderPath, targetPath, zipName) {
53
48
  */
54
49
  export async function getArchivedEntries(archivedPackage: string) {
55
50
  var deferred = Q.defer();
56
- var unzipper = new DecompressZip(archivedPackage);
57
- unzipper.on('error', function (error) {
51
+ const zip = new StreamZip.async({file: archivedPackage});
52
+ zip.entries().then(entries => {
53
+ var packageConmponent = {
54
+ 'entries': Object.keys(entries)
55
+ }
56
+ zip.close();
57
+ deferred.resolve(packageConmponent);
58
+ }).catch(error => {
58
59
  deferred.reject(error);
59
- });
60
- unzipper.on('list', function (files) {
61
- var packageComponent = {
62
- "entries":files
63
- };
64
- deferred.resolve(packageComponent);
65
- });
66
- unzipper.list();
60
+ })
67
61
  return deferred.promise;
68
62
  }
69
63