@24i/smartapps-bigscreen-rnv-build-engine 0.9.2-alpha.1435 → 0.9.2-xbox-alpha2.1473

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 (52) hide show
  1. package/dist/src/__tests__/sdks/sdk-utils/sdk-installer/services/download.spec.js +10 -28
  2. package/dist/src/scripts/generateDeployUrls/generateDeployUrls.js +89 -0
  3. package/dist/src/scripts/generateDeployUrls/index.js +2 -86
  4. package/dist/src/sdks/sdk-tizen/index.js +3 -230
  5. package/dist/src/sdks/sdk-tizen/sdkTizen.js +240 -0
  6. package/dist/src/sdks/sdk-webos/index.js +3 -125
  7. package/dist/src/sdks/sdk-webos/sdkWebos.js +135 -0
  8. package/dist/src/sdks/sdk-webpack/index.js +11 -30
  9. package/dist/src/sdks/sdk-webpack/sdkWebpack.js +32 -0
  10. package/dist/src/tasks/task.rnv.configure.js +2 -8
  11. package/dist/src/utils/generateSvgSpriteMap.js +74 -0
  12. package/jest.config.js +1 -0
  13. package/package.json +4 -5
  14. package/coverage/clover.xml +0 -199
  15. package/coverage/coverage-final.json +0 -10
  16. package/coverage/lcov-report/base.css +0 -224
  17. package/coverage/lcov-report/block-navigation.js +0 -79
  18. package/coverage/lcov-report/clean.ts.html +0 -113
  19. package/coverage/lcov-report/download.ts.html +0 -260
  20. package/coverage/lcov-report/favicon.png +0 -0
  21. package/coverage/lcov-report/index.html +0 -141
  22. package/coverage/lcov-report/index.ts.html +0 -86
  23. package/coverage/lcov-report/install.ts.html +0 -161
  24. package/coverage/lcov-report/prettify.css +0 -1
  25. package/coverage/lcov-report/prettify.js +0 -2
  26. package/coverage/lcov-report/registerSdkPath.ts.html +0 -134
  27. package/coverage/lcov-report/sdk-installer/index.html +0 -126
  28. package/coverage/lcov-report/sdk-installer/index.ts.html +0 -83
  29. package/coverage/lcov-report/sdk-installer/sdkInstaller.ts.html +0 -233
  30. package/coverage/lcov-report/sdk-installer/services/clean.ts.html +0 -113
  31. package/coverage/lcov-report/sdk-installer/services/download.ts.html +0 -260
  32. package/coverage/lcov-report/sdk-installer/services/index.html +0 -171
  33. package/coverage/lcov-report/sdk-installer/services/index.ts.html +0 -92
  34. package/coverage/lcov-report/sdk-installer/services/install.ts.html +0 -161
  35. package/coverage/lcov-report/sdk-installer/services/unzip.ts.html +0 -116
  36. package/coverage/lcov-report/sdk-utils/index.html +0 -126
  37. package/coverage/lcov-report/sdk-utils/index.ts.html +0 -86
  38. package/coverage/lcov-report/sdk-utils/installSdk.ts.html +0 -113
  39. package/coverage/lcov-report/sdk-utils/registerSdkPath.ts.html +0 -134
  40. package/coverage/lcov-report/sdk-utils/sdk-installer/index.html +0 -126
  41. package/coverage/lcov-report/sdk-utils/sdk-installer/index.ts.html +0 -83
  42. package/coverage/lcov-report/sdk-utils/sdk-installer/sdkInstaller.ts.html +0 -224
  43. package/coverage/lcov-report/sdk-utils/sdk-installer/services/clean.ts.html +0 -113
  44. package/coverage/lcov-report/sdk-utils/sdk-installer/services/download.ts.html +0 -260
  45. package/coverage/lcov-report/sdk-utils/sdk-installer/services/index.html +0 -171
  46. package/coverage/lcov-report/sdk-utils/sdk-installer/services/index.ts.html +0 -92
  47. package/coverage/lcov-report/sdk-utils/sdk-installer/services/install.ts.html +0 -161
  48. package/coverage/lcov-report/sdk-utils/sdk-installer/services/unzip.ts.html +0 -116
  49. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  50. package/coverage/lcov-report/sorter.js +0 -170
  51. package/coverage/lcov-report/unzip.ts.html +0 -116
  52. package/coverage/lcov.info +0 -371
