@24i/smartapps-bigscreen-rnv-build-engine 0.0.2-alpha.1343 → 0.0.2-alpha.1345

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 (144) hide show
  1. package/dist/src/constants/buildSchemes.js +11 -14
  2. package/dist/src/constants/index.js +6 -20
  3. package/dist/src/constants/platforms.js +8 -11
  4. package/dist/src/index.js +68 -79
  5. package/dist/src/resolvers/index.js +20 -76
  6. package/dist/src/resolvers/resolveBaseUrl.js +29 -55
  7. package/dist/src/resolvers/resolveBuildVersion.js +37 -58
  8. package/dist/src/resolvers/resolveBuildVersionOffset.js +30 -49
  9. package/dist/src/resolvers/resolveDeployLocations.js +62 -106
  10. package/dist/src/resolvers/resolveGenericRnvConfig.js +61 -68
  11. package/dist/src/resolvers/resolveHbbtvDeployConfig.js +5 -12
  12. package/dist/src/resolvers/resolveHbbtvDeployUrl.js +8 -17
  13. package/dist/src/resolvers/resolveHbbtvRemoteBuildDirRelativePath.js +24 -40
  14. package/dist/src/resolvers/resolveZippedPlatformBuildsRelativeFilePath.js +12 -18
  15. package/dist/src/scripts/buildAllWithScheme.js +21 -32
  16. package/dist/src/scripts/gitReleaser/afterVersionBump.js +17 -31
  17. package/dist/src/scripts/gitReleaser/beforeVersionBump.js +10 -20
  18. package/dist/src/scripts/gitReleaser/checkReleaseNotes.js +15 -31
  19. package/dist/src/scripts/gitReleaser/pushRelease.js +27 -48
  20. package/dist/src/scripts/gitReleaser/pushReleaseCandidate.js +4 -9
  21. package/dist/src/scripts/gitReleaser/pushReleaseNotes.js +33 -63
  22. package/dist/src/scripts/release/deleteSourceMaps.js +8 -19
  23. package/dist/src/scripts/release/deployToAppCenter.js +60 -81
  24. package/dist/src/scripts/release/githubRelease.js +106 -142
  25. package/dist/src/scripts/release/notifySlack/makePayload.js +75 -136
  26. package/dist/src/scripts/release/notifySlack/notifySlack.js +37 -43
  27. package/dist/src/scripts/release/notifySlack/slackBlockKitBuilder.js +27 -56
  28. package/dist/src/scripts/release/sentryRelease.js +62 -96
  29. package/dist/src/scripts/release/urlsMarkdown.js +51 -109
  30. package/dist/src/scripts/releaseAllWithScheme.js +69 -97
  31. package/dist/src/scripts/utils/cmdUtils.js +10 -29
  32. package/dist/src/scripts/utils/fsUtils.js +9 -16
  33. package/dist/src/scripts/utils/gitUtils.js +68 -108
  34. package/dist/src/scripts/utils/index.js +9 -14
  35. package/dist/src/scripts/utils/stringUtils.js +3 -8
  36. package/dist/src/sdks/index.js +35 -59
  37. package/dist/src/sdks/sdk-tizen/index.js +203 -517
  38. package/dist/src/sdks/sdk-webos/index.js +138 -377
  39. package/dist/src/sdks/sdk-webpack/index.js +25 -100
  40. package/dist/src/sdks/sdkUtils.js +15 -71
  41. package/dist/src/tasks/deploy/aswS3/aws.js +21 -41
  42. package/dist/src/tasks/deploy/aswS3/deployS3.js +70 -105
  43. package/dist/src/tasks/deploy/hbbtv/deployHbbtv.js +96 -199
  44. package/dist/src/tasks/engineTasks.js +20 -23
  45. package/dist/src/tasks/task.rnv.build.js +101 -176
  46. package/dist/src/tasks/task.rnv.configure.js +46 -103
  47. package/dist/src/tasks/task.rnv.configureSoft.js +27 -79
  48. package/dist/src/tasks/task.rnv.deploy.js +33 -76
  49. package/dist/src/tasks/task.rnv.hooks.run.js +55 -122
  50. package/dist/src/tasks/task.rnv.package.js +23 -62
  51. package/dist/src/tasks/task.rnv.project.configure.js +104 -261
  52. package/dist/src/tasks/task.rnv.start.js +48 -95
  53. package/dist/src/types/c.js +2 -0
  54. package/dist/src/types/index.js +2 -0
  55. package/dist/src/utils/forEachSupportedPlatformFlavour.js +19 -38
  56. package/dist/src/utils/replaceRelevantStringsInConfig/index.js +4 -12
  57. package/dist/src/utils/replaceRelevantStringsInConfig/replaceRelevantStringsInConfig.js +29 -44
  58. package/dist/src/utils/replaceRelevantStringsInConfig/replaceTemplateString.js +54 -83
  59. package/dist/src/utils/zipBuildsByPlatforms.js +42 -77
  60. package/dist/templates/platforms/_shared/template.js +76 -91
  61. package/dist/templates/platforms/_shared/webpack.base.js +244 -271
  62. package/dist/templates/platforms/entone/webpack.config.dev.js +46 -46
  63. package/dist/templates/platforms/entone/webpack.config.prod.js +40 -40
  64. package/dist/templates/platforms/hbbtv/webpack.config.dev.js +63 -50
  65. package/dist/templates/platforms/hbbtv/webpack.config.prod.js +57 -44
  66. package/dist/templates/platforms/tizen/webpack.config.dev.js +47 -47
  67. package/dist/templates/platforms/tizen/webpack.config.prod.js +40 -40
  68. package/dist/templates/platforms/webos/project/public/content/js/webOSTVjs-1.2.3/webOSTV.js +1 -391
  69. package/dist/templates/platforms/webos/webpack.config.dev.js +50 -48
  70. package/dist/templates/platforms/webos/webpack.config.prod.js +42 -40
  71. package/dist/templates/platforms/webtv/webpack.config.dev.js +46 -46
  72. package/dist/templates/platforms/webtv/webpack.config.prod.js +40 -40
  73. package/dist/types/src/constants/buildSchemes.d.ts +11 -0
  74. package/dist/types/src/constants/index.d.ts +2 -0
  75. package/dist/types/src/constants/platforms.d.ts +8 -0
  76. package/dist/types/src/index.d.ts +18 -0
  77. package/dist/types/src/resolvers/index.d.ts +9 -0
  78. package/dist/types/src/resolvers/resolveBaseUrl.d.ts +6 -0
  79. package/dist/types/src/resolvers/resolveBuildVersion.d.ts +6 -0
  80. package/dist/types/src/resolvers/resolveBuildVersionOffset.d.ts +3 -0
  81. package/dist/types/src/resolvers/resolveDeployLocations.d.ts +9 -0
  82. package/dist/types/src/resolvers/resolveGenericRnvConfig.d.ts +4 -0
  83. package/dist/types/src/resolvers/resolveHbbtvDeployConfig.d.ts +10 -0
  84. package/dist/types/src/resolvers/resolveHbbtvDeployUrl.d.ts +3 -0
  85. package/dist/types/src/resolvers/resolveHbbtvRemoteBuildDirRelativePath.d.ts +3 -0
  86. package/dist/types/src/resolvers/resolveZippedPlatformBuildsRelativeFilePath.d.ts +3 -0
  87. package/dist/types/src/scripts/buildAllWithScheme.d.ts +1 -0
  88. package/dist/types/src/scripts/gitReleaser/afterVersionBump.d.ts +1 -0
  89. package/dist/types/src/scripts/gitReleaser/beforeVersionBump.d.ts +1 -0
  90. package/dist/types/src/scripts/gitReleaser/checkReleaseNotes.d.ts +1 -0
  91. package/dist/types/src/scripts/gitReleaser/pushRelease.d.ts +1 -0
  92. package/dist/types/src/scripts/gitReleaser/pushReleaseCandidate.d.ts +1 -0
  93. package/dist/types/src/scripts/gitReleaser/pushReleaseNotes.d.ts +1 -0
  94. package/dist/types/src/scripts/release/deleteSourceMaps.d.ts +1 -0
  95. package/dist/types/src/scripts/release/deployToAppCenter.d.ts +1 -0
  96. package/dist/types/src/scripts/release/githubRelease.d.ts +1 -0
  97. package/dist/types/src/scripts/release/notifySlack/makePayload.d.ts +15 -0
  98. package/dist/types/src/scripts/release/notifySlack/notifySlack.d.ts +1 -0
  99. package/dist/types/src/scripts/release/notifySlack/slackBlockKitBuilder.d.ts +26 -0
  100. package/dist/types/src/scripts/release/sentryRelease.d.ts +1 -0
  101. package/dist/types/src/scripts/release/urlsMarkdown.d.ts +1 -0
  102. package/dist/types/src/scripts/releaseAllWithScheme.d.ts +1 -0
  103. package/dist/types/src/scripts/utils/cmdUtils.d.ts +4 -0
  104. package/dist/types/src/scripts/utils/fsUtils.d.ts +2 -0
  105. package/dist/types/src/scripts/utils/gitUtils.d.ts +14 -0
  106. package/dist/types/src/scripts/utils/index.d.ts +5 -0
  107. package/dist/types/src/scripts/utils/stringUtils.d.ts +1 -0
  108. package/dist/types/src/sdks/index.d.ts +5 -0
  109. package/dist/types/src/sdks/sdk-tizen/index.d.ts +5 -0
  110. package/dist/types/src/sdks/sdk-webos/index.d.ts +4 -0
  111. package/dist/types/src/sdks/sdk-webpack/index.d.ts +4 -0
  112. package/dist/types/src/sdks/sdkUtils.d.ts +2 -0
  113. package/dist/types/src/tasks/deploy/aswS3/aws.d.ts +2 -0
  114. package/dist/types/src/tasks/deploy/aswS3/deployS3.d.ts +1 -0
  115. package/dist/types/src/tasks/deploy/hbbtv/deployHbbtv.d.ts +1 -0
  116. package/dist/types/src/tasks/engineTasks.d.ts +13 -0
  117. package/dist/types/src/tasks/task.rnv.build.d.ts +9 -0
  118. package/dist/types/src/tasks/task.rnv.configure.d.ts +9 -0
  119. package/dist/types/src/tasks/task.rnv.configureSoft.d.ts +9 -0
  120. package/dist/types/src/tasks/task.rnv.deploy.d.ts +9 -0
  121. package/dist/types/src/tasks/task.rnv.hooks.run.d.ts +13 -0
  122. package/dist/types/src/tasks/task.rnv.package.d.ts +9 -0
  123. package/dist/types/src/tasks/task.rnv.project.configure.d.ts +9 -0
  124. package/dist/types/src/tasks/task.rnv.start.d.ts +9 -0
  125. package/dist/types/src/types/c.d.ts +316 -0
  126. package/dist/types/src/types/index.d.ts +1 -0
  127. package/dist/types/src/utils/forEachSupportedPlatformFlavour.d.ts +1 -0
  128. package/dist/types/src/utils/replaceRelevantStringsInConfig/index.d.ts +1 -0
  129. package/dist/types/src/utils/replaceRelevantStringsInConfig/replaceRelevantStringsInConfig.d.ts +1 -0
  130. package/dist/types/src/utils/replaceRelevantStringsInConfig/replaceTemplateString.d.ts +1 -0
  131. package/dist/types/src/utils/zipBuildsByPlatforms.d.ts +1 -0
  132. package/dist/types/templates/platforms/_shared/template.d.ts +2 -0
  133. package/dist/types/templates/platforms/_shared/webpack.base.d.ts +1 -0
  134. package/dist/types/templates/platforms/entone/webpack.config.dev.d.ts +2 -0
  135. package/dist/types/templates/platforms/entone/webpack.config.prod.d.ts +2 -0
  136. package/dist/types/templates/platforms/hbbtv/webpack.config.dev.d.ts +2 -0
  137. package/dist/types/templates/platforms/hbbtv/webpack.config.prod.d.ts +2 -0
  138. package/dist/types/templates/platforms/tizen/webpack.config.dev.d.ts +2 -0
  139. package/dist/types/templates/platforms/tizen/webpack.config.prod.d.ts +2 -0
  140. package/dist/types/templates/platforms/webos/webpack.config.dev.d.ts +2 -0
  141. package/dist/types/templates/platforms/webos/webpack.config.prod.d.ts +2 -0
  142. package/dist/types/templates/platforms/webtv/webpack.config.dev.d.ts +2 -0
  143. package/dist/types/templates/platforms/webtv/webpack.config.prod.d.ts +2 -0
  144. package/package.json +14 -17
