@24i/bigscreen-sdk 1.0.26 → 1.0.27

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.
Files changed (29) hide show
  1. package/package.json +16 -16
  2. package/packages/focus/src/Layout/Base.tsx +3 -3
  3. package/packages/focus/src/Layout/Matrix.tsx +3 -3
  4. package/packages/grid/src/Base/Base.tsx +5 -0
  5. package/packages/list/src/Base/Base.tsx +5 -0
  6. package/packages/create-package/dist/createPackage.js +0 -66
  7. package/packages/create-package/dist/createPackage.js.map +0 -1
  8. package/packages/create-package/dist/index.js +0 -5
  9. package/packages/create-package/dist/index.js.map +0 -1
  10. package/packages/create-package/dist/questionnaire/questions.js +0 -35
  11. package/packages/create-package/dist/questionnaire/questions.js.map +0 -1
  12. package/packages/create-package/dist/settings/Settings.js +0 -10
  13. package/packages/create-package/dist/settings/Settings.js.map +0 -1
  14. package/packages/create-package/dist/types.js +0 -3
  15. package/packages/create-package/dist/types.js.map +0 -1
  16. package/packages/sdk-installer/dist/index.js +0 -5
  17. package/packages/sdk-installer/dist/sdkInstaller.js +0 -38
  18. package/packages/sdk-installer/dist/services/clean.js +0 -11
  19. package/packages/sdk-installer/dist/services/download.js +0 -55
  20. package/packages/sdk-installer/dist/services/index.js +0 -11
  21. package/packages/sdk-installer/dist/services/install.js +0 -24
  22. package/packages/sdk-installer/dist/services/unzip.js +0 -12
  23. package/packages/sdk-installer/dist/types/index.d.ts +0 -1
  24. package/packages/sdk-installer/dist/types/sdkInstaller.d.ts +0 -7
  25. package/packages/sdk-installer/dist/types/services/clean.d.ts +0 -2
  26. package/packages/sdk-installer/dist/types/services/download.d.ts +0 -2
  27. package/packages/sdk-installer/dist/types/services/index.d.ts +0 -4
  28. package/packages/sdk-installer/dist/types/services/install.d.ts +0 -2
  29. package/packages/sdk-installer/dist/types/services/unzip.d.ts +0 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@24i/bigscreen-sdk",
3
- "version": "1.0.26",
3
+ "version": "1.0.27",
4
4
  "description": "SmartApps BIGscreen SDK monorepo",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -41,12 +41,12 @@
41
41
  "@24i/appstage-shared-events-manager": "1.0.11",
42
42
  "@24i/appstage-shared-perf-utils": "1.0.11",
43
43
  "@24i/bigscreen-players-engine-base": "1.0.6",
44
- "@24i/smartapps-datalayer": "3.0.10-alpha.1016",
44
+ "@24i/smartapps-datalayer": "3.0.10",
45
45
  "@sentry/browser": "7.35.0",
46
46
  "@sentry/types": "7.35.0",
47
- "@types/gtag.js": "^0.0.13",
48
- "@types/prop-types": "^15.7.5",
49
- "@types/scheduler": "^0.16.3",
47
+ "@types/gtag.js": "^0.0.14",
48
+ "@types/prop-types": "^15.7.7",
49
+ "@types/scheduler": "^0.16.4",
50
50
  "csstype": "^3.1.2",
51
51
  "date-fns": "2.29.3",
52
52
  "lottie-web": "5.12.2",
@@ -56,29 +56,29 @@
56
56
  "@24i/bigscreen-sdk": "file:.",
57
57
  "@24i/eslint-config-smartapps-bigscreen-linters": "file:./libs/linters",
58
58
  "@24i/smartapps-bigscreen-changelog-generator": "0.17.0",
59
- "@babel/core": "^7.22.15",
60
- "@babel/preset-env": "^7.22.14",
61
- "@types/fs-extra": "^11.0.1",
59
+ "@babel/core": "^7.23.0",
60
+ "@babel/preset-env": "^7.22.20",
61
+ "@types/fs-extra": "^11.0.2",
62
62
  "@types/inquirer": "^9.0.3",
