@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
@@ -18,97 +18,59 @@ var __importStar = (this && this.__importStar) || function (mod) {
18
18
  __setModuleDefault(result, mod);
19
19
  return result;
20
20
  };
21
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
- return new (P || (P = Promise))(function (resolve, reject) {
24
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
- step((generator = generator.apply(thisArg, _arguments || [])).next());
28
- });
29
- };
30
- var __generator = (this && this.__generator) || function (thisArg, body) {
31
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
32
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
33
- function verb(n) { return function (v) { return step([n, v]); }; }
34
- function step(op) {
35
- if (f) throw new TypeError("Generator is already executing.");
36
- while (_) try {
37
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
38
- if (y = 0, t) op = [op[0] & 2, t.value];
39
- switch (op[0]) {
40
- case 0: case 1: t = op; break;
41
- case 4: _.label++; return { value: op[1], done: false };
42
- case 5: _.label++; y = op[1]; op = [0]; continue;
43
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
44
- default:
45
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
46
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
47
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
48
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
49
- if (t[2]) _.ops.pop();
50
- _.trys.pop(); continue;
51
- }
52
- op = body.call(thisArg, _);
53
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
54
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
55
- }
56
- };
57
21
  var __importDefault = (this && this.__importDefault) || function (mod) {
58
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
59
23
  };
60
- exports.__esModule = true;
24
+ Object.defineProperty(exports, "__esModule", { value: true });
61
25
  exports.deployToS3 = void 0;
62
- var path_1 = __importDefault(require("path"));
63
- var fs_1 = __importDefault(require("fs"));
64
- var rnv_1 = require("rnv");
65
- var aws = __importStar(require("./aws"));
66
- var resolvers_1 = require("../../../resolvers");
67
- var getConfigProp = rnv_1.Common.getConfigProp;
68
- var uploadPackage = function (c, sourcePath, uploadPath) {
69
- var packageOutputDirPath = sourcePath + "/output";
70
- var outputFilenameList = fs_1["default"].readdirSync(packageOutputDirPath);
71
- var packageFileName = outputFilenameList[0];
72
- var packageLocalPath = "\"" + packageOutputDirPath + "/" + packageFileName + "\"";
73
- var packageRemotePath = "\"" + uploadPath + "/build/" + packageFileName + "\"";
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}"`;
74
39
  aws.cp(packageLocalPath, packageRemotePath);
75
40
  };
76
- var uploadPublicDir = function (sourcePath, uploadPath) {
77
- var publicDirLocalPath = path_1["default"].join(sourcePath, 'project', 'public');
78
- var publicDirRemotePath = uploadPath + "/public";
41
+ const uploadPublicDir = (sourcePath, uploadPath) => {
42
+ const publicDirLocalPath = path_1.default.join(sourcePath, 'project', 'public');
43
+ const publicDirRemotePath = `${uploadPath}/public`;
79
44
  aws.cp(publicDirLocalPath, publicDirRemotePath);
80
45
  };
81
- var urlToS3Protocol = function (url) {
82
- var hostWithPath = url.split('://')[1];
83
- var bucketHostnameAwsPostfix = '.s3.amazonaws.com';
46
+ const urlToS3Protocol = (url) => {
47
+ const hostWithPath = url.split('://')[1];
48
+ const bucketHostnameAwsPostfix = '.s3.amazonaws.com';
84
49
  return hostWithPath.replace(bucketHostnameAwsPostfix, '');
85
50
  };
86
- var deployToS3 = function (c) { return __awaiter(void 0, void 0, void 0, function () {
87
- var platform, runtime, sourcePath, isBuildHosted, baseUrl, uploadPath, sourceDirPath;
88
- return __generator(this, function (_a) {
89
- platform = c.platform, runtime = c.runtime;
90
- sourcePath = runtime.appDir;
91
- isBuildHosted = getConfigProp(c, platform, 'webpackConfig', {}).isBuildHosted;
92
- baseUrl = resolvers_1.resolveBaseUrl({
93
- platform: platform,
94
- scheme: runtime.scheme || '',
95
- appConfigId: runtime.appId
96
- });
97
- if (!baseUrl) {
98
- return [2, false];
99
- }
100
- uploadPath = urlToS3Protocol(baseUrl);
101
- aws.rm(uploadPath + "/");
102
- uploadPackage(c, sourcePath, uploadPath);
103
- if (platform === 'hbbtv') {
104
- process.stdout.write("For " + platform + " platform, only ZIP package deployment is configured. Skipping deploying app content to AWS S3.\n");
105
- process.stdout.write('Deploy done.\n');
106
- return [2, true];
107
- }
108
- sourceDirPath = isBuildHosted ? sourcePath + "-public" : sourcePath;
109
- uploadPublicDir(sourceDirPath, uploadPath);
110
- process.stdout.write('Deploy done.\n');
111
- return [2, true];
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,
112
59
  });
113
- }); };
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;
75
+ };
114
76
  exports.deployToS3 = deployToS3;
@@ -1,189 +1,85 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
39
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
40
4
  };
