@24i/smartapps-bigscreen-rnv-build-engine 0.0.2-alpha.1315

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 (52) hide show
  1. package/README.md +6 -0
  2. package/dist/src/enginePlatforms.js +18 -0
  3. package/dist/src/index.js +73 -0
  4. package/dist/src/scripts/buildAllWithScheme.js +35 -0
  5. package/dist/src/scripts/gitReleaser/afterVersionBump.js +32 -0
  6. package/dist/src/scripts/gitReleaser/beforeVersionBump.js +24 -0
  7. package/dist/src/scripts/gitReleaser/checkReleaseNotes.js +34 -0
  8. package/dist/src/scripts/gitReleaser/pushRelease.js +54 -0
  9. package/dist/src/scripts/gitReleaser/pushReleaseCandidate.js +11 -0
  10. package/dist/src/scripts/gitReleaser/pushReleaseNotes.js +75 -0
  11. package/dist/src/scripts/release/deleteSourceMaps.js +22 -0
  12. package/dist/src/scripts/release/deployToAppCenter.js +88 -0
  13. package/dist/src/scripts/release/githubRelease.js +152 -0
  14. package/dist/src/scripts/release/notifySlack/makePayload.js +148 -0
  15. package/dist/src/scripts/release/notifySlack/notifySlack.js +48 -0
  16. package/dist/src/scripts/release/notifySlack/slackBlockKitBuilder.js +68 -0
  17. package/dist/src/scripts/release/sentryRelease.js +103 -0
  18. package/dist/src/scripts/release/urlsMarkdown.js +118 -0
  19. package/dist/src/scripts/releaseAllWithScheme.js +106 -0
  20. package/dist/src/scripts/utils/cmdUtils.js +31 -0
  21. package/dist/src/scripts/utils/fsUtils.js +19 -0
  22. package/dist/src/scripts/utils/gitUtils.js +115 -0
  23. package/dist/src/scripts/utils/index.js +16 -0
  24. package/dist/src/scripts/utils/stringUtils.js +10 -0
  25. package/dist/src/sdks/index.js +69 -0
  26. package/dist/src/sdks/sdk-tizen/index.js +536 -0
  27. package/dist/src/sdks/sdk-webos/index.js +392 -0
  28. package/dist/src/sdks/sdk-webpack/index.js +107 -0
  29. package/dist/src/sdks/sdkUtils.js +74 -0
  30. package/dist/src/tasks/deploy/aswS3/aws.js +46 -0
  31. package/dist/src/tasks/deploy/aswS3/deployS3.js +113 -0
  32. package/dist/src/tasks/deploy/hbbtv/deployHbbtv.js +250 -0
  33. package/dist/src/tasks/engineTasks.js +27 -0
  34. package/dist/src/tasks/task.rnv.build.js +188 -0
  35. package/dist/src/tasks/task.rnv.configure.js +107 -0
  36. package/dist/src/tasks/task.rnv.configureSoft.js +83 -0
  37. package/dist/src/tasks/task.rnv.deploy.js +80 -0
  38. package/dist/src/tasks/task.rnv.hooks.run.js +126 -0
  39. package/dist/src/tasks/task.rnv.package.js +66 -0
  40. package/dist/src/tasks/task.rnv.project.configure.js +269 -0
  41. package/dist/src/tasks/task.rnv.start.js +100 -0
  42. package/dist/src/utils/forEachSupportedPlatformFlavour.js +43 -0
  43. package/dist/src/utils/getBaseConfig.js +80 -0
  44. package/dist/src/utils/getDeployLocations.js +112 -0
  45. package/dist/src/utils/getVersionOffset.js +55 -0
  46. package/dist/src/utils/replaceRelevantStringsInConfig/index.js +13 -0
  47. package/dist/src/utils/replaceRelevantStringsInConfig/replaceRelevantStringsInConfig.js +48 -0
  48. package/dist/src/utils/replaceRelevantStringsInConfig/replaceTemplateString.js +91 -0
  49. package/dist/src/utils/resolveBaseUrl.js +56 -0
  50. package/dist/src/utils/resolveBuildVersion.js +61 -0
  51. package/dist/src/utils/zipBuildsByPlatforms.js +95 -0
  52. package/package.json +50 -0
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = exports.taskRnvStart = void 0;
7
+
8
+ var _betterOpn = _interopRequireDefault(require("better-opn"));
9
+
10
+ var _rnv = require("rnv");
11
+
12
+ var _enginePlatforms = require("../enginePlatforms");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
+
16
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
17
+
18
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
19
+
20
+ var getConfigProp = _rnv.Common.getConfigProp;
21
+ var logErrorPlatform = _rnv.PlatformManager.logErrorPlatform;
22
+ var logTask = _rnv.Logger.logTask,
23
+ logError = _rnv.Logger.logError;
24
+ var TASK_START = _rnv.Constants.TASK_START,
25
+ TASK_CONFIGURE = _rnv.Constants.TASK_CONFIGURE,
26
+ REMOTE_DEBUGGER_ENABLED_PLATFORMS = _rnv.Constants.REMOTE_DEBUGGER_ENABLED_PLATFORMS,
27
+ PARAMS = _rnv.Constants.PARAMS;
28
+ var runWebpackServer = _rnv.WebpackUtils.runWebpackServer,
29
+ waitForWebpack = _rnv.WebpackUtils.waitForWebpack;
30
+ var executeTask = _rnv.TaskManager.executeTask;
31
+
32
+ var taskRnvStart = /*#__PURE__*/function () {
33
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(c, parentTask, originTask) {
34
+ var platform, runtime, program, port, hosted, bundleAssets, isWeinreEnabled;
35
+ return regeneratorRuntime.wrap(function _callee$(_context) {
36
+ while (1) {
37
+ switch (_context.prev = _context.next) {
38
+ case 0:
39
+ platform = c.platform, runtime = c.runtime, program = c.program;
40
+ port = runtime.port;
41
+ hosted = program.hosted;
42
+ logTask('taskRnvStart', "parent:".concat(parentTask, " port:").concat(port, " hosted:").concat(!!hosted));
43
+
44
+ if (parentTask) {
45
+ _context.next = 7;
46
+ break;
47
+ }
48
+
49
+ _context.next = 7;
50
+ return executeTask(c, TASK_CONFIGURE, TASK_START, originTask);
51
+
52
+ case 7:
53
+ if (hosted) {
54
+ waitForWebpack(c).then(function () {
55
+ return (0, _betterOpn["default"])("http://".concat(c.runtime.localhost, ":").concat(port, "/"));
56
+ })["catch"](logError);
57
+ }
58
+
59
+ bundleAssets = getConfigProp(c, c.platform, 'bundleAssets');
60
+ isWeinreEnabled = REMOTE_DEBUGGER_ENABLED_PLATFORMS.includes(platform) && !bundleAssets && !hosted;
61
+ _context.t0 = platform;
62
+ _context.next = _context.t0 === _enginePlatforms.enginePlatforms.ENTONE ? 13 : _context.t0 === _enginePlatforms.enginePlatforms.HBBTV ? 13 : _context.t0 === _enginePlatforms.enginePlatforms.TIZEN ? 13 : _context.t0 === _enginePlatforms.enginePlatforms.WEBOS ? 13 : _context.t0 === _enginePlatforms.enginePlatforms.WEBTV ? 13 : 14;
63
+ break;
64
+
65
+ case 13:
66
+ return _context.abrupt("return", runWebpackServer(c, isWeinreEnabled));
67
+
68
+ case 14:
69
+ if (!hosted) {
70
+ _context.next = 16;
71
+ break;
72
+ }
73
+
74
+ return _context.abrupt("return", logError('This platform does not support hosted mode', true));
75
+
76
+ case 16:
77
+ return _context.abrupt("return", logErrorPlatform(c));
78
+
79
+ case 17:
80
+ case "end":
81
+ return _context.stop();
82
+ }
83
+ }
84
+ }, _callee);
85
+ }));
86
+
87
+ return function taskRnvStart(_x, _x2, _x3) {
88
+ return _ref.apply(this, arguments);
89
+ };
90
+ }();
91
+
92
+ exports.taskRnvStart = taskRnvStart;
93
+ var _default = {
94
+ description: 'Starts bundler / server',
95
+ fn: taskRnvStart,
96
+ task: 'start',
97
+ params: PARAMS.withBase(PARAMS.withConfigure()),
98
+ platforms: _enginePlatforms.enginePlatformList
99
+ };
100
+ exports["default"] = _default;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.forEachSupportedPlatformFlavour = void 0;
7
+
8
+ var makeCurrentStateMessage = function makeCurrentStateMessage(supportedPlatforms, platformIndex, supportedFlavours, flavourIndex) {
9
+ var string = "\nProcessing \"".concat(supportedPlatforms[platformIndex], "\" platform");
10
+ string += " (".concat(platformIndex + 1, "/").concat(supportedPlatforms.length, ")");
11
+ string += " and its \"".concat(supportedFlavours[flavourIndex], "\" flavour");
12
+ string += " (".concat(flavourIndex + 1, "/").concat(supportedFlavours.length, ")...");
13
+ return string;
14
+ };
15
+
16
+ var forEachSupportedPlatformFlavour = function forEachSupportedPlatformFlavour(c, cb) {
17
+ var processPlatformFlavours = function processPlatformFlavours(platform, platformIndex, supportedPlatforms) {
18
+ var _c$buildConfig$platfo;
19
+
20
+ var processFlavour = function processFlavour(flavour, flavourIndex, supportedFlavours) {
21
+ console.log(makeCurrentStateMessage(supportedPlatforms, platformIndex, supportedFlavours, flavourIndex));
22
+ return cb({
23
+ platform: platform,
24
+ flavour: flavour,
25
+ scheme: c.runtime.scheme
26
+ });
27
+ };
28
+
29
+ var _ref = ((_c$buildConfig$platfo = c.buildConfig.platforms[platform]) === null || _c$buildConfig$platfo === void 0 ? void 0 : _c$buildConfig$platfo.deploy) || {},
30
+ _ref$supportedFlavour = _ref.supportedFlavours,
31
+ supportedFlavours = _ref$supportedFlavour === void 0 ? [] : _ref$supportedFlavour;
32
+
33
+ supportedFlavours.forEach(processFlavour);
34
+ };
35
+
36
+ var _ref2 = c.buildConfig.defaults || {},
37
+ _ref2$supportedPlatfo = _ref2.supportedPlatforms,
38
+ supportedPlatforms = _ref2$supportedPlatfo === void 0 ? [] : _ref2$supportedPlatfo;
39
+
40
+ supportedPlatforms.forEach(processPlatformFlavours);
41
+ };
42
+
43
+ exports.forEachSupportedPlatformFlavour = forEachSupportedPlatformFlavour;
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isObject = isObject;
7
+ exports.getBaseConfig = void 0;
8
+
9
+ var _fs = _interopRequireDefault(require("fs"));
10
+
11
+ var _path = _interopRequireDefault(require("path"));
12
+
13
+ var ConfigManager = _interopRequireWildcard(require("rnv/dist/core/configManager"));
14
+
15
+ var _replaceRelevantStringsInConfig = require("./replaceRelevantStringsInConfig");
16
+
17
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
18
+
19
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
20
+
21
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
22
+
23
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
24
+
25
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
26
+
27
+ function isObject(item) {
28
+ return item && _typeof(item) === 'object' && !Array.isArray(item);
29
+ }
30
+
31
+ var mergeDeep = function mergeDeep(target) {
32
+ for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
33
+ sources[_key - 1] = arguments[_key];
34
+ }
35
+
36
+ if (!sources.length) return target;
37
+ var source = sources.shift();
38
+
39
+ if (isObject(target) && isObject(source)) {
40
+ for (var key in source) {
41
+ if (isObject(source[key])) {
42
+ if (!target[key]) Object.assign(target, _defineProperty({}, key, {}));
43
+ mergeDeep(target[key], source[key]);
44
+ } else {
45
+ Object.assign(target, _defineProperty({}, key, source[key]));
46
+ }
47
+ }
48
+ }
49
+
50
+ return mergeDeep.apply(void 0, [target].concat(sources));
51
+ };
52
+
53
+ var mergeFileJsonIntoObject = function mergeFileJsonIntoObject() {
54
+ var filePath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
55
+ var targetObject = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
56
+
57
+ var fileContentAsString = _fs["default"].readFileSync(filePath).toString();
58
+
59
+ var fileContentAsJSON = JSON.parse(fileContentAsString);
60
+ mergeDeep(targetObject, fileContentAsJSON);
61
+ };
62
+
63
+ var getBaseConfig = function getBaseConfig() {
64
+ var c = ConfigManager.createRnvConfig({
65
+ ci: true
66
+ }, process);
67
+ c.buildConfig = {};
68
+
69
+ var packageJsonfileContent = _fs["default"].readFileSync('package.json').toString();
70
+
71
+ c.files.project["package"] = JSON.parse(packageJsonfileContent); // renative.json
72
+
73
+ mergeFileJsonIntoObject(c.paths.project.config, c.buildConfig); // appConfigs/base/renative.json
74
+
75
+ mergeFileJsonIntoObject(_path["default"].join(c.paths.project.appConfigBase.dir, 'renative.json'), c.buildConfig);
76
+ (0, _replaceRelevantStringsInConfig.replaceRelevantStringsInConfig)(c);
77
+ return c;
78
+ };
79
+
80
+ exports.getBaseConfig = getBaseConfig;
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getDeployLocations = void 0;
7
+
8
+ var _fs = _interopRequireDefault(require("fs"));
9
+
10
+ var _common = require("rnv/dist/core/common");
11
+
12
+ var _deployHbbtv = require("../tasks/deploy/hbbtv/deployHbbtv");
13
+
14
+ var _resolveBaseUrl = require("./resolveBaseUrl");
15
+
16
+ var _resolveBuildVersion = require("./resolveBuildVersion");
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
+
20
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
21
+
22
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
23
+
24
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
25
+
26
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
27
+
28
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
29
+
30
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
31
+
32
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
33
+
34
+ var getBuildVersion = function getBuildVersion(c) {
35
+ var platform = c.platform,
36
+ runtime = c.runtime;
37
+ var scheme = runtime.scheme,
38
+ appId = runtime.appId;
39
+ return (0, _resolveBuildVersion.resolveBuildVersion)({
40
+ platform: platform,
41
+ scheme: scheme,
42
+ appConfigId: appId
43
+ });
44
+ };
45
+
46
+ var getSupportedPlatforms = function getSupportedPlatforms(c) {
47
+ var _ref = c.buildConfig.defaults || {},
48
+ _ref$supportedPlatfor = _ref.supportedPlatforms,
49
+ supportedPlatforms = _ref$supportedPlatfor === void 0 ? [] : _ref$supportedPlatfor;
50
+
51
+ return supportedPlatforms;
52
+ };
53
+
54
+ var getSupportedFlavoursForPlatform = function getSupportedFlavoursForPlatform(c, platformName) {
55
+ var _c$buildConfig$platfo;
56
+
57
+ var _ref2 = ((_c$buildConfig$platfo = c.buildConfig.platforms[platformName]) === null || _c$buildConfig$platfo === void 0 ? void 0 : _c$buildConfig$platfo.deploy) || {},
58
+ _ref2$supportedFlavou = _ref2.supportedFlavours,
59
+ supportedFlavours = _ref2$supportedFlavou === void 0 ? [] : _ref2$supportedFlavou;
60
+
61
+ return supportedFlavours;
62
+ };
63
+
64
+ var makeOutputObject = function makeOutputObject() {
65
+ var buildVersion = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
66
+ return {
67
+ versions: _defineProperty({}, buildVersion, {
68
+ platforms: {}
69
+ })
70
+ };
71
+ };
72
+
73
+ var makeUrls = function makeUrls(c, platformName, flavourName) {
74
+ var isHbbTVPlatform = platformName === 'hbbtv';
75
+ var baseUrl = (0, _resolveBaseUrl.resolveBaseUrl)({
76
+ platform: platformName,
77
+ scheme: c.runtime.scheme || '',
78
+ appConfigId: flavourName
79
+ });
80
+ if (!baseUrl) return;
81
+ var packageOutputDirPath = "platformBuilds/".concat(flavourName, "_").concat(platformName, "/output");
82
+
83
+ var outputFilenameList = _fs["default"].readdirSync(packageOutputDirPath);
84
+
85
+ var packageFileName = outputFilenameList[0];
86
+ var packageUrl = packageFileName ? "".concat(baseUrl, "/build/").concat(packageFileName) : '';
87
+ var indexUrl = isHbbTVPlatform ? (0, _deployHbbtv.getHbbTVDeployUrl)(c, c.runtime.scheme, flavourName) : "".concat(baseUrl, "/public/index.html");
88
+ return {
89
+ packageUrl: packageUrl,
90
+ indexUrl: indexUrl
91
+ };
92
+ };
93
+
94
+ var getDeployLocations = function getDeployLocations(c) {
95
+ var buildVersion = getBuildVersion(c);
96
+ var output = makeOutputObject(buildVersion);
97
+ var outputPlatforms = output.versions[buildVersion].platforms;
98
+
99
+ var processPlatform = function processPlatform(platformName) {
100
+ var processPlatformFlavour = function processPlatformFlavour(flavourName) {
101
+ return _defineProperty({}, flavourName, makeUrls(c, platformName, flavourName));
102
+ };
103
+
104
+ var outputPlatformData = getSupportedFlavoursForPlatform(c, platformName).map(processPlatformFlavour);
105
+ outputPlatforms[platformName] = Object.assign.apply(Object, [{}].concat(_toConsumableArray(outputPlatformData)));
106
+ };
107
+
108
+ getSupportedPlatforms(c).forEach(processPlatform);
109
+ return output;
110
+ };
111
+
112
+ exports.getDeployLocations = getDeployLocations;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getVersionOffset = void 0;
7
+
8
+ var _child_process = require("child_process");
9
+
10
+ var getCurrentGitBranchName = function getCurrentGitBranchName() {
11
+ if (process.env.BRANCH) return process.env.BRANCH; // exported in Travis CI config
12
+
13
+ var gitCommand = 'git branch --show-current';
14
+ return (0, _child_process.execSync)(gitCommand, {
15
+ stdio: 'pipe'
16
+ }).toString().trim();
17
+ };
18
+
19
+ var getMergedPullRequestsOffsetFromBranch = function getMergedPullRequestsOffsetFromBranch(branchName) {
20
+ var defaultValue = '';
21
+
22
+ try {
23
+ var mergeTitleRegex = '^Merge pull request #'; // it's a default title for GitHub
24
+
25
+ var cmd = "git rev-list --count --merges --grep=\"".concat(mergeTitleRegex, "\" HEAD ^origin/").concat(branchName);
26
+ var diffCount = (0, _child_process.execSync)(cmd, {
27
+ stdio: 'pipe'
28
+ }).toString().trim();
29
+ var diffCountNumeric = parseInt(diffCount, 10);
30
+ return diffCountNumeric > 0 ? String(diffCountNumeric) : defaultValue;
31
+ } catch (error) {
32
+ return defaultValue;
33
+ }
34
+ };
35
+
36
+ var getVersionOffset = function getVersionOffset(c) {
37
+ var _c$buildConfig, _c$buildConfig$common;
38
+
39
+ var _ref = ((_c$buildConfig = c.buildConfig) === null || _c$buildConfig === void 0 ? void 0 : (_c$buildConfig$common = _c$buildConfig.common) === null || _c$buildConfig$common === void 0 ? void 0 : _c$buildConfig$common.git) || {},
40
+ _ref$branchNames = _ref.branchNames,
41
+ branchNames = _ref$branchNames === void 0 ? {} : _ref$branchNames;
42
+
43
+ switch (getCurrentGitBranchName()) {
44
+ case branchNames.dev:
45
+ return getMergedPullRequestsOffsetFromBranch(branchNames.dist);
46
+
47
+ case branchNames.rc:
48
+ return getMergedPullRequestsOffsetFromBranch(branchNames.dev);
49
+
50
+ default:
51
+ return '';
52
+ }
53
+ };
54
+
55
+ exports.getVersionOffset = getVersionOffset;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "replaceRelevantStringsInConfig", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _replaceRelevantStringsInConfig.replaceRelevantStringsInConfig;
10
+ }
11
+ });
12
+
13
+ var _replaceRelevantStringsInConfig = require("./replaceRelevantStringsInConfig");
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.replaceRelevantStringsInConfig = void 0;
7
+
8
+ var _replaceTemplateString = require("./replaceTemplateString");
9
+
10
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
11
+
12
+ var processObject = function processObject(c, object) {
13
+ var excludedPropsList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
14
+ if (!object) return;
15
+ var objectKeys = Object.keys(object);
16
+
17
+ var processStringValue = function processStringValue(string, objectKeyName) {
18
+ var replacedString = (0, _replaceTemplateString.replaceTemplateString)(c, string);
19
+
20
+ if (replacedString !== string) {
21
+ object[objectKeyName] = replacedString;
22
+ }
23
+ };
24
+
25
+ objectKeys.forEach(function (key) {
26
+ var keyValue = object[key];
27
+
28
+ if (typeof keyValue === 'string') {
29
+ processStringValue(keyValue, key);
30
+ } else if (_typeof(keyValue) === 'object' && keyValue !== null) {
31
+ if (!excludedPropsList.includes(key)) {
32
+ processObject(c, keyValue);
33
+ }
34
+ }
35
+ });
36
+ };
37
+
38
+ var replaceRelevantStringsInConfig = function replaceRelevantStringsInConfig(c) {
39
+ var _c$buildConfig = c.buildConfig,
40
+ defaults = _c$buildConfig.defaults,
41
+ common = _c$buildConfig.common,
42
+ platforms = _c$buildConfig.platforms;
43
+ processObject(c, defaults);
44
+ processObject(c, common, ['']);
45
+ processObject(c, platforms);
46
+ };
47
+
48
+ exports.replaceRelevantStringsInConfig = replaceRelevantStringsInConfig;
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.replaceTemplateString = void 0;
7
+
8
+ var _rnv = require("rnv");
9
+
10
+ var _getVersionOffset = require("../getVersionOffset");
11
+
12
+ var getConfigProp = _rnv.Common.getConfigProp;
13
+
14
+ var getValueFromConfigByStringPath = function getValueFromConfigByStringPath(c) {
15
+ var stringPathToObjectProp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
16
+ var pathToPropList = stringPathToObjectProp.split('.');
17
+ var listLength = pathToPropList.length;
18
+ var currentPropValue = c;
19
+
20
+ try {
21
+ for (var i = 1; i < listLength; i++) {
22
+ // i = 1 to skip processing parent (base) object
23
+ currentPropValue = currentPropValue[pathToPropList[i]];
24
+
25
+ if (currentPropValue === undefined) {
26
+ return null;
27
+ }
28
+ }
29
+
30
+ return currentPropValue;
31
+ } catch (error) {
32
+ return null;
33
+ }
34
+ };
35
+
36
+ var getValue = function getValue(c) {
37
+ var stringInsideBracelets = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
38
+
39
+ if (stringInsideBracelets.startsWith('c.')) {
40
+ return getValueFromConfigByStringPath(c, stringInsideBracelets);
41
+ }
42
+
43
+ if (stringInsideBracelets.startsWith('configProps.')) {
44
+ return getConfigProp(c, c.platform, stringInsideBracelets.replace('configProps.', ''));
45
+ }
46
+
47
+ if (stringInsideBracelets === 'BRANCH_COMMIT_OFFSET') {
48
+ return (0, _getVersionOffset.getVersionOffset)(c);
49
+ }
50
+
51
+ return stringInsideBracelets;
52
+ };
53
+
54
+ var handleStringEnd = function handleStringEnd(string) {
55
+ // string ends with "[[X]]" - instead X, there can be any char(s) except "[" and "]"
56
+ var outputString = string.replace(/\[\[[^[\]]+]]$/, '');
57
+ var matches = outputString.match(/\[\[[^[\]]+]]/g);
58
+ if (!matches || !matches.length) return outputString;
59
+
60
+ var getStringInside = function getStringInside() {
61
+ var templateString = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
62
+ return templateString.slice(2, -2);
63
+ };
64
+
65
+ var removeBracelets = function removeBracelets(match) {
66
+ outputString = outputString.replace(match, getStringInside(match));
67
+ };
68
+
69
+ matches.forEach(removeBracelets);
70
+ return outputString;
71
+ };
72
+
73
+ var injectorStartMark = '{{';
74
+ var injectorEndMark = '}}';
75
+ var injectorRegexp = new RegExp("".concat(injectorStartMark, ".*?").concat(injectorEndMark), 'g');
76
+
77
+ var replaceTemplateString = function replaceTemplateString(c) {
78
+ var string = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
79
+ if (!string || typeof string !== 'string') return '';
80
+
81
+ var replacer = function replacer(match) {
82
+ var stringBetweenBracelets = match.slice(injectorStartMark.length, -injectorEndMark.length);
83
+ var value = getValue(c, stringBetweenBracelets);
84
+ return value === match ? value : replaceTemplateString(c, value);
85
+ };
86
+
87
+ var parsedString = string.replace(injectorRegexp, replacer);
88
+ return handleStringEnd(parsedString);
89
+ };
90
+
91
+ exports.replaceTemplateString = replaceTemplateString;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.resolveBaseUrl = void 0;
7
+
8
+ var _getBaseConfig = require("./getBaseConfig");
9
+
10
+ var resolveBaseUrl = function resolveBaseUrl(_ref) {
11
+ var _c$buildConfig, _deploy$aws;
12
+
13
+ var _ref$platform = _ref.platform,
14
+ platform = _ref$platform === void 0 ? '' : _ref$platform,
15
+ _ref$scheme = _ref.scheme,
16
+ scheme = _ref$scheme === void 0 ? '' : _ref$scheme,
17
+ _ref$appConfigId = _ref.appConfigId,
18
+ appConfigId = _ref$appConfigId === void 0 ? '' : _ref$appConfigId;
19
+ var c = (0, _getBaseConfig.getBaseConfig)();
20
+ c.platform = platform;
21
+ c.runtime.scheme = scheme;
22
+ c.runtime.appConfigId = appConfigId;
23
+
24
+ var _ref2 = ((_c$buildConfig = c.buildConfig) === null || _c$buildConfig === void 0 ? void 0 : _c$buildConfig.common) || {},
25
+ _ref2$packageVersion = _ref2.packageVersion,
26
+ packageVersion = _ref2$packageVersion === void 0 ? '' : _ref2$packageVersion,
27
+ _ref2$deploy = _ref2.deploy,
28
+ deploy = _ref2$deploy === void 0 ? {} : _ref2$deploy;
29
+
30
+ var bucketName = ((_deploy$aws = deploy.aws3) === null || _deploy$aws === void 0 ? void 0 : _deploy$aws.bucketName) || '';
31
+ var bucketUrl = "http://".concat(bucketName, ".s3.amazonaws.com");
32
+ var appFolderUrl = "".concat(bucketUrl, "/builds/").concat(platform, "/").concat(appConfigId);
33
+
34
+ if (!packageVersion) {
35
+ return '';
36
+ }
37
+
38
+ switch (scheme) {
39
+ case 'dev:latest':
40
+ return "".concat(appFolderUrl, "/latest/dev");
41
+
42
+ case 'rc:latest':
43
+ return "".concat(appFolderUrl, "/latest/rc");
44
+
45
+ case 'release:latest':
46
+ return "".concat(appFolderUrl, "/latest/release");
47
+
48
+ case 'release:dist':
49
+ return "".concat(appFolderUrl, "/dist/v").concat(packageVersion);
50
+
51
+ default:
52
+ return '';
53
+ }
54
+ };
55
+
56
+ exports.resolveBaseUrl = resolveBaseUrl;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.resolveBuildVersion = void 0;
7
+
8
+ var _getBaseConfig = require("./getBaseConfig");
9
+
10
+ var _getVersionOffset = require("./getVersionOffset");
11
+
12
+ var resolvePackageVersion = function resolvePackageVersion(c) {
13
+ return c.buildConfig.common.packageVersion || '';
14
+ };
15
+
16
+ var resolveBuildType = function resolveBuildType(c) {
17
+ switch (c.runtime.scheme) {
18
+ case 'debug':
19
+ return '.debug';
20
+
21
+ case 'dev':
22
+ case 'dev:latest':
23
+ return '.dev';
24
+
25
+ case 'rc':
26
+ case 'rc:latest':
27
+ return '.rc';
28
+
29
+ case 'release':
30
+ case 'release:latest':
31
+ case 'release:dist':
32
+ return '';
33
+
34
+ default:
35
+ throw new Error("resolveBuildType: scheme \"".concat(c.runtime.scheme, "\" is not defined!"));
36
+ }
37
+ };
38
+
39
+ var resolveVersionOffset = function resolveVersionOffset(c) {
40
+ var versionOffsetString = (0, _getVersionOffset.getVersionOffset)(c);
41
+ return versionOffsetString ? "-".concat(versionOffsetString) : '';
42
+ };
43
+
44
+ var resolveBuildVersion = function resolveBuildVersion(_ref) {
45
+ var _ref$platform = _ref.platform,
46
+ platform = _ref$platform === void 0 ? '' : _ref$platform,
47
+ _ref$scheme = _ref.scheme,
48
+ scheme = _ref$scheme === void 0 ? '' : _ref$scheme,
49
+ _ref$appConfigId = _ref.appConfigId,
50
+ appConfigId = _ref$appConfigId === void 0 ? '' : _ref$appConfigId;
51
+ var c = (0, _getBaseConfig.getBaseConfig)();
52
+ c.platform = platform;
53
+ c.runtime.scheme = scheme;
54
+ c.runtime.appConfigId = appConfigId;
55
+ var packageVersion = resolvePackageVersion(c);
56
+ var buildType = resolveBuildType(c);
57
+ var maybeGitCommitsOffset = resolveVersionOffset(c);
58
+ return "v".concat(packageVersion).concat(buildType).concat(maybeGitCommitsOffset);
59
+ };
60
+
61
+ exports.resolveBuildVersion = resolveBuildVersion;