azure-pipelines-tasks-webdeployment-common 4.229.0 → 4.230.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 +2 -1
- package/packageUtility.js +1 -9
- package/ziputility.d.ts +1 -0
- package/ziputility.js +27 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azure-pipelines-tasks-webdeployment-common",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.230.0",
|
|
4
4
|
"description": "Common Lib for MSDeploy Utility",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"azure-pipelines-task-lib": "^4.2.0",
|
|
24
24
|
"decompress-zip": "^0.3.3",
|
|
25
25
|
"ltx": "2.8.0",
|
|
26
|
+
"node-stream-zip": "^1.15.0",
|
|
26
27
|
"q": "1.4.1",
|
|
27
28
|
"winreg": "1.2.2",
|
|
28
29
|
"xml2js": "0.6.2"
|
package/packageUtility.js
CHANGED
|
@@ -74,15 +74,7 @@ class Package {
|
|
|
74
74
|
isMSBuildPackage() {
|
|
75
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
76
76
|
if (this._isMSBuildPackage == undefined) {
|
|
77
|
-
this._isMSBuildPackage =
|
|
78
|
-
if (this.getPackageType() != PackageType.folder) {
|
|
79
|
-
var pacakgeComponent = yield zipUtility.getArchivedEntries(this._path);
|
|
80
|
-
if (((pacakgeComponent["entries"].indexOf("parameters.xml") > -1) || (pacakgeComponent["entries"].indexOf("Parameters.xml") > -1)) &&
|
|
81
|
-
((pacakgeComponent["entries"].indexOf("systemInfo.xml") > -1) || (pacakgeComponent["entries"].indexOf("systeminfo.xml") > -1)
|
|
82
|
-
|| (pacakgeComponent["entries"].indexOf("SystemInfo.xml") > -1))) {
|
|
83
|
-
this._isMSBuildPackage = true;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
77
|
+
this._isMSBuildPackage = this.getPackageType() != PackageType.folder && (yield zipUtility.checkIfFilesExistsInZip(this._path, ["parameters.xml", "systeminfo.xml"]));
|
|
86
78
|
tl.debug("Is the package an msdeploy package : " + this._isMSBuildPackage);
|
|
87
79
|
}
|
|
88
80
|
return this._isMSBuildPackage;
|
package/ziputility.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export declare function archiveFolder(folderPath: any, targetPath: any, zipName:
|
|
|
4
4
|
* Returns array of files present in archived package
|
|
5
5
|
*/
|
|
6
6
|
export declare function getArchivedEntries(archivedPackage: string): Promise<any>;
|
|
7
|
+
export declare function checkIfFilesExistsInZip(archivedPackage: string, files: string[]): any;
|
package/ziputility.js
CHANGED
|
@@ -9,11 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getArchivedEntries = exports.archiveFolder = exports.unzip = void 0;
|
|
12
|
+
exports.checkIfFilesExistsInZip = exports.getArchivedEntries = exports.archiveFolder = exports.unzip = void 0;
|
|
13
13
|
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");
|
|
17
18
|
var DecompressZip = require('decompress-zip');
|
|
18
19
|
var archiver = require('archiver');
|
|
19
20
|
const deleteDir = (path) => tl.exist(path) && tl.rmRF(path);
|
|
@@ -155,3 +156,28 @@ function getArchivedEntries(archivedPackage) {
|
|
|
155
156
|
});
|
|
156
157
|
}
|
|
157
158
|
exports.getArchivedEntries = getArchivedEntries;
|
|
159
|
+
function checkIfFilesExistsInZip(archivedPackage, files) {
|
|
160
|
+
let deferred = Q.defer();
|
|
161
|
+
for (let i = 0; i < files.length; i++) {
|
|
162
|
+
files[i] = files[i].toLowerCase();
|
|
163
|
+
}
|
|
164
|
+
const zip = new StreamZip({
|
|
165
|
+
file: archivedPackage,
|
|
166
|
+
storeEntries: true
|
|
167
|
+
});
|
|
168
|
+
zip.on('ready', () => {
|
|
169
|
+
let fileCount = 0;
|
|
170
|
+
for (let entry in zip.entries()) {
|
|
171
|
+
if (files.indexOf(entry.toLowerCase()) != -1) {
|
|
172
|
+
fileCount += 1;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
zip.close();
|
|
176
|
+
deferred.resolve(fileCount == files.length);
|
|
177
|
+
});
|
|
178
|
+
zip.on('error', error => {
|
|
179
|
+
deferred.reject(error);
|
|
180
|
+
});
|
|
181
|
+
return deferred.promise;
|
|
182
|
+
}
|
|
183
|
+
exports.checkIfFilesExistsInZip = checkIfFilesExistsInZip;
|