@sap-ux/deploy-tooling 0.10.1 → 0.10.2

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.
@@ -1,4 +1,3 @@
1
- export * from './archive';
2
1
  export * from './config';
3
2
  export * from './deploy';
4
3
  export * from './prompt';
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./archive"), exports);
18
17
  __exportStar(require("./config"), exports);
19
18
  __exportStar(require("./deploy"), exports);
20
19
  __exportStar(require("./prompt"), exports);
@@ -15,9 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.getArchive = void 0;
16
16
  const axios_1 = __importDefault(require("axios"));
17
17
  const fs_1 = require("fs");
18
- const yazl_1 = require("yazl");
19
- const path_1 = require("path");
20
- const archive_1 = require("../base/archive");
18
+ const adm_zip_1 = __importDefault(require("adm-zip"));
21
19
  const https_1 = require("https");
22
20
  /**
23
21
  * Get/read zip file from the given path.
@@ -74,15 +72,13 @@ function fetchArchiveFromUrl(logger, url, rejectUnauthorized) {
74
72
  function createArchiveFromFolder(logger, path) {
75
73
  try {
76
74
  logger.info(`Creating archive from ${path}.`);
77
- const files = (0, archive_1.getFileNames)(path);
78
- const zip = new yazl_1.ZipFile();
79
- for (const filePath of files) {
80
- const relPath = (0, path_1.relative)(path, filePath);
81
- logger.debug(`Adding ${relPath}`);
82
- zip.addFile(filePath, relPath);
75
+ const zip = new adm_zip_1.default();
76
+ zip.addLocalFolder(path);
77
+ for (const entry of zip.getEntries()) {
78
+ logger.debug(`Adding ${entry.entryName}`);
83
79
  }
84
80
  logger.info(`Archive created from ${path}.`);
85
- return (0, archive_1.createBuffer)(zip);
81
+ return zip.toBufferPromise();
86
82
  }
87
83
  catch (error) {
88
84
  throw new Error(`Archive creation has failed. Please ensure ${path} is valid and accessible.`);
@@ -8,10 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.createUi5Archive = void 0;
13
- const yazl_1 = require("yazl");
14
- const base_1 = require("../base");
16
+ const adm_zip_1 = __importDefault(require("adm-zip"));
15
17
  /**
16
18
  * Create an archive of files in the workspace.
17
19
  *
@@ -25,18 +27,18 @@ function createUi5Archive(logger, workspace, projectName, exclude = []) {
25
27
  return __awaiter(this, void 0, void 0, function* () {
26
28
  logger.info('Creating archive with UI5 build result.');
27
29
  const prefix = `/resources/${projectName}/`;
28
- const zip = new yazl_1.ZipFile();
30
+ const zip = new adm_zip_1.default();
29
31
  const resources = yield workspace.byGlob(`${prefix}**/*`);
30
32
  for (const resource of resources) {
31
33
  if (!exclude.some((regex) => RegExp(regex, 'g').exec(resource.getPath()))) {
32
34
  const path = resource.getPath().replace(prefix, '');
33
35
  logger.debug(`Adding ${path}`);
34
36
  const buffer = yield resource.getBuffer();
35
- zip.addBuffer(buffer, path);
37
+ zip.addFile(path, buffer);
36
38
  }
37
39
  }
38
40
  logger.info('Archive created.');
39
- return (0, base_1.createBuffer)(zip);
41
+ return zip.toBuffer();
40
42
  });
41
43
  }
42
44
  exports.createUi5Archive = createUi5Archive;
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "bugs": {
10
10
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Adeploy-tooling"
11
11
  },
12
- "version": "0.10.1",
12
+ "version": "0.10.2",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -30,18 +30,18 @@
30
30
  "commander": "9.4.0",
31
31
  "dotenv": "16.3.1",
32
32
  "prompts": "2.4.2",
33
- "yazl": "2.5.1",
33
+ "adm-zip": "0.5.10",
34
34
  "chalk": "4.1.2",
35
- "@sap-ux/axios-extension": "1.6.1",
35
+ "@sap-ux/axios-extension": "1.7.0",
36
36
  "@sap-ux/btp-utils": "0.12.0",
37
37
  "@sap-ux/logger": "0.4.0",
38
- "@sap-ux/system-access": "0.3.1",
38
+ "@sap-ux/system-access": "0.3.2",
39
39
  "@sap-ux/ui5-config": "0.20.0",
40
40
  "@sap-ux/project-input-validator": "0.1.2"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/prompts": "2.4.4",
44
- "@types/yazl": "2.4.2",
44
+ "@types/adm-zip": "0.5.2",
45
45
  "@sap-ux/store": "0.4.0"
46
46
  },
47
47
  "ui5": {
@@ -1,17 +0,0 @@
1
- /// <reference types="node" />
2
- import type { ZipFile } from 'yazl';
3
- /**
4
- * Helper function to recursively get a list of all files in a given folder and its sub folders.
5
- *
6
- * @param path - path to the folder that is to be searched
7
- * @returns list of files names
8
- */
9
- export declare function getFileNames(path: string): string[];
10
- /**
11
- * Create a zip file based on the given object.
12
- *
13
- * @param zip zip file as object
14
- * @returns the zip file as buffer
15
- */
16
- export declare function createBuffer(zip: ZipFile): Promise<Buffer>;
17
- //# sourceMappingURL=archive.d.ts.map
@@ -1,82 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __asyncValues = (this && this.__asyncValues) || function (o) {
12
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
13
- var m = o[Symbol.asyncIterator], i;
14
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
15
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
16
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
17
- };
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.createBuffer = exports.getFileNames = void 0;
20
- const fs_1 = require("fs");
21
- const path_1 = require("path");
22
- /**
23
- * Helper function to recursively get a list of all files in a given folder and its sub folders.
24
- *
25
- * @param path - path to the folder that is to be searched
26
- * @returns list of files names
27
- */
28
- function getFileNames(path) {
29
- const names = [];
30
- const files = (0, fs_1.readdirSync)(path);
31
- for (const file of files) {
32
- const filePath = (0, path_1.join)(path, file);
33
- if ((0, fs_1.statSync)(filePath).isDirectory()) {
34
- names.push(...getFileNames(filePath));
35
- }
36
- else {
37
- names.push(filePath);
38
- }
39
- }
40
- return names;
41
- }
42
- exports.getFileNames = getFileNames;
43
- /**
44
- * Create a zip file based on the given object.
45
- *
46
- * @param zip zip file as object
47
- * @returns the zip file as buffer
48
- */
49
- function createBuffer(zip) {
50
- var _a, e_1, _b, _c;
51
- return __awaiter(this, void 0, void 0, function* () {
52
- yield new Promise((resolve) => {
53
- zip.end({ forceZip64Format: false }, () => {
54
- resolve();
55
- });
56
- });
57
- const chunks = [];
58
- try {
59
- for (var _d = true, _e = __asyncValues(zip.outputStream), _f; _f = yield _e.next(), _a = _f.done, !_a;) {
60
- _c = _f.value;
61
- _d = false;
62
- try {
63
- const chunk = _c;
64
- chunks.push(chunk);
65
- }
66
- finally {
67
- _d = true;
68
- }
69
- }
70
- }
71
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
72
- finally {
73
- try {
74
- if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
75
- }
76
- finally { if (e_1) throw e_1.error; }
77
- }
78
- return Buffer.concat(chunks);
79
- });
80
- }
81
- exports.createBuffer = createBuffer;
82
- //# sourceMappingURL=archive.js.map