@@ -1,74 +1,18 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.installSdk = exports.registerSdkPath = void 0;
7
-
8
- 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; }
9
-
10
- 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); } }
11
-
12
- 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); }); }; }
13
-
14
- var _require = require('rnv'),
15
- FileUtils = _require.FileUtils;
16
-
17
- var _require2 = require('@24i/smartapps-bigscreen-sdk-installer'),
18
- sdkInstaller = _require2.sdkInstaller;
19
-
20
- var registerSdkPath = /*#__PURE__*/function () {
21
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(c, sdkKey, sdkValue) {
22
- var rnvWorkspaceConfigPath, customObjectToMerge;
23
- return regeneratorRuntime.wrap(function _callee$(_context) {
24
- while (1) {
25
- switch (_context.prev = _context.next) {
26
- case 0:
27
- rnvWorkspaceConfigPath = c.paths.workspace.config;
28
- customObjectToMerge = {
29
- sdks: _defineProperty({}, sdkKey, sdkValue)
30
- };
31
- FileUtils.updateObjectSync(rnvWorkspaceConfigPath, customObjectToMerge);
32
- Object.assign(c.buildConfig, customObjectToMerge);
33
-
34
- case 4:
35
- case "end":
36
- return _context.stop();
37
- }
38
- }
39
- }, _callee);
40
- }));
41
-
42
- return function registerSdkPath(_x, _x2, _x3) {
43
- return _ref.apply(this, arguments);
44
- };
45
- }();
46
-
4
+ const { FileUtils } = require('rnv');
5
+ const { sdkInstaller } = require('@24i/smartapps-bigscreen-sdk-installer');
6
+ const registerSdkPath = async (c, sdkKey, sdkValue) => {
7
+ const rnvWorkspaceConfigPath = c.paths.workspace.config;
8
+ const customObjectToMerge = { sdks: { [sdkKey]: sdkValue } };
9
+ FileUtils.updateObjectSync(rnvWorkspaceConfigPath, customObjectToMerge);
10
+ Object.assign(c.buildConfig, customObjectToMerge);
11
+ };
47
12
  exports.registerSdkPath = registerSdkPath;
