@24i/smartapps-bigscreen-rnv-build-engine 0.0.2-alpha.1337 → 0.0.2-alpha.1340

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 (83) hide show
  1. package/dist/src/constants/buildSchemes.js +3 -3
  2. package/dist/src/constants/index.js +10 -3
  3. package/dist/src/constants/platforms.js +3 -3
  4. package/dist/src/index.js +31 -29
  5. package/dist/src/resolvers/index.js +17 -10
  6. package/dist/src/resolvers/resolveBaseUrl.js +15 -14
  7. package/dist/src/resolvers/resolveBuildVersion.js +17 -16
  8. package/dist/src/resolvers/resolveBuildVersionOffset.js +12 -12
  9. package/dist/src/resolvers/resolveDeployLocations.js +56 -44
  10. package/dist/src/resolvers/resolveGenericRnvConfig.js +30 -18
  11. package/dist/src/resolvers/resolveHbbtvDeployConfig.js +4 -4
  12. package/dist/src/resolvers/resolveHbbtvDeployUrl.js +7 -7
  13. package/dist/src/resolvers/resolveHbbtvRemoteBuildDirRelativePath.js +12 -12
  14. package/dist/src/resolvers/resolveZippedPlatformBuildsRelativeFilePath.js +11 -11
  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 +38 -37
  24. package/dist/src/scripts/release/githubRelease.js +64 -60
  25. package/dist/src/scripts/release/notifySlack/makePayload.js +48 -44
  26. package/dist/src/scripts/release/notifySlack/notifySlack.js +10 -10
  27. package/dist/src/scripts/release/notifySlack/slackBlockKitBuilder.js +28 -25
  28. package/dist/src/scripts/release/sentryRelease.js +34 -34
  29. package/dist/src/scripts/release/urlsMarkdown.js +25 -23
  30. package/dist/src/scripts/releaseAllWithScheme.js +26 -26
  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 +5 -2
  36. package/dist/src/sdks/index.js +54 -15
  37. package/dist/src/sdks/sdk-tizen/index.js +254 -154
  38. package/dist/src/sdks/sdk-webos/index.js +231 -136
  39. package/dist/src/sdks/sdk-webpack/index.js +69 -20
  40. package/dist/src/sdks/sdkUtils.js +59 -14
  41. package/dist/src/tasks/deploy/aswS3/aws.js +9 -9
  42. package/dist/src/tasks/deploy/aswS3/deployS3.js +83 -44
  43. package/dist/src/tasks/deploy/hbbtv/deployHbbtv.js +139 -70
  44. package/dist/src/tasks/engineTasks.js +10 -10
  45. package/dist/src/tasks/task.rnv.build.js +132 -75
  46. package/dist/src/tasks/task.rnv.configure.js +88 -39
  47. package/dist/src/tasks/task.rnv.configureSoft.js +75 -22
  48. package/dist/src/tasks/task.rnv.deploy.js +78 -28
  49. package/dist/src/tasks/task.rnv.hooks.run.js +92 -42
  50. package/dist/src/tasks/task.rnv.package.js +61 -18
  51. package/dist/src/tasks/task.rnv.project.configure.js +183 -80
  52. package/dist/src/tasks/task.rnv.start.js +87 -42
  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 +9 -2
  57. package/dist/src/utils/replaceRelevantStringsInConfig/replaceRelevantStringsInConfig.js +11 -10
  58. package/dist/src/utils/replaceRelevantStringsInConfig/replaceTemplateString.js +29 -23
  59. package/dist/src/utils/zipBuildsByPlatforms.js +25 -25
  60. package/dist/templates/platforms/_shared/template.js +41 -56
  61. package/dist/templates/platforms/_shared/webpack.base.js +140 -120
  62. package/dist/templates/platforms/entone/webpack.config.dev.js +22 -27
  63. package/dist/templates/platforms/entone/webpack.config.prod.js +20 -21
  64. package/dist/templates/platforms/hbbtv/webpack.config.dev.js +24 -42
  65. package/dist/templates/platforms/hbbtv/webpack.config.prod.js +22 -36
  66. package/dist/templates/platforms/tizen/webpack.config.dev.js +22 -28
  67. package/dist/templates/platforms/tizen/webpack.config.prod.js +20 -21
  68. package/dist/templates/platforms/webos/webpack.config.dev.js +24 -31
  69. package/dist/templates/platforms/webos/webpack.config.prod.js +22 -23
  70. package/dist/templates/platforms/webtv/webpack.config.dev.js +22 -27
  71. package/dist/templates/platforms/webtv/webpack.config.prod.js +20 -21
  72. package/dist/types/src/index.d.ts +1 -1
  73. package/dist/types/src/resolvers/resolveBaseUrl.d.ts +3 -3
  74. package/dist/types/src/resolvers/resolveBuildVersion.d.ts +3 -3
  75. package/dist/types/src/resolvers/resolveGenericRnvConfig.d.ts +1 -1
  76. package/dist/types/src/resolvers/resolveHbbtvDeployConfig.d.ts +1 -1
  77. package/dist/types/src/resolvers/resolveHbbtvRemoteBuildDirRelativePath.d.ts +1 -1
  78. package/dist/types/src/scripts/release/notifySlack/makePayload.d.ts +3 -9
  79. package/dist/types/src/tasks/engineTasks.d.ts +9 -3
  80. package/dist/types/src/tasks/task.rnv.configureSoft.d.ts +1 -1
  81. package/dist/types/src/tasks/task.rnv.hooks.run.d.ts +1 -1
  82. package/dist/types/src/tasks/task.rnv.project.configure.d.ts +1 -1
  83. package/package.json +2 -2
