@24i/smartapps-bigscreen-rnv-build-engine 0.17.5 → 0.17.6-alpha.10

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 (48) hide show
  1. package/README.md +25 -18
  2. package/dist/src/__tests__/resolvers/resolveBuildEnvType.spec.js +23 -0
  3. package/dist/src/constants/buildEnvironments.js +9 -0
  4. package/dist/src/constants/buildProductionPackages.js +9 -0
  5. package/dist/src/constants/delopyLivePlatforms.js +13 -0
  6. package/dist/src/constants/index.js +3 -1
  7. package/dist/src/resolvers/index.js +6 -1
  8. package/dist/src/resolvers/resolveBaseUrl.js +11 -1
  9. package/dist/src/resolvers/resolveBuildEnvName.js +7 -14
  10. package/dist/src/resolvers/resolveBuildEnvType.js +23 -0
  11. package/dist/src/resolvers/resolveDeployLocations.js +3 -6
  12. package/dist/src/resolvers/resolveGenericRnvConfig.js +9 -2
  13. package/dist/src/resolvers/resolveProductionZipFileRelativePath.js +36 -0
  14. package/dist/src/resolvers/resolveSupportedFlavoursForPlatform.js +8 -0
  15. package/dist/src/resolvers/resolveZippedPlatformBuildsRelativeFilePath.js +25 -1
  16. package/dist/src/scripts/buildAllWithSchemes.js +88 -0
  17. package/dist/src/scripts/buildProductionPackagesAll.js +75 -0
  18. package/dist/src/scripts/deployLiveAll.js +27 -0
  19. package/dist/src/scripts/deployLivePlatform.js +44 -0
  20. package/dist/src/scripts/generateDeployUrls/makeTableDataByScheme.js +1 -1
  21. package/dist/src/scripts/release/appCenter/appCenter.js +17 -0
  22. package/dist/src/scripts/release/appCenter/deployProductionPackagesToAppCenter.js +117 -0
  23. package/dist/src/scripts/release/{deployToAppCenter.js → appCenter/deployToAppCenter.js} +6 -17
  24. package/dist/src/scripts/release/notifySlack/notifySlack.js +11 -8
  25. package/dist/src/scripts/release/sentryRelease.js +11 -5
  26. package/dist/src/scripts/releaseAllWithScheme.js +4 -4
  27. package/dist/src/scripts/releaseAllWithSchemes.js +158 -0
  28. package/dist/src/scripts/releaseProductionPackagesAll.js +13 -0
  29. package/dist/src/sdks/sdk-androidtv/sdkAndroidtv.js +16 -6
  30. package/dist/src/sdks/sdk-tizen/sdkTizen.js +3 -0
  31. package/dist/src/sdks/sdk-webos/sdkWebos.js +3 -0
  32. package/dist/src/sdks/sdk-webpack/sdkWebpack.js +23 -3
  33. package/dist/src/tasks/deploy/aswS3/aws.js +21 -3
  34. package/dist/src/tasks/deploy/aswS3/deployS3.js +8 -2
  35. package/dist/src/tasks/deploy/aswS3/distToLiveS3.js +76 -0
  36. package/dist/src/tasks/deploy/hbbtv/deployHbbtv.js +7 -1
  37. package/dist/src/tasks/task.rnv.build.js +10 -1
  38. package/dist/src/tasks/task.rnv.deploy.js +10 -1
  39. package/dist/src/utils/copyEnvironmentFolder.js +65 -0
  40. package/dist/src/utils/forEachSupportedPlatformFlavour.js +29 -7
  41. package/dist/src/utils/getSafeSchemeString.js +7 -0
  42. package/dist/src/utils/zipBuildsByPlatforms.js +8 -5
  43. package/dist/src/utils/zipStagingProdBuildsByPlatforms.js +114 -0
  44. package/dist/templates/platforms/_shared/webpack.base.js +2 -2
  45. package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/bridge/BridgeFromJavaScript.kt +44 -0
  46. package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/model/MediaEventType.kt +3 -1
  47. package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/viewmodel/WebViewModel.kt +11 -0
  48. package/package.json +3 -1
@@ -18,7 +18,7 @@ const makePlatformRowData = (rnvC, deployLocations, tableFlavours, platform) =>
18
18
  const versionRegex = /\d{1,4}\.\d{1,4}\.\d{1,4}/g;
19
19
  const versionPlaceholder = '<VERSION>';
20
20
  packageUrl = packageUrl.replace(versionRegex, versionPlaceholder);
21
- indexUrl = packageUrl.replace(versionRegex, versionPlaceholder);
21
+ indexUrl = indexUrl.replace(versionRegex, versionPlaceholder);
22
22
  }
23
23
  const tableCellContent = `[package](${packageUrl}) / [index.html](${indexUrl})`;
24
24
  data.push(tableCellContent);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.appCenterRelease = void 0;
