@24i/smartapps-bigscreen-rnv-build-engine 0.0.2-alpha.1353 → 0.0.2-alpha.1355

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