@@ -18,59 +18,98 @@ 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
+ };
21
57
  var __importDefault = (this && this.__importDefault) || function (mod) {
22
58
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
59
  };
24
- Object.defineProperty(exports, "__esModule", { value: true });
60
+ exports.__esModule = true;
25
61
  exports.deployToS3 = void 0;
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}"`;
62
+ var path_1 = __importDefault(require("path"));
63
+ var fs_1 = __importDefault(require("fs"));
64
+ var rnv_1 = require("rnv");
65
+ var constants_1 = require("../../../constants");
66
+ var aws = __importStar(require("./aws"));
67
+ var resolvers_1 = require("../../../resolvers");
68
+ var getConfigProp = rnv_1.Common.getConfigProp;
69
+ var uploadPackage = function (c, sourcePath, uploadPath) {
70
+ var packageOutputDirPath = sourcePath + "/output";
71
+ var outputFilenameList = fs_1["default"].readdirSync(packageOutputDirPath);
72
+ var packageFileName = outputFilenameList[0];
73
+ var packageLocalPath = "\"" + packageOutputDirPath + "/" + packageFileName + "\"";
74
+ var packageRemotePath = "\"" + uploadPath + "/build/" + packageFileName + "\"";
39
75
  aws.cp(packageLocalPath, packageRemotePath);
40
76
  };
