@24i/smartapps-bigscreen-rnv-build-engine 0.8.7-alpha.1417 → 0.8.7-alpha.1421

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 (113) hide show
  1. package/README.md +1 -2
  2. package/coverage/clover.xml +199 -0
  3. package/coverage/coverage-final.json +10 -0
  4. package/coverage/lcov-report/base.css +224 -0
  5. package/coverage/lcov-report/block-navigation.js +79 -0
  6. package/coverage/lcov-report/clean.ts.html +113 -0
  7. package/coverage/lcov-report/download.ts.html +260 -0
  8. package/coverage/lcov-report/favicon.png +0 -0
  9. package/coverage/lcov-report/index.html +141 -0
  10. package/coverage/lcov-report/index.ts.html +86 -0
  11. package/coverage/lcov-report/install.ts.html +161 -0
  12. package/coverage/lcov-report/prettify.css +1 -0
  13. package/coverage/lcov-report/prettify.js +2 -0
  14. package/coverage/lcov-report/registerSdkPath.ts.html +134 -0
  15. package/coverage/lcov-report/sdk-installer/index.html +126 -0
  16. package/coverage/lcov-report/sdk-installer/index.ts.html +83 -0
  17. package/coverage/lcov-report/sdk-installer/sdkInstaller.ts.html +233 -0
  18. package/coverage/lcov-report/sdk-installer/services/clean.ts.html +113 -0
  19. package/coverage/lcov-report/sdk-installer/services/download.ts.html +260 -0
  20. package/coverage/lcov-report/sdk-installer/services/index.html +171 -0
  21. package/coverage/lcov-report/sdk-installer/services/index.ts.html +92 -0
  22. package/coverage/lcov-report/sdk-installer/services/install.ts.html +161 -0
  23. package/coverage/lcov-report/sdk-installer/services/unzip.ts.html +116 -0
  24. package/coverage/lcov-report/sdk-utils/index.html +126 -0
  25. package/coverage/lcov-report/sdk-utils/index.ts.html +86 -0
  26. package/coverage/lcov-report/sdk-utils/installSdk.ts.html +113 -0
  27. package/coverage/lcov-report/sdk-utils/registerSdkPath.ts.html +134 -0
  28. package/coverage/lcov-report/sdk-utils/sdk-installer/index.html +126 -0
  29. package/coverage/lcov-report/sdk-utils/sdk-installer/index.ts.html +83 -0
  30. package/coverage/lcov-report/sdk-utils/sdk-installer/sdkInstaller.ts.html +224 -0
  31. package/coverage/lcov-report/sdk-utils/sdk-installer/services/clean.ts.html +113 -0
  32. package/coverage/lcov-report/sdk-utils/sdk-installer/services/download.ts.html +260 -0
  33. package/coverage/lcov-report/sdk-utils/sdk-installer/services/index.html +171 -0
  34. package/coverage/lcov-report/sdk-utils/sdk-installer/services/index.ts.html +92 -0
  35. package/coverage/lcov-report/sdk-utils/sdk-installer/services/install.ts.html +161 -0
  36. package/coverage/lcov-report/sdk-utils/sdk-installer/services/unzip.ts.html +116 -0
  37. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  38. package/coverage/lcov-report/sorter.js +170 -0
  39. package/coverage/lcov-report/unzip.ts.html +116 -0
  40. package/coverage/lcov.info +371 -0
  41. package/dist/src/__tests__/sdks/sdk-utils/registerSdkPath.spec.js +60 -0
  42. package/dist/src/__tests__/sdks/sdk-utils/sdk-installer/sdkInstaller.spec.js +85 -0
  43. package/dist/src/__tests__/sdks/sdk-utils/sdk-installer/services/clean.spec.js +46 -0
  44. package/dist/src/__tests__/sdks/sdk-utils/sdk-installer/services/download.spec.js +121 -0
  45. package/dist/src/__tests__/sdks/sdk-utils/sdk-installer/services/install.spec.js +53 -0
  46. package/dist/src/__tests__/sdks/sdk-utils/sdk-installer/services/unzip.spec.js +47 -0
  47. package/dist/src/resolvers/resolveBaseUrl.js +1 -1
  48. package/dist/src/resolvers/resolveBuildFileName.js +2 -2
  49. package/dist/src/resolvers/resolveBuildVersion.js +2 -2
  50. package/dist/src/resolvers/resolveBuildVersionOffset.js +2 -2
  51. package/dist/src/resolvers/resolveDeployLocations.js +5 -5
  52. package/dist/src/resolvers/resolveGenericRnvConfig.js +2 -2
  53. package/dist/src/resolvers/resolveHbbtvDeployUrl.js +2 -2
  54. package/dist/src/resolvers/resolveUsedFlavours.js +1 -1
  55. package/dist/src/scripts/buildAllWithScheme.js +3 -3
  56. package/dist/src/scripts/generateDeployUrls/index.js +4 -4
  57. package/dist/src/scripts/generateDeployUrls/makeTableDataByScheme.js +3 -3
  58. package/dist/src/scripts/gitReleaser/afterVersionBump.js +6 -6
  59. package/dist/src/scripts/gitReleaser/beforeVersionBump.js +6 -6
  60. package/dist/src/scripts/gitReleaser/checkReleaseNotes.js +1 -1
  61. package/dist/src/scripts/gitReleaser/pushRelease.js +7 -7
  62. package/dist/src/scripts/gitReleaser/pushReleaseCandidate.js +1 -1
  63. package/dist/src/scripts/gitReleaser/pushReleaseNotes.js +7 -7
  64. package/dist/src/scripts/release/deleteSourceMaps.js +1 -1
  65. package/dist/src/scripts/release/deployToAppCenter.js +6 -6
  66. package/dist/src/scripts/release/githubRelease.js +16 -16
  67. package/dist/src/scripts/release/notifySlack/makePayload.js +1 -1
  68. package/dist/src/scripts/release/notifySlack/notifySlack.js +1 -1
  69. package/dist/src/scripts/release/sentryRelease.js +3 -3
  70. package/dist/src/scripts/release/urlsMarkdown.js +1 -1
  71. package/dist/src/scripts/releaseAllWithScheme.js +11 -11
  72. package/dist/src/scripts/utils/cmdUtils.js +1 -1
  73. package/dist/src/scripts/utils/fsUtils.js +1 -1
  74. package/dist/src/scripts/utils/gitUtils.js +17 -17
  75. package/dist/src/sdks/sdk-tizen/index.js +10 -10
  76. package/dist/src/sdks/sdk-utils/index.js +14 -0
  77. package/dist/src/sdks/sdk-utils/registerSdkPath.js +14 -0
  78. package/dist/src/sdks/sdk-utils/sdk-installer/index.js +5 -0
  79. package/dist/src/sdks/sdk-utils/sdk-installer/sdkInstaller.js +39 -0
  80. package/dist/src/sdks/sdk-utils/sdk-installer/services/clean.js +11 -0
  81. package/dist/src/sdks/sdk-utils/sdk-installer/services/download.js +74 -0
  82. package/dist/src/sdks/sdk-utils/sdk-installer/services/index.js +11 -0
  83. package/dist/src/sdks/sdk-utils/sdk-installer/services/install.js +23 -0
  84. package/dist/src/sdks/sdk-utils/sdk-installer/services/unzip.js +12 -0
  85. package/dist/src/sdks/sdk-webos/index.js +5 -5
  86. package/dist/src/tasks/deploy/aswS3/aws.js +2 -2
  87. package/dist/src/tasks/deploy/aswS3/deployS3.js +2 -2
  88. package/dist/src/tasks/deploy/hbbtv/deployHbbtv.js +7 -7
  89. package/dist/src/tasks/task.rnv.build.js +8 -8
  90. package/dist/src/tasks/task.rnv.configure.js +1 -1
  91. package/dist/src/tasks/task.rnv.configureSoft.js +2 -2
  92. package/dist/src/tasks/task.rnv.deploy.js +3 -3
  93. package/dist/src/tasks/task.rnv.hooks.run.js +1 -1
  94. package/dist/src/tasks/task.rnv.project.configure.js +2 -2
  95. package/dist/src/utils/forEachSupportedPlatformFlavour.js +1 -1
  96. package/dist/src/utils/replaceRelevantStringsInConfig/replaceRelevantStringsInConfig.js +1 -1
  97. package/dist/src/utils/replaceRelevantStringsInConfig/replaceTemplateString.js +1 -1
  98. package/dist/src/utils/zipBuildsByPlatforms.js +9 -9
  99. package/dist/templates/platforms/entone/webpack.config.dev.js +1 -1
  100. package/dist/templates/platforms/entone/webpack.config.prod.js +1 -1
  101. package/dist/templates/platforms/hbbtv/webpack.config.dev.js +1 -1
  102. package/dist/templates/platforms/hbbtv/webpack.config.prod.js +1 -1
  103. package/dist/templates/platforms/saphi/webpack.config.dev.js +1 -1
  104. package/dist/templates/platforms/saphi/webpack.config.prod.js +1 -1
  105. package/dist/templates/platforms/tizen/webpack.config.dev.js +1 -1
  106. package/dist/templates/platforms/tizen/webpack.config.prod.js +1 -1
  107. package/dist/templates/platforms/webos/webpack.config.dev.js +1 -1
  108. package/dist/templates/platforms/webos/webpack.config.prod.js +1 -1
  109. package/dist/templates/platforms/webtv/webpack.config.dev.js +1 -1
  110. package/dist/templates/platforms/webtv/webpack.config.prod.js +1 -1
  111. package/jest.config.js +6 -0
  112. package/package.json +22 -25
  113. package/dist/src/sdks/sdkUtils.js +0 -18