4
+ const child_process_1 = require("child_process");
5
+ const appCenterRelease = (params) => {
6
+ const { filePath, releaseNotesPath, buildVersion, token, projectName } = params;
7
+ const app = `24i-Media/${projectName}`;
8
+ (0, child_process_1.execSync)('appcenter distribute release '
9
+ + `--file "${filePath}" `
10
+ + `--release-notes-file "${releaseNotesPath}" `
11
+ + `--build-version "${buildVersion}" `
12
+ + `--app "${app}" `
13
+ + `--token "${token}" `
14
+ + '--group "Collaborators" '
15
+ + '--disable-telemetry', { stdio: 'inherit' });
16
+ };
17
+ exports.appCenterRelease = appCenterRelease;
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.deployProductionPackagesToAppCenter = void 0;
27
+ const child_process_1 = require("child_process");
28
+ const fs = __importStar(require("fs"));
29
+ const constants_1 = require("../../../constants");
30
+ const buildProductionPackages_1 = require("../../../constants/buildProductionPackages");
31
+ const resolvers_1 = require("../../../resolvers");
32
+ const appCenter_1 = require("./appCenter");
33
+ const newLine = '\r\n';
34
+ const getAppCenterConfig = (c) => {
35
+ try {
36
+ return c.buildConfig.common.deploy?.productionPackages?.appCenter || null;
37
+ }
38
+ catch (error) {
39
+ return null;
40
+ }
41
+ };
42
+ const getPlatformPackagesList = (c) => {
43
+ const scheme = constants_1.BuildSchemes.RELEASE_PROD_DIST;
44
+ const packagesList = [];
45
+ const platforms = (0, resolvers_1.resolveSupportedPlatforms)(c)
46
+ .filter((platform) => buildProductionPackages_1.SUPPORTED_PACKAGE_PLATFORMS.includes(platform));
47
+ platforms.forEach((platform) => {
48
+ const supportedFlavours = (0, resolvers_1.resolveSupportedFlavoursForPlatform)(c, platform);
49
+ const platformObj = {
50
+ platformName: platform,
51
+ packages: supportedFlavours.map((appConfigID) => {
52
+ const c = (0, resolvers_1.getBaseConfig)({
53
+ platform, scheme, appConfigID, productionPackagesHostedUrl: true
54
+ });
55
+ return {
56
+ name: (0, resolvers_1.resolveBuildFileName)(c),
57
+ flavour: appConfigID,
58
+ hostedUrl: `${(0, resolvers_1.resolveProductionPackagesBaseUrl)(c)}/public`,
59
+ };
60
+ })
61
+ };
62
+ packagesList.push(platformObj);
63
+ });
64
+ return packagesList;
65
+ };
66
+ const getAppCenterToken = () => {
67
+ return process.env['APPCENTER_TOKEN_PRODUCTION_PACKAGES'] || '';
68
+ };
69
+ const deployProductionPackagesToAppCenter = (c) => {
70
+ console.log('deployProductionPackagesToAppCenter');
71
+ const appCenterConfig = getAppCenterConfig(c);
72
+ if (!appCenterConfig) {
73
+ throw new Error('Not found App Center Config (for production packages) in build config');
74
+ }
75
+ const { appName: centerAppName } = appCenterConfig;
76
+ const token = getAppCenterToken();
77
+ const zipPath = (0, resolvers_1.getProductionZipFileRelativePath)(c);
78
+ const { appName, packageVersion } = c.buildConfig.common;
79
+ if (!centerAppName)
80
+ throw new Error('Missing centerAppName in appCenterConfig');
81
+ if (!token)
82
+ throw new Error('Missing App Center Token');
83
+ if (!zipPath)
84
+ throw new Error('Missing path of zip file to be upload to the App Center');
85
+ if (!packageVersion)
86
+ throw new Error('Missing packageVersion to be send to the App Center');
87
+ const tempReleaseNotesPath = `RELEASE_NOTES_APPCENTER_PRODUCTION_PACKAGES.md`;
88
+ if (fs.existsSync(tempReleaseNotesPath)) {
89
+ fs.unlinkSync(tempReleaseNotesPath);
90
+ }
91
+ const packagesList = getPlatformPackagesList(c);
92
+ const notes = [
93
+ `# ${appName} Production Packages`,
94
+ '',
95
+ '## List of Production Packages',
96
+ ...packagesList.reduce((acc, { platformName, packages }) => ([
97
+ ...acc,
98
+ `- ${platformName}`,
99
+ ...packages.reduce((accPackages, { name, hostedUrl }) => ([
100
+ ...accPackages,
101
+ ` - ${name}`,
102
+ ` - App URL: ${hostedUrl}`
103
+ ]), []),
104
+ ]), []),
105
+ ];
106
+ const packagesMarkdown = notes.join(newLine);
107
+ (0, child_process_1.execSync)(`echo "${packagesMarkdown}" >> ${tempReleaseNotesPath}`);
108
+ console.log(`Deploying Production packages to AppCenter.ms...`);
109
+ (0, appCenter_1.appCenterRelease)({
110
+ projectName: centerAppName,
111
+ buildVersion: packageVersion,
112
+ filePath: zipPath,
113
+ releaseNotesPath: tempReleaseNotesPath,
114
+ token,
115
+ });
116
+ };
117
+ exports.deployProductionPackagesToAppCenter = deployProductionPackagesToAppCenter;
@@ -27,20 +27,9 @@ exports.deployToAppCenter = void 0;
27
27
  const child_process_1 = require("child_process");
