@24i/smartapps-bigscreen-rnv-build-engine 0.0.2-alpha.1328 → 0.0.2-alpha.1332

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 (98) hide show
  1. package/dist/src/constants/buildSchemes.js +3 -3
  2. package/dist/src/constants/index.js +5 -10
  3. package/dist/src/constants/platforms.js +11 -0
  4. package/dist/src/index.js +29 -31
  5. package/dist/src/resolvers/index.js +19 -12
  6. package/dist/src/resolvers/resolveBaseUrl.js +15 -16
  7. package/dist/src/resolvers/resolveBuildVersion.js +17 -19
  8. package/dist/src/resolvers/resolveBuildVersionOffset.js +35 -0
  9. package/dist/src/resolvers/resolveDeployLocations.js +70 -0
  10. package/dist/src/{utils/getBaseConfig.js → resolvers/resolveGenericRnvConfig.js} +18 -30
  11. package/dist/src/resolvers/resolveHbbtvDeployConfig.js +13 -0
  12. package/dist/src/resolvers/resolveHbbtvDeployUrl.js +11 -0
  13. package/dist/src/resolvers/resolveHbbtvRemoteBuildDirRelativePath.js +27 -0
  14. package/dist/src/resolvers/resolveZippedPlatformBuildsRelativeFilePath.js +15 -0
  15. package/dist/src/scripts/buildAllWithScheme.js +14 -14
  16. package/dist/src/scripts/gitReleaser/afterVersionBump.js +10 -10
  17. package/dist/src/scripts/gitReleaser/beforeVersionBump.js +7 -7
  18. package/dist/src/scripts/gitReleaser/checkReleaseNotes.js +9 -9
  19. package/dist/src/scripts/gitReleaser/pushRelease.js +17 -17
  20. package/dist/src/scripts/gitReleaser/pushReleaseCandidate.js +4 -4
  21. package/dist/src/scripts/gitReleaser/pushReleaseNotes.js +16 -16
  22. package/dist/src/scripts/release/deleteSourceMaps.js +6 -6
  23. package/dist/src/scripts/release/deployToAppCenter.js +37 -38
  24. package/dist/src/scripts/release/githubRelease.js +60 -64
  25. package/dist/src/scripts/release/notifySlack/makePayload.js +44 -48
  26. package/dist/src/scripts/release/notifySlack/notifySlack.js +10 -10
  27. package/dist/src/scripts/release/notifySlack/slackBlockKitBuilder.js +25 -28
  28. package/dist/src/scripts/release/sentryRelease.js +34 -33
  29. package/dist/src/scripts/release/urlsMarkdown.js +29 -30
  30. package/dist/src/scripts/releaseAllWithScheme.js +27 -28
  31. package/dist/src/scripts/utils/cmdUtils.js +9 -9
  32. package/dist/src/scripts/utils/fsUtils.js +7 -7
  33. package/dist/src/scripts/utils/gitUtils.js +50 -50
  34. package/dist/src/scripts/utils/index.js +8 -8
  35. package/dist/src/scripts/utils/stringUtils.js +2 -5
  36. package/dist/src/sdks/index.js +15 -54
  37. package/dist/src/sdks/sdk-tizen/index.js +154 -254
  38. package/dist/src/sdks/sdk-webos/index.js +136 -231
  39. package/dist/src/sdks/sdk-webpack/index.js +20 -69
  40. package/dist/src/sdks/sdkUtils.js +14 -59
  41. package/dist/src/tasks/deploy/aswS3/aws.js +9 -9
  42. package/dist/src/tasks/deploy/aswS3/deployS3.js +44 -82
  43. package/dist/src/tasks/deploy/hbbtv/deployHbbtv.js +70 -174
  44. package/dist/src/tasks/engineTasks.js +10 -10
  45. package/dist/src/tasks/task.rnv.build.js +77 -134
  46. package/dist/src/tasks/task.rnv.configure.js +39 -88
  47. package/dist/src/tasks/task.rnv.configureSoft.js +22 -75
  48. package/dist/src/tasks/task.rnv.deploy.js +28 -78
  49. package/dist/src/tasks/task.rnv.hooks.run.js +42 -92
  50. package/dist/src/tasks/task.rnv.package.js +18 -61
  51. package/dist/src/tasks/task.rnv.project.configure.js +80 -183
  52. package/dist/src/tasks/task.rnv.start.js +42 -87
  53. package/dist/src/types/c.js +1 -1
  54. package/dist/src/types/index.js +1 -1
  55. package/dist/src/utils/forEachSupportedPlatformFlavour.js +12 -12
  56. package/dist/src/utils/replaceRelevantStringsInConfig/index.js +2 -9
  57. package/dist/src/utils/replaceRelevantStringsInConfig/replaceRelevantStringsInConfig.js +10 -11
  58. package/dist/src/utils/replaceRelevantStringsInConfig/replaceTemplateString.js +24 -30
  59. package/dist/src/utils/zipBuildsByPlatforms.js +28 -39
  60. package/dist/templates/platforms/_shared/template.js +58 -42
  61. package/dist/templates/platforms/_shared/webpack.base.js +119 -139
  62. package/dist/templates/platforms/entone/webpack.config.dev.js +27 -22
  63. package/dist/templates/platforms/entone/webpack.config.prod.js +21 -20
  64. package/dist/templates/platforms/hbbtv/webpack.config.dev.js +42 -24
  65. package/dist/templates/platforms/hbbtv/webpack.config.prod.js +36 -22
  66. package/dist/templates/platforms/tizen/webpack.config.dev.js +28 -22
  67. package/dist/templates/platforms/tizen/webpack.config.prod.js +21 -20
  68. package/dist/templates/platforms/webos/webpack.config.dev.js +31 -24
  69. package/dist/templates/platforms/webos/webpack.config.prod.js +23 -22
  70. package/dist/templates/platforms/webtv/webpack.config.dev.js +27 -22
  71. package/dist/templates/platforms/webtv/webpack.config.prod.js +21 -20
  72. package/dist/types/src/constants/index.d.ts +1 -0
  73. package/dist/types/src/constants/platforms.d.ts +8 -0
  74. package/dist/types/src/resolvers/index.d.ts +8 -1
  75. package/dist/types/src/resolvers/resolveBuildVersionOffset.d.ts +3 -0
  76. package/dist/types/src/resolvers/resolveDeployLocations.d.ts +9 -0
  77. package/dist/types/src/resolvers/resolveGenericRnvConfig.d.ts +4 -0
  78. package/dist/types/src/resolvers/resolveHbbtvDeployConfig.d.ts +10 -0
  79. package/dist/types/src/resolvers/resolveHbbtvDeployUrl.d.ts +3 -0
  80. package/dist/types/src/resolvers/resolveHbbtvRemoteBuildDirRelativePath.d.ts +3 -0
  81. package/dist/types/src/resolvers/resolveZippedPlatformBuildsRelativeFilePath.d.ts +3 -0
  82. package/dist/types/src/scripts/release/notifySlack/makePayload.d.ts +9 -3
  83. package/dist/types/src/tasks/deploy/hbbtv/deployHbbtv.d.ts +0 -1
  84. package/dist/types/src/tasks/task.rnv.build.d.ts +1 -2
  85. package/dist/types/src/tasks/task.rnv.configure.d.ts +1 -2
  86. package/dist/types/src/tasks/task.rnv.deploy.d.ts +1 -2
  87. package/dist/types/src/tasks/task.rnv.package.d.ts +1 -2
  88. package/dist/types/src/tasks/task.rnv.start.d.ts +1 -2
  89. package/dist/types/src/types/c.d.ts +278 -8
  90. package/dist/types/src/utils/zipBuildsByPlatforms.d.ts +0 -1
  91. package/package.json +3 -3
  92. package/dist/src/enginePlatforms.js +0 -15
  93. package/dist/src/utils/getDeployLocations.js +0 -80
  94. package/dist/src/utils/getVersionOffset.js +0 -35
  95. package/dist/types/src/enginePlatforms.d.ts +0 -8
  96. package/dist/types/src/utils/getBaseConfig.d.ts +0 -2
  97. package/dist/types/src/utils/getDeployLocations.d.ts +0 -7
  98. package/dist/types/src/utils/getVersionOffset.d.ts +0 -1
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkReleaseNotes = void 0;
4
- var assert_1 = require("assert");
5
- var utils_1 = require("../utils");
6
- var ok = assert_1.strict.ok;
7
- var checkReleaseNotes = function (c) {
4
+ const assert_1 = require("assert");
5
+ const utils_1 = require("../utils");
6
+ const { ok } = assert_1.strict;
7
+ const checkReleaseNotes = (c) => {
8
8
  var _a, _b;
9
- var _c = ((_b = (_a = c.buildConfig) === null || _a === void 0 ? void 0 : _a.common) === null || _b === void 0 ? void 0 : _b.releaseNotes) || {}, relativePath = _c.relativePath, _d = _c.requiredRows, requiredRows = _d === void 0 ? [] : _d;
9
+ const { relativePath, requiredRows = [] } = ((_b = (_a = c.buildConfig) === null || _a === void 0 ? void 0 : _a.common) === null || _b === void 0 ? void 0 : _b.releaseNotes) || {};
10
10
  utils_1.fsUtils.assertPath(relativePath);
11
- var fileContent = utils_1.fsUtils.getFileContentAsString(relativePath);
12
- var assertFileContentRow = function (expectedRowContent) {
13
- var errorMsg = relativePath + " should contain following row: \"" + expectedRowContent + "\"";
11
+ const fileContent = utils_1.fsUtils.getFileContentAsString(relativePath);
12
+ const assertFileContentRow = (expectedRowContent) => {
13
+ const errorMsg = `${relativePath} should contain following row: "${expectedRowContent}"`;
14
14
  ok(fileContent.includes(expectedRowContent), errorMsg);
15
15
  };
16
16
  requiredRows.forEach(assertFileContentRow);
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  var _a, _b;
3
- exports.__esModule = true;
4
- var assert_1 = require("assert");
5
- var getBaseConfig_1 = require("../../utils/getBaseConfig");
6
- var utils_1 = require("../utils");
7
- var checkReleaseNotes_1 = require("./checkReleaseNotes");
8
- var ok = assert_1.strict.ok;
9
- var c = getBaseConfig_1.getBaseConfig();
10
- var _c = ((_b = (_a = c.buildConfig) === null || _a === void 0 ? void 0 : _a.common) === null || _b === void 0 ? void 0 : _b.git) || {}, _d = _c.branchNames, branchNames = _d === void 0 ? {} : _d, pullRequestTitles = _c.pullRequestTitles;
11
- var rcBranchName = branchNames.rc;
12
- var distBranchName = branchNames.dist;
13
- var devBranchName = branchNames.dev;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const assert_1 = require("assert");
5
+ const resolvers_1 = require("../../resolvers");
6
+ const utils_1 = require("../utils");
7
+ const checkReleaseNotes_1 = require("./checkReleaseNotes");
8
+ const { ok } = assert_1.strict;
9
+ const c = resolvers_1.getBaseConfig();
10
+ const { branchNames = {}, pullRequestTitles } = ((_b = (_a = c.buildConfig) === null || _a === void 0 ? void 0 : _a.common) === null || _b === void 0 ? void 0 : _b.git) || {};
11
+ const rcBranchName = branchNames.rc;
12
+ const distBranchName = branchNames.dist;
13
+ const devBranchName = branchNames.dev;
14
14
  ok(rcBranchName);
15
15
  ok(distBranchName);
16
16
  ok(devBranchName);
@@ -18,16 +18,16 @@ utils_1.gitUtils.assertCurrentBranch(rcBranchName);
18
18
  utils_1.gitUtils.assertEmptyStatusList();
19
19
  utils_1.gitUtils.assertRemoteBranch(rcBranchName);
20
20
  utils_1.gitUtils.assertRemoteBranch(distBranchName);
21
- var distributionPrTitle = pullRequestTitles.rcToDist;
22
- var developmentPrTitle = pullRequestTitles.rcToDev;
21
+ const distributionPrTitle = pullRequestTitles.rcToDist;
22
+ const developmentPrTitle = pullRequestTitles.rcToDev;
23
23
  ok(distributionPrTitle);
24
24
  ok(developmentPrTitle);
25
25
  utils_1.gitUtils.pull();
26
26
  checkReleaseNotes_1.checkReleaseNotes(c);
27
- console.log("Creating Pull Request from " + rcBranchName + " branch to " + distBranchName + " branch...");
28
- console.log("Applied PR title: \"" + distributionPrTitle + "\"");
27
+ console.log(`Creating Pull Request from ${rcBranchName} branch to ${distBranchName} branch...`);
28
+ console.log(`Applied PR title: "${distributionPrTitle}"`);
29
29
  utils_1.gitUtils.pullRequest(rcBranchName, distBranchName, distributionPrTitle);
30
- console.log("\nCreating Pull Request from " + rcBranchName + " branch to " + devBranchName + " branch...");
31
- console.log("Applied PR title: \"" + developmentPrTitle + "\"");
30
+ console.log(`\nCreating Pull Request from ${rcBranchName} branch to ${devBranchName} branch...`);
31
+ console.log(`Applied PR title: "${developmentPrTitle}"`);
32
32
  utils_1.gitUtils.pullRequest(rcBranchName, devBranchName, developmentPrTitle);
33
33
  console.log('\nDone! Pull requests have been created!');
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- exports.__esModule = true;
3
- var child_process_1 = require("child_process");
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const child_process_1 = require("child_process");
4
4
  console.log('Bumping the version...');
5
- var bumpType = process.argv[2] || 'patch';
6
- child_process_1.execSync("npm --no-git-tag-version version " + bumpType, { stdio: 'inherit' });
5
+ const bumpType = process.argv[2] || 'patch';
6
+ child_process_1.execSync(`npm --no-git-tag-version version ${bumpType}`, { stdio: 'inherit' });
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
  var _a, _b, _c, _d;
3
- exports.__esModule = true;
4
- var assert_1 = require("assert");
5
- var getBaseConfig_1 = require("../../utils/getBaseConfig");
6
- var utils_1 = require("../utils");
7
- var checkReleaseNotes_1 = require("./checkReleaseNotes");
8
- var ok = assert_1.strict.ok;
9
- var c = getBaseConfig_1.getBaseConfig();
10
- var _e = ((_b = (_a = c.buildConfig) === null || _a === void 0 ? void 0 : _a.common) === null || _b === void 0 ? void 0 : _b.git) || {}, _f = _e.branchNames, branchNames = _f === void 0 ? {} : _f, _g = _e.commitTitles, commitTitles = _g === void 0 ? {} : _g, _h = _e.pullRequestTitles, pullRequestTitles = _h === void 0 ? {} : _h;
11
- var _j = (((_d = (_c = c.buildConfig) === null || _c === void 0 ? void 0 : _c.common) === null || _d === void 0 ? void 0 : _d.releaseNotes) || {}).relativePath, relativePath = _j === void 0 ? [] : _j;
12
- var rcBranchName = branchNames.rc;
13
- var releaseNotesBranchName = branchNames.rcReleaseNotes;
14
- var commitTitle = commitTitles.rcReleaseNotes;
15
- var prTitle = pullRequestTitles.releaseNotesToRc;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const assert_1 = require("assert");
5
+ const resolvers_1 = require("../../resolvers");
6
+ const utils_1 = require("../utils");
7
+ const checkReleaseNotes_1 = require("./checkReleaseNotes");
8
+ const { ok } = assert_1.strict;
9
+ const c = resolvers_1.getBaseConfig();
10
+ const { branchNames = {}, commitTitles = {}, pullRequestTitles = {}, } = ((_b = (_a = c.buildConfig) === null || _a === void 0 ? void 0 : _a.common) === null || _b === void 0 ? void 0 : _b.git) || {};
11
+ const { relativePath = [] } = ((_d = (_c = c.buildConfig) === null || _c === void 0 ? void 0 : _c.common) === null || _d === void 0 ? void 0 : _d.releaseNotes) || {};
12
+ const rcBranchName = branchNames.rc;
13
+ const releaseNotesBranchName = branchNames.rcReleaseNotes;
14
+ const commitTitle = commitTitles.rcReleaseNotes;
15
+ const prTitle = pullRequestTitles.releaseNotesToRc;
16
16
  ok(relativePath);
17
17
  ok(releaseNotesBranchName);
18
18
  ok(commitTitle);
@@ -21,13 +21,13 @@ utils_1.gitUtils.assertCurrentBranch(rcBranchName);
21
21
  utils_1.gitUtils.assertRemoteBranch(rcBranchName);
22
22
  checkReleaseNotes_1.checkReleaseNotes(c);
23
23
  utils_1.gitUtils.pull();
24
- var changedFilesCount = utils_1.gitUtils.statusList().length;
24
+ const changedFilesCount = utils_1.gitUtils.statusList().length;
25
25
  if (changedFilesCount === 0) {
26
- console.log("It seems " + relativePath + " file has been updated before.");
26
+ console.log(`It seems ${relativePath} file has been updated before.`);
27
27
  console.log('Skipping making a commit, if needed, please continue on your own (manually).');
28
28
  }
29
29
  else {
30
- ok(changedFilesCount === 1, "Only " + relativePath + " should contain changes!");
30
+ ok(changedFilesCount === 1, `Only ${relativePath} should contain changes!`);
31
31
  utils_1.gitUtils.createBranch(releaseNotesBranchName);
32
32
  utils_1.gitUtils.checkout(releaseNotesBranchName);
33
33
  utils_1.gitUtils.add([relativePath]);
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deleteSourceMaps = void 0;
4
- var child_process_1 = require("child_process");
5
- var executeSync = function (cmd) { return child_process_1.execSync(cmd, { stdio: 'inherit' }); };
6
- var deleteSourceMaps = function (c) {
7
- var platformBuildsDir = c.buildConfig.paths.platformBuildsDir;
8
- executeSync("find " + platformBuildsDir + " -type f -iname \"*.map\" -delete");
4
+ const child_process_1 = require("child_process");
5
+ const executeSync = (cmd) => child_process_1.execSync(cmd, { stdio: 'inherit' });
6
+ const deleteSourceMaps = (c) => {
7
+ const { platformBuildsDir } = c.buildConfig.paths;
8
+ executeSync(`find ${platformBuildsDir} -type f -iname "*.map" -delete`);
9
9
  console.log('Source Maps deleted...');
10
10
  };
11
11
  exports.deleteSourceMaps = deleteSourceMaps;
@@ -2,26 +2,26 @@
2
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
- exports.__esModule = true;
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.deployToAppCenter = void 0;
7
- var child_process_1 = require("child_process");
8
- var fs_1 = __importDefault(require("fs"));
9
- var common_1 = require("rnv/dist/core/common");
10
- var zipBuildsByPlatforms_1 = require("../../utils/zipBuildsByPlatforms");
11
- var urlsMarkdown_1 = require("./urlsMarkdown");
12
- var appCenterRelease = function (params) {
13
- var filePath = params.filePath, releaseNotesPath = params.releaseNotesPath, buildVersion = params.buildVersion, token = params.token, projectName = params.projectName, _a = params.group, group = _a === void 0 ? 'Collaborators' : _a, _b = params.organizationName, organizationName = _b === void 0 ? '24i-Media' : _b;
14
- var app = organizationName + "/" + projectName;
7
+ const child_process_1 = require("child_process");
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const common_1 = require("rnv/dist/core/common");
10
+ const resolvers_1 = require("../../resolvers");
11
+ const urlsMarkdown_1 = require("./urlsMarkdown");
12
+ const appCenterRelease = (params) => {
13
+ const { filePath, releaseNotesPath, buildVersion, token, projectName, group = 'Collaborators', organizationName = '24i-Media', } = params;
14
+ const app = `${organizationName}/${projectName}`;
15
15
  child_process_1.execSync('appcenter distribute release '
16
- + ("--file \"" + filePath + "\" ")
17
- + ("--release-notes-file \"" + releaseNotesPath + "\" ")
18
- + ("--build-version \"" + buildVersion + "\" ")
19
- + ("--app \"" + app + "\" ")
20
- + ("--token \"" + token + "\" ")
21
- + ("--group \"" + group + "\" ")
16
+ + `--file "${filePath}" `
17
+ + `--release-notes-file "${releaseNotesPath}" `
18
+ + `--build-version "${buildVersion}" `
19
+ + `--app "${app}" `
20
+ + `--token "${token}" `
21
+ + `--group "${group}" `
22
22
  + '--disable-telemetry', { stdio: 'inherit' });
23
23
  };
24
- var getAppCenterConfigByPlatformName = function (c, platformName) {
24
+ const getAppCenterConfigByPlatformName = (c, platformName) => {
25
25
  try {
26
26
  return c.buildConfig.platforms[platformName].deploy.appCenter || null;
27
27
  }
@@ -29,40 +29,39 @@ var getAppCenterConfigByPlatformName = function (c, platformName) {
29
29
  return null;
30
30
  }
31
31
  };
32
- var getTokenByPlatform = function (platformName) {
33
- if (platformName === void 0) { platformName = ''; }
34
- var envVariableName = "APPCENTER_TOKEN_" + platformName.toUpperCase();
32
+ const getTokenByPlatform = (platformName = '') => {
33
+ const envVariableName = `APPCENTER_TOKEN_${platformName.toUpperCase()}`;
35
34
  return process.env[envVariableName] || '';
36
35
  };
37
- var processPlatform = function (c, platformName) {
38
- var appCenterConfig = getAppCenterConfigByPlatformName(c, platformName);
36
+ const processPlatform = (c, platformName) => {
37
+ const appCenterConfig = getAppCenterConfigByPlatformName(c, platformName);
39
38
  if (!appCenterConfig)
40
39
  return;
41
- var appName = appCenterConfig.appName;
42
- var token = getTokenByPlatform(platformName);
43
- var zipPath = zipBuildsByPlatforms_1.getZippedPlatformBuildsFilePath(c, platformName);
44
- var buildVersion = common_1.getConfigProp(c, platformName, 'packageVersion', '');
45
- var releaseNotesPath = common_1.getConfigProp(c, platformName, 'releaseNotes', {}).relativePath || '';
40
+ const { appName } = appCenterConfig;
41
+ const token = getTokenByPlatform(platformName);
42
+ const zipPath = resolvers_1.resolveZippedPlatformBuildsRelativeFilePath(c, platformName);
43
+ const buildVersion = common_1.getConfigProp(c, platformName, 'packageVersion', '');
44
+ const releaseNotesPath = common_1.getConfigProp(c, platformName, 'releaseNotes', {}).relativePath || '';
46
45
  if (!appName || !token || !releaseNotesPath || !zipPath || !buildVersion)
47
46
  return;
48
- var tempReleaseNotesPath = "RELEASE_NOTES_APPCENTER_" + platformName.toUpperCase() + ".md";
49
- if (fs_1["default"].existsSync(tempReleaseNotesPath)) {
50
- fs_1["default"].unlinkSync(tempReleaseNotesPath);
47
+ const tempReleaseNotesPath = `RELEASE_NOTES_APPCENTER_${platformName.toUpperCase()}.md`;
48
+ if (fs_1.default.existsSync(tempReleaseNotesPath)) {
49
+ fs_1.default.unlinkSync(tempReleaseNotesPath);
51
50
  }
52
- child_process_1.execSync("cat " + releaseNotesPath + " >> " + tempReleaseNotesPath);
53
- var urlsMarkdown = urlsMarkdown_1.getUrlsMarkdown(c, [platformName]);
54
- child_process_1.execSync("echo \"" + urlsMarkdown + "\" >> " + tempReleaseNotesPath);
55
- console.log("Deploying " + platformName + " platform to AppCenter.ms...");
51
+ child_process_1.execSync(`cat ${releaseNotesPath} >> ${tempReleaseNotesPath}`);
52
+ const urlsMarkdown = urlsMarkdown_1.getUrlsMarkdown(c, [platformName]);
53
+ child_process_1.execSync(`echo "${urlsMarkdown}" >> ${tempReleaseNotesPath}`);
54
+ console.log(`Deploying ${platformName} platform to AppCenter.ms...`);
56
55
  appCenterRelease({
57
56
  projectName: appName,
58
- buildVersion: buildVersion,
57
+ buildVersion,
59
58
  filePath: zipPath,
60
59
  releaseNotesPath: tempReleaseNotesPath,
61
- token: token
60
+ token,
62
61
  });
63
62
  };
64
- var deployToAppCenter = function (c) {
65
- var _a = (c.buildConfig.defaults || {}).supportedPlatforms, supportedPlatforms = _a === void 0 ? [] : _a;
66
- supportedPlatforms.forEach(function (platformName) { return processPlatform(c, platformName); });
63
+ const deployToAppCenter = (c) => {
64
+ const { supportedPlatforms = [] } = c.buildConfig.defaults || {};
65
+ supportedPlatforms.forEach((platformName) => processPlatform(c, platformName));
67
66
  };
68
67
  exports.deployToAppCenter = deployToAppCenter;
@@ -2,36 +2,33 @@
2
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
- exports.__esModule = true;
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.githubRelease = void 0;
7
- var child_process_1 = require("child_process");
8
- var fs_1 = __importDefault(require("fs"));
9
- var assert_1 = require("assert");
10
- var path_1 = require("path");
11
- var zipBuildsByPlatforms_1 = require("../../utils/zipBuildsByPlatforms");
12
- var urlsMarkdown_1 = require("./urlsMarkdown");
13
- var ok = assert_1.strict.ok;
14
- var token = process.env.GITHUB_TOKEN;
15
- var targetCommit = process.env.TRAVIS_COMMIT;
16
- var githubContentType = 'application/vnd.github.v3+json';
17
- var githubReleaseNotesPath = 'RELEASE_NOTES_GITHUB.md';
18
- var handleResponseErrors = function (response) {
19
- var errors = response.errors, message = response.message;
7
+ const child_process_1 = require("child_process");
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const assert_1 = require("assert");
10
+ const path_1 = require("path");
11
+ const resolvers_1 = require("../../resolvers");
12
+ const urlsMarkdown_1 = require("./urlsMarkdown");
13
+ const { ok } = assert_1.strict;
14
+ const token = process.env.GITHUB_TOKEN;
15
+ const targetCommit = process.env.TRAVIS_COMMIT;
16
+ const githubContentType = 'application/vnd.github.v3+json';
17
+ const githubReleaseNotesPath = 'RELEASE_NOTES_GITHUB.md';
18
+ const handleResponseErrors = (response) => {
19
+ const { errors, message } = response;
20
20
  if (message && !errors)
21
- throw new Error("GitHub error: " + message);
21
+ throw new Error(`GitHub error: ${message}`);
22
22
  if (!errors)
23
23
  return;
24
- var makeErrorDetailString = function (error) {
25
- if (error === void 0) { error = {}; }
26
- return Object
27
- .keys(error)
28
- .map(function (key) { return key + ": \"" + error[key] + "\""; })
29
- .join(', ');
30
- };
31
- var errorsDetails = errors.map(makeErrorDetailString);
32
- throw new Error("GitHub error: " + (message || '') + "\n" + errorsDetails.join('\n'));
24
+ const makeErrorDetailString = (error = {}) => Object
25
+ .keys(error)
26
+ .map((key) => `${key}: "${error[key]}"`)
27
+ .join(', ');
28
+ const errorsDetails = errors.map(makeErrorDetailString);
29
+ throw new Error(`GitHub error: ${message || ''}\n${errorsDetails.join('\n')}`);
33
30
  };
34
- var getReleaseNotesPath = function (c) {
31
+ const getReleaseNotesPath = (c) => {
35
32
  try {
36
33
  return c.buildConfig.common.releaseNotes.relativePath || '';
37
34
  }
@@ -39,81 +36,80 @@ var getReleaseNotesPath = function (c) {
39
36
  return '';
40
37
  }
41
38
  };
42
- var deleteFileIfExists = function (filePath) {
43
- if (fs_1["default"].existsSync(filePath)) {
44
- fs_1["default"].unlinkSync(filePath);
39
+ const deleteFileIfExists = (filePath) => {
40
+ if (fs_1.default.existsSync(filePath)) {
41
+ fs_1.default.unlinkSync(filePath);
45
42
  }
46
43
  };
47
- var makeGitHubReleaseNotes = function (c) {
48
- var releaseNotesPath = getReleaseNotesPath(c);
44
+ const makeGitHubReleaseNotes = (c) => {
45
+ const releaseNotesPath = getReleaseNotesPath(c);
49
46
  ok(releaseNotesPath, 'The path to the file with release notes is missing!');
50
47
  deleteFileIfExists(githubReleaseNotesPath);
51
- child_process_1.execSync("sed '1d;2d' " + releaseNotesPath + " >> " + githubReleaseNotesPath);
52
- var textToAppend = urlsMarkdown_1.getUrlsMarkdown(c);
53
- child_process_1.execSync("echo \"" + textToAppend + "\" >> " + githubReleaseNotesPath);
48
+ child_process_1.execSync(`sed '1d;2d' ${releaseNotesPath} >> ${githubReleaseNotesPath}`);
49
+ const textToAppend = urlsMarkdown_1.getUrlsMarkdown(c);
50
+ child_process_1.execSync(`echo "${textToAppend}" >> ${githubReleaseNotesPath}`);
54
51
  };
55
- var createRelease = function (c) {
56
- var _a = c.buildConfig.common, packageVersion = _a.packageVersion, _b = _a.git, git = _b === void 0 ? {} : _b;
57
- var versionLabel = "v" + packageVersion;
52
+ const createRelease = (c) => {
53
+ const { packageVersion, git = {} } = c.buildConfig.common;
54
+ const versionLabel = `v${packageVersion}`;
58
55
  ok(token, 'process.env.GITHUB_TOKEN is not set!');
59
56
  ok(targetCommit, 'process.env.TRAVIS_COMMIT is not set!');
60
57
  ok(git.owner, 'Missing value for rnv config prop: common.git.owner');
61
58
  ok(git.repo, 'Missing value for rnv config prop: common.git.repo');
62
59
  ok(packageVersion);
63
60
  makeGitHubReleaseNotes(c);
64
- var releaseNotesContent = fs_1["default"].readFileSync(githubReleaseNotesPath).toString();
65
- var data = {
61
+ const releaseNotesContent = fs_1.default.readFileSync(githubReleaseNotesPath).toString();
62
+ const data = {
66
63
  tag_name: versionLabel,
67
64
  target_commitish: targetCommit,
68
65
  name: versionLabel,
69
66
  body: releaseNotesContent,
70
67
  draft: false,
71
- prerelease: false
68
+ prerelease: false,
72
69
  };
73
- var url = "https://api.github.com/repos/" + git.owner + "/" + git.repo + "/releases";
74
- var headers = "-H \"Accept: " + githubContentType + "\" -H \"Authorization: token " + token + "\"";
75
- var dataStringWithFixedSingleQuotes = JSON.stringify(data).replace(/'/g, "'\\''");
76
- var cmd = "curl -X POST " + headers + " " + url + " -d '" + dataStringWithFixedSingleQuotes + "'";
77
- console.log("Pushing GitHub Release: " + versionLabel + "...");
78
- var responseString = child_process_1.execSync(cmd, { stdio: 'pipe' }).toString();
79
- var response = JSON.parse(responseString);
70
+ const url = `https://api.github.com/repos/${git.owner}/${git.repo}/releases`;
71
+ const headers = `-H "Accept: ${githubContentType}" -H "Authorization: token ${token}"`;
72
+ const dataStringWithFixedSingleQuotes = JSON.stringify(data).replace(/'/g, "'\\''");
73
+ const cmd = `curl -X POST ${headers} ${url} -d '${dataStringWithFixedSingleQuotes}'`;
74
+ console.log(`Pushing GitHub Release: ${versionLabel}...`);
75
+ const responseString = child_process_1.execSync(cmd, { stdio: 'pipe' }).toString();
76
+ const response = JSON.parse(responseString);
80
77
  handleResponseErrors(response);
81
78
  console.log('Pushing done.');
82
79
  return response;
83
80
  };
84
- var getFileMimeType = function (filepath) {
85
- var cmd = "file --mime-type -b " + filepath;
81
+ const getFileMimeType = (filepath) => {
82
+ const cmd = `file --mime-type -b ${filepath}`;
86
83
  return child_process_1.execSync(cmd, { stdio: 'pipe' })
87
84
  .toString()
88
85
  .replace(/\r?\n/, '');
89
86
  };
90
- var uploadAsset = function (uploadUrl, filePath) {
91
- if (uploadUrl === void 0) { uploadUrl = ''; }
87
+ const uploadAsset = (uploadUrl = '', filePath) => {
92
88
  if (!uploadUrl)
93
89
  return null;
94
- var url = "" + uploadUrl.replace('{?name,label}', '');
95
- var headers = "-H \"Accept: " + githubContentType + "\" -H \"Authorization: token " + token + "\" -H \"content-type: " + getFileMimeType(filePath) + "\" -H \"content-length: " + fs_1["default"].statSync(filePath).size + "\"";
96
- var cmd = "curl --data-binary @\"" + filePath + "\" " + headers + " " + url + "?name=" + path_1.basename(filePath);
97
- console.log("Uploading " + filePath + " asset to created GitHub Release...");
98
- var responseString = child_process_1.execSync(cmd, { stdio: 'pipe' }).toString();
99
- var uploadResponse = JSON.parse(responseString);
90
+ const url = `${uploadUrl.replace('{?name,label}', '')}`;
91
+ const headers = `-H "Accept: ${githubContentType}" -H "Authorization: token ${token}" -H "content-type: ${getFileMimeType(filePath)}" -H "content-length: ${fs_1.default.statSync(filePath).size}"`;
92
+ const cmd = `curl --data-binary @"${filePath}" ${headers} ${url}?name=${path_1.basename(filePath)}`;
93
+ console.log(`Uploading ${filePath} asset to created GitHub Release...`);
94
+ const responseString = child_process_1.execSync(cmd, { stdio: 'pipe' }).toString();
95
+ const uploadResponse = JSON.parse(responseString);
100
96
  handleResponseErrors(uploadResponse);
101
97
  console.log('Uploading done.');
102
98
  return uploadResponse;
103
99
  };
104
- var uploadZipWithPlatformBuilds = function (c, platformName, githubUploadUrl) {
105
- var zipFilePath = zipBuildsByPlatforms_1.getZippedPlatformBuildsFilePath(c, platformName);
100
+ const uploadZipWithPlatformBuilds = (c, platformName, githubUploadUrl) => {
101
+ const zipFilePath = resolvers_1.resolveZippedPlatformBuildsRelativeFilePath(c, platformName);
106
102
  if (zipFilePath) {
107
103
  uploadAsset(githubUploadUrl, zipFilePath);
108
104
  }
109
105
  };
110
- var githubRelease = function (c) {
111
- var releaseResponse = createRelease(c) || {};
112
- var uploadUrl = releaseResponse.upload_url;
106
+ const githubRelease = (c) => {
107
+ const releaseResponse = createRelease(c) || {};
108
+ const uploadUrl = releaseResponse.upload_url;
113
109
  ok(uploadUrl, 'Missing "upload_url" in release response!');
114
- var _a = c.buildConfig.defaults, defaults = _a === void 0 ? {} : _a;
115
- var _b = defaults.supportedPlatforms, supportedPlatforms = _b === void 0 ? [] : _b;
116
- supportedPlatforms.forEach(function (platformName) {
110
+ const { defaults = {} } = c.buildConfig;
111
+ const { supportedPlatforms = [] } = defaults;
112
+ supportedPlatforms.forEach((platformName) => {
117
113
  uploadZipWithPlatformBuilds(c, platformName, uploadUrl);
118
114
  });
119
115
  deleteFileIfExists(githubReleaseNotesPath);
@@ -1,24 +1,19 @@
1
1
  "use strict";
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
3
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
4
- to[j] = from[i];
5
- return to;
6
- };
7
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
8
3
  exports.makeDistributionPayload = exports.makeReleaseCandidatePayload = exports.makeDevelopmentPayload = void 0;
9
- var slackBlockKitBuilder_1 = require("./slackBlockKitBuilder");
10
- var getDeployLocations_1 = require("../../../utils/getDeployLocations");
11
- var getVersionsObject = function (c) {
12
- var _a = (getDeployLocations_1.getDeployLocations(c) || {}).versions, versions = _a === void 0 ? [] : _a;
4
+ const slackBlockKitBuilder_1 = require("./slackBlockKitBuilder");
5
+ const resolvers_1 = require("../../../resolvers");
6
+ const getVersionsObject = (c) => {
7
+ const { versions = [] } = resolvers_1.resolveDeployLocations(c) || {};
13
8
  return versions;
14
9
  };
15
- var getVersion = function (c) { return Object.keys(getVersionsObject(c))[0] || ''; };
16
- var getPlatformsObject = function (c) {
17
- var version = getVersion(c);
18
- var _a = (getVersionsObject(c)[version] || {}).platforms, platforms = _a === void 0 ? {} : _a;
10
+ const getVersion = (c) => Object.keys(getVersionsObject(c))[0] || '';
11
+ const getPlatformsObject = (c) => {
12
+ const version = getVersion(c);
13
+ const { platforms = {} } = getVersionsObject(c)[version] || {};
19
14
  return platforms;
20
15
  };
21
- var getCommonAppName = function (c) {
16
+ const getCommonAppName = (c) => {
22
17
  try {
23
18
  return c.buildConfig.common.appName;
24
19
  }
@@ -26,67 +21,68 @@ var getCommonAppName = function (c) {
26
21
  return '';
27
22
  }
28
23
  };
29
- var makeFlavoursMarkdown = function (platformName, entries) { return entries
30
- .map(function (_a) {
31
- var flavour = _a[0], flavourData = _a[1];
32
- var indexUrl = flavourData.indexUrl, packageUrl = flavourData.packageUrl;
33
- return "- *" + flavour + "* [<" + packageUrl + "|Download>] [<" + indexUrl + "|Open deployed index.html>]";
24
+ const makeFlavoursMarkdown = (platformName, entries) => entries
25
+ .map(([flavour, flavourData]) => {
26
+ const { indexUrl, packageUrl } = flavourData;
27
+ return `- *${flavour}* [<${packageUrl}|Download>] [<${indexUrl}|Open deployed index.html>]`;
34
28
  })
35
- .join('\n'); };
36
- var makePackagePayload = function (c, platformName) {
37
- var platformData = getPlatformsObject(c)[platformName];
38
- var flavoursEntries = Object.entries(platformData);
29
+ .join('\n');
30
+ const makePackagePayload = (c, platformName) => {
31
+ const platformData = getPlatformsObject(c)[platformName];
32
+ const flavoursEntries = Object.entries(platformData);
39
33
  return [
40
34
  slackBlockKitBuilder_1.Divider.plain(),
41
- slackBlockKitBuilder_1.Context.mrkdwns(["Platform: *" + platformName + "*"]),
35
+ slackBlockKitBuilder_1.Context.mrkdwns([`Platform: *${platformName}*`]),
42
36
  slackBlockKitBuilder_1.Context.mrkdwns([makeFlavoursMarkdown(platformName, flavoursEntries)]),
43
37
  ];
44
38
  };
45
- var makePackagesPayload = function (c) {
46
- var platformList = Object.keys(getPlatformsObject(c));
39
+ const makePackagesPayload = (c) => {
40
+ const platformList = Object.keys(getPlatformsObject(c));
47
41
  return platformList
48
- .map(function (platformName) { return makePackagePayload(c, platformName); })
42
+ .map((platformName) => makePackagePayload(c, platformName))
49
43
  .flat();
50
44
  };
51
- var makeHeaderPayload = function (c, _a) {
52
- var _b = _a.title, title = _b === void 0 ? '' : _b, buttons = _a.buttons;
53
- var _c = buttons || {}, travisBuild = _c.travisBuild, gitHubRelease = _c.gitHubRelease;
54
- var _d = c.buildConfig.common.git || {}, owner = _d.owner, repo = _d.repo;
55
- var version = getVersion(c);
45
+ const makeHeaderPayload = (c, { title = '', buttons }) => {
46
+ const { travisBuild, gitHubRelease } = buttons || {};
47
+ const { owner, repo } = c.buildConfig.common.git || {};
48
+ const version = getVersion(c);
56
49
  return [
57
50
  slackBlockKitBuilder_1.Divider.plain(),
58
51
  slackBlockKitBuilder_1.Section.mrkdwn(title),
59
- slackBlockKitBuilder_1.Context.mrkdwns(["Version: *" + version + "*"]),
52
+ slackBlockKitBuilder_1.Context.mrkdwns([`Version: *${version}*`]),
60
53
  slackBlockKitBuilder_1.Actions.buttons([
61
54
  travisBuild ? {
62
55
  text: 'View Travis Build Log',
63
- url: process.env.TRAVIS_BUILD_WEB_URL || "https://travis-ci.com/github/" + owner + "/" + repo + "/branches"
56
+ url: process.env.TRAVIS_BUILD_WEB_URL || `https://travis-ci.com/github/${owner}/${repo}/branches`,
64
57
  } : null,
65
58
  gitHubRelease ? {
66
59
  text: 'View GitHub Release',
67
- url: "https://github.com/" + owner + "/" + repo + "/releases/tag/" + version
60
+ url: `https://github.com/${owner}/${repo}/releases/tag/${version}`,
68
61
  } : null,
69
62
  ].filter(Boolean)),
70
63
  ];
71
64
  };
72
- var makePayload = function (c, title, buttons) { return ({
73
- blocks: __spreadArray(__spreadArray([], makeHeaderPayload(c, { title: title, buttons: buttons })), makePackagesPayload(c))
74
- }); };
75
- var makeDevelopmentPayload = function (c) {
76
- var title = "There are new *development* builds for *" + getCommonAppName(c) + "* app!";
77
- var buttons = { travisBuild: true };
65
+ const makePayload = (c, title, buttons) => ({
66
+ blocks: [
67
+ ...makeHeaderPayload(c, { title, buttons }),
68
+ ...makePackagesPayload(c),
69
+ ],
70
+ });
71
+ const makeDevelopmentPayload = (c) => {
72
+ const title = `There are new *development* builds for *${getCommonAppName(c)}* app!`;
73
+ const buttons = { travisBuild: true };
78
74
  return makePayload(c, title, buttons);
79
75
  };
80
76
  exports.makeDevelopmentPayload = makeDevelopmentPayload;
81
- var makeReleaseCandidatePayload = function (c) {
82
- var title = "There are new *release candidate* builds for *" + getCommonAppName(c) + "* app!";
83
- var buttons = { travisBuild: true };
77
+ const makeReleaseCandidatePayload = (c) => {
78
+ const title = `There are new *release candidate* builds for *${getCommonAppName(c)}* app!`;
79
+ const buttons = { travisBuild: true };
84
80
  return makePayload(c, title, buttons);
85
81
  };
86
82
  exports.makeReleaseCandidatePayload = makeReleaseCandidatePayload;
87
- var makeDistributionPayload = function (c) {
88
- var title = "There are new *distribution* builds for *" + getCommonAppName(c) + "* app!";
89
- var buttons = { travisBuild: true, gitHubRelease: true };
83
+ const makeDistributionPayload = (c) => {
84
+ const title = `There are new *distribution* builds for *${getCommonAppName(c)}* app!`;
85
+ const buttons = { travisBuild: true, gitHubRelease: true };
90
86
  return makePayload(c, title, buttons);
91
87
  };
92
88
  exports.makeDistributionPayload = makeDistributionPayload;