@@ -0,0 +1,371 @@
1
+ TN:
2
+ SF:src/sdks/sdk-utils/index.ts
3
+ FN:2,(anonymous_0)
4
+ FN:4,(anonymous_1)
5
+ FN:5,(anonymous_2)
6
+ FN:9,(anonymous_3)
7
+ FNF:4
8
+ FNH:3
9
+ FNDA:2,(anonymous_0)
10
+ FNDA:8,(anonymous_1)
11
+ FNDA:0,(anonymous_2)
12
+ FNDA:2,(anonymous_3)
13
+ DA:2,1
14
+ DA:3,2
15
+ DA:4,8
16
+ DA:6,0
17
+ DA:7,0
18
+ DA:9,1
19
+ DA:10,2
20
+ DA:12,1
21
+ DA:13,1
22
+ DA:14,1
23
+ LF:10
24
+ LH:8
25
+ BRDA:2,0,0,1
26
+ BRDA:2,0,1,1
27
+ BRDA:2,0,2,1
28
+ BRDA:2,1,0,1
29
+ BRDA:2,1,1,0
30
+ BRDA:3,2,0,2
31
+ BRDA:3,2,1,0
32
+ BRDA:6,3,0,0
33
+ BRDA:6,3,1,0
34
+ BRDA:9,4,0,1
35
+ BRDA:9,4,1,1
36
+ BRDA:9,4,2,1
37
+ BRDA:10,5,0,2
38
+ BRDA:10,5,1,0
39
+ BRDA:10,6,0,2
40
+ BRDA:10,6,1,2
41
+ BRF:16
42
+ BRH:11
43
+ end_of_record
44
+ TN:
45
+ SF:src/sdks/sdk-utils/registerSdkPath.ts
46
+ FN:5,(anonymous_0)
47
+ FNF:1
48
+ FNH:1
49
+ FNDA:8,(anonymous_0)
50
+ DA:2,1
51
+ DA:3,1
52
+ DA:4,1
53
+ DA:5,1
54
+ DA:6,8
55
+ DA:7,8
56
+ DA:8,8
57
+ DA:9,8
58
+ DA:10,4
59
+ DA:12,8
60
+ DA:14,1
61
+ LF:11
62
+ LH:11
63
+ BRDA:9,0,0,4
64
+ BRDA:9,0,1,4
65
+ BRF:2
66
+ BRH:2
67
+ end_of_record
68
+ TN:
69
+ SF:src/sdks/sdk-utils/sdk-installer/index.ts
70
+ FN:5,(anonymous_0)
71
+ FNF:1
72
+ FNH:1
73
+ FNDA:12,(anonymous_0)
74
+ DA:2,2
75
+ DA:3,2
76
+ DA:4,2
77
+ DA:5,12
78
+ LF:4
79
+ LH:4
80
+ BRF:0
81
+ BRH:0
82
+ end_of_record
83
+ TN:
84
+ SF:src/sdks/sdk-utils/sdk-installer/sdkInstaller.ts
85
+ FN:7,(anonymous_0)
86
+ FN:8,(anonymous_1)
87
+ FN:9,(anonymous_2)
88
+ FNF:3
89
+ FNH:3
90
+ FNDA:41,(anonymous_0)
91
+ FNDA:5,(anonymous_1)
92
+ FNDA:12,(anonymous_2)
93
+ DA:2,2
94
+ DA:3,2
95
+ DA:4,2
96
+ DA:5,2
97
+ DA:6,2
98
+ DA:7,41
99
+ DA:8,5
100
+ DA:9,2
101
+ DA:10,12
102
+ DA:11,12
103
+ DA:13,12
104
+ DA:14,12
105
+ DA:15,12
106
+ DA:16,12
107
+ DA:18,1
108
+ DA:20,11
109
+ DA:21,11
110
+ DA:22,11
111
+ DA:23,11
112
+ DA:24,10
113
+ DA:25,10
114
+ DA:26,10
115
+ DA:27,10
116
+ DA:28,9
117
+ DA:29,9
118
+ DA:32,4
119
+ DA:33,4
120
+ DA:35,8
121
+ DA:36,8
122
+ DA:37,8
123
+ DA:38,8
124
+ DA:40,2
125
+ LF:32
126
+ LH:32
127
+ BRDA:9,0,0,10
128
+ BRDA:10,1,0,1
129
+ BRDA:10,1,1,11
130
+ BRDA:16,2,0,1
131
+ BRDA:16,2,1,11
132
+ BRF:5
133
+ BRH:5
134
+ end_of_record
135
+ TN:
136
+ SF:src/sdks/sdk-utils/sdk-installer/services/clean.ts
137
+ FN:5,(anonymous_0)
138
+ FN:8,(anonymous_1)
139
+ FNF:2
140
+ FNH:2
141
+ FNDA:4,(anonymous_0)
142
+ FNDA:1,(anonymous_1)
143
+ DA:2,6
144
+ DA:3,6
145
+ DA:4,6
146
+ DA:5,6
147
+ DA:6,4
148
+ DA:8,6
149
+ DA:9,1
150
+ DA:11,6
151
+ LF:8
152
+ LH:8
153
+ BRF:0
154
+ BRH:0
155
+ end_of_record
156
+ TN:
157
+ SF:src/sdks/sdk-utils/sdk-installer/services/download.ts
158
+ FN:2,(anonymous_0)
159
+ FN:4,(anonymous_1)
160
+ FN:5,(anonymous_2)
161
+ FN:9,(anonymous_3)
162
+ FN:11,(anonymous_4)
163
+ FN:14,(anonymous_5)
164
+ FN:28,(anonymous_6)
165
+ FN:33,(anonymous_7)
166
+ FN:41,(anonymous_8)
167
+ FN:56,(anonymous_9)
168
+ FN:59,(anonymous_10)
169
+ FN:60,(anonymous_11)
170
+ FNF:12
171
+ FNH:10
172
+ FNDA:883,(anonymous_0)
173
+ FNDA:48,(anonymous_1)
174
+ FNDA:0,(anonymous_2)
175
+ FNDA:30,(anonymous_3)
176
+ FNDA:0,(anonymous_4)
177
+ FNDA:30,(anonymous_5)
178
+ FNDA:9,(anonymous_6)
179
+ FNDA:9,(anonymous_7)
180
+ FNDA:8,(anonymous_8)
181
+ FNDA:9,(anonymous_9)
182
+ FNDA:9,(anonymous_10)
183
+ FNDA:8,(anonymous_11)
184
+ DA:2,6
185
+ DA:3,883
186
+ DA:4,883
187
+ DA:6,0
188
+ DA:7,0
189
+ DA:9,6
190
+ DA:10,30
191
+ DA:12,0
192
+ DA:14,6
193
+ DA:15,30
194
+ DA:16,30
195
+ DA:17,883
196
+ DA:18,30
197
+ DA:19,30
198
+ DA:21,6
199
+ DA:22,6
200
+ DA:23,6
201
+ DA:24,6
202
+ DA:25,6
203
+ DA:26,6
204
+ DA:27,6
205
+ DA:28,6
206
+ DA:29,9
207
+ DA:30,8
208
+ DA:33,6
209
+ DA:34,9
210
+ DA:35,9
211
+ DA:36,7
212
+ DA:37,1
213
+ DA:38,1
214
+ DA:41,6
215
+ DA:42,8
216
+ DA:43,8
217
+ DA:44,8
218
+ DA:45,8
219
+ DA:46,1
220
+ DA:48,7
221
+ DA:49,1
222
+ DA:51,6
223
+ DA:52,1
224
+ DA:54,5
225
+ DA:56,6
226
+ DA:57,9
227
+ DA:58,9
228
+ DA:59,9
229
+ DA:60,9
230
+ DA:61,8
231
+ DA:62,8
232
+ DA:63,3
233
+ DA:64,3
234
+ DA:66,5
235
+ DA:67,5
236
+ DA:68,5
237
+ DA:69,5
238
+ DA:71,8
239
+ DA:74,6
240
+ LF:56
241
+ LH:53
242
+ BRDA:2,0,0,6
243
+ BRDA:2,0,1,6
244
+ BRDA:2,0,2,6
245
+ BRDA:2,1,0,6
246
+ BRDA:2,1,1,0
247
+ BRDA:3,2,0,883
248
+ BRDA:3,2,1,0
249
+ BRDA:6,3,0,0
250
+ BRDA:6,3,1,0
251
+ BRDA:9,4,0,6
252
+ BRDA:9,4,1,6
253
+ BRDA:9,4,2,6
254
+ BRDA:9,5,0,6
255
+ BRDA:9,5,1,0
256
+ BRDA:14,6,0,6
257
+ BRDA:14,6,1,6
258
+ BRDA:14,6,2,6
259
+ BRDA:15,7,0,0
260
+ BRDA:15,7,1,30
261
+ BRDA:15,8,0,30
262
+ BRDA:15,8,1,30
263
+ BRDA:17,9,0,30
264
+ BRDA:17,9,1,0
265
+ BRDA:17,10,0,883
266
+ BRDA:17,10,1,0
267
+ BRDA:17,11,0,883
268
+ BRDA:17,11,1,883
269
+ BRDA:29,12,0,8
270
+ BRDA:29,12,1,1
271
+ BRDA:35,13,0,7
272
+ BRDA:35,13,1,1
273
+ BRDA:35,13,2,1
274
+ BRDA:45,14,0,1
275
+ BRDA:45,14,1,7
276
+ BRDA:48,15,0,1
277
+ BRDA:48,15,1,6
278
+ BRDA:51,16,0,1
279
+ BRDA:51,16,1,5
280
+ BRDA:62,17,0,3
281
+ BRDA:62,17,1,5
282
+ BRF:40
283
+ BRH:32
284
+ end_of_record
285
+ TN:
286
+ SF:src/sdks/sdk-utils/sdk-installer/services/index.ts
287
+ FN:5,(anonymous_0)
288
+ FN:7,(anonymous_1)
289
+ FN:9,(anonymous_2)
290
+ FN:11,(anonymous_3)
291
+ FNF:4
292
+ FNH:4
293
+ FNDA:22,(anonymous_0)
294
+ FNDA:14,(anonymous_1)
295
+ FNDA:15,(anonymous_2)
296
+ FNDA:17,(anonymous_3)
297
+ DA:2,6
298
+ DA:3,6
299
+ DA:4,6
300
+ DA:5,22
301
+ DA:6,6
302
+ DA:7,14
303
+ DA:8,6
304
+ DA:9,15
305
+ DA:10,6
306
+ DA:11,17
307
+ LF:10
308
+ LH:10
309
+ BRF:0
310
+ BRH:0
311
+ end_of_record
312
+ TN:
313
+ SF:src/sdks/sdk-utils/sdk-installer/services/install.ts
314
+ FN:5,(anonymous_0)
315
+ FN:9,(anonymous_1)
316
+ FN:10,(anonymous_2)
317
+ FN:13,(anonymous_3)
318
+ FNF:4
319
+ FNH:4
320
+ FNDA:3,(anonymous_0)
321
+ FNDA:3,(anonymous_1)
322
+ FNDA:3,(anonymous_2)
323
+ FNDA:3,(anonymous_3)
324
+ DA:2,6
325
+ DA:3,6
326
+ DA:4,6
327
+ DA:5,6
328
+ DA:6,3
329
+ DA:7,3
330
+ DA:9,3
331
+ DA:10,3
332
+ DA:11,3
333
+ DA:13,6
334
+ DA:14,3
335
+ DA:15,3
336
+ DA:16,3
337
+ DA:19,3
338
+ DA:20,3
339
+ DA:21,3
340
+ DA:23,6
341
+ LF:17
342
+ LH:17
343
+ BRDA:11,0,0,3
344
+ BRDA:11,0,1,2
345
+ BRDA:16,1,0,1
346
+ BRDA:16,1,1,2
347
+ BRF:4
348
+ BRH:4
349
+ end_of_record
350
+ TN:
351
+ SF:src/sdks/sdk-utils/sdk-installer/services/unzip.ts
352
+ FN:5,(anonymous_0)
353
+ FNF:1
354
+ FNH:1
355
+ FNDA:2,(anonymous_0)
356
+ DA:2,6
357
+ DA:3,6
358
+ DA:4,6
359
+ DA:5,6
360
+ DA:6,2
361
+ DA:7,2
362
+ DA:8,2
363
+ DA:9,1
364
+ DA:12,6
365
+ LF:9
366
+ LH:9
367
+ BRDA:8,0,0,1
368
+ BRDA:8,0,1,1
369
+ BRF:2
370
+ BRH:2
371
+ end_of_record
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const fs_1 = __importDefault(require("fs"));
7
+ const sdk_utils_1 = require("../../../sdks/sdk-utils");
8
+ const rnvC = {
9
+ paths: {
10
+ workspace: {
11
+ config: `${process.cwd()}/renative_test.json`,
12
+ },
13
+ },
14
+ buildConfig: {},
15
+ };
16
+ const getWorkspaceConfigPath = () => rnvC.paths.workspace.config;
17
+ describe('SDK Utils - registerSdkPath', () => {
18
+ afterEach(() => {
19
+ fs_1.default.rmSync(getWorkspaceConfigPath(), { force: true });
20
+ rnvC.buildConfig.sdks = undefined;
21
+ });
22
+ it('adds requested sdk entry into the file', async () => {
23
+ expect(fs_1.default.existsSync(getWorkspaceConfigPath())).toBe(false);
24
+ await sdk_utils_1.registerSdkPath(rnvC, 'SDK_KEY_0', 'SDK_VALUE_0');
25
+ await sdk_utils_1.registerSdkPath(rnvC, 'SDK_KEY_1', 'SDK_VALUE_1');
26
+ expect(fs_1.default.existsSync(getWorkspaceConfigPath())).toBe(true);
27
+ const fileContent = fs_1.default.readFileSync(getWorkspaceConfigPath()).toString();
28
+ expect(JSON.parse(fileContent).sdks).toStrictEqual({
29
+ SDK_KEY_0: 'SDK_VALUE_0',
30
+ SDK_KEY_1: 'SDK_VALUE_1',
31
+ });
32
+ });
33
+ it('adds requested sdk entry into the rnv C object', async () => {
34
+ expect(rnvC.buildConfig.sdks).toBeUndefined();
35
+ await sdk_utils_1.registerSdkPath(rnvC, 'SDK_KEY_0', 'SDK_VALUE_0');
36
+ await sdk_utils_1.registerSdkPath(rnvC, 'SDK_KEY_1', 'SDK_VALUE_1');
37
+ expect(rnvC.buildConfig.sdks).toStrictEqual({
38
+ SDK_KEY_0: 'SDK_VALUE_0',
39
+ SDK_KEY_1: 'SDK_VALUE_1',
40
+ });
41
+ });
42
+ it('overwrites entry in the file', async () => {
43
+ expect(fs_1.default.existsSync(getWorkspaceConfigPath())).toBe(false);
44
+ await sdk_utils_1.registerSdkPath(rnvC, 'SDK_KEY_0', 'SDK_VALUE_0');
45
+ await sdk_utils_1.registerSdkPath(rnvC, 'SDK_KEY_0', 'SDK_VALUE_0_OVERWRITTEN');
46
+ expect(fs_1.default.existsSync(getWorkspaceConfigPath())).toBe(true);
47
+ const fileContent = fs_1.default.readFileSync(getWorkspaceConfigPath()).toString();
48
+ expect(JSON.parse(fileContent).sdks).toStrictEqual({
49
+ SDK_KEY_0: 'SDK_VALUE_0_OVERWRITTEN',
50
+ });
51
+ });
52
+ it('overwrites sdk entry in rnv C object', async () => {
53
+ expect(rnvC.buildConfig.sdks).toBeUndefined();
54
+ await sdk_utils_1.registerSdkPath(rnvC, 'SDK_KEY_0', 'SDK_VALUE_0');
55
+ await sdk_utils_1.registerSdkPath(rnvC, 'SDK_KEY_0', 'SDK_VALUE_0_OVERWRITTEN');
56
+ expect(rnvC.buildConfig.sdks).toStrictEqual({
57
+ SDK_KEY_0: 'SDK_VALUE_0_OVERWRITTEN',
58
+ });
59
+ });
60
+ });
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sdk_installer_1 = require("../../../../sdks/sdk-utils/sdk-installer");
4
+ const services_1 = require("../../../../sdks/sdk-utils/sdk-installer/services");
5
+ jest.mock('../../../../sdks/sdk-utils/sdk-installer/services/download');
6
+ jest.mock('../../../../sdks/sdk-utils/sdk-installer/services/unzip');
7
+ jest.mock('../../../../sdks/sdk-utils/sdk-installer/services/install');
8
+ jest.mock('../../../../sdks/sdk-utils/sdk-installer/services/clean');
9
+ describe('SDK Installer', () => {
10
+ const URL_TO_DOWNLOAD_FILE_FROM = 'https://s3.amazonaws.com/file.zip';
11
+ const runSdkInstallerWithDefinedZipPath = async () => {
12
+ await sdk_installer_1.sdkInstaller(URL_TO_DOWNLOAD_FILE_FROM);
13
+ };
14
+ afterEach(() => {
15
+ jest.clearAllMocks();
16
+ });
17
+ describe('throwing the errors', () => {
18
+ it('throws an error when zipPath is not a URL', async () => {
19
+ await expect(async () => {
20
+ await sdk_installer_1.sdkInstaller('/local/path.zip');
21
+ }).rejects.toBeInstanceOf(Error);
22
+ });
23
+ });
24
+ describe('printing log messages', () => {
25
+ it('prints log messages by default', async () => {
26
+ const writeSpy = jest.spyOn(process.stdout, 'write');
27
+ await runSdkInstallerWithDefinedZipPath();
28
+ expect(writeSpy).toHaveBeenCalled();
29
+ });
30
+ it('shows log messages when enabled', async () => {
31
+ const writeSpy = jest.spyOn(process.stdout, 'write');
32
+ writeSpy.mockImplementation(() => true);
33
+ await sdk_installer_1.sdkInstaller(URL_TO_DOWNLOAD_FILE_FROM, '', false);
34
+ expect(writeSpy).toHaveBeenCalled();
35
+ });
36
+ it('does not print log messages when it is not enabled', async () => {
37
+ const writeSpy = jest.spyOn(process.stdout, 'write');
38
+ await sdk_installer_1.sdkInstaller(URL_TO_DOWNLOAD_FILE_FROM, '', true);
39
+ expect(writeSpy).not.toHaveBeenCalled();
40
+ });
41
+ });
42
+ describe('passing values to services when correct URL to ZIP file is provided', () => {
43
+ it('calls downloader with requested url to download file from', async () => {
44
+ await runSdkInstallerWithDefinedZipPath();
45
+ const filePathToSave = `${process.cwd()}/file.zip`;
46
+ expect(services_1.download).toHaveBeenCalledWith(URL_TO_DOWNLOAD_FILE_FROM, filePathToSave);
47
+ });
48
+ it('calls unzipper with requested file path to unzip', async () => {
49
+ await runSdkInstallerWithDefinedZipPath();
50
+ expect(services_1.unzip).toHaveBeenCalledWith(`${process.cwd()}/file.zip`);
51
+ });
52
+ it('calls installer with path to unzipped directory only', async () => {
53
+ await runSdkInstallerWithDefinedZipPath();
54
+ expect(services_1.install).toHaveBeenCalledWith(`${process.cwd()}/file`, undefined);
55
+ });
56
+ it('calls installer with path to unzipped directory and path to install to', async () => {
57
+ await sdk_installer_1.sdkInstaller(URL_TO_DOWNLOAD_FILE_FROM, '/install/path');
58
+ expect(services_1.install).toHaveBeenCalledWith(`${process.cwd()}/file`, '/install/path');
59
+ });
60
+ it('calls cleaner with array including downloaded zip and unzipped dir paths', async () => {
61
+ await runSdkInstallerWithDefinedZipPath();
62
+ expect(services_1.clean).toHaveBeenCalledWith([
63
+ `${process.cwd()}/file.zip`,
64
+ `${process.cwd()}/file`,
65
+ ]);
66
+ });
67
+ });
68
+ describe('cleaning when error occurs', () => {
69
+ it('calls cleaner when downloader throws an error', async () => {
70
+ services_1.download.mockImplementationOnce(async () => { throw new Error(); });
71
+ await expect(runSdkInstallerWithDefinedZipPath).rejects.toBeInstanceOf(Error);
72
+ expect(services_1.clean).toBeCalledTimes(1);
73
+ });
74
+ it('calls cleaner when unzipper throws an error', async () => {
75
+ services_1.unzip.mockImplementationOnce(() => { throw new Error(); });
76
+ await expect(runSdkInstallerWithDefinedZipPath).rejects.toBeInstanceOf(Error);
77
+ expect(services_1.clean).toBeCalledTimes(1);
78
+ });
79
+ it('calls cleaner when installer throws an error', async () => {
80
+ services_1.install.mockImplementationOnce(() => { throw new Error(); });
81
+ await expect(runSdkInstallerWithDefinedZipPath).rejects.toBeInstanceOf(Error);
82
+ expect(services_1.clean).toBeCalledTimes(1);
83
+ });
84
+ });
85
+ });
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ const childProcess = __importStar(require("child_process"));
23
+ const services_1 = require("../../../../../sdks/sdk-utils/sdk-installer/services");
24
+ jest.mock('child_process');
25
+ describe('SDK Installer - Cleaner', () => {
26
+ afterEach(() => {
27
+ jest.clearAllMocks();
28
+ });
29
+ it('removes all dirs and files listed as paths in array', () => {
30
+ childProcess.spawnSync.mockImplementationOnce(() => { });
31
+ const spawnSyncSpy = jest.spyOn(childProcess, 'spawnSync');
32
+ const pathsToClean = [
33
+ '/path/to/dir1',
34
+ '/path/to/dir2',
35
+ '/path/to/file1.zip',
36
+ '/path/to/file2.js',
37
+ ];
38
+ services_1.clean(pathsToClean);
39
+ expect(spawnSyncSpy).toHaveBeenCalledTimes(pathsToClean.length);
40
+ const [call0, call1, call2, call3] = spawnSyncSpy.mock.calls;
41
+ expect(call0).toEqual(['rm', ['-r', '/path/to/dir1']]);
42
+ expect(call1).toEqual(['rm', ['-r', '/path/to/dir2']]);
43
+ expect(call2).toEqual(['rm', ['-r', '/path/to/file1.zip']]);
44
+ expect(call3).toEqual(['rm', ['-r', '/path/to/file2.js']]);
45
+ });
46
+ });
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ const stream_1 = __importDefault(require("stream"));
26
+ const nock = __importStar(require("nock"));
27
+ const http_1 = __importDefault(require("http"));
28
+ const https_1 = __importDefault(require("https"));
29
+ const fs_1 = __importDefault(require("fs"));
30
+ const services_1 = require("../../../../../sdks/sdk-utils/sdk-installer/services");
31
+ jest.mock('fs');
32
+ fs_1.default.createWriteStream.mockImplementation(() => new stream_1.default.PassThrough());
33
+ describe('SDK Installer - Downloader', () => {
34
+ const HTTP_RESPONSE_STATUS_CODE_OK = 200;
35
+ const HTTP_RESPONSE_STATUS_CODE_NOT_FOUND = 404;
36
+ const httpBasePath = 'http://s3.amazonaws.com';
37
+ const zipRelativeFilePath = '/file.zip';
38
+ const zipFileHttpUrl = `${httpBasePath}${zipRelativeFilePath}`;
39
+ const headersWithZipContentType = { 'Content-Type': 'application/zip' };
40
+ const saveFilePath = `${process.cwd()}/test.zip`;
41
+ const makeValidHttpNock = () => nock.default(httpBasePath)
42
+ .get(zipRelativeFilePath)
43
+ .reply(HTTP_RESPONSE_STATUS_CODE_OK, '', headersWithZipContentType);
44
+ nock.disableNetConnect();
45
+ afterEach(() => {
46
+ jest.clearAllMocks();
47
+ });
48
+ afterAll(() => {
49
+ nock.cleanAll();
50
+ nock.enableNetConnect();
51
+ });
52
+ describe('Supported protocols', () => {
53
+ it('calls http.get for URL with HTTP protocol', async () => {
54
+ makeValidHttpNock();
55
+ const getSpy = jest.spyOn(http_1.default, 'get');
56
+ await services_1.download(zipFileHttpUrl, saveFilePath);
57
+ expect(getSpy).toBeCalledTimes(1);
58
+ });
59
+ it('calls https.get for URL with HTTPS protocol', async () => {
60
+ nock.default(httpBasePath.replace('http:', 'https:'))
61
+ .get(zipRelativeFilePath)
62
+ .reply(HTTP_RESPONSE_STATUS_CODE_OK, '', headersWithZipContentType);
63
+ const getSpy = jest.spyOn(https_1.default, 'get');
64
+ await services_1.download(zipFileHttpUrl.replace('http:', 'https:'), saveFilePath);
65
+ expect(getSpy).toBeCalledTimes(1);
66
+ });
67
+ it('throws an error when URL has unsupported protocol', async () => {
68
+ await expect(async () => {
69
+ await services_1.download('ftp://file.zip', saveFilePath);
70
+ }).rejects.toThrow(new Error('ftp: protocol is not supported'));
71
+ });
72
+ });
73
+ describe('Handling response errors', () => {
74
+ it('throws an error when returned content type is not application/zip', async () => {
75
+ nock.default(httpBasePath)
76
+ .get('/file.json')
77
+ .reply(HTTP_RESPONSE_STATUS_CODE_OK, '', { 'Content-Type': 'application/json' });
78
+ await expect(async () => {
79
+ await services_1.download(`${httpBasePath}/file.json`, saveFilePath);
80
+ }).rejects.toThrow(new Error('Wrong Content-Type: expected application/zip, received application/json'));
81
+ nock.default(httpBasePath)
82
+ .get(zipRelativeFilePath)
83
+ .reply(HTTP_RESPONSE_STATUS_CODE_OK, '');
84
+ await expect(async () => {
85
+ await services_1.download(zipFileHttpUrl, saveFilePath);
86
+ }).rejects.toThrow(new Error('Missing Content-Type: expected application/zip'));
87
+ });
88
+ it('throws an error when request status is not 200', async () => {
89
+ nock.default(httpBasePath)
90
+ .get(zipRelativeFilePath)
91
+ .reply(HTTP_RESPONSE_STATUS_CODE_NOT_FOUND, '', headersWithZipContentType);
92
+ await expect(async () => {
93
+ await services_1.download(zipFileHttpUrl, saveFilePath);
94
+ }).rejects.toThrow(new Error('Request Failed. Status Code: 404'));
95
+ });
96
+ });
97
+ describe('Writing received data into a file', () => {
98
+ beforeEach(() => {
99
+ makeValidHttpNock();
100
+ });
101
+ it('Creates dest path if does not exist', async () => {
102
+ const mkDirSync = jest.spyOn(fs_1.default, 'mkdirSync');
103
+ fs_1.default.existsSync.mockImplementationOnce(() => false);
104
+ await services_1.download(zipFileHttpUrl, saveFilePath);
105
+ expect(mkDirSync).toBeCalledTimes(1);
106
+ expect(mkDirSync).toHaveBeenCalledWith(process.cwd(), { recursive: true });
107
+ });
108
+ it('Does not create dest path if path exists', async () => {
109
+ const mkDirSync = jest.spyOn(fs_1.default, 'mkdirSync');
110
+ fs_1.default.existsSync.mockImplementationOnce(() => true);
111
+ await services_1.download(zipFileHttpUrl, saveFilePath);
112
+ expect(mkDirSync).toBeCalledTimes(0);
113
+ });
114
+ it('Calls write fn with dest param', async () => {
115
+ const createWriteStream = jest.spyOn(fs_1.default, 'createWriteStream');
116
+ await services_1.download(zipFileHttpUrl, saveFilePath);
117
+ expect(createWriteStream).toBeCalledTimes(1);
118
+ expect(createWriteStream).toHaveBeenCalledWith(saveFilePath);
119
+ });
120
+ });
121
+ });