@24i/smartapps-bigscreen-rnv-build-engine 0.17.17 → 0.17.19

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.
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const child_process_1 = require("child_process");
4
+ const resolvers_1 = require("../resolvers");
5
+ const constants_1 = require("../constants");
6
+ const purgeCloudfrontCache = () => {
7
+ const alternateDomainName = process.argv[2];
8
+ const scheme = process.argv[3];
9
+ if (!scheme) {
10
+ throw new Error('No scheme name to use found! Please use rnv scheme name as a param.');
11
+ }
12
+ console.log(`Alternative domain name is ${alternateDomainName}`);
13
+ const paths = getPathsToPurge(scheme);
14
+ const distributionId = (0, child_process_1.execSync)(`aws cloudfront list-distributions --query "DistributionList.Items[?Aliases.Items[0] == '${alternateDomainName}'].{Id:Id}" --output text`).toString().trim();
15
+ if (!distributionId) {
16
+ throw new Error('Distribution ID is empty. No matching distribution found for the given alternate domain name.');
17
+ }
18
+ console.log(`CloudFront Distribution ID: ${distributionId}`);
19
+ console.log(`Paths that will be purged: ${paths}`);
20
+ const result = (0, child_process_1.execSync)(`aws cloudfront create-invalidation --distribution-id "${distributionId}" --paths ${paths}`).toString();
21
+ console.log(result);
22
+ };
23
+ const getPathsToPurge = (scheme) => {
24
+ const supportedSet = getSupportedSet(scheme);
25
+ const env = (0, resolvers_1.resolveBuildEnvName)(scheme);
26
+ const paths = [];
27
+ if (scheme === constants_1.BuildSchemes.RC_PROD_LATEST) {
28
+ const limitedSet = getLimitedSetForRC(supportedSet);
29
+ limitedSet.forEach(({ platform, flavour }) => {
30
+ paths.push(`"/builds/${platform}/${flavour}/latest/rc/${env}*"`);
31
+ });
32
+ }
33
+ else {
34
+ throw new Error(`Not supported for scheme: ${scheme}`);
35
+ }
36
+ return paths.join(' ');
37
+ };
38
+ const getLimitedSetForRC = (supportedSet) => {
39
+ const limitedSet = [];
40
+ supportedSet.forEach((item) => {
41
+ if (item.flavour === 'animated_1080') {
42
+ limitedSet.push(item);
43
+ }
44
+ else if (item.flavour === 'animated_720') {
45
+ const platformSet = supportedSet.filter(({ platform }) => item.platform === platform);
46
+ const hasAnimated1080 = platformSet.find(({ flavour }) => flavour === 'animated_1080');
47
+ if (!hasAnimated1080) {
48
+ limitedSet.push(item);
49
+ }
50
+ }
51
+ });
52
+ return limitedSet;
53
+ };
54
+ const getSupportedSet = (scheme) => {
55
+ const supportedSet = [];
56
+ const c = (0, resolvers_1.getBaseConfig)();
57
+ const supportedPlatforms = (0, resolvers_1.resolveSupportedPlatforms)(c);
58
+ supportedPlatforms.forEach((platform) => {
59
+ c.runtime.scheme = scheme;
60
+ const supportedFlavours = (0, resolvers_1.resolveSupportedFlavoursForPlatform)(c, platform);
61
+ supportedFlavours.forEach((flavour) => {
62
+ supportedSet.push({ scheme, platform, flavour });
63
+ });
64
+ });
65
+ return supportedSet;
66
+ };
67
+ const startTimestamp = Date.now();
68
+ purgeCloudfrontCache();
69
+ const msPerSecond = 1000;
70
+ const scriptTotalTimeInSeconds = Math.ceil((Date.now() - startTimestamp) / msPerSecond);
71
+ console.log(`purgeCloudfrontCache: done in ${scriptTotalTimeInSeconds} second(s)!`);
@@ -14,4 +14,5 @@
14
14
  <tizen:privilege name="http://tizen.org/privilege/internet"/>
15
15
  <tizen:privilege name="http://tizen.org/privilege/tv.inputdevice"/>
16
16
  <tizen:setting screen-orientation="landscape" context-menu="enable" background-support="disable" encryption="disable" install-location="auto" hwkey-event="enable"/>
17
+ <tizen:metadata key="http://samsung.com/tv/metadata/use.voiceguide" value="false"/>
17
18
  </widget>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@24i/smartapps-bigscreen-rnv-build-engine",
3
- "version": "0.17.17",
3
+ "version": "0.17.19",
4
4
  "description": "Package with build engine for SmartApps BIGscreen projects...",
5
5
  "main": "dist/src/index.js",
6
6
  "scripts": {