63
- "@types/jest": "^29.5.4",
64
- "@types/minimist": "^1.2.2",
65
- "@types/node": "^20.5.7",
63
+ "@types/jest": "^29.5.5",
64
+ "@types/minimist": "^1.2.3",
65
+ "@types/node": "^20.8.2",
66
66
  "@types/react": "18.0.33",
67
- "babel-jest": "^29.6.4",
67
+ "babel-jest": "^29.7.0",
68
68
  "chalk": "^5.3.0",
69
69
  "coveralls": "^3.1.1",
70
70
  "cross-env": "^7.0.3",
71
71
  "fs-extra": "^11.1.0",
72
72
  "full-icu": "^1.5.0",
73
73
  "identity-obj-proxy": "^3.0.0",
74
- "inquirer": "^9.2.10",
75
- "jest": "^29.6.4",
74
+ "inquirer": "^9.2.11",
75
+ "jest": "^29.7.0",
76
76
  "jest-canvas-mock": "^2.5.2",
77
- "jest-environment-jsdom": "^29.6.4",
77
+ "jest-environment-jsdom": "^29.7.0",
78
78
  "jest-sonar": "^0.2.15",
79
79
  "minimist": "^1.2.8",
80
80
  "patch-package": "^8.0.0",
81
- "sass": "^1.66.1",
81
+ "sass": "^1.68.0",
82
82
  "sass-true": "^6.1.0",
83
83
  "ts-jest": "^29.1.1",
84
84
  "ts-node": "^10.9.1",
@@ -52,7 +52,7 @@ export const getLayoutBase = (onKeyDown: (event: KeyboardEvent, layout: ILayout)
52
52
  throw new Error(Errors.DOM_REF_ERROR);
53
53
  }
54
54
  domRef.current!.addEventListener('keydown', this.onKeyDown, false);
55
- domRef.current!.addEventListener('keyup', this.onKeyUp, false);
55
+ window.document.addEventListener('keyup', this.onGlobalKeyUp, true);
56
56
  }
57
57
 
58
58
  componentWillUnmount() {
@@ -61,14 +61,14 @@ export const getLayoutBase = (onKeyDown: (event: KeyboardEvent, layout: ILayout)
61
61
  throw new Error(Errors.DOM_REF_ERROR);
62
62
  }
63
63
  domRef.current!.removeEventListener('keydown', this.onKeyDown, false);
64
- domRef.current!.removeEventListener('keyup', this.onKeyUp, false);
64
+ window.document.removeEventListener('keyup', this.onGlobalKeyUp, true);
65
65
  }
66
66
 
67
67
  onKeyDown = (e: KeyboardEvent) => {
68
68
  onKeyDown(e, this);
69
69
  };
70
70
 
71
- onKeyUp = () => {
71
+ onGlobalKeyUp = () => {
72
72
  this.preventBlurCounter = 0;
73
73
  };
74
74
 
@@ -58,7 +58,7 @@ export class Matrix extends Component<Props> implements IFocusable {
58
58
  throw new Error(Errors.DOM_REF_ERROR);
59
59
  }
60
60
  domRef.current!.addEventListener('keydown', this.onKeyDown, false);
61
- domRef.current!.addEventListener('keyup', this.onKeyUp, false);
61
+ window.document.addEventListener('keyup', this.onGlobalKeyUp, true);
62
62
  }
63
63
 
64
64
  componentWillUnmount() {
@@ -67,7 +67,7 @@ export class Matrix extends Component<Props> implements IFocusable {
67
67
  throw new Error(Errors.DOM_REF_ERROR);
68
68
  }
69
69
  domRef.current!.removeEventListener('keydown', this.onKeyDown, false);
70
- domRef.current!.removeEventListener('keyup', this.onKeyUp, false);
70
+ window.document.removeEventListener('keyup', this.onGlobalKeyUp, true);
71
71
  }
72
72
 
73
73
  onKeyDown = (e: KeyboardEvent) => {
@@ -103,7 +103,7 @@ export class Matrix extends Component<Props> implements IFocusable {
103
103
  }
104
104
  };
105
105
 