41
- exports.__esModule = true;
42
- exports.getHbbTVDeployUrl = exports.deployHbbTV = void 0;
43
- var path_1 = __importDefault(require("path"));
44
- var fs_1 = __importDefault(require("fs"));
45
- var rnv_1 = require("rnv");
46
- var node_ssh_1 = require("node-ssh");
47
- var getBaseConfig_1 = require("../../../utils/getBaseConfig");
48
- var getConfigProp = rnv_1.Common.getConfigProp;
49
- var deployConfig = {
50
- host: 'nxg-bigscreen-test.24imedia.tv',
51
- username: 'admin',
52
- privateKeyRelativePath: 'certificates/id_rsa_24i_smartapps_bigscreen',
53
- passphrase: '>>> please set the value via process.env.CI_SSH_KEY_PASSPHRASE <<<',
54
- hostHomeDir: '/home/admin',
55
- dockerHtmlRootDir: '/usr/share/nginx/html',
56
- dockerContainerName: '24inginx'
57
- };
58
- var getSshKeyAbsolutePath = function (c, sshKeyRelativePath) {
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.deployHbbTV = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const node_ssh_1 = require("node-ssh");
10
+ const constants_1 = require("../../../constants");
11
+ const resolvers_1 = require("../../../resolvers");
12
+ const getSshKeyAbsolutePath = (c, sshKeyRelativePath) => {
59
13
  if (!sshKeyRelativePath)
60
14
  return '';
61
- return path_1["default"].join(c.paths.project.dir, sshKeyRelativePath);
15
+ return path_1.default.join(c.paths.project.dir, sshKeyRelativePath);
62
16
  };
63
- var makeSshConnection = function (c) { return __awaiter(void 0, void 0, void 0, function () {
64
- var host, username, privateKeyRelativePath, privateKey, passphrase, ssh;
65
- return __generator(this, function (_a) {
66
- switch (_a.label) {
67
- case 0:
68
- host = deployConfig.host, username = deployConfig.username, privateKeyRelativePath = deployConfig.privateKeyRelativePath;
69
- privateKey = getSshKeyAbsolutePath(c, privateKeyRelativePath);
70
- passphrase = process.env.CI_SSH_KEY_PASSPHRASE;
71
- if (!privateKey || !passphrase) {
72
- return [2, null];
73
- }
74
- ssh = new node_ssh_1.NodeSSH();
75
- return [4, ssh.connect({ host: host, username: username, privateKey: privateKey, passphrase: passphrase })];
76
- case 1:
77
- _a.sent();
78
- return [2, ssh];
79
- }
80
- });
81
- }); };
82
- var getBuildPackageFileName = function (c) {
83
- var packageOutputDirPath = c.runtime.appDir + "/output";
84
- var outputFilenameList = fs_1["default"].readdirSync(packageOutputDirPath);
85
- return outputFilenameList[0];
17
+ const makeSshConnection = async (c) => {
18
+ const { host, username, privateKeyRelativePath } = resolvers_1.resolveHbbtvDeployConfig();
19
+ const privateKey = getSshKeyAbsolutePath(c, privateKeyRelativePath);
20
+ const passphrase = process.env.CI_SSH_KEY_PASSPHRASE;
21
+ if (!privateKey || !passphrase) {
22
+ return null;
23
+ }
24
+ const ssh = new node_ssh_1.NodeSSH();
25
+ await ssh.connect({ host, username, privateKey, passphrase });
26
+ return ssh;
86
27
  };
87
- var getLocalBuildPackagePath = function (c) {
88
- var fileName = getBuildPackageFileName(c);
89
- return path_1["default"].join(c.runtime.appDir, 'output', fileName);
28
+ const getBuildPackageFileName = (c) => {
29
+ const packageOutputDirPath = `${c.runtime.appDir}/output`;
30
+ const outputFilenameList = fs_1.default.readdirSync(packageOutputDirPath);
31
+ return outputFilenameList[0];
90
32
  };
91
- var getRemoteBuildDirRelativePath = function (c, scheme, appConfigId) {
92
- if (scheme === void 0) { scheme = ''; }
93
- if (appConfigId === void 0) { appConfigId = ''; }
94
- var projectDirName = getConfigProp(c, 'hbbtv', 'deploy', {}).projectDirName;
95
- var appId = c.runtime.appId || appConfigId;
96
- var version = getConfigProp(c, 'hbbtv', 'packageVersion', '');
97
- if (!projectDirName || !appId) {
98
- return '';
99
- }
100
- switch (c.runtime.scheme || scheme) {
101
- case 'dev:latest': return projectDirName + "/" + appId + "/latest/dev";
102
- case 'rc:latest': return projectDirName + "/" + appId + "/latest/rc";
103
- case 'release:latest': return projectDirName + "/" + appId + "/latest/release";
104
- case 'release:dist': return projectDirName + "/" + appId + "/dist/v" + version;
105
- default: return '';
106
- }
33
+ const getLocalBuildPackagePath = (c) => {
34
+ const fileName = getBuildPackageFileName(c);
35
+ return path_1.default.join(c.runtime.appDir, 'output', fileName);
107
36
  };
108
- var resolveRemotePaths = function (c) {
109
- var remoteBuildDirRelativePath = getRemoteBuildDirRelativePath(c);
110
- var hostHomeDir = deployConfig.hostHomeDir, dockerHtmlRootDir = deployConfig.dockerHtmlRootDir;
111
- var hostTempDirName = 'travis-ci-temp';
37
+ const resolveRemotePaths = (c) => {
38
+ const remoteBuildDirRelativePath = resolvers_1.resolveHbbtvRemoteBuildDirRelativePath(c);
39
+ const { hostHomeDir, dockerHtmlRootDir } = resolvers_1.resolveHbbtvDeployConfig();
40
+ const hostTempDirName = 'travis-ci-temp';
112
41
  return {
113
- serverTempDirPath: hostHomeDir + "/" + hostTempDirName + "/" + remoteBuildDirRelativePath,
114
- dockerProjectDirPath: dockerHtmlRootDir + "/" + remoteBuildDirRelativePath
42
+ serverTempDirPath: `${hostHomeDir}/${hostTempDirName}/${remoteBuildDirRelativePath}`,
43
+ dockerProjectDirPath: `${dockerHtmlRootDir}/${remoteBuildDirRelativePath}`,
115
44
  };
116
45
  };
117
- var log = function (msg) { return process.stdout.write(msg); };
118
- var getHbbTVDeployUrl = function (c, scheme, appConfigId) {
119
- if (c === void 0) { c = getBaseConfig_1.getBaseConfig(); }
120
- if (scheme === void 0) { scheme = ''; }
121
- if (appConfigId === void 0) { appConfigId = ''; }
122
- var host = deployConfig.host;
123
- var remoteDirRelativePath = getRemoteBuildDirRelativePath(c, scheme, appConfigId);
124
- return "http://" + host + "/" + remoteDirRelativePath + "/public/index.html";
46
+ const log = (msg) => process.stdout.write(msg);
47
+ const deployHbbTV = async (c) => {
48
+ if (c.platform !== constants_1.Platforms.HBBTV)
49
+ return;
50
+ const { scheme, appId } = c.runtime;
51
+ log('HbbTV deploy via SSH.\n\n');
52
+ const remotePaths = resolveRemotePaths(c);
53
+ const { dockerContainerName } = resolvers_1.resolveHbbtvDeployConfig();
54
+ const remotePackagePath = `${remotePaths.serverTempDirPath}/${getBuildPackageFileName(c)}`;
55
+ const dockerExecPrefix = `docker exec -t ${dockerContainerName}`;
56
+ const dockerAppDirPath = remotePaths.dockerProjectDirPath;
57
+ log('Creating connection...\n');
58
+ const ssh = await makeSshConnection(c);
59
+ if (ssh === null) {
60
+ throw new Error('Connection failed - check "privateKeyRelativePath" or "process.env.CI_SSH_KEY_PASSPHRASE" deploy params.');
61
+ }
62
+ log('Clearing temporary dir on host side...\n');
63
+ await ssh.execCommand(`rm -Rf ${remotePaths.serverTempDirPath}`);
64
+ log('Transferring build package from local machine to host...\n');
65
+ await ssh.putFile(getLocalBuildPackagePath(c), remotePackagePath);
66
+ log('Unzipping transferred build package...\n');
67
+ await ssh.execCommand(`unzip ${remotePackagePath}`, { cwd: remotePaths.serverTempDirPath });
68
+ log('Removing transferred build package...\n');
69
+ await ssh.execCommand(`rm ${remotePackagePath}`);
70
+ log('Clearing docker dir on host side...\n');
71
+ await ssh.execCommand(`${dockerExecPrefix} rm -rf ${dockerAppDirPath}`);
72
+ const indexHtmlParentDirPath = `${dockerAppDirPath}/public`;
73
+ log('Creating requested path for build in docker...\n');
74
+ await ssh.execCommand(`${dockerExecPrefix} mkdir -p ${indexHtmlParentDirPath}`);
75
+ log('Copying unzipped build package from host to host\'s docker path...\n');
76
+ const sourcePath = `${remotePaths.serverTempDirPath}/.`;
77
+ const destPath = `${dockerContainerName}:${indexHtmlParentDirPath}`;
78
+ const cmd = `docker cp ${sourcePath} ${destPath}`;
79
+ await ssh.execCommand(cmd);
80
+ log('Clearing temporary dir on host side...\n');
81
+ await ssh.execCommand(`rm -Rf ${remotePaths.serverTempDirPath}`);
82
+ log(`\nThe build is deployed at ${resolvers_1.resolveHbbtvDeployUrl(c, scheme, appId)}\n`);
83
+ log('Deploy done.\n');
125
84
  };
126
- exports.getHbbTVDeployUrl = getHbbTVDeployUrl;
127
- var deployHbbTV = function (c) { return __awaiter(void 0, void 0, void 0, function () {
128
- var remotePaths, dockerContainerName, remotePackagePath, dockerExecPrefix, dockerAppDirPath, ssh, indexHtmlParentDirPath, sourcePath, destPath, cmd;
129
- return __generator(this, function (_a) {
130
- switch (_a.label) {
131
- case 0:
132
- if (c.platform !== 'hbbtv')
133
- return [2];
134
- log('HbbTV deploy via SSH.\n\n');
135
- remotePaths = resolveRemotePaths(c);
136
- dockerContainerName = deployConfig.dockerContainerName;
137
- remotePackagePath = remotePaths.serverTempDirPath + "/" + getBuildPackageFileName(c);
138
- dockerExecPrefix = "docker exec -t " + dockerContainerName;
139
- dockerAppDirPath = remotePaths.dockerProjectDirPath;
140
- log('Creating connection...\n');
141
- return [4, makeSshConnection(c)];
142
- case 1:
143
- ssh = _a.sent();
144
- if (ssh === null) {
145
- throw new Error('Connection failed - check "privateKeyRelativePath" or "process.env.CI_SSH_KEY_PASSPHRASE" deploy params.');
146
- }
147
- log('Clearing temporary dir on host side...\n');
148
- return [4, ssh.execCommand("rm -Rf " + remotePaths.serverTempDirPath)];
149
- case 2:
150
- _a.sent();
151
- log('Transferring build package from local machine to host...\n');
152
- return [4, ssh.putFile(getLocalBuildPackagePath(c), remotePackagePath)];
153
- case 3:
154
- _a.sent();
155
- log('Unzipping transferred build package...\n');
156
- return [4, ssh.execCommand("unzip " + remotePackagePath, { cwd: remotePaths.serverTempDirPath })];
157
- case 4:
158
- _a.sent();
159
- log('Removing transferred build package...\n');
160
- return [4, ssh.execCommand("rm " + remotePackagePath)];
161
- case 5:
162
- _a.sent();
163
- log('Clearing docker dir on host side...\n');
164
- return [4, ssh.execCommand(dockerExecPrefix + " rm -rf " + dockerAppDirPath)];
165
- case 6:
166
- _a.sent();
167
- indexHtmlParentDirPath = dockerAppDirPath + "/public";
168
- log('Creating requested path for build in docker...\n');
169
- return [4, ssh.execCommand(dockerExecPrefix + " mkdir -p " + indexHtmlParentDirPath)];
170
- case 7:
171
- _a.sent();
172
- log('Copying unzipped build package from host to host\'s docker path...\n');
173
- sourcePath = remotePaths.serverTempDirPath + "/.";
174
- destPath = dockerContainerName + ":" + indexHtmlParentDirPath;
175
- cmd = "docker cp " + sourcePath + " " + destPath;
176
- return [4, ssh.execCommand(cmd)];
177
- case 8:
178
- _a.sent();
179
- log('Clearing temporary dir on host side...\n');
180
- return [4, ssh.execCommand("rm -Rf " + remotePaths.serverTempDirPath)];
181
- case 9:
182
- _a.sent();
183
- log("\nThe build is deployed at " + getHbbTVDeployUrl(c) + "\n");
184
- log('Deploy done.\n');
185
- return [2];
186
- }
187
- });
188
- }); };
189
85
  exports.deployHbbTV = deployHbbTV;
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.engineTaskList = void 0;
4
- var task_rnv_build_1 = require("./task.rnv.build");
5
- var task_rnv_configure_1 = require("./task.rnv.configure");
6
- var task_rnv_configureSoft_1 = require("./task.rnv.configureSoft");
7
- var task_rnv_deploy_1 = require("./task.rnv.deploy");
8
- var task_rnv_hooks_run_1 = require("./task.rnv.hooks.run");
9
- var task_rnv_package_1 = require("./task.rnv.package");
10
- var task_rnv_start_1 = require("./task.rnv.start");
11
- var task_rnv_project_configure_1 = require("./task.rnv.project.configure");
12
- var engineTaskList = [
4
+ const task_rnv_build_1 = require("./task.rnv.build");
5
+ const task_rnv_configure_1 = require("./task.rnv.configure");
6
+ const task_rnv_configureSoft_1 = require("./task.rnv.configureSoft");
7
+ const task_rnv_deploy_1 = require("./task.rnv.deploy");
8
+ const task_rnv_hooks_run_1 = require("./task.rnv.hooks.run");
9
+ const task_rnv_package_1 = require("./task.rnv.package");
10
+ const task_rnv_start_1 = require("./task.rnv.start");
11
+ const task_rnv_project_configure_1 = require("./task.rnv.project.configure");
12
+ const engineTaskList = [
13
13
  task_rnv_build_1.customRnvBuildTask,
14
14
  task_rnv_configure_1.customRnvConfigureTask,
15
15
  task_rnv_configureSoft_1.customRnvConfigureSoftTask,