28
28
  const fs = __importStar(require("fs"));
29
29
  const rnv_1 = require("rnv");
30
- const resolvers_1 = require("../../resolvers");
31
- const urlsMarkdown_1 = require("./urlsMarkdown");
32
- const appCenterRelease = (params) => {
33
- const { filePath, releaseNotesPath, buildVersion, token, projectName } = params;
34
- const app = `24i-Media/${projectName}`;
35
- (0, child_process_1.execSync)('appcenter distribute release '
36
- + `--file "${filePath}" `
37
- + `--release-notes-file "${releaseNotesPath}" `
38
- + `--build-version "${buildVersion}" `
39
- + `--app "${app}" `
40
- + `--token "${token}" `
41
- + '--group "Collaborators" '
42
- + '--disable-telemetry', { stdio: 'inherit' });
43
- };
30
+ const resolvers_1 = require("../../../resolvers");
31
+ const urlsMarkdown_1 = require("../urlsMarkdown");
32
+ const appCenter_1 = require("./appCenter");
44
33
  const getAppCenterConfigByPlatformName = (c, platformName) => {
45
34
  try {
46
35
  return c.buildConfig.platforms[platformName]?.deploy?.appCenter || null;
@@ -49,7 +38,7 @@ const getAppCenterConfigByPlatformName = (c, platformName) => {
49
38
  return null;
50
39
  }
51
40
  };
52
- const getTokenByPlatform = (platformName = '') => {
41
+ const getAppCenterTokenByPlatform = (platformName = '') => {
53
42
  const envVariableName = `APPCENTER_TOKEN_${platformName.toUpperCase()}`;
54
43
  return process.env[envVariableName] || '';
55
44
  };
@@ -59,7 +48,7 @@ const processPlatform = (c, platformName) => {
59
48
  if (!appCenterConfig)
60
49
  return;
61
50
  const { appName } = appCenterConfig;
62
- const token = getTokenByPlatform(platformName);
51
+ const token = getAppCenterTokenByPlatform(platformName);
63
52
  const zipPath = (0, resolvers_1.resolveZippedPlatformBuildsRelativeFilePath)(c, platformName);
64
53
  const buildVersion = getConfigProp(c, platformName, 'packageVersion', '');
65
54
  const releaseNotesPath = getConfigProp(c, platformName, 'releaseNotes', {}).relativePath || '';
@@ -73,7 +62,7 @@ const processPlatform = (c, platformName) => {
73
62
  const urlsMarkdown = (0, urlsMarkdown_1.getUrlsMarkdown)(c, [platformName]);
74
63
  (0, child_process_1.execSync)(`echo "${urlsMarkdown}" >> ${tempReleaseNotesPath}`);
75
64
  console.log(`Deploying ${platformName} platform to AppCenter.ms...`);
76
- appCenterRelease({
65
+ (0, appCenter_1.appCenterRelease)({
77
66
  projectName: appName,
78
67
  buildVersion,
79
68
  filePath: zipPath,
@@ -41,13 +41,16 @@ const getSlackPayload = (c) => {
41
41
  default: throw new Error('Notify Slack: unsupported or undefined release type! Did you pass it as an argument?');
42
42
  }
43
43
  };
44
- const notifySlack = (c) => {
45
- const contentType = '"Content-type: application/json"';
46
- const data = `--data '${JSON.stringify(getSlackPayload(c))}'`;
47
- const webHookUrl = c.buildConfig.common.deploy.slack?.webhookUrl || '';
48
- if (webHookUrl) {
49
- const cmd = `curl -X POST -H ${contentType} ${data} ${webHookUrl}`;
50
- (0, child_process_1.execSync)(cmd, { stdio: 'inherit' });
51
- }
44
+ const notifySlack = (c, schemes) => {
45
+ schemes.forEach((scheme) => {
46
+ c.runtime.scheme = scheme;
47
+ const contentType = '"Content-type: application/json"';
48
+ const data = `--data '${JSON.stringify(getSlackPayload(c))}'`;
49
+ const webHookUrl = c.buildConfig.common.deploy.slack?.webhookUrl || '';
50
+ if (webHookUrl) {
51
+ const cmd = `curl -X POST -H ${contentType} ${data} ${webHookUrl}`;
52
+ (0, child_process_1.execSync)(cmd, { stdio: 'inherit' });
53
+ }
54
+ });
52
55
  };
53
56
  exports.notifySlack = notifySlack;
@@ -28,6 +28,7 @@ const child_process_1 = require("child_process");
28
28
  const fs = __importStar(require("fs"));
29
29
  const constants_1 = require("../../constants");
30
30
  const resolvers_1 = require("../../resolvers");
31
+ const getSafeSchemeString_1 = require("../../utils/getSafeSchemeString");
31
32
  const UNSUPPORTED_PLATFORMS = [constants_1.Platforms.WEBTV];
32
33
  const executeSync = (cmd) => (0, child_process_1.execSync)(cmd, { stdio: 'inherit' });
33
34
  const createNewRelease = (version) => {
@@ -54,15 +55,20 @@ const finalizeRelease = (version) => {
54
55
  };
55
56
  const processPlatform = (c, platform, version) => {
56
57
  const processFlavour = (flavour) => {
58
+ const { scheme } = c.runtime;
57
59
  const { platformBuildsDir } = c.buildConfig.paths;
58
- const mapsPath = `${platformBuildsDir}/${flavour}_${platform}-public/public/content/js`;
59
- const urlPrefix = `builds/${platform}/${flavour}/dist/${version}/public/content/js/`;
60
- if (!fs.existsSync(mapsPath))
60
+ const schemeDirName = (0, getSafeSchemeString_1.getSafeSchemeString)(scheme);
61
+ const envName = (0, resolvers_1.resolveBuildEnvName)(scheme);
62
+ const mapsPath = `${platformBuildsDir}/${schemeDirName}/${flavour}_${platform}-public/project/public/content/js`;
63
+ const urlPrefix = `builds/${platform}/${flavour}/dist/${version}/${envName}/public/content/js/`;
64
+ if (!fs.existsSync(mapsPath)) {
65
+ console.log(`Warning: non-existing mapsPath: ${mapsPath}`);
61
66
  return;
62
- console.log(`Uploading ${flavour}_${platform} sourcemaps to Sentry...`);
67
+ }
68
+ console.log(`Uploading ${schemeDirName}/${flavour}_${platform} sourcemaps to Sentry...`);
63
69
  uploadSourceMaps({ version, sourceMapsPath: mapsPath, urlPrefix });
64
70
  };
65
- const { supportedFlavours = [] } = c.buildConfig.platforms[platform]?.deploy || {};
71
+ const supportedFlavours = (0, resolvers_1.resolveSupportedFlavoursForPlatform)(c, platform);
66
72
  supportedFlavours.forEach(processFlavour);
67
73
  };
68
74
  const isSentryProjectConfigured = () => {
@@ -5,7 +5,7 @@ const forEachSupportedPlatformFlavour_1 = require("../utils/forEachSupportedPlat
5
5
  const resolvers_1 = require("../resolvers");
6
6
  const zipBuildsByPlatforms_1 = require("../utils/zipBuildsByPlatforms");
7
7
  const deleteSourceMaps_1 = require("./release/deleteSourceMaps");
8
- const deployToAppCenter_1 = require("./release/deployToAppCenter");
8
+ const deployToAppCenter_1 = require("./release/appCenter/deployToAppCenter");
9
9
  const githubRelease_1 = require("./release/githubRelease");
10
10
  const notifySlack_1 = require("./release/notifySlack/notifySlack");
11
11
  const sentryRelease_1 = require("./release/sentryRelease");
@@ -27,7 +27,7 @@ const doLatestDevelopmentRelease = (c) => {
27
27
  const doLatestReleaseCandidateRelease = (c) => {
28
28
  console.log('doLatestReleaseCandidateRelease');
29
29
  deployBuilds(c);
30
- (0, notifySlack_1.notifySlack)(c);
30
+ (0, notifySlack_1.notifySlack)(c, [c.runtime.scheme]);
31
31
  return true;
32
32
  };
33
33
  const doLatestRelease = (c) => {
@@ -37,7 +37,7 @@ const doLatestRelease = (c) => {
37
37
  const doStagingDistributionRelease = (c) => {
38
38
  console.log('doStagingDistributionRelease');
39
39
  deployBuilds(c);
40
- (0, notifySlack_1.notifySlack)(c);
40
+ (0, notifySlack_1.notifySlack)(c, [c.runtime.scheme]);
41
41
  return true;
42
42
  };
43
43
  const doProductionDistributionRelease = (c) => {
@@ -48,7 +48,7 @@ const doProductionDistributionRelease = (c) => {
48
48
  (0, deleteSourceMaps_1.deleteSourceMaps)(c);
49
49
  (0, githubRelease_1.githubRelease)(c);
50
50
  (0, deployToAppCenter_1.deployToAppCenter)(c);
51
- (0, notifySlack_1.notifySlack)(c);
51
+ (0, notifySlack_1.notifySlack)(c, [c.runtime.scheme]);
52
52
  return true;
53
53
  };
54
54
  const releaseAllWithScheme = () => {
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const child_process_1 = require("child_process");
4
+ const forEachSupportedPlatformFlavour_1 = require("../utils/forEachSupportedPlatformFlavour");
5
+ const resolvers_1 = require("../resolvers");
6
+ const zipStagingProdBuildsByPlatforms_1 = require("../utils/zipStagingProdBuildsByPlatforms");
7
+ const deleteSourceMaps_1 = require("./release/deleteSourceMaps");
8
+ const deployToAppCenter_1 = require("./release/appCenter/deployToAppCenter");
9
+ const githubRelease_1 = require("./release/githubRelease");
10
+ const notifySlack_1 = require("./release/notifySlack/notifySlack");
11
+ const sentryRelease_1 = require("./release/sentryRelease");
12
+ const constants_1 = require("../constants");
13
+ const deployTask = (options) => {
14
+ const { scheme, platform, flavour } = options;
15
+ const cmd = `npx rnv deploy -s ${scheme} -p ${platform} -c ${flavour} --ci --only --schemeFolder`;
16
+ (0, child_process_1.execSync)(cmd, { stdio: 'inherit' });
17
+ };
18
+ const deployBuilds = (c) => {
19
+ console.log('Deploying the builds...');
20
+ (0, forEachSupportedPlatformFlavour_1.forEachSupportedPlatformFlavour)(c, deployTask);
21
+ return true;
22
+ };
23
+ const doLatestDevelopmentRelease = (c, scheme) => {
24
+ console.log('doLatestDevelopmentRelease');
25
+ c.runtime.scheme = scheme.type;
26
+ return deployBuilds(c);
27
+ };
28
+ const doLatestReleaseCandidateRelease = (c, schemes) => {
29
+ console.log('doLatestReleaseCandidateRelease', schemes);
30
+ const [stagingScheme, prodScheme] = schemes;
31
+ if (stagingScheme) {
32
+ c.runtime.scheme = stagingScheme.type;
33
+ deployBuilds(c);
34
+ }
35
+ if (prodScheme) {
36
+ c.runtime.scheme = prodScheme.type;
37
+ deployBuilds(c);
38
+ }
39
+ const schemeArr = schemes.map((scheme) => scheme?.type).filter(Boolean);
40
+ (0, notifySlack_1.notifySlack)(c, schemeArr);
41
+ return true;
42
+ };
43
+ const doLatestRelease = (c, schemes) => {
44
+ console.log('doLatestRelease', schemes);
45
+ const [stagingScheme, prodScheme] = schemes;
46
+ if (stagingScheme) {
47
+ c.runtime.scheme = stagingScheme.type;
48
+ deployBuilds(c);
49
+ }
50
+ if (prodScheme) {
51
+ c.runtime.scheme = prodScheme.type;
52
+ deployBuilds(c);
53
+ }
54
+ };
55
+ const doDistributionRelease = (c, schemes) => {
56
+ console.log('doDistributionRelease', schemes);
57
+ const [stagingScheme, prodScheme] = schemes;
58
+ if (stagingScheme) {
59
+ c.runtime.scheme = stagingScheme.type;
60
+ deployBuilds(c);
61
+ }
62
+ if (prodScheme) {
63
+ c.runtime.scheme = prodScheme.type;
64
+ (0, zipStagingProdBuildsByPlatforms_1.zipStagingProdBuildsByPlatforms)(c, [stagingScheme?.type, prodScheme.type]);
65
+ deployBuilds(c);
66
+ (0, sentryRelease_1.sentryRelease)(c);
67
+ (0, deleteSourceMaps_1.deleteSourceMaps)(c);
68
+ (0, githubRelease_1.githubRelease)(c);
69
+ (0, deployToAppCenter_1.deployToAppCenter)(c);
70
+ }
71
+ const schemeArr = schemes.map((scheme) => scheme?.type).filter(Boolean);
72
+ (0, notifySlack_1.notifySlack)(c, schemeArr);
73
+ };
74
+ const releaseAllWithSchemes = () => {
75
+ const schemes = process.argv.slice(2);
76
+ if (!schemes.length) {
77
+ throw new Error('No scheme name to use found! Please use rnv scheme names as a param.');
78
+ }
79
+ const c = (0, resolvers_1.getBaseConfig)();
80
+ const schemesArr = schemes.map((scheme) => ({ type: scheme, processed: false }));
81
+ schemesArr.forEach((schemeObj) => {
82
+ if (schemeObj.processed)
83
+ return;
84
+ switch (schemeObj.type) {
85
+ case constants_1.BuildSchemes.DEV_LATEST:
86
+ doLatestDevelopmentRelease(c, schemeObj);
87
+ schemeObj.processed = true;
88
+ break;
89
+ case constants_1.BuildSchemes.RC_STAGING_LATEST:
90
+ case constants_1.BuildSchemes.RC_PROD_LATEST:
91
+ {
92
+ const [staging, prod] = findSchemes(schemesArr, [
93
+ constants_1.BuildSchemes.RC_STAGING_LATEST,
94
+ constants_1.BuildSchemes.RC_PROD_LATEST,
95
+ ]);
96
+ doLatestReleaseCandidateRelease(c, [staging, prod]);
97
+ if (staging) {
98
+ staging.processed = true;
99
+ }
100
+ if (prod) {
101
+ prod.processed = true;
102
+ }
103
+ }
104
+ break;
105
+ case constants_1.BuildSchemes.RELEASE_STAGING_LATEST:
106
+ case constants_1.BuildSchemes.RELEASE_PROD_LATEST:
107
+ {
108
+ const [staging, prod] = findSchemes(schemesArr, [
109
+ constants_1.BuildSchemes.RELEASE_STAGING_LATEST,
110
+ constants_1.BuildSchemes.RELEASE_PROD_LATEST,
111
+ ]);
112
+ doLatestRelease(c, [staging, prod]);
113
+ if (staging) {
114
+ staging.processed = true;
115
+ }
116
+ if (prod) {
117
+ prod.processed = true;
118
+ }
119
+ }
120
+ break;
121
+ case constants_1.BuildSchemes.RELEASE_STAGING_DIST:
122
+ case constants_1.BuildSchemes.RELEASE_PROD_DIST:
123
+ {
124
+ const [staging, prod] = findSchemes(schemesArr, [
125
+ constants_1.BuildSchemes.RELEASE_STAGING_DIST,
126
+ constants_1.BuildSchemes.RELEASE_PROD_DIST,
127
+ ]);
128
+ doDistributionRelease(c, [staging, prod]);
129
+ if (staging) {
130
+ staging.processed = true;
131
+ }
132
+ if (prod) {
133
+ prod.processed = true;
134
+ }
135
+ }
136
+ break;
137
+ default:
138
+ throw new Error('Unsupported scheme to release!');
139
+ }
140
+ });
141
+ const deployLocations = schemesArr.reduce((acc, scheme) => {
142
+ const schemeType = scheme.type;
143
+ c.runtime.scheme = schemeType;
144
+ acc[schemeType] = (0, resolvers_1.resolveDeployLocations)(c);
145
+ return acc;
146
+ }, {});
147
+ const spacing = 2;
148
+ console.log(JSON.stringify(deployLocations, null, spacing));
149
+ return true;
150
+ };
151
+ const findSchemes = (schemesArray, schemesToFind) => {
152
+ return schemesToFind.map((schemeToFind) => (schemesArray.find((schemeObj) => schemeObj.type === schemeToFind)));
153
+ };
154
+ const startTimestamp = Date.now();
155
+ releaseAllWithSchemes();
156
+ const msPerSecond = 1000;
157
+ const scriptTotalTimeInSeconds = Math.ceil((Date.now() - startTimestamp) / msPerSecond);
158
+ console.log(`releaseAllWithSchemes: done in ${scriptTotalTimeInSeconds} second(s)!`);
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_1 = require("../resolvers/index");
4
+ const deployProductionPackagesToAppCenter_1 = require("./release/appCenter/deployProductionPackagesToAppCenter");
5
+ const releaseProductionPackagesAll = () => {
6
+ const c = (0, index_1.getBaseConfig)();
7
+ (0, deployProductionPackagesToAppCenter_1.deployProductionPackagesToAppCenter)(c);
8
+ };
9
+ const startTimestamp = Date.now();
10
+ releaseProductionPackagesAll();
11
+ const msPerSecond = 1000;
12
+ const scriptTotalTimeInSeconds = Math.ceil((Date.now() - startTimestamp) / msPerSecond);
13
+ console.log(`releaseProductionPackagesAll: done in ${scriptTotalTimeInSeconds} second(s)!`);
@@ -35,6 +35,7 @@ const sdk_webpack_2 = require("../sdk-webpack");
35
35
  const sdk_utils_1 = require("../sdk-utils");
36
36
  const services_1 = require("../sdk-utils/sdk-installer/services");
37
37
  const resolvers_1 = require("../../resolvers");
38
+ const copyEnvironmentFolder_1 = require("../../utils/copyEnvironmentFolder");
38
39
  const constants_1 = require("../../constants");
39
40
  const flavourName = 'bigscreenAppstage';
40
41
  const capitalizeFirstLetter = (str) => {
@@ -164,11 +165,17 @@ const configureProject = (c) => {
164
165
  };
165
166
  const getHostedAppEntryUrl = (c) => {
166
167
  const { platform, runtime } = c;
167
- const baseUrl = (0, resolvers_1.resolveBaseUrl)({
168
- platform,
169
- scheme: runtime.scheme || '',
170
- flavour: runtime.appId,
171
- });
168
+ let baseUrl = '';
169
+ if (c.program.productionPackagesHostedUrl) {
170
+ baseUrl = (0, resolvers_1.resolveProductionPackagesBaseUrl)(c);
171
+ }
172
+ else {
173
+ baseUrl = (0, resolvers_1.resolveBaseUrl)({
174
+ platform,
175
+ scheme: runtime.scheme || '',
176
+ flavour: runtime.appId,
177
+ });
178
+ }
172
179
  return `${baseUrl}/public/index.html`;
173
180
  };
174
181
  const configureEntryUrl = (c) => {
@@ -186,7 +193,9 @@ const configureAndroidTVProject = async (c) => {
186
193
  rnv_1.Logger.logTask('configureAndroidTVProject');
187
194
  c.runtime.platformBuildsProjectPath = rnv_1.Common.getPlatformProjectDir(c);
188
195
  const platform = constants_1.Platforms.ANDROIDTV;
189
- await rnv_1.ProjectManager.copyAssetsFolder(c, platform, `app/src/${flavourName}/res`);
196
+ const resSubPath = `app/src/${flavourName}/res`;
197
+ await rnv_1.ProjectManager.copyAssetsFolder(c, platform, resSubPath);
198
+ (0, copyEnvironmentFolder_1.copyEnvFolderInProject)(c, resSubPath);
190
199
  await (0, sdk_webpack_1.configureCoreWebProject)(c);
191
200
  await configureAndroidProperties(c);
192
201
  configureProject(c);
@@ -195,6 +204,7 @@ const configureAndroidTVProject = async (c) => {
195
204
  const gradlew = path.join(rnv_1.Common.getPlatformProjectDir(c), 'gradlew');
196
205
  fs.chmodSync(gradlew, '755');
197
206
  await rnv_1.ProjectManager.copyBuildsFolder(c, platform);
207
+ (0, copyEnvironmentFolder_1.copyEnvFolderInPublicConfig)(c);
198
208
  };
199
209
  exports.configureAndroidTVProject = configureAndroidTVProject;
200
210
  const configureAndroidProperties = async (c) => {
@@ -33,6 +33,7 @@ const rnv_1 = require("rnv");
33
33
  const sdk_webpack_1 = require("@rnv/sdk-webpack");
34
34
  const sdk_webpack_2 = require("../sdk-webpack");
35
35
  const sdk_utils_1 = require("../sdk-utils");
36
+ const copyEnvironmentFolder_1 = require("../../utils/copyEnvironmentFolder");
36
37
  const constants_1 = require("../../constants");
37
38
  const { createDevelopTizenCertificate, DEFAULT_CERTIFICATE_NAME, DEFAULT_SECURITY_PROFILE_NAME, } = rnv_1.SDKManager.Tizen;
38
39
  const DEFAULT_CERTIFICATE_NAME_WITH_EXTENSION = `${DEFAULT_CERTIFICATE_NAME}.p12`;
@@ -87,9 +88,11 @@ const configureTizenProject = async (c) => {
87
88
  await createDevelopTizenCertificate(c);
88
89
  }
89
90
  await rnv_1.ProjectManager.copyAssetsFolder(c, platform);
91
+ (0, copyEnvironmentFolder_1.copyEnvFolderInProject)(c);
90
92
  await (0, sdk_webpack_1.configureCoreWebProject)(c);
91
93
  configureProject(c);
92
94
  await rnv_1.ProjectManager.copyBuildsFolder(c, platform);
95
+ (0, copyEnvironmentFolder_1.copyEnvFolderInPublicConfig)(c);
93
96
  };
94
97
  exports.configureTizenProject = configureTizenProject;
95
98
  const handleLinuxKeyring = () => {
@@ -31,6 +31,7 @@ const rnv_1 = require("rnv");
31
31
  const sdk_webpack_1 = require("@rnv/sdk-webpack");
32
32
  const sdk_webpack_2 = require("../sdk-webpack");
33
33
  const sdk_utils_1 = require("../sdk-utils");
34
+ const copyEnvironmentFolder_1 = require("../../utils/copyEnvironmentFolder");
34
35
  const constants_1 = require("../../constants");
35
36
  const buildWebOSProject = async (c) => {
36
37
  rnv_1.Logger.logTask('buildWebOSProject');
@@ -60,9 +61,11 @@ const configureWebOSProject = async (c) => {
60
61
  c.runtime.platformBuildsProjectPath = rnv_1.Common.getPlatformProjectDir(c);
61
62
  const platform = constants_1.Platforms.WEBOS;
62
63
  await rnv_1.ProjectManager.copyAssetsFolder(c, platform);
64
+ (0, copyEnvironmentFolder_1.copyEnvFolderInProject)(c);
63
65
  await (0, sdk_webpack_1.configureCoreWebProject)(c);
64
66
  configureProject(c);
65
67
  await rnv_1.ProjectManager.copyBuildsFolder(c, platform);
68
+ (0, copyEnvironmentFolder_1.copyEnvFolderInPublicConfig)(c);
66
69
  };
67
70
  exports.configureWebOSProject = configureWebOSProject;
68
71
  const sdkInstallerUUrl = 'https://s3.amazonaws.com/tools.nxg-bigscreen.24imedia.com/sdks/webos/ares_webos_builder_v1.10.4_multiplatform.zip';
@@ -7,8 +7,22 @@ exports.runWebpackServer = exports.buildCoreWebpackProject = exports.configureWe
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const ip_1 = __importDefault(require("ip"));
9
9
  const rnv_1 = require("rnv");
10
- var sdk_webpack_1 = require("@rnv/sdk-webpack");
11
- Object.defineProperty(exports, "configureWebProject", { enumerable: true, get: function () { return sdk_webpack_1.configureWebProject; } });
10
+ const sdk_webpack_1 = require("@rnv/sdk-webpack");
11
+ const resolvers_1 = require("../../resolvers");
12
+ const copyEnvironmentFolder_1 = require("../../utils/copyEnvironmentFolder");
13
+ const configureWebProject = async (c) => {
14
+ rnv_1.Logger.logTask('configureWebProject');
15
+ const { platform } = c;
16
+ c.runtime.platformBuildsProjectPath = rnv_1.Common.getPlatformProjectDir(c);
17
+ if (!rnv_1.PlatformManager.isPlatformActive(c, platform))
18
+ return;
19
+ await rnv_1.ProjectManager.copyAssetsFolder(c, platform);
20
+ (0, copyEnvironmentFolder_1.copyEnvFolderInProject)(c);
21
+ await (0, sdk_webpack_1.configureCoreWebProject)(c);
22
+ await rnv_1.ProjectManager.copyBuildsFolder(c, platform);
23
+ (0, copyEnvironmentFolder_1.copyEnvFolderInPublicConfig)(c);
24
+ };
25
+ exports.configureWebProject = configureWebProject;
12
26
  const getWebpackPath = () => {
13
27
  const binWebpackJs = 'bin/webpack.js';
14
28
  const WEBPACK = path_1.default.join(__dirname, '../../../node_modules/webpack', binWebpackJs);
@@ -38,7 +52,13 @@ const buildCoreWebpackProject = async (c) => {
38
52
  if (wp === '') {
39
53
  rnv_1.Logger.logWarning('Webpack not found. Will try to use globally installed one');
40
54
  }
41
- const envVars = `PLATFORM=${platform} NODE_ENV=${environment} ${debugVariables}`;
55
+ let hostedUrlVariable = '';
56
+ if (c.program.productionPackagesHostedUrl) {
57
+ hostedUrlVariable = `HOSTED_URL=${(0, resolvers_1.resolveProductionPackagesBaseUrl)(c)}`;
58
+ }
59
+ const envVars = [
60
+ `PLATFORM=${platform}`, `NODE_ENV=${environment}`, debugVariables, hostedUrlVariable,
61
+ ].filter(Boolean).join(' ');
42
62
  const wpConfigPath = `./platformBuilds/${appId}_${platform}/webpack.config.${configName}.js`;
43
63
  const wpCmd = `node ${wp} build --mode production --config ${wpConfigPath}`;
44
64
  await rnv_1.Exec.executeAsync(c, `npx cross-env ${envVars} ${wpCmd}`);
@@ -1,21 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rm = exports.cp = void 0;
3
+ exports.getIdentity = exports.ls = exports.rm = exports.cpRemote = exports.cp = void 0;
4
4
  const child_process_1 = require("child_process");
5
5
  const fsUtils_1 = require("../../../scripts/utils/fsUtils");
6
+ const RECURSIVE_FLAG = ' --recursive';
6
7
  const runCmdSync = (cmd) => (0, child_process_1.execSync)(cmd, { stdio: 'inherit' });
8
+ const runCmdSyncSilent = (cmd) => (0, child_process_1.execSync)(cmd, { stdio: 'pipe' });
9
+ const getIdentity = () => {
10
+ runCmdSyncSilent('aws sts get-caller-identity');
11
+ };
12
+ exports.getIdentity = getIdentity;
13
+ const ls = (remotePath) => {
14
+ runCmdSyncSilent(`aws s3 ls s3://${remotePath}`);
15
+ };
16
+ exports.ls = ls;
7
17
  const cp = (source, destination) => {
8
18
  let cmd = `aws s3 cp ${source} s3://${destination} --acl public-read`;
9
19
  if ((0, fsUtils_1.isDir)(source)) {
10
- cmd += ' --recursive';
20
+ cmd += RECURSIVE_FLAG;
11
21
  }
12
22
  runCmdSync(cmd);
13
23
  };
14
24
  exports.cp = cp;
25
+ const cpRemote = (source, destination) => {
26
+ let cmd = `aws s3 cp s3://${source} s3://${destination} --acl public-read`;
27
+ if (source.endsWith('/')) {
28
+ cmd += RECURSIVE_FLAG;
29
+ }
30
+ runCmdSync(cmd);
31
+ };
32
+ exports.cpRemote = cpRemote;
15
33
  const rm = (remoteDirPath) => {
16
34
  let cmd = `aws s3 rm s3://${remoteDirPath}`;
17
35
  if (remoteDirPath.endsWith('/')) {
18
- cmd += ' --recursive';
36
+ cmd += RECURSIVE_FLAG;
19
37
  }
20
38
  runCmdSync(cmd);
21
39
  };