48
-
49
- var installSdk = /*#__PURE__*/function () {
50
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(installerUrl, installPath) {
51
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
52
- while (1) {
53
- switch (_context2.prev = _context2.next) {
54
- case 0:
55
- return _context2.abrupt("return", sdkInstaller({
56
- zipPath: installerUrl,
57
- installPath: installPath,
58
- enableLogs: true
59
- }));
60
-
61
- case 1:
62
- case "end":
63
- return _context2.stop();
64
- }
65
- }
66
- }, _callee2);
67
- }));
68
-
69
- return function installSdk(_x4, _x5) {
70
- return _ref2.apply(this, arguments);
71
- };
72
- }();
73
-
74
- exports.installSdk = installSdk;
13
+ const installSdk = async (installerUrl, installPath) => sdkInstaller({
14
+ zipPath: installerUrl,
15
+ installPath,
16
+ enableLogs: true,
17
+ });
18
+ exports.installSdk = installSdk;
@@ -1,46 +1,26 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.rm = exports.cp = void 0;
7
-
8
- var _child_process = require("child_process");
9
-
10
- var _fs = _interopRequireDefault(require("fs"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
- var runCmdSync = function runCmdSync(cmd) {
15
- return (0, _child_process.execSync)(cmd, {
16
- stdio: 'inherit'
17
- });
18
- };
19
-
20
- var isDir = function isDir(path) {
21
- return _fs["default"].existsSync(path) && _fs["default"].lstatSync(path).isDirectory();
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22
4
  };
23
-
24
- var cp = function cp(source, destination) {
25
- var cmd = "aws s3 cp ".concat(source, " s3://").concat(destination, " --acl public-read");
26
-
27
- if (isDir(source)) {
28
- cmd += ' --recursive';
29
- }
30
-
31
- runCmdSync(cmd);
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.rm = exports.cp = void 0;
7
+ const child_process_1 = require("child_process");
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const runCmdSync = (cmd) => child_process_1.execSync(cmd, { stdio: 'inherit' });
10
+ const isDir = (path) => fs_1.default.existsSync(path) && fs_1.default.lstatSync(path).isDirectory();
11
+ const cp = (source, destination) => {
12
+ let cmd = `aws s3 cp ${source} s3://${destination} --acl public-read`;
13
+ if (isDir(source)) {
14
+ cmd += ' --recursive';
15
+ }
16
+ runCmdSync(cmd);
32
17
  };
33
-
34
18
  exports.cp = cp;
35
-
36
- var rm = function rm(remoteDirPath) {
37
- var cmd = "aws s3 rm s3://".concat(remoteDirPath);
38
-
39
- if (remoteDirPath.endsWith('/')) {
40
- cmd += ' --recursive';
41
- }
42
-
43
- runCmdSync(cmd);
19
+ const rm = (remoteDirPath) => {
20
+ let cmd = `aws s3 rm s3://${remoteDirPath}`;
21
+ if (remoteDirPath.endsWith('/')) {
22
+ cmd += ' --recursive';
23
+ }
24
+ runCmdSync(cmd);
44
25
  };
45
-
46
- exports.rm = rm;
26
+ exports.rm = rm;
@@ -1,111 +1,76 @@
1
1
  "use strict";
2
-
3
- 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); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
7
13
  });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
8
25
  exports.deployToS3 = void 0;
9
-
10
- var path = _interopRequireWildcard(require("path"));
11
-
12
- var fs = _interopRequireWildcard(require("fs"));
13
-
14
- var _rnv = require("rnv");
15
-
16
- var _constants = require("../../../constants");
17
-
18
- var aws = _interopRequireWildcard(require("./aws"));
19
-
20
- var _resolvers = require("../../../resolvers");
21
-
22
- 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); }
23
-
24
- 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; }
25
-
26
- 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); } }
27
-
28
- 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); }); }; }
29
-
30
- var getConfigProp = _rnv.Common.getConfigProp;
31
-
32
- var uploadPackage = function uploadPackage(c, sourcePath, uploadPath) {
33
- var packageOutputDirPath = "".concat(sourcePath, "/output");
34
- var outputFilenameList = fs.readdirSync(packageOutputDirPath);
35
- var packageFileName = outputFilenameList[0];
36
- var packageLocalPath = "\"".concat(packageOutputDirPath, "/").concat(packageFileName, "\"");
37
- var packageRemotePath = "\"".concat(uploadPath, "/build/").concat(packageFileName, "\"");
38
- aws.cp(packageLocalPath, packageRemotePath);
26
+ const path_1 = __importDefault(require("path"));
27
+ const fs_1 = __importDefault(require("fs"));
28
+ const rnv_1 = require("rnv");
29
+ const constants_1 = require("../../../constants");
30
+ const aws = __importStar(require("./aws"));
31
+ const resolvers_1 = require("../../../resolvers");
32
+ const { getConfigProp } = rnv_1.Common;
33
+ const uploadPackage = (c, sourcePath, uploadPath) => {
34
+ const packageOutputDirPath = `${sourcePath}/output`;
35
+ const outputFilenameList = fs_1.default.readdirSync(packageOutputDirPath);
36
+ const packageFileName = outputFilenameList[0];
37
+ const packageLocalPath = `"${packageOutputDirPath}/${packageFileName}"`;
38
+ const packageRemotePath = `"${uploadPath}/build/${packageFileName}"`;
39
+ aws.cp(packageLocalPath, packageRemotePath);
40
+ };
41
+ const uploadPublicDir = (sourcePath, uploadPath) => {
42
+ const publicDirLocalPath = path_1.default.join(sourcePath, 'project', 'public');
43
+ const publicDirRemotePath = `${uploadPath}/public`;
44
+ aws.cp(publicDirLocalPath, publicDirRemotePath);
39
45
  };
40
-
41
- var uploadPublicDir = function uploadPublicDir(sourcePath, uploadPath) {
42
- var publicDirLocalPath = path.join(sourcePath, 'project', 'public');
43
- var publicDirRemotePath = "".concat(uploadPath, "/public");
44
- aws.cp(publicDirLocalPath, publicDirRemotePath);
46
+ const urlToS3Protocol = (url) => {
47
+ const hostWithPath = url.split('://')[1];
48
+ const bucketHostnameAwsPostfix = '.s3.amazonaws.com';
49
+ return hostWithPath.replace(bucketHostnameAwsPostfix, '');
45
50
  };
46
-
47
- var urlToS3Protocol = function urlToS3Protocol(url) {
48
- var hostWithPath = url.split('://')[1];
49
- var bucketHostnameAwsPostfix = '.s3.amazonaws.com';
50
- return hostWithPath.replace(bucketHostnameAwsPostfix, '');
51
+ const deployToS3 = async (c) => {
52
+ const { platform, runtime } = c;
53
+ const sourcePath = runtime.appDir;
54
+ const { isBuildHosted } = getConfigProp(c, platform, 'webpackConfig', {});
55
+ const baseUrl = resolvers_1.resolveBaseUrl({
56
+ platform,
57
+ scheme: runtime.scheme || '',
58
+ appConfigId: runtime.appId,
59
+ });
60
+ if (!baseUrl) {
61
+ return false;
62
+ }
63
+ const uploadPath = urlToS3Protocol(baseUrl);
64
+ aws.rm(`${uploadPath}/`);
65
+ uploadPackage(c, sourcePath, uploadPath);
66
+ if (platform === constants_1.Platforms.HBBTV) {
67
+ process.stdout.write(`For ${platform} platform, only ZIP package deployment is configured. Skipping deploying app content to AWS S3.\n`);
68
+ process.stdout.write('Deploy done.\n');
69
+ return true;
70
+ }
71
+ const sourceDirPath = isBuildHosted ? `${sourcePath}-public` : sourcePath;
72
+ uploadPublicDir(sourceDirPath, uploadPath);
73
+ process.stdout.write('Deploy done.\n');
74
+ return true;
51
75
  };
52
-
53
- var deployToS3 = /*#__PURE__*/function () {
54
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(c) {
55
- var platform, runtime, sourcePath, _getConfigProp, isBuildHosted, baseUrl, uploadPath, sourceDirPath;
56
-
57
- return regeneratorRuntime.wrap(function _callee$(_context) {
58
- while (1) {
59
- switch (_context.prev = _context.next) {
60
- case 0:
61
- platform = c.platform, runtime = c.runtime;
62
- sourcePath = runtime.appDir;
63
- _getConfigProp = getConfigProp(c, platform, 'webpackConfig', {}), isBuildHosted = _getConfigProp.isBuildHosted;
64
- baseUrl = (0, _resolvers.resolveBaseUrl)({
65
- platform: platform,
66
- scheme: runtime.scheme || '',
67
- appConfigId: runtime.appId
68
- });
69
-
70
- if (baseUrl) {
71
- _context.next = 6;
72
- break;
73
- }
74
-
75
- return _context.abrupt("return", false);
76
-
77
- case 6:
78
- uploadPath = urlToS3Protocol(baseUrl);
79
- aws.rm("".concat(uploadPath, "/"));
80
- uploadPackage(c, sourcePath, uploadPath);
81
-
82
- if (!(platform === _constants.Platforms.HBBTV)) {
83
- _context.next = 13;
84
- break;
85
- }
86
-
87
- // eslint-disable-next-line max-len
88
- process.stdout.write("For ".concat(platform, " platform, only ZIP package deployment is configured. Skipping deploying app content to AWS S3.\n"));
89
- process.stdout.write('Deploy done.\n');
90
- return _context.abrupt("return", true);
91
-
92
- case 13:
93
- sourceDirPath = isBuildHosted ? "".concat(sourcePath, "-public") : sourcePath;
94
- uploadPublicDir(sourceDirPath, uploadPath);
95
- process.stdout.write('Deploy done.\n');
96
- return _context.abrupt("return", true);
97
-
98
- case 17:
99
- case "end":
100
- return _context.stop();
101
- }
102
- }
103
- }, _callee);
104
- }));
105
-
106
- return function deployToS3(_x) {
107
- return _ref.apply(this, arguments);
108
- };
109
- }();
110
-
111
- exports.deployToS3 = deployToS3;
76
+ exports.deployToS3 = deployToS3;
@@ -1,207 +1,104 @@
1
1
  "use strict";
2
-
3
- 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); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
7
13
  });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
