@24i/bigscreen-sdk 1.0.16 → 1.0.17-alpha.2324
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/package.json +4 -3
- package/packages/create-package/dist/createPackage.js +66 -0
- package/packages/create-package/dist/createPackage.js.map +1 -0
- package/packages/create-package/dist/index.js +5 -0
- package/packages/create-package/dist/index.js.map +1 -0
- package/packages/create-package/dist/questionnaire/questions.js +35 -0
- package/packages/create-package/dist/questionnaire/questions.js.map +1 -0
- package/packages/create-package/dist/settings/Settings.js +10 -0
- package/packages/create-package/dist/settings/Settings.js.map +1 -0
- package/packages/create-package/dist/types.js +3 -0
- package/packages/create-package/dist/types.js.map +1 -0
- package/packages/input/README.md +1 -1
- package/packages/input/src/Input.tsx +3 -5
- package/packages/interactable/src/Interactable.tsx +3 -22
- package/packages/rnv-build-engine/dist/src/constants/buildSchemes.js +14 -0
- package/packages/rnv-build-engine/dist/src/constants/index.js +7 -0
- package/packages/rnv-build-engine/dist/src/constants/platforms.js +14 -0
- package/packages/rnv-build-engine/dist/src/engine.js +94 -0
- package/packages/rnv-build-engine/dist/src/index.js +26 -0
- package/packages/rnv-build-engine/dist/src/resolvers/index.js +29 -0
- package/packages/rnv-build-engine/dist/src/resolvers/resolveBaseUrl.js +31 -0
- package/packages/rnv-build-engine/dist/src/resolvers/resolveBuildFileExtension.js +12 -0
- package/packages/rnv-build-engine/dist/src/resolvers/resolveBuildFileName.js +36 -0
- package/packages/rnv-build-engine/dist/src/resolvers/resolveBuildVersion.js +42 -0
- package/packages/rnv-build-engine/dist/src/resolvers/resolveBuildVersionOffset.js +34 -0
- package/packages/rnv-build-engine/dist/src/resolvers/resolveDeployLocations.js +79 -0
- package/packages/rnv-build-engine/dist/src/resolvers/resolveGenericRnvConfig.js +47 -0
- package/packages/rnv-build-engine/dist/src/resolvers/resolveHbbtvDeployConfig.js +13 -0
- package/packages/rnv-build-engine/dist/src/resolvers/resolveHbbtvDeployUrl.js +11 -0
- package/packages/rnv-build-engine/dist/src/resolvers/resolveHbbtvRemoteBuildDirRelativePath.js +24 -0
- package/packages/rnv-build-engine/dist/src/resolvers/resolveSupportedPlatforms.js +5 -0
- package/packages/rnv-build-engine/dist/src/resolvers/resolveUsedFlavours.js +23 -0
- package/packages/rnv-build-engine/dist/src/resolvers/resolveZippedPlatformBuildsRelativeFilePath.js +14 -0
- package/packages/rnv-build-engine/dist/src/scripts/buildAllWithScheme.js +25 -0
- package/packages/rnv-build-engine/dist/src/scripts/generateDeployUrls/formatTableDataSpaces.js +30 -0
- package/packages/rnv-build-engine/dist/src/scripts/generateDeployUrls/generateDeployUrls.js +90 -0
- package/packages/rnv-build-engine/dist/src/scripts/generateDeployUrls/index.js +4 -0
- package/packages/rnv-build-engine/dist/src/scripts/generateDeployUrls/makeTableDataByScheme.js +63 -0
- package/packages/rnv-build-engine/dist/src/scripts/gitReleaser/afterVersionBump.js +18 -0
- package/packages/rnv-build-engine/dist/src/scripts/gitReleaser/beforeVersionBump.js +12 -0
- package/packages/rnv-build-engine/dist/src/scripts/gitReleaser/checkReleaseNotes.js +16 -0
- package/packages/rnv-build-engine/dist/src/scripts/gitReleaser/pushRelease.js +31 -0
- package/packages/rnv-build-engine/dist/src/scripts/gitReleaser/pushReleaseCandidate.js +6 -0
- package/packages/rnv-build-engine/dist/src/scripts/gitReleaser/pushReleaseNotes.js +37 -0
- package/packages/rnv-build-engine/dist/src/scripts/release/deleteSourceMaps.js +11 -0
- package/packages/rnv-build-engine/dist/src/scripts/release/deployToAppCenter.js +83 -0
- package/packages/rnv-build-engine/dist/src/scripts/release/githubRelease.js +128 -0
- package/packages/rnv-build-engine/dist/src/scripts/release/notifySlack/generateWebhoook.js +66 -0
- package/packages/rnv-build-engine/dist/src/scripts/release/notifySlack/makePayload.js +92 -0
- package/packages/rnv-build-engine/dist/src/scripts/release/notifySlack/notifySlack.js +44 -0
- package/packages/rnv-build-engine/dist/src/scripts/release/notifySlack/slackBlockKitBuilder.js +39 -0
- package/packages/rnv-build-engine/dist/src/scripts/release/sentryRelease.js +85 -0
- package/packages/rnv-build-engine/dist/src/scripts/release/urlsMarkdown.js +62 -0
- package/packages/rnv-build-engine/dist/src/scripts/releaseAllWithScheme.js +79 -0
- package/packages/rnv-build-engine/dist/src/scripts/utils/cmdUtils.js +12 -0
- package/packages/rnv-build-engine/dist/src/scripts/utils/fsUtils.js +33 -0
- package/packages/rnv-build-engine/dist/src/scripts/utils/generateIcons.js +29 -0
- package/packages/rnv-build-engine/dist/src/scripts/utils/gitUtils.js +78 -0
- package/packages/rnv-build-engine/dist/src/scripts/utils/index.js +27 -0
- package/packages/rnv-build-engine/dist/src/scripts/utils/stringUtils.js +5 -0
- package/packages/rnv-build-engine/dist/src/sdks/index.js +42 -0
- package/packages/rnv-build-engine/dist/src/sdks/sdk-tizen/index.js +13 -0
- package/packages/rnv-build-engine/dist/src/sdks/sdk-tizen/sdkTizen.js +240 -0
- package/packages/rnv-build-engine/dist/src/sdks/sdk-utils/index.js +14 -0
- package/packages/rnv-build-engine/dist/src/sdks/sdk-utils/registerSdkPath.js +14 -0
- package/packages/rnv-build-engine/dist/src/sdks/sdk-utils/sdk-installer/index.js +5 -0
- package/packages/rnv-build-engine/dist/src/sdks/sdk-utils/sdk-installer/sdkInstaller.js +39 -0
- package/packages/rnv-build-engine/dist/src/sdks/sdk-utils/sdk-installer/services/clean.js +11 -0
- package/packages/rnv-build-engine/dist/src/sdks/sdk-utils/sdk-installer/services/download.js +74 -0
- package/packages/rnv-build-engine/dist/src/sdks/sdk-utils/sdk-installer/services/index.js +11 -0
- package/packages/rnv-build-engine/dist/src/sdks/sdk-utils/sdk-installer/services/install.js +23 -0
- package/packages/rnv-build-engine/dist/src/sdks/sdk-utils/sdk-installer/services/unzip.js +12 -0
- package/packages/rnv-build-engine/dist/src/sdks/sdk-webos/index.js +13 -0
- package/packages/rnv-build-engine/dist/src/sdks/sdk-webos/sdkWebos.js +135 -0
- package/packages/rnv-build-engine/dist/src/sdks/sdk-webpack/index.js +13 -0
- package/packages/rnv-build-engine/dist/src/sdks/sdk-webpack/sdkWebpack.js +32 -0
- package/packages/rnv-build-engine/dist/src/sdks/sdk-xbox/index.js +13 -0
- package/packages/rnv-build-engine/dist/src/sdks/sdk-xbox/sdkXbox.js +222 -0
- package/packages/rnv-build-engine/dist/src/tasks/deploy/aswS3/aws.js +22 -0
- package/packages/rnv-build-engine/dist/src/tasks/deploy/aswS3/deployS3.js +71 -0
- package/packages/rnv-build-engine/dist/src/tasks/deploy/hbbtv/deployHbbtv.js +94 -0
- package/packages/rnv-build-engine/dist/src/tasks/engineTasks.js +22 -0
- package/packages/rnv-build-engine/dist/src/tasks/task.rnv.build.js +99 -0
- package/packages/rnv-build-engine/dist/src/tasks/task.rnv.configure.js +45 -0
- package/packages/rnv-build-engine/dist/src/tasks/task.rnv.configureSoft.js +31 -0
- package/packages/rnv-build-engine/dist/src/tasks/task.rnv.deploy.js +40 -0
- package/packages/rnv-build-engine/dist/src/tasks/task.rnv.hooks.run.js +71 -0
- package/packages/rnv-build-engine/dist/src/tasks/task.rnv.package.js +19 -0
- package/packages/rnv-build-engine/dist/src/tasks/task.rnv.project.configure.js +116 -0
- package/packages/rnv-build-engine/dist/src/tasks/task.rnv.start.js +72 -0
- package/packages/rnv-build-engine/dist/src/types/c.js +2 -0
- package/packages/rnv-build-engine/dist/src/types/constants.js +2 -0
- package/packages/rnv-build-engine/dist/src/types/index.js +2 -0
- package/packages/rnv-build-engine/dist/src/utils/forEachSupportedPlatformFlavour.js +24 -0
- package/packages/rnv-build-engine/dist/src/utils/generatePngSpriteMap.js +78 -0
- package/packages/rnv-build-engine/dist/src/utils/generateSvgSpriteMap.js +113 -0
- package/packages/rnv-build-engine/dist/src/utils/mergeSvgAndPngIcons.js +61 -0
- package/packages/rnv-build-engine/dist/src/utils/replaceRelevantStringsInConfig/index.js +5 -0
- package/packages/rnv-build-engine/dist/src/utils/replaceRelevantStringsInConfig/replaceRelevantStringsInConfig.js +31 -0
- package/packages/rnv-build-engine/dist/src/utils/replaceRelevantStringsInConfig/replaceTemplateString.js +40 -0
- package/packages/rnv-build-engine/dist/src/utils/zipBuildsByPlatforms.js +61 -0
- package/packages/rnv-build-engine/dist/templates/platforms/_shared/template.js +110 -0
- package/packages/rnv-build-engine/dist/templates/platforms/_shared/utils/extendSass.js +29 -0
- package/packages/rnv-build-engine/dist/templates/platforms/_shared/utils/joinStrings.js +5 -0
- package/packages/rnv-build-engine/dist/templates/platforms/_shared/webpack.base.js +239 -0
- package/packages/rnv-build-engine/dist/templates/platforms/entone/webpack.config.dev.js +63 -0
- package/packages/rnv-build-engine/dist/templates/platforms/entone/webpack.config.prod.js +58 -0
- package/packages/rnv-build-engine/dist/templates/platforms/hbbtv/webpack.config.dev.js +80 -0
- package/packages/rnv-build-engine/dist/templates/platforms/hbbtv/webpack.config.prod.js +75 -0
- package/packages/rnv-build-engine/dist/templates/platforms/kreatv/webpack.config.dev.js +63 -0
- package/packages/rnv-build-engine/dist/templates/platforms/kreatv/webpack.config.prod.js +58 -0
- package/packages/rnv-build-engine/dist/templates/platforms/saphi/webpack.config.dev.js +63 -0
- package/packages/rnv-build-engine/dist/templates/platforms/saphi/webpack.config.prod.js +58 -0
- package/packages/rnv-build-engine/dist/templates/platforms/tizen/project/.project +24 -0
- package/packages/rnv-build-engine/dist/templates/platforms/tizen/project/.tproject +12 -0
- package/packages/rnv-build-engine/dist/templates/platforms/tizen/project/config.xml +17 -0
- package/packages/rnv-build-engine/dist/templates/platforms/tizen/webpack.config.dev.js +64 -0
- package/packages/rnv-build-engine/dist/templates/platforms/tizen/webpack.config.prod.js +58 -0
- package/packages/rnv-build-engine/dist/templates/platforms/webos/project/.project +35 -0
- package/packages/rnv-build-engine/dist/templates/platforms/webos/project/appinfo.json +19 -0
- package/packages/rnv-build-engine/dist/templates/platforms/webos/webpack.config.dev.js +65 -0
- package/packages/rnv-build-engine/dist/templates/platforms/webos/webpack.config.prod.js +58 -0
- package/packages/rnv-build-engine/dist/templates/platforms/webtv/webpack.config.dev.js +63 -0
- package/packages/rnv-build-engine/dist/templates/platforms/webtv/webpack.config.prod.js +58 -0
- package/packages/rnv-build-engine/dist/templates/platforms/xbox/webpack.config.dev.js +64 -0
- package/packages/rnv-build-engine/dist/templates/platforms/xbox/webpack.config.prod.js +58 -0
- package/packages/sdk-installer/dist/index.js +5 -0
- package/packages/sdk-installer/dist/sdkInstaller.js +38 -0
- package/packages/sdk-installer/dist/services/clean.js +11 -0
- package/packages/sdk-installer/dist/services/download.js +55 -0
- package/packages/sdk-installer/dist/services/index.js +11 -0
- package/packages/sdk-installer/dist/services/install.js +24 -0
- package/packages/sdk-installer/dist/services/unzip.js +12 -0
- package/packages/sdk-installer/dist/types/index.d.ts +1 -0
- package/packages/sdk-installer/dist/types/sdkInstaller.d.ts +7 -0
- package/packages/sdk-installer/dist/types/services/clean.d.ts +2 -0
- package/packages/sdk-installer/dist/types/services/download.d.ts +2 -0
- package/packages/sdk-installer/dist/types/services/index.d.ts +4 -0
- package/packages/sdk-installer/dist/types/services/install.d.ts +2 -0
- package/packages/sdk-installer/dist/types/services/unzip.d.ts +2 -0
- package/packages/types-bigscreen-jsx/README.md +5 -4
- package/packages/types-bigscreen-jsx/index.d.ts +4 -4
- package/packages/utils/README.md +10 -0
- package/packages/utils/src/index.ts +5 -0
- package/packages/utils/src/keyPress/index.ts +2 -0
- package/packages/utils/src/keyPress/keyPressSimulator.ts +44 -0
- package/packages/utils/src/keyPress/simulateKeyPress.ts +25 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.download = void 0;
|
|
23
|
+
const fs = __importStar(require("fs"));
|
|
24
|
+
const path = __importStar(require("path"));
|
|
25
|
+
const url = __importStar(require("url"));
|
|
26
|
+
const http = __importStar(require("http"));
|
|
27
|
+
const https = __importStar(require("https"));
|
|
28
|
+
const createDirPathIfDoesntExist = async (dirPath) => {
|
|
29
|
+
if (!fs.existsSync(dirPath)) {
|
|
30
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const getNetworkProtocolAdapter = (requestedUrl) => {
|
|
34
|
+
const { protocol } = url.parse(requestedUrl);
|
|
35
|
+
switch (protocol) {
|
|
36
|
+
case 'http:': return http;
|
|
37
|
+
case 'https:': return https;
|
|
38
|
+
default: throw new Error(`${protocol} protocol is not supported`);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const getResponseError = (response) => {
|
|
42
|
+
const HTTP_RESPONSE_STATUS_CODE_OK = 200;
|
|
43
|
+
const { statusCode, headers } = response;
|
|
44
|
+
const contentType = headers['content-type'];
|
|
45
|
+
if (statusCode !== HTTP_RESPONSE_STATUS_CODE_OK) {
|
|
46
|
+
return new Error(`Request Failed. Status Code: ${statusCode}`);
|
|
47
|
+
}
|
|
48
|
+
if (!contentType) {
|
|
49
|
+
return new Error('Missing Content-Type: expected application/zip');
|
|
50
|
+
}
|
|
51
|
+
if (!/^application\/zip/.test(contentType)) {
|
|
52
|
+
return new Error(`Wrong Content-Type: expected application/zip, received ${contentType}`);
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
};
|
|
56
|
+
const download = async (fromUrl, toFilePath) => {
|
|
57
|
+
const toDirPath = path.parse(toFilePath).dir;
|
|
58
|
+
await createDirPathIfDoesntExist(toDirPath);
|
|
59
|
+
return new Promise((resolve, reject) => {
|
|
60
|
+
const request = getNetworkProtocolAdapter(fromUrl).get(fromUrl, (response) => {
|
|
61
|
+
const error = getResponseError(response);
|
|
62
|
+
if (error) {
|
|
63
|
+
reject(error);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const file = fs.createWriteStream(toFilePath);
|
|
67
|
+
file.on('error', reject);
|
|
68
|
+
file.on('finish', resolve);
|
|
69
|
+
response.pipe(file);
|
|
70
|
+
});
|
|
71
|
+
request.on('error', reject);
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
exports.download = download;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clean = exports.install = exports.unzip = exports.download = void 0;
|
|
4
|
+
var download_1 = require("./download");
|
|
5
|
+
Object.defineProperty(exports, "download", { enumerable: true, get: function () { return download_1.download; } });
|
|
6
|
+
var unzip_1 = require("./unzip");
|
|
7
|
+
Object.defineProperty(exports, "unzip", { enumerable: true, get: function () { return unzip_1.unzip; } });
|
|
8
|
+
var install_1 = require("./install");
|
|
9
|
+
Object.defineProperty(exports, "install", { enumerable: true, get: function () { return install_1.install; } });
|
|
10
|
+
var clean_1 = require("./clean");
|
|
11
|
+
Object.defineProperty(exports, "clean", { enumerable: true, get: function () { return clean_1.clean; } });
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.install = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const getInstalledPathFromOutput = (output) => {
|
|
6
|
+
const prefix = 'INSTALL_PATH=';
|
|
7
|
+
const installedPathRow = output
|
|
8
|
+
.split('\n')
|
|
9
|
+
.map((outputRow) => outputRow.trim())
|
|
10
|
+
.filter((trimmedOutputRow) => trimmedOutputRow.startsWith(prefix));
|
|
11
|
+
return installedPathRow[0]?.replace(prefix, '') || '';
|
|
12
|
+
};
|
|
13
|
+
const install = (installerDirPath, installToPath) => {
|
|
14
|
+
const installationScriptPath = `${installerDirPath}/install.js`;
|
|
15
|
+
const installationCommandWithoutCustomPath = `node ${installationScriptPath}`;
|
|
16
|
+
const installationCmdToBeUsed = installToPath
|
|
17
|
+
? `${installationCommandWithoutCustomPath} ${installToPath}`
|
|
18
|
+
: installationCommandWithoutCustomPath;
|
|
19
|
+
const execOptions = { maxBuffer: 5242880 };
|
|
20
|
+
const installationScriptOutput = (0, child_process_1.execSync)(installationCmdToBeUsed, execOptions).toString();
|
|
21
|
+
return getInstalledPathFromOutput(installationScriptOutput);
|
|
22
|
+
};
|
|
23
|
+
exports.install = install;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unzip = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const unzip = (filePath) => {
|
|
6
|
+
const spawnOptions = { maxBuffer: 5242880 };
|
|
7
|
+
const unzipProcess = (0, child_process_1.spawnSync)('unzip', ['-n', filePath], spawnOptions);
|
|
8
|
+
if (unzipProcess.stderr.length) {
|
|
9
|
+
throw new Error(unzipProcess.stderr.toString());
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
exports.unzip = unzip;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./sdkWebos"), exports);
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.handleWebosSdk = exports.configureWebOSProject = exports.buildWebOSProject = exports.runWebOS = void 0;
|
|
23
|
+
const fs = __importStar(require("fs"));
|
|
24
|
+
const path = __importStar(require("path"));
|
|
25
|
+
const os_1 = require("os");
|
|
26
|
+
const rnv_1 = require("rnv");
|
|
27
|
+
const sdk_webpack_1 = require("@rnv/sdk-webpack");
|
|
28
|
+
const sdk_utils_1 = require("../sdk-utils");
|
|
29
|
+
const { writeCleanFile } = rnv_1.FileUtils;
|
|
30
|
+
const { execCLI } = rnv_1.Exec;
|
|
31
|
+
const { getPlatformProjectDir, getTemplateProjectDir, getPlatformBuildDir, getConfigProp, checkPortInUse, confirmActiveBundler, } = rnv_1.Common;
|
|
32
|
+
const { isPlatformActive } = rnv_1.PlatformManager;
|
|
33
|
+
const { chalk, logTask, logInfo, logSuccess, logError } = rnv_1.Logger;
|
|
34
|
+
const { copyBuildsFolder, copyAssetsFolder } = rnv_1.ProjectManager;
|
|
35
|
+
const { CLI_WEBOS_ARES_PACKAGE, REMOTE_DEBUGGER_ENABLED_PLATFORMS } = rnv_1.Constants;
|
|
36
|
+
const { runWebosSimOrDevice } = rnv_1.SDKManager.Webos;
|
|
37
|
+
const runWebOS = async (c) => {
|
|
38
|
+
const { hosted } = c.program;
|
|
39
|
+
const { target } = c.runtime;
|
|
40
|
+
const { platform } = c;
|
|
41
|
+
const isHosted = hosted && !getConfigProp(c, platform, 'bundleAssets');
|
|
42
|
+
if (isHosted) {
|
|
43
|
+
const isPortActive = await checkPortInUse(c, platform, c.runtime.port);
|
|
44
|
+
if (isPortActive) {
|
|
45
|
+
const resetCompleted = await confirmActiveBundler(c);
|
|
46
|
+
c.runtime.skipActiveServerCheck = !resetCompleted;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
logTask('runWebOS', `target:${target} hosted:${!!isHosted}`);
|
|
50
|
+
if (isHosted)
|
|
51
|
+
return;
|
|
52
|
+
const bundleAssets = getConfigProp(c, platform, 'bundleAssets') === true;
|
|
53
|
+
if (bundleAssets) {
|
|
54
|
+
await (0, sdk_webpack_1.buildCoreWebpackProject)(c);
|
|
55
|
+
await runWebosSimOrDevice(c);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
const isPortActive = await checkPortInUse(c, platform, c.runtime.port);
|
|
59
|
+
const isDebuggerEnabledForPlatform = REMOTE_DEBUGGER_ENABLED_PLATFORMS.includes(platform);
|
|
60
|
+
const isWeinreEnabled = isDebuggerEnabledForPlatform && !hosted;
|
|
61
|
+
if (!isPortActive) {
|
|
62
|
+
logInfo(`Your ${chalk().white(platform)} devServer at port ${chalk().white(c.runtime.port)} is not running. Starting it up for you...`);
|
|
63
|
+
(0, sdk_webpack_1.waitForWebpack)(c)
|
|
64
|
+
.then(() => runWebosSimOrDevice(c))
|
|
65
|
+
.catch(logError);
|
|
66
|
+
await (0, sdk_webpack_1.runWebpackServer)(c, isWeinreEnabled);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
const resetCompleted = await confirmActiveBundler(c);
|
|
70
|
+
if (resetCompleted) {
|
|
71
|
+
(0, sdk_webpack_1.waitForWebpack)(c)
|
|
72
|
+
.then(() => runWebosSimOrDevice(c))
|
|
73
|
+
.catch(logError);
|
|
74
|
+
await (0, sdk_webpack_1.runWebpackServer)(c, isWeinreEnabled);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
await runWebosSimOrDevice(c);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
exports.runWebOS = runWebOS;
|
|
83
|
+
const buildWebOSProject = async (c) => {
|
|
84
|
+
logTask('buildWebOSProject');
|
|
85
|
+
await (0, sdk_webpack_1.buildCoreWebpackProject)(c);
|
|
86
|
+
if (!c.program.hosted) {
|
|
87
|
+
const tDir = getPlatformProjectDir(c);
|
|
88
|
+
const tOut = path.join(getPlatformBuildDir(c), 'output');
|
|
89
|
+
await execCLI(c, CLI_WEBOS_ARES_PACKAGE, `-o ${tOut} ${tDir} -n`);
|
|
90
|
+
logSuccess(`Your IPK package is located in ${chalk().cyan(tOut)} .`);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
exports.buildWebOSProject = buildWebOSProject;
|
|
94
|
+
const configureProject = async (c) => {
|
|
95
|
+
logTask('configureProject');
|
|
96
|
+
const configFile = 'appinfo.json';
|
|
97
|
+
const configFileSource = path.join(getTemplateProjectDir(c), configFile);
|
|
98
|
+
const configFileDest = path.join(getPlatformProjectDir(c), configFile);
|
|
99
|
+
writeCleanFile(configFileSource, configFileDest, [], null, c);
|
|
100
|
+
let fileContent = fs.readFileSync(configFileDest).toString();
|
|
101
|
+
fileContent = fileContent.replace(/"true"/g, 'true');
|
|
102
|
+
fileContent = fileContent.replace(/"false"/g, 'false');
|
|
103
|
+
fs.writeFileSync(configFileDest, fileContent);
|
|
104
|
+
return true;
|
|
105
|
+
};
|
|
106
|
+
const configureWebOSProject = async (c) => {
|
|
107
|
+
logTask('configureWebOSProject');
|
|
108
|
+
const { platform } = c;
|
|
109
|
+
c.runtime.platformBuildsProjectPath = getPlatformProjectDir(c);
|
|
110
|
+
if (!isPlatformActive(c, platform))
|
|
111
|
+
return;
|
|
112
|
+
await copyAssetsFolder(c, platform);
|
|
113
|
+
await (0, sdk_webpack_1.configureCoreWebProject)(c);
|
|
114
|
+
await configureProject(c);
|
|
115
|
+
await copyBuildsFolder(c, platform);
|
|
116
|
+
};
|
|
117
|
+
exports.configureWebOSProject = configureWebOSProject;
|
|
118
|
+
const sdkInstallerUUrl = 'https://s3.amazonaws.com/tools.nxg-bigscreen.24imedia.com/sdks/webos/ares_webos_builder_v1.10.4_multiplatform.zip';
|
|
119
|
+
const handleWebosSdk = async (c) => {
|
|
120
|
+
const { WEBOS_SDK_INSTALLER_URL = sdkInstallerUUrl } = process.env;
|
|
121
|
+
const { WEBOS_SDK } = c.buildConfig.sdks || {};
|
|
122
|
+
const installPath = `${(0, os_1.homedir)()}/webOS_TV_SDK`;
|
|
123
|
+
const rnvSdkKey = 'WEBOS_SDK';
|
|
124
|
+
if (!WEBOS_SDK) {
|
|
125
|
+
if (fs.existsSync(installPath)) {
|
|
126
|
+
await (0, sdk_utils_1.registerSdkPath)(c, rnvSdkKey, installPath);
|
|
127
|
+
}
|
|
128
|
+
const sdkInstalledToPath = await (0, sdk_utils_1.sdkInstaller)(WEBOS_SDK_INSTALLER_URL, installPath, true);
|
|
129
|
+
if (sdkInstalledToPath) {
|
|
130
|
+
await (0, sdk_utils_1.registerSdkPath)(c, rnvSdkKey, sdkInstalledToPath);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
await rnv_1.SDKManager.Installer.checkAndConfigureWebosSdks(c);
|
|
134
|
+
};
|
|
135
|
+
exports.handleWebosSdk = handleWebosSdk;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./sdkWebpack"), exports);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.exportWeb = exports.deployWeb = exports.configureWebProject = exports.buildWeb = void 0;
|
|
4
|
+
const rnv_1 = require("rnv");
|
|
5
|
+
const sdk_webpack_1 = require("@rnv/sdk-webpack");
|
|
6
|
+
const { getPlatformProjectDir } = rnv_1.Common;
|
|
7
|
+
const { isPlatformActive } = rnv_1.PlatformManager;
|
|
8
|
+
const { logTask } = rnv_1.Logger;
|
|
9
|
+
const { copyBuildsFolder, copyAssetsFolder } = rnv_1.ProjectManager;
|
|
10
|
+
const buildWeb = async (c) => (0, sdk_webpack_1.buildCoreWebpackProject)(c);
|
|
11
|
+
exports.buildWeb = buildWeb;
|
|
12
|
+
const configureWebProject = async (c) => {
|
|
13
|
+
logTask('configureWebProject');
|
|
14
|
+
const { platform } = c;
|
|
15
|
+
c.runtime.platformBuildsProjectPath = getPlatformProjectDir(c);
|
|
16
|
+
if (!isPlatformActive(c, platform))
|
|
17
|
+
return;
|
|
18
|
+
await copyAssetsFolder(c, platform);
|
|
19
|
+
await (0, sdk_webpack_1.configureCoreWebProject)(c);
|
|
20
|
+
copyBuildsFolder(c, platform);
|
|
21
|
+
};
|
|
22
|
+
exports.configureWebProject = configureWebProject;
|
|
23
|
+
const deployWeb = () => {
|
|
24
|
+
logTask('deployWeb');
|
|
25
|
+
return true;
|
|
26
|
+
};
|
|
27
|
+
exports.deployWeb = deployWeb;
|
|
28
|
+
const exportWeb = () => {
|
|
29
|
+
logTask('exportWeb');
|
|
30
|
+
return true;
|
|
31
|
+
};
|
|
32
|
+
exports.exportWeb = exportWeb;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./sdkXbox"), exports);
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildXboxProject = void 0;
|
|
4
|
+
const rnv_1 = require("rnv");
|
|
5
|
+
const sdk_webpack_1 = require("@rnv/sdk-webpack");
|
|
6
|
+
const child_process_1 = require("child_process");
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const manifoldjs_windows10_1 = require("manifoldjs-windows10");
|
|
9
|
+
const xml2js_1 = require("xml2js");
|
|
10
|
+
const resolvers_1 = require("../../resolvers");
|
|
11
|
+
const fs = fs_1.promises;
|
|
12
|
+
const { logTask } = rnv_1.Logger;
|
|
13
|
+
const hostedAppOutputPath = '/output/hosted';
|
|
14
|
+
const packagedAppOutputPath = '/output/packaged';
|
|
15
|
+
const packagedAppSrcDestination = '/output/packaged/windows10/source/src';
|
|
16
|
+
const appSourcePath = '/project/public';
|
|
17
|
+
const packagedAppEntryUrl = 'src/index.html';
|
|
18
|
+
const wrapperConfigPath = '/wrapperConfig.json';
|
|
19
|
+
const hostedAppSource = '/output/hosted/windows10/source';
|
|
20
|
+
const packagedAppSource = '/output/packaged/windows10/source';
|
|
21
|
+
const hostedSourceImages = '/output/hosted/windows10/source/images';
|
|
22
|
+
const packagedSourceImages = '/output/packaged/windows10/source/images';
|
|
23
|
+
const hostedManifestImages = '/output/hosted/windows10/manifest/images';
|
|
24
|
+
const packagedManifestImages = '/output/packaged/windows10/manifest/images';
|
|
25
|
+
const directionalNavPath = '/node_modules/@24i/smartapps-bigscreen-driver-xbox/__external__/winjs/directionalnavigation-1.0.0.0.js';
|
|
26
|
+
const identityNamePlaceholder = 'INSERT-YOUR-PACKAGE-IDENTITY-NAME-HERE';
|
|
27
|
+
const identityPublisherPlaceholder = 'INSERT-YOUR-PACKAGE-IDENTITY-PUBLISHER-HERE';
|
|
28
|
+
const publisherDisplayNamePlaceholder = 'INSERT-YOUR-PACKAGE-PROPERTIES-PUBLISHERDISPLAYNAME-HERE';
|
|
29
|
+
class Manifest {
|
|
30
|
+
content = { start_url: '', short_name: '', theme_color: 'white' };
|
|
31
|
+
format = 'w3c';
|
|
32
|
+
}
|
|
33
|
+
const getHostedAppEntryUrl = (c) => {
|
|
34
|
+
const deployLocations = (0, resolvers_1.resolveDeployLocations)(c);
|
|
35
|
+
const keys = Object.keys(deployLocations.versions);
|
|
36
|
+
let url = '';
|
|
37
|
+
if (keys.length > 0) {
|
|
38
|
+
const version = keys[0];
|
|
39
|
+
if (version !== null) {
|
|
40
|
+
const flavour = c.runtime.appId;
|
|
41
|
+
url = deployLocations.versions[version].platforms.xbox?.[flavour].indexUrl ?? '';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return url;
|
|
45
|
+
};
|
|
46
|
+
const getBuildFolder = (c) => `${rnv_1.Common.getPlatformBuildDir(c)}`;
|
|
47
|
+
const zipOutput = async (c) => {
|
|
48
|
+
logTask('zipOutput');
|
|
49
|
+
const defaultZipFileName = `${c.platform}_${c.runtime.appId}.zip`;
|
|
50
|
+
const fileName = (0, resolvers_1.resolveBuildFileName)(c) || defaultZipFileName;
|
|
51
|
+
const outputDirectory = `${getBuildFolder(c)}/output`;
|
|
52
|
+
const tmpOutputDirectory = `${getBuildFolder(c)}/tmpOutput`;
|
|
53
|
+
try {
|
|
54
|
+
await fs.mkdir(tmpOutputDirectory);
|
|
55
|
+
(0, child_process_1.execSync)(`cp -r ${outputDirectory} ${tmpOutputDirectory}`);
|
|
56
|
+
await fs.rm(outputDirectory, { recursive: true, force: true });
|
|
57
|
+
await fs.mkdir(outputDirectory);
|
|
58
|
+
(0, child_process_1.execSync)(`zip -r ${outputDirectory}/${fileName} *`, { cwd: `${tmpOutputDirectory}` });
|
|
59
|
+
await fs.rm(tmpOutputDirectory, { recursive: true, force: true });
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
throw new Error('Unable to zip the output folder');
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const createVSSolution = async (c, outputPath, manifest) => {
|
|
66
|
+
logTask('createVSSolution');
|
|
67
|
+
try {
|
|
68
|
+
manifest.content.short_name = c.buildConfig.common.appName;
|
|
69
|
+
const platform = new manifoldjs_windows10_1.Platform('package', ['windows10']);
|
|
70
|
+
await platform.create(manifest, outputPath, ['windows10'], '');
|
|
71
|
+
}
|
|
72
|
+
catch (e) {
|
|
73
|
+
if (e instanceof Error
|
|
74
|
+
&& !e.message.includes('Error retrieving information for module')) {
|
|
75
|
+
console.error(e.message);
|
|
76
|
+
throw new Error('Failed to create VSSolution');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const createHostedApplication = async (c) => {
|
|
81
|
+
logTask('createHostedApplication');
|
|
82
|
+
const manifest = new Manifest();
|
|
83
|
+
manifest.content.start_url = getHostedAppEntryUrl(c);
|
|
84
|
+
await createVSSolution(c, `${getBuildFolder(c)}${hostedAppOutputPath}`, manifest);
|
|
85
|
+
};
|
|
86
|
+
const readContent = (c, path) => {
|
|
87
|
+
logTask('readContent');
|
|
88
|
+
const srcDirectory = `${getBuildFolder(c)}${packagedAppSource}/${path}`;
|
|
89
|
+
let content = [];
|
|
90
|
+
try {
|
|
91
|
+
const res = (0, fs_1.readdirSync)(srcDirectory, { withFileTypes: true });
|
|
92
|
+
for (let i = 0; i < res.length; i++) {
|
|
93
|
+
const file = res[i];
|
|
94
|
+
const fileNameWithPath = `${path}/${file.name}`;
|
|
95
|
+
if (file.isDirectory()) {
|
|
96
|
+
const subdirectoryContent = readContent(c, fileNameWithPath);
|
|
97
|
+
content = content.concat(subdirectoryContent);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
content.push(fileNameWithPath);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
throw new Error('Failed to parse project content');
|
|
106
|
+
}
|
|
107
|
+
return content;
|
|
108
|
+
};
|
|
109
|
+
const addPackagedFiles = async (c) => {
|
|
110
|
+
logTask('addPackagedFiles');
|
|
111
|
+
const destinationDirectory = `${getBuildFolder(c)}${packagedAppSource}/App.jsproj`;
|
|
112
|
+
try {
|
|
113
|
+
let xmlString = await fs.readFile(destinationDirectory, 'utf-8');
|
|
114
|
+
const xmlObject = await (0, xml2js_1.parseStringPromise)(xmlString);
|
|
115
|
+
const srcDirectoryContent = readContent(c, 'src');
|
|
116
|
+
srcDirectoryContent.forEach((element) => {
|
|
117
|
+
const contentElement = { $: { Include: element } };
|
|
118
|
+
xmlObject.Project.ItemGroup[1].Content.push(contentElement);
|
|
119
|
+
});
|
|
120
|
+
const builder = new xml2js_1.Builder();
|
|
121
|
+
xmlString = builder.buildObject(xmlObject);
|
|
122
|
+
await fs.writeFile(destinationDirectory, xmlString);
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
throw new Error('Failed to parse update App.jsproj project file');
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const createPackagedApplication = async (c) => {
|
|
129
|
+
logTask('createPackagedApplication');
|
|
130
|
+
const manifest = new Manifest();
|
|
131
|
+
manifest.content.start_url = packagedAppEntryUrl;
|
|
132
|
+
const sourceDir = `${getBuildFolder(c)}${appSourcePath}`;
|
|
133
|
+
const destinationDirectory = `${getBuildFolder(c)}${packagedAppSrcDestination}`;
|
|
134
|
+
await createVSSolution(c, `${getBuildFolder(c)}${packagedAppOutputPath}`, manifest);
|
|
135
|
+
(0, child_process_1.execSync)(`cp -r ${sourceDir} ${destinationDirectory}`);
|
|
136
|
+
await addPackagedFiles(c);
|
|
137
|
+
};
|
|
138
|
+
const replacePublisherId = async (c, basePath) => {
|
|
139
|
+
logTask('replacePublisherId');
|
|
140
|
+
const output = `${basePath}/windows10/manifest/appxmanifest.xml`;
|
|
141
|
+
const configPath = `${getBuildFolder(c)}${wrapperConfigPath}`;
|
|
142
|
+
let appxmanifest = null;
|
|
143
|
+
let identityName = null;
|
|
144
|
+
let identityPublisher = null;
|
|
145
|
+
let publisherDisplayName = null;
|
|
146
|
+
try {
|
|
147
|
+
const data = await fs.readFile(configPath, 'utf-8');
|
|
148
|
+
const config = JSON.parse(data);
|
|
149
|
+
({
|
|
150
|
+
identityName = null,
|
|
151
|
+
identityPublisher = null,
|
|
152
|
+
publisherDisplayName = null,
|
|
153
|
+
} = config);
|
|
154
|
+
const appxmanifestData = await fs.readFile(output, 'utf-8');
|
|
155
|
+
appxmanifest = appxmanifestData;
|
|
156
|
+
if (identityName !== null
|
|
157
|
+
&& identityPublisher !== null
|
|
158
|
+
&& publisherDisplayName !== null) {
|
|
159
|
+
appxmanifest = appxmanifest.replace(identityNamePlaceholder, identityName)
|
|
160
|
+
.replace(identityPublisherPlaceholder, identityPublisher)
|
|
161
|
+
.replace(publisherDisplayNamePlaceholder, publisherDisplayName);
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
throw new Error('failed to obtain store settings');
|
|
165
|
+
}
|
|
166
|
+
await fs.writeFile(output, appxmanifest ?? '');
|
|
167
|
+
}
|
|
168
|
+
catch (e) {
|
|
169
|
+
if (e instanceof Error) {
|
|
170
|
+
throw new Error(`Failed to modify the xbox appxmanifest.xml - ${e.message}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
const replaceImages = async (c) => {
|
|
175
|
+
logTask('replaceImages');
|
|
176
|
+
const hostedOutputDirectory = `${getBuildFolder(c)}${hostedSourceImages}`;
|
|
177
|
+
const packagedOutputDirectory = `${getBuildFolder(c)}${packagedSourceImages}`;
|
|
178
|
+
const hostedOutputManifestDirectory = `${getBuildFolder(c)}${hostedManifestImages}`;
|
|
179
|
+
const packagedOutputManifestDirectory = `${getBuildFolder(c)}${packagedManifestImages}`;
|
|
180
|
+
const appIconsDirectory = `${getBuildFolder(c)}/project/appIcons`;
|
|
181
|
+
try {
|
|
182
|
+
await fs.rm(hostedOutputDirectory, { recursive: true, force: true });
|
|
183
|
+
await fs.rm(packagedOutputDirectory, { recursive: true, force: true });
|
|
184
|
+
(0, child_process_1.execSync)(`cp -r ${appIconsDirectory} ${hostedOutputDirectory}`);
|
|
185
|
+
(0, child_process_1.execSync)(`cp -r ${appIconsDirectory} ${packagedOutputDirectory}`);
|
|
186
|
+
(0, child_process_1.execSync)(`cp -r ${appIconsDirectory} ${hostedOutputManifestDirectory}`);
|
|
187
|
+
(0, child_process_1.execSync)(`cp -r ${appIconsDirectory} ${packagedOutputManifestDirectory}`);
|
|
188
|
+
await fs.rm(appIconsDirectory, { recursive: true, force: true });
|
|
189
|
+
}
|
|
190
|
+
catch {
|
|
191
|
+
throw new Error('Failed to replace the xbox icons');
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
const copyWinJS = async (c) => {
|
|
195
|
+
logTask('copyWinJS');
|
|
196
|
+
const source = `${process.cwd()}${directionalNavPath}`;
|
|
197
|
+
const packagedAppDestination = `${getBuildFolder(c)}${packagedAppSource}/lib/TVHelpers`;
|
|
198
|
+
const hostedAppDestination = `${getBuildFolder(c)}${hostedAppSource}/lib/TVHelpers`;
|
|
199
|
+
try {
|
|
200
|
+
await fs.mkdir(packagedAppDestination, { recursive: true });
|
|
201
|
+
await fs.mkdir(hostedAppDestination, { recursive: true });
|
|
202
|
+
(0, child_process_1.execSync)(`cp -r ${source} ${packagedAppDestination}`);
|
|
203
|
+
(0, child_process_1.execSync)(`cp -r ${source} ${hostedAppDestination}`);
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
throw new Error('Failed to copy the winJS library');
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
const buildXboxProject = async (c) => {
|
|
210
|
+
logTask('buildXboxProject');
|
|
211
|
+
const outputDirectory = `${getBuildFolder(c)}/output`;
|
|
212
|
+
await (0, sdk_webpack_1.buildCoreWebpackProject)(c);
|
|
213
|
+
await fs.rm(outputDirectory, { recursive: true, force: true });
|
|
214
|
+
await createHostedApplication(c);
|
|
215
|
+
await createPackagedApplication(c);
|
|
216
|
+
await replacePublisherId(c, `${getBuildFolder(c)}${hostedAppOutputPath}`);
|
|
217
|
+
await replacePublisherId(c, `${getBuildFolder(c)}${packagedAppOutputPath}`);
|
|
218
|
+
await replaceImages(c);
|
|
219
|
+
await copyWinJS(c);
|
|
220
|
+
await zipOutput(c);
|
|
221
|
+
};
|
|
222
|
+
exports.buildXboxProject = buildXboxProject;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rm = exports.cp = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const fsUtils_1 = require("../../../scripts/utils/fsUtils");
|
|
6
|
+
const runCmdSync = (cmd) => (0, child_process_1.execSync)(cmd, { stdio: 'inherit' });
|
|
7
|
+
const cp = (source, destination) => {
|
|
8
|
+
let cmd = `aws s3 cp ${source} s3://${destination} --acl public-read`;
|
|
9
|
+
if ((0, fsUtils_1.isDir)(source)) {
|
|
10
|
+
cmd += ' --recursive';
|
|
11
|
+
}
|
|
12
|
+
runCmdSync(cmd);
|
|
13
|
+
};
|
|
14
|
+
exports.cp = cp;
|
|
15
|
+
const rm = (remoteDirPath) => {
|
|
16
|
+
let cmd = `aws s3 rm s3://${remoteDirPath}`;
|
|
17
|
+
if (remoteDirPath.endsWith('/')) {
|
|
18
|
+
cmd += ' --recursive';
|
|
19
|
+
}
|
|
20
|
+
runCmdSync(cmd);
|
|
21
|
+
};
|
|
22
|
+
exports.rm = rm;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.deployToS3 = void 0;
|
|
23
|
+
const path = __importStar(require("path"));
|
|
24
|
+
const rnv_1 = require("rnv");
|
|
25
|
+
const aws = __importStar(require("./aws"));
|
|
26
|
+
const constants_1 = require("../../../constants");
|
|
27
|
+
const resolvers_1 = require("../../../resolvers");
|
|
28
|
+
const { getConfigProp } = rnv_1.Common;
|
|
29
|
+
const uploadPackage = (c, sourcePath, uploadPath) => {
|
|
30
|
+
const packageOutputDirPath = `${sourcePath}/output`;
|
|
31
|
+
const packageFileName = (0, resolvers_1.resolveBuildFileName)(c);
|
|
32
|
+
const packageLocalPath = `"${packageOutputDirPath}/${packageFileName}"`;
|
|
33
|
+
const packageRemotePath = `"${uploadPath}/build/${packageFileName}"`;
|
|
34
|
+
aws.cp(packageLocalPath, packageRemotePath);
|
|
35
|
+
};
|
|
36
|
+
const uploadPublicDir = (sourcePath, uploadPath) => {
|
|
37
|
+
const publicDirLocalPath = path.join(sourcePath, 'project', 'public');
|
|
38
|
+
const publicDirRemotePath = `${uploadPath}/public`;
|
|
39
|
+
aws.cp(publicDirLocalPath, publicDirRemotePath);
|
|
40
|
+
};
|
|
41
|
+
const urlToS3Protocol = (url) => {
|
|
42
|
+
const hostWithPath = url.split('://')[1];
|
|
43
|
+
const bucketHostnameAwsPostfix = '.s3.amazonaws.com';
|
|
44
|
+
return hostWithPath.replace(bucketHostnameAwsPostfix, '');
|
|
45
|
+
};
|
|
46
|
+
const deployToS3 = async (c) => {
|
|
47
|
+
const { platform, runtime } = c;
|
|
48
|
+
const sourcePath = runtime.appDir;
|
|
49
|
+
const { isBuildHosted } = getConfigProp(c, platform, 'webpackConfig', {});
|
|
50
|
+
const baseUrl = (0, resolvers_1.resolveBaseUrl)({
|
|
51
|
+
platform,
|
|
52
|
+
scheme: runtime.scheme || '',
|
|
53
|
+
flavour: runtime.appId,
|
|
54
|
+
});
|
|
55
|
+
if (!baseUrl) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
const uploadPath = urlToS3Protocol(baseUrl);
|
|
59
|
+
aws.rm(`${uploadPath}/`);
|
|
60
|
+
uploadPackage(c, sourcePath, uploadPath);
|
|
61
|
+
if (platform === constants_1.Platforms.HBBTV) {
|
|
62
|
+
process.stdout.write(`For ${platform} platform, only ZIP package deployment is configured. Skipping deploying app content to AWS S3.\n`);
|
|
63
|
+
process.stdout.write('Deploy done.\n');
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
const sourceDirPath = isBuildHosted ? `${sourcePath}-public` : sourcePath;
|
|
67
|
+
uploadPublicDir(sourceDirPath, uploadPath);
|
|
68
|
+
process.stdout.write('Deploy done.\n');
|
|
69
|
+
return true;
|
|
70
|
+
};
|
|
71
|
+
exports.deployToS3 = deployToS3;
|