106
- onKeyUp = () => {
106
+ onGlobalKeyUp = () => {
107
107
  this.preventBlurCounter = 0;
108
108
  };
109
109
 
@@ -111,11 +111,13 @@ export class GridBase<T extends Item<U>, U>
111
111
  componentDidMount() {
112
112
  this.scrollerDom.current!.addEventListener('wheel', this.onWheel);
113
113
  this.scroller.current!.wrapRef.current!.addEventListener('keyup', this.onKeyUp);
114
+ window.document.addEventListener('keyup', this.onGlobalKeyUp, true);
114
115
  }
115
116
 
116
117
  componentWillUnmount() {
117
118
  this.scrollerDom.current!.removeEventListener('wheel', this.onWheel);
118
119
  this.scroller.current!.wrapRef.current!.removeEventListener('keyup', this.onKeyUp);
120
+ window.document.removeEventListener('keyup', this.onGlobalKeyUp, true);
119
121
  }
120
122
 
121
123
  // eslint-disable-next-line sonarjs/cognitive-complexity
@@ -155,6 +157,9 @@ export class GridBase<T extends Item<U>, U>
155
157
  onKeyUp = () => {
156
158
  this.stopFastScrolling();
157
159
  this.fastFocusingOptimizer.stop();
160
+ };
161
+
162
+ onGlobalKeyUp = () => {
158
163
  this.preventBlurCounter = 0;
159
164
  };
160
165
 
@@ -100,11 +100,13 @@ export class ListBase<T extends Item<U>, U>
100
100
  componentDidMount() {
101
101
  this.scrollerDom.current!.addEventListener('wheel', this.onWheel);
102
102
  this.scroller.current!.wrapRef.current!.addEventListener('keyup', this.onKeyUp);
103
+ window.document.addEventListener('keyup', this.onGlobalKeyUp, true);
103
104
  }
104
105
 
105
106
  componentWillUnmount() {
106
107
  this.scrollerDom.current!.removeEventListener('wheel', this.onWheel);
107
108
  this.scroller.current!.wrapRef.current!.removeEventListener('keyup', this.onKeyUp);
109
+ window.document.removeEventListener('keyup', this.onGlobalKeyUp, true);
108
110
  }
109
111
 
110
112
  onKeyDown = (event: KeyboardEvent) => {
@@ -130,6 +132,9 @@ export class ListBase<T extends Item<U>, U>
130
132
  onKeyUp = () => {
131
133
  this.stopFastScrolling();
132
134
  this.fastFocusingOptimizer.stop();
135
+ };
136
+
137
+ onGlobalKeyUp = () => {
133
138
  this.preventBlurCounter = 0;
134
139
  };
135
140
 
@@ -1,66 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.main = void 0;
5
- const path = require("path");
6
- const fs = require("fs");
7
- const fse = require("fs-extra");
8
- const chalk = require("chalk");
9
- const minimist = require("minimist");
10
- const questions_1 = require("./questionnaire/questions");
11
- const Settings_1 = require("./settings/Settings");
12
- async function isDirectoryEmpty(dirPath) {
13
- const files = await fs.promises.readdir(dirPath);
14
- return !files.length;
15
- }
16
- async function copyTemplateFiles(templateDir, targetDir) {
17
- return fse.copy(templateDir, targetDir);
18
- }
19
- function updatePackageJsonFile(filePath, options) {
20
- let data = fs.readFileSync(filePath, 'utf8');
21
- const keywords = options.keywords.map((word) => `"${word}"`).join(', ');
22
- data = data.replace(/("name": ")(.*)(")/, `$1${options.name}$3`);
23
- data = data.replace(/("version": ")(.*)(")/, `$1${options.version}$3`);
24
- data = data.replace(/("description": ")(.*)(")/, `$1${options.description}$3`);
25
- data = data.replace(/("keywords": \[)(.*)(\])/, `$1${keywords}$3`);
26
- data = data.replace(/("author": ")(.*)(")/, `$1${options.author}$3`);
27
- fs.writeFileSync(filePath, data);
28
- }
29
- function parseArguments(rawArgv) {
30
- const argv = minimist(rawArgv.slice(2));
31
- const dirName = argv._[0];
32
- if (!dirName) {
33
- console.error('Error: Missing package name');
34
- process.exit(1);
35
- }
36
- return {
37
- dirName,
38
- };
39
- }
40
- async function main() {
41
- const { dirName: destDirName } = parseArguments(process.argv);
42
- const destDir = path.join(process.cwd(), 'packages/', destDirName);
43
- if (fs.existsSync(destDir)) {
44
- console.error(`Error: Target directory "${destDir}" already exists`);
45
- process.exit(1);
46
- }
47
- fs.mkdirSync(destDir, { recursive: true });
48
- const isDirEmpty = await isDirectoryEmpty(destDir);
49
- if (!isDirEmpty) {
50
- console.error(`Error: Target directory "${destDir}" is not empty.`);
51
- process.exit(1);
52
- }
53
- const settings = Object.assign({}, Settings_1.Settings);
54
- settings.name = `${Settings_1.Settings.name}${destDirName}`.toLowerCase();
55
- const details = await (0, questions_1.promptPackageDetails)(settings);
56
- const templateDir = path.join(__dirname, '..', 'templates/typescript');
57
- await copyTemplateFiles(templateDir, destDir);
58
- const packageJsonFile = path.join(destDir, 'package.json');
59
- updatePackageJsonFile(packageJsonFile, details);
60
- const docsSymlinkTarget = path.join('../../../packages/', destDirName, '/README.md');
61
- const docsSymlinkPath = path.join(process.cwd(), 'docs/packages/', destDirName, '/README.md');
62
- await fse.ensureSymlink(docsSymlinkTarget, docsSymlinkPath);
63
- console.log(`${chalk.green('Success')}, package has been initialized!`);
64
- }
65
- exports.main = main;
66
- //# sourceMappingURL=createPackage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createPackage.js","sourceRoot":"","sources":["../src/createPackage.ts"],"names":[],"mappings":";;;;AAEA,6BAA6B;AAC7B,yBAAyB;AACzB,gCAAgC;AAChC,+BAA+B;AAC/B,qCAAqC;AACrC,yDAAiE;AACjE,kDAA+C;AAG/C,KAAK,UAAU,gBAAgB,CAAC,OAAe;IAC3C,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC;AACzB,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AAC,CAAC;IAC3D,qBAAqB,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IAGhD,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;IACrF,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,gBAAgB,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;IAC9F,MAAM,GAAG,CAAC,aAAa,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;IAE5D,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,iCAAiC,CAAC,CAAC;AAC5E,CAAC;AA/BD,oBA+BC"}
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const createPackage_1 = require("./createPackage");
4
- (0, createPackage_1.main)();
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,mDAAuC;AAEvC,IAAA,oBAAI,GAAE,CAAC"}
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.promptPackageDetails = void 0;
4
- const inquirer = require("inquirer");
5
- async function promptPackageDetails(defaultValues) {
6
- return inquirer.prompt([
7
- {
8
- type: 'input',
9
- name: 'name',
10
- message: 'Package name:',
11
- default: defaultValues.name,
12
- }, {
13
- type: 'input',
14
- name: 'version',
15
- message: 'Version:',
16
- default: defaultValues.version,
17
- }, {
18
- type: 'input',
19
- name: 'description',
20
- message: 'Description:',
21
- }, {
22
- type: 'input',
23
- name: 'keywords',
24
- message: 'Keywords:',
25
- filter: (ans) => ans.split(/[\s,]+/),
26
- }, {
27
- type: 'input',
28
- name: 'author',
29
- message: 'Author:',
30
- default: defaultValues.author,
31
- },
32
- ]);
33
- }
34
- exports.promptPackageDetails = promptPackageDetails;
35
- //# sourceMappingURL=questions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"questions.js","sourceRoot":"","sources":["../../src/questionnaire/questions.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAWrC,KAAK,UAAU,oBAAoB,CAAC,aAA4C;IAC5E,OAAO,QAAQ,CAAC,MAAM,CAAC;QACnB;YACI,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,eAAe;YACxB,OAAO,EAAE,aAAa,CAAC,IAAI;SAC9B,EAAE;YACC,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,UAAU;YACnB,OAAO,EAAE,aAAa,CAAC,OAAO;SACjC,EAAE;YACC,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE,cAAc;SAC1B,EAAE;YACC,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,WAAW;YACpB,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC;SACvC,EAAE;YACC,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,SAAS;YAClB,OAAO,EAAE,aAAa,CAAC,MAAM;SAChC;KACJ,CAAC,CAAC;AACP,CAAC;AAEQ,oDAAoB"}
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Settings = void 0;
4
- const Settings = {
5
- name: '@24i/smartapps-bigscreen-',
6
- version: '0.0.1',
7
- author: '24i',
8
- };
9
- exports.Settings = Settings;
10
- //# sourceMappingURL=Settings.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Settings.js","sourceRoot":"","sources":["../../src/settings/Settings.ts"],"names":[],"mappings":";;;AAAA,MAAM,QAAQ,GAAG;IACb,IAAI,EAAE,2BAA2B;IACjC,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,KAAK;CAChB,CAAC;AAEO,4BAAQ"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sdkInstaller = void 0;
4
- var sdkInstaller_1 = require("./sdkInstaller");
5
- Object.defineProperty(exports, "sdkInstaller", { enumerable: true, get: function () { return sdkInstaller_1.sdkInstaller; } });
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sdkInstaller = void 0;
4
- const path_1 = require("path");
5
- const url_1 = require("url");
6
- const services_1 = require("./services");
7
- const log = (message) => process.stdout.write(message);
8
- const sdkInstaller = async ({ zipPath, installPath, enableLogs }) => {
9
- const logger = enableLogs ? log : () => false;
10
- const pathsToDelete = [];
11
- let usedInstallPath;
12
- try {
13
- const parsedZipPath = (0, path_1.parse)(zipPath);
14
- const parsedZipUrl = (0, url_1.parse)(zipPath);
15
- if (!parsedZipUrl.protocol) {
16
- throw new Error('Installation from local packages is not supported yet.');
17
- }
18
- logger('Downloading...');
19
- const downloadedFilePath = `${process.cwd()}/${parsedZipPath.base}`;
20
- pathsToDelete.push(downloadedFilePath);
21
- await (0, services_1.download)(zipPath, downloadedFilePath);
22
- logger('\rUnpacking...');
23
- const unzippedDirPath = `${process.cwd()}/${parsedZipPath.name}`;
24
- pathsToDelete.push(unzippedDirPath);
25
- (0, services_1.unzip)(downloadedFilePath);
26
- logger('\rInstalling...');
27
- usedInstallPath = (0, services_1.install)(unzippedDirPath, installPath);
28
- }
29
- catch (e) {
30
- (0, services_1.clean)(pathsToDelete);
31
- throw e;
32
- }
33
- logger('\rCleaning...');
34
- (0, services_1.clean)(pathsToDelete);
35
- logger(`\rInstalled to ${usedInstallPath}\n`);
36
- return usedInstallPath;
37
- };
38
- exports.sdkInstaller = sdkInstaller;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.clean = void 0;
4
- const child_process_1 = require("child_process");
5
- const deleteFileOrDirectory = (path) => {
6
- (0, child_process_1.spawnSync)('rm', ['-r', path]);
7
- };
8
- const clean = (pathsToBeDeleted) => {
9
- pathsToBeDeleted.forEach(deleteFileOrDirectory);
10
- };
11
- exports.clean = clean;
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.download = void 0;
4
- const fs = require("fs");
5
- const path = require("path");
6
- const url = require("url");
7
- const http = require("http");
8
- const https = require("https");
9
- const createDirPathIfDoesntExist = async (dirPath) => {
10
- if (!fs.existsSync(dirPath)) {
11
- fs.mkdirSync(dirPath, { recursive: true });
12
- }
13
- };
14
- const getNetworkProtocolAdapter = (requestedUrl) => {
15
- const { protocol } = url.parse(requestedUrl);
16
- switch (protocol) {
17
- case 'http:': return http;
18
- case 'https:': return https;
19
- default: throw new Error(`${protocol} protocol is not supported`);
20
- }
21
- };
22
- const getResponseError = (response) => {
23
- const HTTP_RESPONSE_STATUS_CODE_OK = 200;
24
- const { statusCode, headers } = response;
25
- const contentType = headers['content-type'];
26
- if (statusCode !== HTTP_RESPONSE_STATUS_CODE_OK) {
27
- return new Error(`Request Failed. Status Code: ${statusCode}`);
28
- }
29
- if (!contentType) {
30
- return new Error('Missing Content-Type: expected application/zip');
31
- }
32
- if (!/^application\/zip/.test(contentType)) {
33
- return new Error(`Wrong Content-Type: expected application/zip, received ${contentType}`);
34
- }
35
- return null;
36
- };
37
- const download = async (fromUrl, toFilePath) => {
38
- const toDirPath = path.parse(toFilePath).dir;
39
- await createDirPathIfDoesntExist(toDirPath);
40
- return new Promise((resolve, reject) => {
41
- const request = getNetworkProtocolAdapter(fromUrl).get(fromUrl, (response) => {
42
- const error = getResponseError(response);
43
- if (error) {
44
- reject(error);
45
- return;
46
- }
47
- const file = fs.createWriteStream(toFilePath);
48
- file.on('error', reject);
49
- file.on('finish', resolve);
50
- response.pipe(file);
51
- });
52
- request.on('error', reject);
53
- });
54
- };
55
- exports.download = download;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.clean = exports.install = exports.unzip = exports.download = void 0;
4
- var download_1 = require("./download");
5
- Object.defineProperty(exports, "download", { enumerable: true, get: function () { return download_1.download; } });
6
- var unzip_1 = require("./unzip");
7
- Object.defineProperty(exports, "unzip", { enumerable: true, get: function () { return unzip_1.unzip; } });
8
- var install_1 = require("./install");
9
- Object.defineProperty(exports, "install", { enumerable: true, get: function () { return install_1.install; } });
10
- var clean_1 = require("./clean");
11
- Object.defineProperty(exports, "clean", { enumerable: true, get: function () { return clean_1.clean; } });
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.install = void 0;
4
- const child_process_1 = require("child_process");
5
- const getInstalledPathFromOutput = (output) => {
6
- var _a;
7
- const prefix = 'INSTALL_PATH=';
8
- const installedPathRow = output
9
- .split('\n')
10
- .map((outputRow) => outputRow.trim())
11
- .filter((trimmedOutputRow) => trimmedOutputRow.startsWith(prefix));
12
- return ((_a = installedPathRow[0]) === null || _a === void 0 ? void 0 : _a.replace(prefix, '')) || '';
13
- };
14
- const install = (installerDirPath, installToPath) => {
15
- const installationScriptPath = `${installerDirPath}/install.js`;
16
- const installationCommandWithoutCustomPath = `node ${installationScriptPath}`;
17
- const installationCmdToBeUsed = installToPath
18
- ? `${installationCommandWithoutCustomPath} ${installToPath}`
19
- : installationCommandWithoutCustomPath;
20
- const execOptions = { maxBuffer: 5242880 };
21
- const installationScriptOutput = (0, child_process_1.execSync)(installationCmdToBeUsed, execOptions).toString();
22
- return getInstalledPathFromOutput(installationScriptOutput);
23
- };
24
- exports.install = install;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.unzip = void 0;
4
- const child_process_1 = require("child_process");
5
- const unzip = (filePath) => {
6
- const spawnOptions = { maxBuffer: 5242880 };
7
- const unzipProcess = (0, child_process_1.spawnSync)('unzip', ['-n', filePath], spawnOptions);
8
- if (unzipProcess.stderr.length) {
9
- throw new Error(unzipProcess.stderr.toString());
10
- }
11
- };
12
- exports.unzip = unzip;
@@ -1 +0,0 @@
1
- export { sdkInstaller } from './sdkInstaller';
@@ -1,7 +0,0 @@
1
- declare type SdkInstallerOptions = {
2
- zipPath: string;
3
- installPath?: string;
4
- enableLogs?: boolean;
5
- };
6
- declare const sdkInstaller: ({ zipPath, installPath, enableLogs }: SdkInstallerOptions) => Promise<string>;
7
- export { sdkInstaller };
@@ -1,2 +0,0 @@
1
- declare const clean: (pathsToBeDeleted: string[]) => void;
2
- export { clean };
@@ -1,2 +0,0 @@
1
- declare const download: (fromUrl: string, toFilePath: string) => Promise<void>;
2
- export { download };
@@ -1,4 +0,0 @@
1
- export { download } from './download';
2
- export { unzip } from './unzip';
3
- export { install } from './install';
4
- export { clean } from './clean';
@@ -1,2 +0,0 @@
1
- declare const install: (installerDirPath: string, installToPath?: string | undefined) => string;
2
- export { install };
@@ -1,2 +0,0 @@
1
- declare const unzip: (filePath: string) => void;
2
- export { unzip };