8
25
  exports.deployHbbTV = void 0;
9
-
10
- var path = _interopRequireWildcard(require("path"));
11
-
12
- var fs = _interopRequireWildcard(require("fs"));
13
-
14
- var nodessh = _interopRequireWildcard(require("node-ssh"));
15
-
16
- var _constants = require("../../../constants");
17
-
18
- var _resolvers = require("../../../resolvers");
19
-
20
- 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); }
21
-
22
- 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; }
23
-
24
- 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); } }
25
-
26
- 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); }); }; }
27
-
28
- var getSshKeyAbsolutePath = function getSshKeyAbsolutePath(c, sshKeyRelativePath) {
29
- if (!sshKeyRelativePath) return '';
30
- return path.join(c.paths.project.dir, sshKeyRelativePath);
26
+ const path_1 = __importDefault(require("path"));
27
+ const fs_1 = __importDefault(require("fs"));
28
+ const nodessh = __importStar(require("node-ssh"));
29
+ const constants_1 = require("../../../constants");
30
+ const resolvers_1 = require("../../../resolvers");
31
+ const getSshKeyAbsolutePath = (c, sshKeyRelativePath) => {
32
+ if (!sshKeyRelativePath)
33
+ return '';
34
+ return path_1.default.join(c.paths.project.dir, sshKeyRelativePath);
35
+ };
36
+ const makeSshConnection = async (c) => {
37
+ const { host, username, privateKeyRelativePath } = resolvers_1.resolveHbbtvDeployConfig();
38
+ const privateKey = getSshKeyAbsolutePath(c, privateKeyRelativePath);
39
+ const passphrase = process.env.CI_SSH_KEY_PASSPHRASE;
40
+ if (!privateKey || !passphrase) {
41
+ return null;
42
+ }
43
+ const ssh = new nodessh.NodeSSH();
44
+ await ssh.connect({ host, username, privateKey, passphrase });
45
+ return ssh;
31
46
  };
32
-
33
- var makeSshConnection = /*#__PURE__*/function () {
34
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(c) {
35
- var _resolveHbbtvDeployCo, host, username, privateKeyRelativePath, privateKey, passphrase, ssh;
36
-
37
- return regeneratorRuntime.wrap(function _callee$(_context) {
38
- while (1) {
39
- switch (_context.prev = _context.next) {
40
- case 0:
41
- _resolveHbbtvDeployCo = (0, _resolvers.resolveHbbtvDeployConfig)(), host = _resolveHbbtvDeployCo.host, username = _resolveHbbtvDeployCo.username, privateKeyRelativePath = _resolveHbbtvDeployCo.privateKeyRelativePath;
42
- privateKey = getSshKeyAbsolutePath(c, privateKeyRelativePath);
43
- passphrase = process.env.CI_SSH_KEY_PASSPHRASE;
44
-
45
- if (!(!privateKey || !passphrase)) {
46
- _context.next = 5;
47
- break;
48
- }
49
-
50
- return _context.abrupt("return", null);
51
-
52
- case 5:
53
- ssh = new nodessh.NodeSSH();
54
- _context.next = 8;
55
- return ssh.connect({
56
- host: host,
57
- username: username,
58
- privateKey: privateKey,
59
- passphrase: passphrase
60
- });
61
-
62
- case 8:
63
- return _context.abrupt("return", ssh);
64
-
65
- case 9:
66
- case "end":
67
- return _context.stop();
68
- }
69
- }
70
- }, _callee);
71
- }));
72
-
73
- return function makeSshConnection(_x) {
74
- return _ref.apply(this, arguments);
75
- };
76
- }();
77
-
78
- var getBuildPackageFileName = function getBuildPackageFileName(c) {
79
- var packageOutputDirPath = "".concat(c.runtime.appDir, "/output");
80
- var outputFilenameList = fs.readdirSync(packageOutputDirPath);
81
- return outputFilenameList[0];
47
+ const getBuildPackageFileName = (c) => {
48
+ const packageOutputDirPath = `${c.runtime.appDir}/output`;
49
+ const outputFilenameList = fs_1.default.readdirSync(packageOutputDirPath);
50
+ return outputFilenameList[0];
82
51
  };
83
-
84
- var getLocalBuildPackagePath = function getLocalBuildPackagePath(c) {
85
- var fileName = getBuildPackageFileName(c);
86
- return path.join(c.runtime.appDir, 'output', fileName);
52
+ const getLocalBuildPackagePath = (c) => {
53
+ const fileName = getBuildPackageFileName(c);
54
+ return path_1.default.join(c.runtime.appDir, 'output', fileName);
87
55
  };
88
-
89
- var resolveRemotePaths = function resolveRemotePaths(c) {
90
- var remoteBuildDirRelativePath = (0, _resolvers.resolveHbbtvRemoteBuildDirRelativePath)(c);
91
-
92
- var _resolveHbbtvDeployCo2 = (0, _resolvers.resolveHbbtvDeployConfig)(),
93
- hostHomeDir = _resolveHbbtvDeployCo2.hostHomeDir,
94
- dockerHtmlRootDir = _resolveHbbtvDeployCo2.dockerHtmlRootDir;
95
-
96
- var hostTempDirName = 'travis-ci-temp';
97
- return {
98
- serverTempDirPath: "".concat(hostHomeDir, "/").concat(hostTempDirName, "/").concat(remoteBuildDirRelativePath),
99
- dockerProjectDirPath: "".concat(dockerHtmlRootDir, "/").concat(remoteBuildDirRelativePath)
100
- };
56
+ const resolveRemotePaths = (c) => {
57
+ const remoteBuildDirRelativePath = resolvers_1.resolveHbbtvRemoteBuildDirRelativePath(c);
58
+ const { hostHomeDir, dockerHtmlRootDir } = resolvers_1.resolveHbbtvDeployConfig();
59
+ const hostTempDirName = 'travis-ci-temp';
60
+ return {
61
+ serverTempDirPath: `${hostHomeDir}/${hostTempDirName}/${remoteBuildDirRelativePath}`,
62
+ dockerProjectDirPath: `${dockerHtmlRootDir}/${remoteBuildDirRelativePath}`,
63
+ };
101
64
  };
102
-
103
- var log = function log(msg) {
104
- return process.stdout.write(msg);
65
+ const log = (msg) => process.stdout.write(msg);
66
+ const deployHbbTV = async (c) => {
67
+ if (c.platform !== constants_1.Platforms.HBBTV)
68
+ return;
69
+ const { scheme, appId } = c.runtime;
70
+ log('HbbTV deploy via SSH.\n\n');
71
+ const remotePaths = resolveRemotePaths(c);
72
+ const { dockerContainerName } = resolvers_1.resolveHbbtvDeployConfig();
73
+ const remotePackagePath = `${remotePaths.serverTempDirPath}/${getBuildPackageFileName(c)}`;
74
+ const dockerExecPrefix = `docker exec -t ${dockerContainerName}`;
75
+ const dockerAppDirPath = remotePaths.dockerProjectDirPath;
76
+ log('Creating connection...\n');
77
+ const ssh = await makeSshConnection(c);
78
+ if (ssh === null) {
79
+ throw new Error('Connection failed - check "privateKeyRelativePath" or "process.env.CI_SSH_KEY_PASSPHRASE" deploy params.');
80
+ }
81
+ log('Clearing temporary dir on host side...\n');
82
+ await ssh.execCommand(`rm -Rf ${remotePaths.serverTempDirPath}`);
83
+ log('Transferring build package from local machine to host...\n');
84
+ await ssh.putFile(getLocalBuildPackagePath(c), remotePackagePath);
85
+ log('Unzipping transferred build package...\n');
86
+ await ssh.execCommand(`unzip ${remotePackagePath}`, { cwd: remotePaths.serverTempDirPath });
87
+ log('Removing transferred build package...\n');
88
+ await ssh.execCommand(`rm ${remotePackagePath}`);
89
+ log('Clearing docker dir on host side...\n');
90
+ await ssh.execCommand(`${dockerExecPrefix} rm -rf ${dockerAppDirPath}`);
91
+ const indexHtmlParentDirPath = `${dockerAppDirPath}/public`;
92
+ log('Creating requested path for build in docker...\n');
93
+ await ssh.execCommand(`${dockerExecPrefix} mkdir -p ${indexHtmlParentDirPath}`);
94
+ log('Copying unzipped build package from host to host\'s docker path...\n');
95
+ const sourcePath = `${remotePaths.serverTempDirPath}/.`;
96
+ const destPath = `${dockerContainerName}:${indexHtmlParentDirPath}`;
97
+ const cmd = `docker cp ${sourcePath} ${destPath}`;
98
+ await ssh.execCommand(cmd);
99
+ log('Clearing temporary dir on host side...\n');
100
+ await ssh.execCommand(`rm -Rf ${remotePaths.serverTempDirPath}`);
101
+ log(`\nThe build is deployed at ${resolvers_1.resolveHbbtvDeployUrl(c, scheme, appId)}\n`);
102
+ log('Deploy done.\n');
105
103
  };
106
-
107
- var deployHbbTV = /*#__PURE__*/function () {
108
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(c) {
109
- var _c$runtime, scheme, appId, remotePaths, _resolveHbbtvDeployCo3, dockerContainerName, remotePackagePath, dockerExecPrefix, dockerAppDirPath, ssh, indexHtmlParentDirPath, sourcePath, destPath, cmd;
110
-
111
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
112
- while (1) {
113
- switch (_context2.prev = _context2.next) {
114
- case 0:
115
- if (!(c.platform !== _constants.Platforms.HBBTV)) {
116
- _context2.next = 2;
117
- break;
118
- }
119
-
120
- return _context2.abrupt("return");
121
-
122
- case 2:
123
- _c$runtime = c.runtime, scheme = _c$runtime.scheme, appId = _c$runtime.appId;
124
- log('HbbTV deploy via SSH.\n\n');
125
- remotePaths = resolveRemotePaths(c);
126
- _resolveHbbtvDeployCo3 = (0, _resolvers.resolveHbbtvDeployConfig)(), dockerContainerName = _resolveHbbtvDeployCo3.dockerContainerName;
127
- remotePackagePath = "".concat(remotePaths.serverTempDirPath, "/").concat(getBuildPackageFileName(c));
128
- dockerExecPrefix = "docker exec -t ".concat(dockerContainerName);
129
- dockerAppDirPath = remotePaths.dockerProjectDirPath;
130
- log('Creating connection...\n');
131
- _context2.next = 12;
132
- return makeSshConnection(c);
133
-
134
- case 12:
135
- ssh = _context2.sent;
136
-
137
- if (!(ssh === null)) {
138
- _context2.next = 15;
139
- break;
140
- }
141
-
142
- throw new Error('Connection failed - check "privateKeyRelativePath" or "process.env.CI_SSH_KEY_PASSPHRASE" deploy params.');
143
-
144
- case 15:
145
- log('Clearing temporary dir on host side...\n');
146
- _context2.next = 18;
147
- return ssh.execCommand("rm -Rf ".concat(remotePaths.serverTempDirPath));
148
-
149
- case 18:
150
- log('Transferring build package from local machine to host...\n');
151
- _context2.next = 21;
152
- return ssh.putFile(getLocalBuildPackagePath(c), remotePackagePath);
153
-
154
- case 21:
155
- log('Unzipping transferred build package...\n');
156
- _context2.next = 24;
157
- return ssh.execCommand("unzip ".concat(remotePackagePath), {
158
- cwd: remotePaths.serverTempDirPath
159
- });
160
-
161
- case 24:
162
- log('Removing transferred build package...\n');
163
- _context2.next = 27;
164
- return ssh.execCommand("rm ".concat(remotePackagePath));
165
-
166
- case 27:
167
- log('Clearing docker dir on host side...\n');
168
- _context2.next = 30;
169
- return ssh.execCommand("".concat(dockerExecPrefix, " rm -rf ").concat(dockerAppDirPath));
170
-
171
- case 30:
172
- indexHtmlParentDirPath = "".concat(dockerAppDirPath, "/public");
173
- log('Creating requested path for build in docker...\n');
174
- _context2.next = 34;
175
- return ssh.execCommand("".concat(dockerExecPrefix, " mkdir -p ").concat(indexHtmlParentDirPath));
176
-
177
- case 34:
178
- log('Copying unzipped build package from host to host\'s docker path...\n');
179
- sourcePath = "".concat(remotePaths.serverTempDirPath, "/.");
180
- destPath = "".concat(dockerContainerName, ":").concat(indexHtmlParentDirPath);
181
- cmd = "docker cp ".concat(sourcePath, " ").concat(destPath);
182
- _context2.next = 40;
183
- return ssh.execCommand(cmd);
184
-
185
- case 40:
186
- log('Clearing temporary dir on host side...\n');
187
- _context2.next = 43;
188
- return ssh.execCommand("rm -Rf ".concat(remotePaths.serverTempDirPath));
189
-
190
- case 43:
191
- log("\nThe build is deployed at ".concat((0, _resolvers.resolveHbbtvDeployUrl)(c, scheme, appId), "\n"));
192
- log('Deploy done.\n');
193
-
194
- case 45:
195
- case "end":
196
- return _context2.stop();
197
- }
198
- }
199
- }, _callee2);
200
- }));
201
-
202
- return function deployHbbTV(_x2) {
203
- return _ref2.apply(this, arguments);
204
- };
205
- }();
206
-
207
- exports.deployHbbTV = deployHbbTV;
104
+ exports.deployHbbTV = deployHbbTV;