41
- const uploadPublicDir = (sourcePath, uploadPath) => {
42
- const publicDirLocalPath = path_1.default.join(sourcePath, 'project', 'public');
43
- const publicDirRemotePath = `${uploadPath}/public`;
77
+ var uploadPublicDir = function (sourcePath, uploadPath) {
78
+ var publicDirLocalPath = path_1["default"].join(sourcePath, 'project', 'public');
79
+ var publicDirRemotePath = uploadPath + "/public";
44
80
  aws.cp(publicDirLocalPath, publicDirRemotePath);
45
81
  };
46
- const urlToS3Protocol = (url) => {
47
- const hostWithPath = url.split('://')[1];
48
- const bucketHostnameAwsPostfix = '.s3.amazonaws.com';
82
+ var urlToS3Protocol = function (url) {
83
+ var hostWithPath = url.split('://')[1];
84
+ var bucketHostnameAwsPostfix = '.s3.amazonaws.com';
49
85
  return hostWithPath.replace(bucketHostnameAwsPostfix, '');
50
86
  };
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`);
87
+ var deployToS3 = function (c) { return __awaiter(void 0, void 0, void 0, function () {
88
+ var platform, runtime, sourcePath, isBuildHosted, baseUrl, uploadPath, sourceDirPath;
89
+ return __generator(this, function (_a) {
90
+ platform = c.platform, runtime = c.runtime;
91
+ sourcePath = runtime.appDir;
92
+ isBuildHosted = getConfigProp(c, platform, 'webpackConfig', {}).isBuildHosted;
93
+ baseUrl = resolvers_1.resolveBaseUrl({
94
+ platform: platform,
95
+ scheme: runtime.scheme || '',
96
+ appConfigId: runtime.appId
97
+ });
98
+ if (!baseUrl) {
99
+ return [2, false];
100
+ }
101
+ uploadPath = urlToS3Protocol(baseUrl);
102
+ aws.rm(uploadPath + "/");
103
+ uploadPackage(c, sourcePath, uploadPath);
104
+ if (platform === constants_1.Platforms.HBBTV) {
105
+ process.stdout.write("For " + platform + " platform, only ZIP package deployment is configured. Skipping deploying app content to AWS S3.\n");
106
+ process.stdout.write('Deploy done.\n');
107
+ return [2, true];
108
+ }
109
+ sourceDirPath = isBuildHosted ? sourcePath + "-public" : sourcePath;
110
+ uploadPublicDir(sourceDirPath, uploadPath);
68
111
  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
- };
112
+ return [2, true];
113
+ });
114
+ }); };
76
115
  exports.deployToS3 = deployToS3;
@@ -18,87 +18,156 @@ 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
+ };
21
57
  var __importDefault = (this && this.__importDefault) || function (mod) {
22
58
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
59
  };
24
- Object.defineProperty(exports, "__esModule", { value: true });
60
+ exports.__esModule = true;
25
61
  exports.deployHbbTV = void 0;
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) => {
62
+ var path_1 = __importDefault(require("path"));
63
+ var fs_1 = __importDefault(require("fs"));
64
+ var nodessh = __importStar(require("node-ssh"));
65
+ var constants_1 = require("../../../constants");
66
+ var resolvers_1 = require("../../../resolvers");
67
+ var getSshKeyAbsolutePath = function (c, sshKeyRelativePath) {
32
68
  if (!sshKeyRelativePath)
33
69
  return '';
34
- return path_1.default.join(c.paths.project.dir, sshKeyRelativePath);
70
+ return path_1["default"].join(c.paths.project.dir, sshKeyRelativePath);
35
71
  };
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;
46
- };
47
- const getBuildPackageFileName = (c) => {
48
- const packageOutputDirPath = `${c.runtime.appDir}/output`;
49
- const outputFilenameList = fs_1.default.readdirSync(packageOutputDirPath);
72
+ var makeSshConnection = function (c) { return __awaiter(void 0, void 0, void 0, function () {
73
+ var _a, host, username, privateKeyRelativePath, privateKey, passphrase, ssh;
74
+ return __generator(this, function (_b) {
75
+ switch (_b.label) {
76
+ case 0:
77
+ _a = resolvers_1.resolveHbbtvDeployConfig(), host = _a.host, username = _a.username, privateKeyRelativePath = _a.privateKeyRelativePath;
78
+ privateKey = getSshKeyAbsolutePath(c, privateKeyRelativePath);
79
+ passphrase = process.env.CI_SSH_KEY_PASSPHRASE;
80
+ if (!privateKey || !passphrase) {
81
+ return [2, null];
82
+ }
83
+ ssh = new nodessh.NodeSSH();
84
+ return [4, ssh.connect({ host: host, username: username, privateKey: privateKey, passphrase: passphrase })];
85
+ case 1:
86
+ _b.sent();
87
+ return [2, ssh];
88
+ }
89
+ });
90
+ }); };
91
+ var getBuildPackageFileName = function (c) {
92
+ var packageOutputDirPath = c.runtime.appDir + "/output";
93
+ var outputFilenameList = fs_1["default"].readdirSync(packageOutputDirPath);
50
94
  return outputFilenameList[0];
51
95
  };
52
- const getLocalBuildPackagePath = (c) => {
53
- const fileName = getBuildPackageFileName(c);
54
- return path_1.default.join(c.runtime.appDir, 'output', fileName);
96
+ var getLocalBuildPackagePath = function (c) {
97
+ var fileName = getBuildPackageFileName(c);
98
+ return path_1["default"].join(c.runtime.appDir, 'output', fileName);
55
99
  };
56
- const resolveRemotePaths = (c) => {
57
- const remoteBuildDirRelativePath = resolvers_1.resolveHbbtvRemoteBuildDirRelativePath(c);
58
- const { hostHomeDir, dockerHtmlRootDir } = resolvers_1.resolveHbbtvDeployConfig();
59
- const hostTempDirName = 'travis-ci-temp';
100
+ var resolveRemotePaths = function (c) {
101
+ var remoteBuildDirRelativePath = resolvers_1.resolveHbbtvRemoteBuildDirRelativePath(c);
102
+ var _a = resolvers_1.resolveHbbtvDeployConfig(), hostHomeDir = _a.hostHomeDir, dockerHtmlRootDir = _a.dockerHtmlRootDir;
103
+ var hostTempDirName = 'travis-ci-temp';
60
104
  return {
61
- serverTempDirPath: `${hostHomeDir}/${hostTempDirName}/${remoteBuildDirRelativePath}`,
62
- dockerProjectDirPath: `${dockerHtmlRootDir}/${remoteBuildDirRelativePath}`,
105
+ serverTempDirPath: hostHomeDir + "/" + hostTempDirName + "/" + remoteBuildDirRelativePath,
106
+ dockerProjectDirPath: dockerHtmlRootDir + "/" + remoteBuildDirRelativePath
63
107
  };
64
108
  };
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');
103
- };
109
+ var log = function (msg) { return process.stdout.write(msg); };
110
+ var deployHbbTV = function (c) { return __awaiter(void 0, void 0, void 0, function () {
111
+ var _a, scheme, appId, remotePaths, dockerContainerName, remotePackagePath, dockerExecPrefix, dockerAppDirPath, ssh, indexHtmlParentDirPath, sourcePath, destPath, cmd;
112
+ return __generator(this, function (_b) {
113
+ switch (_b.label) {
114
+ case 0:
115
+ if (c.platform !== constants_1.Platforms.HBBTV)
116
+ return [2];
117
+ _a = c.runtime, scheme = _a.scheme, appId = _a.appId;
118
+ log('HbbTV deploy via SSH.\n\n');
119
+ remotePaths = resolveRemotePaths(c);
120
+ dockerContainerName = resolvers_1.resolveHbbtvDeployConfig().dockerContainerName;
121
+ remotePackagePath = remotePaths.serverTempDirPath + "/" + getBuildPackageFileName(c);
122
+ dockerExecPrefix = "docker exec -t " + dockerContainerName;
123
+ dockerAppDirPath = remotePaths.dockerProjectDirPath;
124
+ log('Creating connection...\n');
125
+ return [4, makeSshConnection(c)];
126
+ case 1:
127
+ ssh = _b.sent();
128
+ if (ssh === null) {
129
+ throw new Error('Connection failed - check "privateKeyRelativePath" or "process.env.CI_SSH_KEY_PASSPHRASE" deploy params.');
130
+ }
131
+ log('Clearing temporary dir on host side...\n');
132
+ return [4, ssh.execCommand("rm -Rf " + remotePaths.serverTempDirPath)];
133
+ case 2:
134
+ _b.sent();
135
+ log('Transferring build package from local machine to host...\n');
136
+ return [4, ssh.putFile(getLocalBuildPackagePath(c), remotePackagePath)];
137
+ case 3:
138
+ _b.sent();
139
+ log('Unzipping transferred build package...\n');
140
+ return [4, ssh.execCommand("unzip " + remotePackagePath, { cwd: remotePaths.serverTempDirPath })];
141
+ case 4:
142
+ _b.sent();
143
+ log('Removing transferred build package...\n');
144
+ return [4, ssh.execCommand("rm " + remotePackagePath)];
145
+ case 5:
146
+ _b.sent();
147
+ log('Clearing docker dir on host side...\n');
148
+ return [4, ssh.execCommand(dockerExecPrefix + " rm -rf " + dockerAppDirPath)];
149
+ case 6:
150
+ _b.sent();
151
+ indexHtmlParentDirPath = dockerAppDirPath + "/public";
152
+ log('Creating requested path for build in docker...\n');
153
+ return [4, ssh.execCommand(dockerExecPrefix + " mkdir -p " + indexHtmlParentDirPath)];
154
+ case 7:
155
+ _b.sent();
156
+ log('Copying unzipped build package from host to host\'s docker path...\n');
157
+ sourcePath = remotePaths.serverTempDirPath + "/.";
158
+ destPath = dockerContainerName + ":" + indexHtmlParentDirPath;
159
+ cmd = "docker cp " + sourcePath + " " + destPath;
160
+ return [4, ssh.execCommand(cmd)];
161
+ case 8:
162
+ _b.sent();
163
+ log('Clearing temporary dir on host side...\n');
164
+ return [4, ssh.execCommand("rm -Rf " + remotePaths.serverTempDirPath)];
165
+ case 9:
166
+ _b.sent();
167
+ log("\nThe build is deployed at " + resolvers_1.resolveHbbtvDeployUrl(c, scheme, appId) + "\n");
168
+ log('Deploy done.\n');
169
+ return [2];
170
+ }
171
+ });
172
+ }); };
104
173
  exports.deployHbbTV = deployHbbTV;
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
2
+ exports.__esModule = true;
3
3
  exports.engineTaskList = void 0;
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 = [
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 = [
13
13
  task_rnv_build_1.customRnvBuildTask,
14
14
  task_rnv_configure_1.customRnvConfigureTask,
15
15
  task_rnv_configureSoft_1.customRnvConfigureSoftTask,