@@ -1,29 +1,10 @@
1
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
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
22
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
4
  };
24
5
  Object.defineProperty(exports, "__esModule", { value: true });
25
6
  const stream_1 = __importDefault(require("stream"));
26
- const nock = __importStar(require("nock"));
7
+ const nock_1 = __importDefault(require("nock"));
27
8
  const http_1 = __importDefault(require("http"));
28
9
  const https_1 = __importDefault(require("https"));
29
10
  const fs_1 = __importDefault(require("fs"));
@@ -38,16 +19,17 @@ describe('SDK Installer - Downloader', () => {
38
19
  const zipFileHttpUrl = `${httpBasePath}${zipRelativeFilePath}`;
39
20
  const headersWithZipContentType = { 'Content-Type': 'application/zip' };
40
21
  const saveFilePath = `${process.cwd()}/test.zip`;
41
- const makeValidHttpNock = () => nock.default(httpBasePath)
22
+ const makeValidHttpNock = () => (0, nock_1.default)(httpBasePath)
42
23
  .get(zipRelativeFilePath)
43
24
  .reply(HTTP_RESPONSE_STATUS_CODE_OK, '', headersWithZipContentType);
44
- nock.disableNetConnect();
25
+ nock_1.default.disableNetConnect();
45
26
  afterEach(() => {
46
27
  jest.clearAllMocks();
47
28
  });
48
29
  afterAll(() => {
49
- nock.cleanAll();
50
- nock.enableNetConnect();
30
+ nock_1.default.enableNetConnect();
31
+ nock_1.default.cleanAll();
32
+ nock_1.default.restore();
51
33
  });
52
34
  describe('Supported protocols', () => {
53
35
  it('calls http.get for URL with HTTP protocol', async () => {
@@ -57,7 +39,7 @@ describe('SDK Installer - Downloader', () => {
57
39
  expect(getSpy).toBeCalledTimes(1);
58
40
  });
59
41
  it('calls https.get for URL with HTTPS protocol', async () => {
60
- nock.default(httpBasePath.replace('http:', 'https:'))
42
+ (0, nock_1.default)(httpBasePath.replace('http:', 'https:'))
61
43
  .get(zipRelativeFilePath)
62
44
  .reply(HTTP_RESPONSE_STATUS_CODE_OK, '', headersWithZipContentType);
63
45
  const getSpy = jest.spyOn(https_1.default, 'get');
@@ -72,13 +54,13 @@ describe('SDK Installer - Downloader', () => {
72
54
  });
73
55
  describe('Handling response errors', () => {
74
56
  it('throws an error when returned content type is not application/zip', async () => {
75
- nock.default(httpBasePath)
57
+ (0, nock_1.default)(httpBasePath)
76
58
  .get('/file.json')
77
59
  .reply(HTTP_RESPONSE_STATUS_CODE_OK, '', { 'Content-Type': 'application/json' });
78
60
  await expect(async () => {
79
61
  await (0, services_1.download)(`${httpBasePath}/file.json`, saveFilePath);
80
62
  }).rejects.toThrow(new Error('Wrong Content-Type: expected application/zip, received application/json'));
81
- nock.default(httpBasePath)
63
+ (0, nock_1.default)(httpBasePath)
82
64
  .get(zipRelativeFilePath)
83
65
  .reply(HTTP_RESPONSE_STATUS_CODE_OK, '');
84
66
  await expect(async () => {
@@ -86,7 +68,7 @@ describe('SDK Installer - Downloader', () => {
86
68
  }).rejects.toThrow(new Error('Missing Content-Type: expected application/zip'));
87
69
  });
88
70
  it('throws an error when request status is not 200', async () => {
89
- nock.default(httpBasePath)
71
+ (0, nock_1.default)(httpBasePath)
90
72
  .get(zipRelativeFilePath)
91
73
  .reply(HTTP_RESPONSE_STATUS_CODE_NOT_FOUND, '', headersWithZipContentType);
92
74
  await expect(async () => {
@@ -0,0 +1,89 @@
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.generateDeployUrls = void 0;
23
+ const fs = __importStar(require("fs"));
24
+ const path = __importStar(require("path"));
25
+ const resolvers_1 = require("../../resolvers");
26
+ const constants_1 = require("../../constants");
27
+ const fsUtils_1 = require("../utils/fsUtils");
28
+ const makeTableDataByScheme_1 = require("./makeTableDataByScheme");
29
+ const formatTableDataSpaces_1 = require("./formatTableDataSpaces");
30
+ const processOutput = (outputFilePath, fileContent) => {
31
+ if (!(0, fsUtils_1.isDir)(outputFilePath)) {
32
+ const dirname = path.dirname(outputFilePath);
33
+ fs.mkdirSync(dirname, { recursive: true });
34
+ }
35
+ fs.writeFileSync(outputFilePath, fileContent);
36
+ };
37
+ const tableDataToMarkdown = (tableData) => {
38
+ const tableRowDataToTableRowMarkdown = (tableRowData) => (`| ${tableRowData.join(' | ')} |`);
39
+ const tableRowsMarkdown = tableData.map(tableRowDataToTableRowMarkdown);
40
+ return tableRowsMarkdown.join('\n');
41
+ };
42
+ const makeTableMarkdownByScheme = (rnvC, scheme) => {
43
+ const tableData = (0, makeTableDataByScheme_1.makeTableDataByScheme)(rnvC, scheme);
44
+ const formattedTableData = (0, formatTableDataSpaces_1.formatTableDataSpaces)(tableData);
45
+ return tableDataToMarkdown(formattedTableData);
46
+ };
47
+ const makeMarkdownFileContentRows = (rnvC) => ([
48
+ `# ${rnvC.buildConfig.projectName}`,
49
+ '## Deploy URLs',
50
+ '',
51
+ '---',
52
+ '### Latest `development` builds',
53
+ '> Latest builds against the development git branch.',
54
+ '> Deployed each time into the same path.',
55
+ '',
56
+ makeTableMarkdownByScheme(rnvC, constants_1.BuildSchemes.DEV_LATEST),
57
+ '',
58
+ '---',
59
+ '### Latest `release candidate` builds',
60
+ '> Latest builds against the release candidate git branch.',
61
+ '> Deployed each time into the same path.',
62
+ '',
63
+ makeTableMarkdownByScheme(rnvC, constants_1.BuildSchemes.RC_LATEST),
64
+ '---',
65
+ '### Latest `release` builds',
66
+ '> Latest builds against the release git branch.',
67
+ '> Deployed each time into the same path.',
68
+ '',
69
+ makeTableMarkdownByScheme(rnvC, constants_1.BuildSchemes.RELEASE_LATEST),
70
+ '---',
71
+ '### Distribution `release` builds',
72
+ '> Builds against the release git branch.',
73
+ '> Each new release version is deployed into its own folder.',
74
+ '',
75
+ '*In opened URL, just replace `<VERSION>` placeholder with requested app version.*',
76
+ '',
77
+ makeTableMarkdownByScheme(rnvC, constants_1.BuildSchemes.RELEASE_DIST),
78
+ '---',
79
+ ]);
80
+ const generateDeployUrls = () => {
81
+ const outputFilePath = process.argv[2];
82
+ if (!outputFilePath) {
83
+ throw new Error('You need to provide a path to output file as an argument!');
84
+ }
85
+ const rnvC = (0, resolvers_1.getBaseConfig)();
86
+ const markdownFileContentRows = makeMarkdownFileContentRows(rnvC);
87
+ processOutput(outputFilePath, markdownFileContentRows.join('\n'));
88
+ };
89
+ exports.generateDeployUrls = generateDeployUrls;
@@ -1,88 +1,4 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
22
- const fs = __importStar(require("fs"));
23
- const path = __importStar(require("path"));
24
- const resolvers_1 = require("../../resolvers");
25
- const constants_1 = require("../../constants");
26
- const fsUtils_1 = require("../utils/fsUtils");
27
- const makeTableDataByScheme_1 = require("./makeTableDataByScheme");
28
- const formatTableDataSpaces_1 = require("./formatTableDataSpaces");
29
- const processOutput = (outputFilePath, fileContent) => {
30
- if (!(0, fsUtils_1.isDir)(outputFilePath)) {
31
- const dirname = path.dirname(outputFilePath);
32
- fs.mkdirSync(dirname, { recursive: true });
33
- }
34
- fs.writeFileSync(outputFilePath, fileContent);
35
- };
36
- const tableDataToMarkdown = (tableData) => {
37
- const tableRowDataToTableRowMarkdown = (tableRowData) => (`| ${tableRowData.join(' | ')} |`);
38
- const tableRowsMarkdown = tableData.map(tableRowDataToTableRowMarkdown);
39
- return tableRowsMarkdown.join('\n');
40
- };
41
- const makeTableMarkdownByScheme = (rnvC, scheme) => {
42
- const tableData = (0, makeTableDataByScheme_1.makeTableDataByScheme)(rnvC, scheme);
43
- const formattedTableData = (0, formatTableDataSpaces_1.formatTableDataSpaces)(tableData);
44
- return tableDataToMarkdown(formattedTableData);
45
- };
46
- const makeMarkdownFileContentRows = (rnvC) => ([
47
- `# ${rnvC.buildConfig.projectName}`,
48
- '## Deploy URLs',
49
- '',
50
- '---',
51
- '### Latest `development` builds',
52
- '> Latest builds against the development git branch.',
53
- '> Deployed each time into the same path.',
54
- '',
55
- makeTableMarkdownByScheme(rnvC, constants_1.BuildSchemes.DEV_LATEST),
56
- '',
57
- '---',
58
- '### Latest `release candidate` builds',
59
- '> Latest builds against the release candidate git branch.',
60
- '> Deployed each time into the same path.',
61
- '',
62
- makeTableMarkdownByScheme(rnvC, constants_1.BuildSchemes.RC_LATEST),
63
- '---',
64
- '### Latest `release` builds',
65
- '> Latest builds against the release git branch.',
66
- '> Deployed each time into the same path.',
67
- '',
68
- makeTableMarkdownByScheme(rnvC, constants_1.BuildSchemes.RELEASE_LATEST),
69
- '---',
70
- '### Distribution `release` builds',
71
- '> Builds against the release git branch.',
72
- '> Each new release version is deployed into its own folder.',
73
- '',
74
- '*In opened URL, just replace `<VERSION>` placeholder with requested app version.*',
75
- '',
76
- makeTableMarkdownByScheme(rnvC, constants_1.BuildSchemes.RELEASE_DIST),
77
- '---',
78
- ]);
79
- const main = () => {
80
- const outputFilePath = process.argv[2];
81
- if (!outputFilePath) {
82
- throw new Error('You need to provide a path to output file as an argument!');
83
- }
84
- const rnvC = (0, resolvers_1.getBaseConfig)();
85
- const markdownFileContentRows = makeMarkdownFileContentRows(rnvC);
86
- processOutput(outputFilePath, markdownFileContentRows.join('\n'));
87
- };
88
- main();
3
+ const generateDeployUrls_1 = require("./generateDeployUrls");
4
+ (0, generateDeployUrls_1.generateDeployUrls)();
@@ -6,235 +6,8 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
6
6
  if (k2 === undefined) k2 = k;
7
7
  o[k2] = m[k];
8
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;
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);
20
11
  };
21
12
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.runTizen = exports.handleTizenSdk = exports.configureTizenProject = exports.configureTizenGlobal = exports.buildTizenProject = void 0;
23
- const fs = __importStar(require("fs"));
24
- const path = __importStar(require("path"));
25
- const os = __importStar(require("os"));
26
- const semver = __importStar(require("semver"));
27
- const child_process_1 = require("child_process");
28
- const rnv_1 = require("rnv");
29
- const sdk_utils_1 = require("../sdk-utils");
30
- const constants_1 = require("../../constants");
31
- const { execCLI } = rnv_1.Exec;
32
- const { CLI_TIZEN, REMOTE_DEBUGGER_ENABLED_PLATFORMS } = rnv_1.Constants;
33
- const { getPlatformProjectDir, getAppVersion, getConfigProp, checkPortInUse, confirmActiveBundler, addSystemInjects, } = rnv_1.Common;
34
- const { chalk, logTask, logDebug, logError, logSuccess, logWarning, logInfo, } = rnv_1.Logger;
35
- const { isPlatformActive } = rnv_1.PlatformManager;
36
- const { writeCleanFile, fsExistsSync, updateObjectSync } = rnv_1.FileUtils;
37
- const { buildCoreWebpackProject, runWebpackServer, configureCoreWebProject, waitForWebpack, } = rnv_1.WebpackUtils;
38
- const { copyAssetsFolder, copyBuildsFolder } = rnv_1.ProjectManager;
39
- const { runTizenSimOrDevice, createDevelopTizenCertificate, DEFAULT_CERTIFICATE_NAME, DEFAULT_SECURITY_PROFILE_NAME, } = rnv_1.SDKManager.Tizen;
40
- const DEFAULT_CERTIFICATE_NAME_WITH_EXTENSION = `${DEFAULT_CERTIFICATE_NAME}.p12`;
41
- const configureTizenGlobal = (c) => new Promise((resolve, reject) => {
42
- logTask('configureTizenGlobal');
43
- const authorCert = path.join(c.paths.workspace.dir, DEFAULT_CERTIFICATE_NAME_WITH_EXTENSION);
44
- if (fsExistsSync(authorCert)) {
45
- logDebug(`${DEFAULT_CERTIFICATE_NAME_WITH_EXTENSION} file exists!`);
46
- resolve();
47
- }
48
- else {
49
- logWarning(`${DEFAULT_CERTIFICATE_NAME_WITH_EXTENSION} file missing! Creating one for you...`);
50
- createDevelopTizenCertificate(c)
51
- .then(() => resolve())
52
- .catch((e) => reject(e));
53
- }
54
- });
55
- exports.configureTizenGlobal = configureTizenGlobal;
56
- const handleRunTizenSimOrDevice = async (c) => {
57
- try {
58
- await runTizenSimOrDevice(c);
59
- }
60
- catch (e) {
61
- return Promise.reject(e);
62
- }
63
- return true;
64
- };
65
- const runTizen = async (c, target) => {
66
- logTask('runTizen', `target:${target}`);
67
- const { platform } = c;
68
- const { hosted } = c.program;
69
- const isHosted = hosted && !getConfigProp(c, platform, 'bundleAssets');
70
- if (isHosted) {
71
- const isPortActive = await checkPortInUse(c, platform, c.runtime.port);
72
- if (isPortActive) {
73
- const resetCompleted = await confirmActiveBundler(c);
74
- c.runtime.skipActiveServerCheck = !resetCompleted;
75
- }
76
- }
77
- logTask('runTizen', `target:${target} hosted:${!!isHosted}`);
78
- if (isHosted)
79
- return;
80
- const bundleAssets = getConfigProp(c, platform, 'bundleAssets') === true;
81
- if (bundleAssets) {
82
- await buildCoreWebpackProject(c);
83
- await handleRunTizenSimOrDevice(c);
84
- }
85
- else {
86
- const isPortActive = await checkPortInUse(c, platform, c.runtime.port);
87
- const isDebuggerEnabledForPlatform = REMOTE_DEBUGGER_ENABLED_PLATFORMS.includes(platform);
88
- const isWeinreEnabled = isDebuggerEnabledForPlatform && !bundleAssets && !hosted;
89
- if (!isPortActive) {
90
- logInfo(`Your ${chalk().white(platform)} devServer at port ${chalk().white(c.runtime.port)} is not running. Starting it up for you...`);
91
- waitForWebpack(c)
92
- .then(() => handleRunTizenSimOrDevice(c))
93
- .catch(logError);
94
- await runWebpackServer(c, isWeinreEnabled);
95
- }
96
- else {
97
- const resetCompleted = await confirmActiveBundler(c);
98
- if (resetCompleted) {
99
- waitForWebpack(c)
100
- .then(() => handleRunTizenSimOrDevice(c))
101
- .catch(logError);
102
- await runWebpackServer(c, isWeinreEnabled);
103
- }
104
- else {
105
- await handleRunTizenSimOrDevice(c);
106
- }
107
- }
108
- }
109
- };
110
- exports.runTizen = runTizen;
111
- const buildTizenProject = async (c) => {
112
- logTask('buildTizenProject');
113
- await buildCoreWebpackProject(c);
114
- if (!c.program.hosted) {
115
- const { buildConfig } = c;
116
- const platformConfig = buildConfig.platforms[constants_1.Platforms.TIZEN];
117
- const projectDir = getPlatformProjectDir(c);
118
- const projectParentDir = path.join(projectDir, '..');
119
- const tBuild = path.join(projectParentDir, 'build');
120
- const tOut = path.join(projectParentDir, 'output');
121
- const certProfile = platformConfig.certificateProfile ?? DEFAULT_SECURITY_PROFILE_NAME;
122
- await execCLI(c, CLI_TIZEN, `build-web -- ${projectDir} -out ${tBuild}`);
123
- await execCLI(c, CLI_TIZEN, `package -- ${tBuild} -s ${certProfile} -t wgt -o ${tOut}`);
124
- logSuccess(`Your WGT package is located in ${chalk().cyan(tOut)} .`);
125
- }
126
- return true;
127
- };
128
- exports.buildTizenProject = buildTizenProject;
129
- let isGlobalConfigured = false;
130
- const configureProject = (c) => new Promise((resolve) => {
131
- logTask('configureProject');
132
- const platform = constants_1.Platforms.TIZEN;
133
- const configFile = 'config.xml';
134
- const p = c.buildConfig.platforms[platform];
135
- const injects = [
136
- { pattern: '{{PACKAGE}}', override: p.package },
137
- { pattern: '{{ID}}', override: p.id },
138
- { pattern: '{{APP_NAME}}', override: p.appName },
139
- { pattern: '{{APP_VERSION}}', override: semver.coerce(getAppVersion(c, platform)) },
140
- ];
141
- addSystemInjects(c, injects);
142
- const file = path.join(getPlatformProjectDir(c), configFile);
143
- writeCleanFile(file, file, injects, null, c);
144
- resolve();
145
- });
146
- const configureTizenProject = async (c) => {
147
- logTask('configureTizenProject');
148
- const { platform } = c;
149
- c.runtime.platformBuildsProjectPath = `${getPlatformProjectDir(c)}`;
150
- if (!isPlatformActive(c, platform)) {
151
- return;
152
- }
153
- if (!isGlobalConfigured) {
154
- isGlobalConfigured = true;
155
- await configureTizenGlobal(c);
156
- }
157
- await copyAssetsFolder(c, platform);
158
- await configureCoreWebProject(c);
159
- await configureProject(c);
160
- copyBuildsFolder(c, platform);
161
- };
162
- exports.configureTizenProject = configureTizenProject;
163
- const handleLinuxKeyring = () => {
164
- if (process.env.CI && os.platform() === 'linux') {
165
- const options = { stdio: 'inherit' };
166
- (0, child_process_1.execSync)('eval $(dbus-launch --sh-syntax)', options);
167
- (0, child_process_1.execSync)('mkdir -p ~/.cache', options);
168
- (0, child_process_1.execSync)('mkdir -p ~/.local/share/keyrings', options);
169
- (0, child_process_1.execSync)('eval "$(printf \'\\n\' | gnome-keyring-daemon --unlock)"', options);
170
- (0, child_process_1.execSync)('eval "$(printf \'\\n\' | /usr/bin/gnome-keyring-daemon --start)"', options);
171
- }
172
- };
173
- const setTizenCertificate = (c) => {
174
- const { TIZEN_SECURITY_PROFILE_NAME = '24i-SmartApps-BigScreen', TIZEN_AUTHOR_CERTIFICATE_RELATIVE_PATH = 'certificates/24i_smartapps_bigscreen_author.p12', TIZEN_AUTHOR_CERTIFICATE_PASSWORD, } = process.env;
175
- const tizenCliPath = c.cli.tizen;
176
- if (!fs.existsSync(TIZEN_AUTHOR_CERTIFICATE_RELATIVE_PATH)) {
177
- console.log(`'process.env.TIZEN_AUTHOR_CERTIFICATE_RELATIVE_PATH' points to not existing location: ${TIZEN_AUTHOR_CERTIFICATE_RELATIVE_PATH}`);
178
- return false;
179
- }
180
- if (!TIZEN_AUTHOR_CERTIFICATE_PASSWORD) {
181
- console.log('\'process.env.TIZEN_AUTHOR_CERTIFICATE_PASSWORD\' password is not set');
182
- return false;
183
- }
184
- if (!tizenCliPath) {
185
- console.log('\'c.cli.tizen\' is not set');
186
- return false;
187
- }
188
- const spawnSyncReturn = (0, child_process_1.spawnSync)(tizenCliPath, [
189
- 'security-profiles', 'add',
190
- '-n', TIZEN_SECURITY_PROFILE_NAME,
191
- '-a', TIZEN_AUTHOR_CERTIFICATE_RELATIVE_PATH,
192
- '-p', TIZEN_AUTHOR_CERTIFICATE_PASSWORD,
193
- ]);
194
- if (spawnSyncReturn.error)
195
- throw spawnSyncReturn.error;
196
- if (spawnSyncReturn.stdout.toString().includes('Invalid file or password')) {
197
- throw new Error(spawnSyncReturn.stdout.toString());
198
- }
199
- process.stdout.write(spawnSyncReturn.stdout || '');
200
- const rnvWorkspaceConfigPath = c.paths.workspace.config;
201
- const customObjectToMerge = {
202
- platforms: {
203
- tizen: { certificateProfile: TIZEN_SECURITY_PROFILE_NAME },
204
- },
205
- };
206
- updateObjectSync(rnvWorkspaceConfigPath, customObjectToMerge);
207
- Object.assign(c.buildConfig, customObjectToMerge);
208
- return true;
209
- };
210
- const getSdkInstallerUrl = () => {
211
- switch (os.platform()) {
212
- case 'darwin':
213
- return 'https://s3.amazonaws.com/tools.nxg-bigscreen.24imedia.com/sdks/tizen/tizen_builder_v3.7_mac.zip';
214
- case 'linux':
215
- return 'https://s3.amazonaws.com/tools.nxg-bigscreen.24imedia.com/sdks/tizen/tizen_builder_v3.7_ubuntu.zip';
216
- default:
217
- return '';
218
- }
219
- };
220
- const handleTizenSdk = async (c) => {
221
- const { TIZEN_SDK_INSTALLER_URL = getSdkInstallerUrl() } = process.env;
222
- const { TIZEN_SDK } = c.buildConfig.sdks || {};
223
- const installPath = `${os.homedir()}/tizen-studio`;
224
- const rnvSdkKey = 'TIZEN_SDK';
225
- if (!TIZEN_SDK) {
226
- handleLinuxKeyring();
227
- if (fs.existsSync(installPath)) {
228
- await (0, sdk_utils_1.registerSdkPath)(c, rnvSdkKey, installPath);
229
- }
230
- else {
231
- const installedToPath = await (0, sdk_utils_1.sdkInstaller)(TIZEN_SDK_INSTALLER_URL, installPath, true);
232
- if (installedToPath) {
233
- await (0, sdk_utils_1.registerSdkPath)(c, rnvSdkKey, installedToPath);
234
- }
235
- }
236
- }
237
- await rnv_1.SDKManager.Installer.checkAndConfigureTizenSdks(c);
238
- setTizenCertificate(c);
239
- };
240
- exports.handleTizenSdk = handleTizenSdk;
13
+ __exportStar(require("./sdkTizen"), exports);