@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.
- package/dist/src/constants/buildSchemes.js +3 -3
- package/dist/src/constants/index.js +5 -10
- package/dist/src/constants/platforms.js +11 -0
- package/dist/src/index.js +29 -31
- package/dist/src/resolvers/index.js +19 -12
- package/dist/src/resolvers/resolveBaseUrl.js +15 -16
- package/dist/src/resolvers/resolveBuildVersion.js +17 -19
- package/dist/src/resolvers/resolveBuildVersionOffset.js +35 -0
- package/dist/src/resolvers/resolveDeployLocations.js +70 -0
- package/dist/src/{utils/getBaseConfig.js → resolvers/resolveGenericRnvConfig.js} +18 -30
- package/dist/src/resolvers/resolveHbbtvDeployConfig.js +13 -0
- package/dist/src/resolvers/resolveHbbtvDeployUrl.js +11 -0
- package/dist/src/resolvers/resolveHbbtvRemoteBuildDirRelativePath.js +27 -0
- package/dist/src/resolvers/resolveZippedPlatformBuildsRelativeFilePath.js +15 -0
- package/dist/src/scripts/buildAllWithScheme.js +14 -14
- package/dist/src/scripts/gitReleaser/afterVersionBump.js +10 -10
- package/dist/src/scripts/gitReleaser/beforeVersionBump.js +7 -7
- package/dist/src/scripts/gitReleaser/checkReleaseNotes.js +9 -9
- package/dist/src/scripts/gitReleaser/pushRelease.js +17 -17
- package/dist/src/scripts/gitReleaser/pushReleaseCandidate.js +4 -4
- package/dist/src/scripts/gitReleaser/pushReleaseNotes.js +16 -16
- package/dist/src/scripts/release/deleteSourceMaps.js +6 -6
- package/dist/src/scripts/release/deployToAppCenter.js +37 -38
- package/dist/src/scripts/release/githubRelease.js +60 -64
- package/dist/src/scripts/release/notifySlack/makePayload.js +44 -48
- package/dist/src/scripts/release/notifySlack/notifySlack.js +10 -10
- package/dist/src/scripts/release/notifySlack/slackBlockKitBuilder.js +25 -28
- package/dist/src/scripts/release/sentryRelease.js +34 -33
- package/dist/src/scripts/release/urlsMarkdown.js +29 -30
- package/dist/src/scripts/releaseAllWithScheme.js +27 -28
- package/dist/src/scripts/utils/cmdUtils.js +9 -9
- package/dist/src/scripts/utils/fsUtils.js +7 -7
- package/dist/src/scripts/utils/gitUtils.js +50 -50
- package/dist/src/scripts/utils/index.js +8 -8
- package/dist/src/scripts/utils/stringUtils.js +2 -5
- package/dist/src/sdks/index.js +15 -54
- package/dist/src/sdks/sdk-tizen/index.js +154 -254
- package/dist/src/sdks/sdk-webos/index.js +136 -231
- package/dist/src/sdks/sdk-webpack/index.js +20 -69
- package/dist/src/sdks/sdkUtils.js +14 -59
- package/dist/src/tasks/deploy/aswS3/aws.js +9 -9
- package/dist/src/tasks/deploy/aswS3/deployS3.js +44 -82
- package/dist/src/tasks/deploy/hbbtv/deployHbbtv.js +70 -174
- package/dist/src/tasks/engineTasks.js +10 -10
- package/dist/src/tasks/task.rnv.build.js +77 -134
- package/dist/src/tasks/task.rnv.configure.js +39 -88
- package/dist/src/tasks/task.rnv.configureSoft.js +22 -75
- package/dist/src/tasks/task.rnv.deploy.js +28 -78
- package/dist/src/tasks/task.rnv.hooks.run.js +42 -92
- package/dist/src/tasks/task.rnv.package.js +18 -61
- package/dist/src/tasks/task.rnv.project.configure.js +80 -183
- package/dist/src/tasks/task.rnv.start.js +42 -87
- package/dist/src/types/c.js +1 -1
- package/dist/src/types/index.js +1 -1
- package/dist/src/utils/forEachSupportedPlatformFlavour.js +12 -12
- package/dist/src/utils/replaceRelevantStringsInConfig/index.js +2 -9
- package/dist/src/utils/replaceRelevantStringsInConfig/replaceRelevantStringsInConfig.js +10 -11
- package/dist/src/utils/replaceRelevantStringsInConfig/replaceTemplateString.js +24 -30
- package/dist/src/utils/zipBuildsByPlatforms.js +28 -39
- package/dist/templates/platforms/_shared/template.js +58 -42
- package/dist/templates/platforms/_shared/webpack.base.js +119 -139
- package/dist/templates/platforms/entone/webpack.config.dev.js +27 -22
- package/dist/templates/platforms/entone/webpack.config.prod.js +21 -20
- package/dist/templates/platforms/hbbtv/webpack.config.dev.js +42 -24
- package/dist/templates/platforms/hbbtv/webpack.config.prod.js +36 -22
- package/dist/templates/platforms/tizen/webpack.config.dev.js +28 -22
- package/dist/templates/platforms/tizen/webpack.config.prod.js +21 -20
- package/dist/templates/platforms/webos/webpack.config.dev.js +31 -24
- package/dist/templates/platforms/webos/webpack.config.prod.js +23 -22
- package/dist/templates/platforms/webtv/webpack.config.dev.js +27 -22
- package/dist/templates/platforms/webtv/webpack.config.prod.js +21 -20
- package/dist/types/src/constants/index.d.ts +1 -0
- package/dist/types/src/constants/platforms.d.ts +8 -0
- package/dist/types/src/resolvers/index.d.ts +8 -1
- package/dist/types/src/resolvers/resolveBuildVersionOffset.d.ts +3 -0
- package/dist/types/src/resolvers/resolveDeployLocations.d.ts +9 -0
- package/dist/types/src/resolvers/resolveGenericRnvConfig.d.ts +4 -0
- package/dist/types/src/resolvers/resolveHbbtvDeployConfig.d.ts +10 -0
- package/dist/types/src/resolvers/resolveHbbtvDeployUrl.d.ts +3 -0
- package/dist/types/src/resolvers/resolveHbbtvRemoteBuildDirRelativePath.d.ts +3 -0
- package/dist/types/src/resolvers/resolveZippedPlatformBuildsRelativeFilePath.d.ts +3 -0
- package/dist/types/src/scripts/release/notifySlack/makePayload.d.ts +9 -3
- package/dist/types/src/tasks/deploy/hbbtv/deployHbbtv.d.ts +0 -1
- package/dist/types/src/tasks/task.rnv.build.d.ts +1 -2
- package/dist/types/src/tasks/task.rnv.configure.d.ts +1 -2
- package/dist/types/src/tasks/task.rnv.deploy.d.ts +1 -2
- package/dist/types/src/tasks/task.rnv.package.d.ts +1 -2
- package/dist/types/src/tasks/task.rnv.start.d.ts +1 -2
- package/dist/types/src/types/c.d.ts +278 -8
- package/dist/types/src/utils/zipBuildsByPlatforms.d.ts +0 -1
- package/package.json +3 -3
- package/dist/src/enginePlatforms.js +0 -15
- package/dist/src/utils/getDeployLocations.js +0 -80
- package/dist/src/utils/getVersionOffset.js +0 -35
- package/dist/types/src/enginePlatforms.d.ts +0 -8
- package/dist/types/src/utils/getBaseConfig.d.ts +0 -2
- package/dist/types/src/utils/getDeployLocations.d.ts +0 -7
- package/dist/types/src/utils/getVersionOffset.d.ts +0 -1
|
@@ -1,98 +1,53 @@
|
|
|
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
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
6
|
exports.customRnvStartTask = void 0;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return [2, logError('This platform does not support hosted mode', true)];
|
|
84
|
-
}
|
|
85
|
-
return [2, logErrorPlatform(c)];
|
|
86
|
-
}
|
|
87
|
-
return [2];
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}); };
|
|
91
|
-
var customRnvStartTask = {
|
|
7
|
+
const better_opn_1 = __importDefault(require("better-opn"));
|
|
8
|
+
const rnv_1 = require("rnv");
|
|
9
|
+
const constants_1 = require("../constants");
|
|
10
|
+
const { getConfigProp } = rnv_1.Common;
|
|
11
|
+
const { logErrorPlatform } = rnv_1.PlatformManager;
|
|
12
|
+
const { logTask, logError } = rnv_1.Logger;
|
|
13
|
+
const { TASK_START, TASK_CONFIGURE, REMOTE_DEBUGGER_ENABLED_PLATFORMS, PARAMS } = rnv_1.Constants;
|
|
14
|
+
const { runWebpackServer, waitForWebpack } = rnv_1.WebpackUtils;
|
|
15
|
+
const { executeTask } = rnv_1.TaskManager;
|
|
16
|
+
const startFn = async (c, parentTask, originTask) => {
|
|
17
|
+
const { platform, runtime, program } = c;
|
|
18
|
+
const { port } = runtime;
|
|
19
|
+
const { hosted } = program;
|
|
20
|
+
logTask('taskRnvStart', `parent:${parentTask} port:${port} hosted:${!!hosted}`);
|
|
21
|
+
if (!parentTask) {
|
|
22
|
+
await executeTask(c, TASK_CONFIGURE, TASK_START, originTask);
|
|
23
|
+
}
|
|
24
|
+
if (hosted) {
|
|
25
|
+
waitForWebpack(c)
|
|
26
|
+
.then(() => better_opn_1.default(`http://${c.runtime.localhost}:${port}/`))
|
|
27
|
+
.catch(logError);
|
|
28
|
+
}
|
|
29
|
+
const bundleAssets = getConfigProp(c, c.platform, 'bundleAssets');
|
|
30
|
+
const isDebuggerEnabledForPlatform = REMOTE_DEBUGGER_ENABLED_PLATFORMS.includes(platform);
|
|
31
|
+
const isWeinreEnabled = isDebuggerEnabledForPlatform && !bundleAssets && !hosted;
|
|
32
|
+
switch (platform) {
|
|
33
|
+
case constants_1.Platforms.ENTONE:
|
|
34
|
+
case constants_1.Platforms.HBBTV:
|
|
35
|
+
case constants_1.Platforms.TIZEN:
|
|
36
|
+
case constants_1.Platforms.WEBOS:
|
|
37
|
+
case constants_1.Platforms.WEBTV:
|
|
38
|
+
return runWebpackServer(c, isWeinreEnabled);
|
|
39
|
+
default:
|
|
40
|
+
if (hosted) {
|
|
41
|
+
return logError('This platform does not support hosted mode', true);
|
|
42
|
+
}
|
|
43
|
+
return logErrorPlatform(c);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const customRnvStartTask = {
|
|
92
47
|
description: 'Starts bundler / server',
|
|
93
48
|
fn: startFn,
|
|
94
49
|
task: 'start',
|
|
95
50
|
params: PARAMS.withBase(PARAMS.withConfigure()),
|
|
96
|
-
platforms:
|
|
51
|
+
platforms: Object.values(constants_1.Platforms),
|
|
97
52
|
};
|
|
98
53
|
exports.customRnvStartTask = customRnvStartTask;
|
package/dist/src/types/c.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/src/types/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.forEachSupportedPlatformFlavour = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
string +=
|
|
7
|
-
string +=
|
|
8
|
-
string +=
|
|
4
|
+
const getProgressMessage = (platforms, platformIndex, flavours, flavourIndex) => {
|
|
5
|
+
let string = `\nProcessing "${platforms[platformIndex]}" platform`;
|
|
6
|
+
string += ` (${platformIndex + 1}/${platforms.length})`;
|
|
7
|
+
string += ` and its "${flavours[flavourIndex]}" flavour`;
|
|
8
|
+
string += ` (${flavourIndex + 1}/${flavours.length})...`;
|
|
9
9
|
return string;
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const forEachSupportedPlatformFlavour = (c, cb) => {
|
|
12
|
+
const processPlatformFlavours = (platform, platformIndex, platforms) => {
|
|
13
13
|
var _a;
|
|
14
|
-
|
|
14
|
+
const processFlavour = (flavour, flavourIndex, flavours) => {
|
|
15
15
|
console.log(getProgressMessage(platforms, platformIndex, flavours, flavourIndex));
|
|
16
|
-
return cb({ platform
|
|
16
|
+
return cb({ platform, flavour, scheme: c.runtime.scheme });
|
|
17
17
|
};
|
|
18
|
-
|
|
18
|
+
const { supportedFlavours = [] } = ((_a = c.buildConfig.platforms[platform]) === null || _a === void 0 ? void 0 : _a.deploy) || {};
|
|
19
19
|
supportedFlavours.forEach(processFlavour);
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
const { supportedPlatforms = [] } = c.buildConfig.defaults || {};
|
|
22
22
|
supportedPlatforms.forEach(processPlatformFlavours);
|
|
23
23
|
};
|
|
24
24
|
exports.forEachSupportedPlatformFlavour = forEachSupportedPlatformFlavour;
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
exports.__esModule = true;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
3
|
exports.replaceRelevantStringsInConfig = void 0;
|
|
11
4
|
var replaceRelevantStringsInConfig_1 = require("./replaceRelevantStringsInConfig");
|
|
12
|
-
|
|
5
|
+
Object.defineProperty(exports, "replaceRelevantStringsInConfig", { enumerable: true, get: function () { return replaceRelevantStringsInConfig_1.replaceRelevantStringsInConfig; } });
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.replaceRelevantStringsInConfig = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (excludedPropsList === void 0) { excludedPropsList = []; }
|
|
4
|
+
const replaceTemplateString_1 = require("./replaceTemplateString");
|
|
5
|
+
const processObject = (c, object, excludedPropsList = []) => {
|
|
7
6
|
if (!object)
|
|
8
7
|
return;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const objectKeys = Object.keys(object);
|
|
9
|
+
const processStringValue = (string, objectKeyName) => {
|
|
10
|
+
const replacedString = replaceTemplateString_1.replaceTemplateString(c, string);
|
|
12
11
|
if (replacedString !== string) {
|
|
13
12
|
object[objectKeyName] = replacedString;
|
|
14
13
|
}
|
|
15
14
|
};
|
|
16
|
-
objectKeys.forEach(
|
|
17
|
-
|
|
15
|
+
objectKeys.forEach((key) => {
|
|
16
|
+
const keyValue = object[key];
|
|
18
17
|
if (typeof keyValue === 'string') {
|
|
19
18
|
processStringValue(keyValue, key);
|
|
20
19
|
}
|
|
@@ -25,8 +24,8 @@ var processObject = function (c, object, excludedPropsList) {
|
|
|
25
24
|
}
|
|
26
25
|
});
|
|
27
26
|
};
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const replaceRelevantStringsInConfig = (c) => {
|
|
28
|
+
const { defaults, common, platforms } = c.buildConfig;
|
|
30
29
|
processObject(c, defaults);
|
|
31
30
|
processObject(c, common, ['']);
|
|
32
31
|
processObject(c, platforms);
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.replaceTemplateString = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var currentPropValue = c;
|
|
4
|
+
const rnv_1 = require("rnv");
|
|
5
|
+
const resolvers_1 = require("../../resolvers");
|
|
6
|
+
const { getConfigProp } = rnv_1.Common;
|
|
7
|
+
const getValueFromConfigByStringPath = (c, stringPathToObjectProp = '') => {
|
|
8
|
+
const pathToPropList = stringPathToObjectProp.split('.');
|
|
9
|
+
const listLength = pathToPropList.length;
|
|
10
|
+
let currentPropValue = c;
|
|
12
11
|
try {
|
|
13
|
-
for (
|
|
12
|
+
for (let i = 1; i < listLength; i++) {
|
|
14
13
|
currentPropValue = currentPropValue[pathToPropList[i]];
|
|
15
14
|
if (currentPropValue === undefined) {
|
|
16
15
|
return null;
|
|
@@ -22,8 +21,7 @@ var getValueFromConfigByStringPath = function (c, stringPathToObjectProp) {
|
|
|
22
21
|
return null;
|
|
23
22
|
}
|
|
24
23
|
};
|
|
25
|
-
|
|
26
|
-
if (stringInsideBracelets === void 0) { stringInsideBracelets = ''; }
|
|
24
|
+
const getValue = (c, stringInsideBracelets = '') => {
|
|
27
25
|
if (stringInsideBracelets.startsWith('c.')) {
|
|
28
26
|
return getValueFromConfigByStringPath(c, stringInsideBracelets);
|
|
29
27
|
}
|
|
@@ -31,38 +29,34 @@ var getValue = function (c, stringInsideBracelets) {
|
|
|
31
29
|
return getConfigProp(c, c.platform, stringInsideBracelets.replace('configProps.', ''));
|
|
32
30
|
}
|
|
33
31
|
if (stringInsideBracelets === 'BRANCH_COMMIT_OFFSET') {
|
|
34
|
-
return
|
|
32
|
+
return resolvers_1.resolveBuildVersionOffset(c);
|
|
35
33
|
}
|
|
36
34
|
return stringInsideBracelets;
|
|
37
35
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
const injectorStartMark = '{{';
|
|
37
|
+
const injectorEndMark = '}}';
|
|
38
|
+
const injectorRegexp = new RegExp(`${injectorStartMark}.*?${injectorEndMark}`, 'g');
|
|
39
|
+
const handleStringEnd = (string) => {
|
|
40
|
+
let outputString = string.replace(/\[\[[^[\]]+]]$/, '');
|
|
41
|
+
const matches = outputString.match(/\[\[[^[\]]+]]/g);
|
|
44
42
|
if (!matches || !matches.length)
|
|
45
43
|
return outputString;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return (templateString.slice(injectorStartMark.length, -injectorEndMark.length));
|
|
49
|
-
};
|
|
50
|
-
var removeBracelets = function (match) {
|
|
44
|
+
const getStringInside = (templateString = '') => (templateString.slice(injectorStartMark.length, -injectorEndMark.length));
|
|
45
|
+
const removeBracelets = (match) => {
|
|
51
46
|
outputString = outputString.replace(match, getStringInside(match));
|
|
52
47
|
};
|
|
53
48
|
matches.forEach(removeBracelets);
|
|
54
49
|
return outputString;
|
|
55
50
|
};
|
|
56
|
-
|
|
57
|
-
if (string === void 0) { string = ''; }
|
|
51
|
+
const replaceTemplateString = (c, string = '') => {
|
|
58
52
|
if (!string || typeof string !== 'string')
|
|
59
53
|
return '';
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
const replacer = (match) => {
|
|
55
|
+
const stringInBracelets = match.slice(injectorStartMark.length, -injectorEndMark.length);
|
|
56
|
+
const value = getValue(c, stringInBracelets);
|
|
63
57
|
return value === match ? value : replaceTemplateString(c, value);
|
|
64
58
|
};
|
|
65
|
-
|
|
59
|
+
const parsedString = string.replace(injectorRegexp, replacer);
|
|
66
60
|
return handleStringEnd(parsedString);
|
|
67
61
|
};
|
|
68
62
|
exports.replaceTemplateString = replaceTemplateString;
|
|
@@ -2,58 +2,47 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
-
exports
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.zipBuildsByPlatforms = void 0;
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const child_process_1 = require("child_process");
|
|
10
|
+
const glob_1 = __importDefault(require("glob"));
|
|
11
|
+
const constants_1 = require("../constants");
|
|
12
|
+
const resolvers_1 = require("../resolvers");
|
|
13
|
+
const zipDir = (dir, outputFile) => child_process_1.execSync(`zip ${outputFile} -0 -j ${dir}/*`);
|
|
14
|
+
const getPlatformBuildFileExtension = (platformName) => {
|
|
14
15
|
switch (platformName) {
|
|
15
|
-
case
|
|
16
|
-
case
|
|
16
|
+
case constants_1.Platforms.TIZEN: return 'wgt';
|
|
17
|
+
case constants_1.Platforms.WEBOS: return 'ipk';
|
|
17
18
|
default: return 'zip';
|
|
18
19
|
}
|
|
19
20
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return buildsPathsCandidates.filter(
|
|
21
|
+
const getPlatformBuildsPaths = (c, platformName) => {
|
|
22
|
+
const { platformBuildsDir } = c.buildConfig.paths;
|
|
23
|
+
const outputGlob = `${platformBuildsDir}/**/output`;
|
|
24
|
+
const platformBuildsGlob = `${outputGlob}/*.${getPlatformBuildFileExtension(platformName)}`;
|
|
25
|
+
const buildsPathsCandidates = glob_1.default.sync(platformBuildsGlob);
|
|
26
|
+
return buildsPathsCandidates.filter((path) => path.includes(platformName));
|
|
26
27
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var platformBuildsDir = c.buildConfig.paths.platformBuildsDir;
|
|
30
|
-
var zippedFilesParentDir = 'zipped_by_platform';
|
|
31
|
-
var appNameInFileName = common_1.getConfigProp(c, platformName, 'appNameInFileName', '');
|
|
32
|
-
var buildVersion = common_1.getConfigProp(c, platformName, 'packageVersion', '');
|
|
33
|
-
var fileExtension = 'zip';
|
|
34
|
-
var relativePathToDir = platformBuildsDir + "/" + zippedFilesParentDir;
|
|
35
|
-
var zipFileName = appNameInFileName + "_" + platformName + "_" + buildVersion + "." + fileExtension;
|
|
36
|
-
return relativePathToDir + "/" + zipFileName;
|
|
37
|
-
};
|
|
38
|
-
exports.getZippedPlatformBuildsFilePath = getZippedPlatformBuildsFilePath;
|
|
39
|
-
var processPlatform = function (c, platformName) {
|
|
40
|
-
var platformBuildsPaths = getPlatformBuildsPaths(c, platformName);
|
|
28
|
+
const processPlatform = (c, platformName) => {
|
|
29
|
+
const platformBuildsPaths = getPlatformBuildsPaths(c, platformName);
|
|
41
30
|
if (platformBuildsPaths.length === 0)
|
|
42
31
|
return;
|
|
43
|
-
|
|
44
|
-
|
|
32
|
+
const outputZipFilePath = resolvers_1.resolveZippedPlatformBuildsRelativeFilePath(c, platformName);
|
|
33
|
+
const tempPlatformDir = `${path_1.dirname(outputZipFilePath)}/${platformName}`;
|
|
45
34
|
fs_1.mkdirSync(tempPlatformDir, { recursive: true });
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
35
|
+
const copyBuildFileIntoTempPlatformDir = (buildFilePath) => {
|
|
36
|
+
const buildFileName = path_1.basename(buildFilePath);
|
|
37
|
+
const dest = `${tempPlatformDir}/${buildFileName}`;
|
|
49
38
|
fs_1.copyFileSync(buildFilePath, dest);
|
|
50
39
|
};
|
|
51
40
|
platformBuildsPaths.forEach(copyBuildFileIntoTempPlatformDir);
|
|
52
41
|
zipDir(tempPlatformDir, outputZipFilePath);
|
|
53
42
|
fs_1.rmdirSync(tempPlatformDir, { recursive: true });
|
|
54
43
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
supportedPlatforms.forEach(
|
|
44
|
+
const zipBuildsByPlatforms = (c) => {
|
|
45
|
+
const { supportedPlatforms = [] } = c.buildConfig.defaults || {};
|
|
46
|
+
supportedPlatforms.forEach((platformName) => processPlatform(c, platformName));
|
|
58
47
|
};
|
|
59
48
|
exports.zipBuildsByPlatforms = zipBuildsByPlatforms;
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var DEFAULT_CONFIG = {
|
|
2
|
+
const { Constants } = require('@24i/smartapps-bigscreen-rnv-build-engine');
|
|
3
|
+
const DEFAULT_CONFIG = {
|
|
14
4
|
isDebug: false,
|
|
15
5
|
isTestVersion: false,
|
|
16
6
|
title: '24i SmartApps BIGScreen Template',
|
|
@@ -18,47 +8,73 @@ var DEFAULT_CONFIG = {
|
|
|
18
8
|
htmlTag: '<html lang="en">',
|
|
19
9
|
contentType: '',
|
|
20
10
|
metaTags: {
|
|
21
|
-
viewport: 'content="width=1280"'
|
|
22
|
-
}
|
|
11
|
+
viewport: 'content="width=1280"',
|
|
12
|
+
},
|
|
23
13
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
const indent = (level) => ' '.repeat(level);
|
|
15
|
+
const removeBlankLines = (string) => string.replace(/^\s*\n/gm, '');
|
|
16
|
+
const constructMetaTags = (tags) => {
|
|
27
17
|
if (typeof tags === 'string')
|
|
28
18
|
return tags;
|
|
29
|
-
|
|
19
|
+
const metatags = Object
|
|
30
20
|
.keys(tags)
|
|
31
|
-
.map(
|
|
21
|
+
.map((tag) => `<meta name="${tag}" ${tags[tag]} />`);
|
|
32
22
|
metatags.push('<meta charset="utf-8" />');
|
|
33
|
-
return metatags.join(
|
|
23
|
+
return metatags.join(`\n${indent(2)}`);
|
|
34
24
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
25
|
+
const htmlTemp = (options) => {
|
|
26
|
+
const config = { ...DEFAULT_CONFIG, ...options };
|
|
27
|
+
const { docType, title, metaTags, htmlTag, contentType, isDebug, debug, debugIp, platform, bodyPrepend, bodyAppend, } = config;
|
|
28
|
+
const { isBuildHosted, baseUrl } = options;
|
|
29
|
+
const isBuildHostedAndHasBaseUrl = isBuildHosted && !!baseUrl;
|
|
30
|
+
const appContentPath = isBuildHostedAndHasBaseUrl ? `${baseUrl}/public/content` : 'content';
|
|
31
|
+
const titleTag = `<title>${title}</title>`;
|
|
32
|
+
const noScript = '<noscript>You need to enable JavaScript to run this app.</noscript>';
|
|
33
|
+
let remoteDebugScript;
|
|
44
34
|
if (debug === 'true' && debugIp) {
|
|
45
|
-
remoteDebugScript =
|
|
35
|
+
remoteDebugScript = `<script src="http://${debugIp}:8080/target/target-script-min.js#anonymous"></script>`;
|
|
46
36
|
}
|
|
47
|
-
|
|
48
|
-
if (platform ===
|
|
37
|
+
let tizenScripts = '';
|
|
38
|
+
if (platform === Constants.Platforms.TIZEN) {
|
|
49
39
|
tizenScripts = '<script type="text/javascript" src="$WEBAPIS/webapis/webapis.js"></script>';
|
|
50
40
|
}
|
|
51
|
-
|
|
52
|
-
if (platform ===
|
|
53
|
-
|
|
54
|
-
webosScripts =
|
|
41
|
+
let webosScripts = '';
|
|
42
|
+
if (platform === Constants.Platforms.WEBOS) {
|
|
43
|
+
const webosScriptsPath = `${appContentPath}/js/webOSTVjs-1.2.3`;
|
|
44
|
+
webosScripts = `<script type="text/javascript" src="${webosScriptsPath}/webOSTV.js"></script>`;
|
|
55
45
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
46
|
+
const errScript = `
|
|
47
|
+
<script>window.onerror = function(err) {
|
|
48
|
+
var errDiv = document.getElementById('err');
|
|
49
|
+
errDiv.innerHTML += err;
|
|
50
|
+
}
|
|
51
|
+
</script>`;
|
|
52
|
+
const errDiv = '<div id="err" style="color: red; position: absolute; top: 0; left: 0; z-index: 0;"> </div>';
|
|
53
|
+
const customScripts = (config.customScripts || [])
|
|
54
|
+
.map((src) => `<script type="text/javascript" src="${src}"></script>`)
|
|
60
55
|
.join('');
|
|
61
|
-
|
|
62
|
-
return removeBlankLines(
|
|
56
|
+
const rootDiv = '<div id="root" class="root"></div>';
|
|
57
|
+
return removeBlankLines(`
|
|
58
|
+
${docType}
|
|
59
|
+
${htmlTag}
|
|
60
|
+
<head>
|
|
61
|
+
${contentType}
|
|
62
|
+
${constructMetaTags(metaTags)}
|
|
63
|
+
${titleTag}
|
|
64
|
+
${remoteDebugScript || ''}
|
|
65
|
+
${isDebug ? errScript : ''}
|
|
66
|
+
${tizenScripts}
|
|
67
|
+
${webosScripts}
|
|
68
|
+
</head>
|
|
69
|
+
<body>
|
|
70
|
+
${bodyPrepend || ''}
|
|
71
|
+
${noScript}
|
|
72
|
+
${isDebug ? errDiv : ''}
|
|
73
|
+
${rootDiv}
|
|
74
|
+
${bodyAppend || ''}
|
|
75
|
+
${customScripts}
|
|
76
|
+
</body>
|
|
77
|
+
</html>
|
|
78
|
+
`);
|
|
63
79
|
};
|
|
64
80
|
module.exports = htmlTemp;
|