@24i/smartapps-bigscreen-rnv-build-engine 0.9.1 → 0.9.2-alpha.1449
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/__tests__/sdks/sdk-utils/sdk-installer/services/download.spec.js +10 -28
- package/dist/src/scripts/generateDeployUrls/generateDeployUrls.js +89 -0
- package/dist/src/scripts/generateDeployUrls/index.js +2 -86
- package/dist/src/sdks/sdk-tizen/index.js +3 -230
- package/dist/src/sdks/sdk-tizen/sdkTizen.js +240 -0
- package/dist/src/sdks/sdk-webos/index.js +3 -125
- package/dist/src/sdks/sdk-webos/sdkWebos.js +135 -0
- package/dist/src/sdks/sdk-webpack/index.js +11 -30
- package/dist/src/sdks/sdk-webpack/sdkWebpack.js +32 -0
- package/dist/src/tasks/task.rnv.configure.js +2 -8
- package/dist/src/utils/generateSvgSpriteMap.js +74 -0
- package/dist/templates/platforms/_shared/webpack.base.js +1 -1
- package/jest.config.js +1 -0
- package/package.json +4 -5
|
@@ -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
|
|
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 = () =>
|
|
22
|
+
const makeValidHttpNock = () => (0, nock_1.default)(httpBasePath)
|
|
42
23
|
.get(zipRelativeFilePath)
|
|
43
24
|
.reply(HTTP_RESPONSE_STATUS_CODE_OK, '', headersWithZipContentType);
|
|
44
|
-
|
|
25
|
+
nock_1.default.disableNetConnect();
|
|
45
26
|
afterEach(() => {
|
|
46
27
|
jest.clearAllMocks();
|
|
47
28
|
});
|
|
48
29
|
afterAll(() => {
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
23
|
-
|
|
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
|
|
10
|
-
|
|
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
|
-
|
|
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);
|
|
@@ -0,0 +1,240 @@
|
|
|
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.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;
|
|
@@ -6,130 +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
|
|
10
|
-
|
|
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
|
-
|
|
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_utils_1 = require("../sdk-utils");
|
|
28
|
-
const { writeCleanFile } = rnv_1.FileUtils;
|
|
29
|
-
const { execCLI } = rnv_1.Exec;
|
|
30
|
-
const { getPlatformProjectDir, getTemplateProjectDir, getPlatformBuildDir, getConfigProp, checkPortInUse, confirmActiveBundler, } = rnv_1.Common;
|
|
31
|
-
const { buildCoreWebpackProject, runWebpackServer, configureCoreWebProject, waitForWebpack, } = rnv_1.WebpackUtils;
|
|
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 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 && !bundleAssets && !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
|
-
waitForWebpack(c)
|
|
64
|
-
.then(() => runWebosSimOrDevice(c))
|
|
65
|
-
.catch(logError);
|
|
66
|
-
await runWebpackServer(c, isWeinreEnabled);
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
const resetCompleted = await confirmActiveBundler(c);
|
|
70
|
-
if (resetCompleted) {
|
|
71
|
-
waitForWebpack(c)
|
|
72
|
-
.then(() => runWebosSimOrDevice(c))
|
|
73
|
-
.catch(logError);
|
|
74
|
-
await 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 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 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;
|
|
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_utils_1 = require("../sdk-utils");
|
|
28
|
+
const { writeCleanFile } = rnv_1.FileUtils;
|
|
29
|
+
const { execCLI } = rnv_1.Exec;
|
|
30
|
+
const { getPlatformProjectDir, getTemplateProjectDir, getPlatformBuildDir, getConfigProp, checkPortInUse, confirmActiveBundler, } = rnv_1.Common;
|
|
31
|
+
const { buildCoreWebpackProject, runWebpackServer, configureCoreWebProject, waitForWebpack, } = rnv_1.WebpackUtils;
|
|
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 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 && !bundleAssets && !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
|
+
waitForWebpack(c)
|
|
64
|
+
.then(() => runWebosSimOrDevice(c))
|
|
65
|
+
.catch(logError);
|
|
66
|
+
await runWebpackServer(c, isWeinreEnabled);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
const resetCompleted = await confirmActiveBundler(c);
|
|
70
|
+
if (resetCompleted) {
|
|
71
|
+
waitForWebpack(c)
|
|
72
|
+
.then(() => runWebosSimOrDevice(c))
|
|
73
|
+
.catch(logError);
|
|
74
|
+
await 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 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 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;
|
|
@@ -1,32 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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 configureCoreWebProject(c);
|
|
20
|
-
copyBuildsFolder(c, platform);
|
|
21
|
-
};
|
|
22
|
-
exports.configureWebProject = configureWebProject;
|
|
23
|
-
const deployWeb = () => {
|
|
24
|
-
logTask('deployWeb');
|
|
25
|
-
return true;
|
|
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);
|
|
26
11
|
};
|
|
27
|
-
exports
|
|
28
|
-
|
|
29
|
-
logTask('exportWeb');
|
|
30
|
-
return true;
|
|
31
|
-
};
|
|
32
|
-
exports.exportWeb = exportWeb;
|
|
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 { getPlatformProjectDir } = rnv_1.Common;
|
|
6
|
+
const { isPlatformActive } = rnv_1.PlatformManager;
|
|
7
|
+
const { logTask } = rnv_1.Logger;
|
|
8
|
+
const { copyBuildsFolder, copyAssetsFolder } = rnv_1.ProjectManager;
|
|
9
|
+
const { buildCoreWebpackProject, configureCoreWebProject } = rnv_1.WebpackUtils;
|
|
10
|
+
const buildWeb = async (c) => 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 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;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.customRnvConfigureTask = void 0;
|
|
4
4
|
const rnv_1 = require("rnv");
|
|
5
|
-
const
|
|
5
|
+
const generateSvgSpriteMap_1 = require("../utils/generateSvgSpriteMap");
|
|
6
6
|
const constants_1 = require("../constants");
|
|
7
7
|
const sdks_1 = require("../sdks");
|
|
8
8
|
const { logErrorPlatform, copySharedPlatforms } = rnv_1.PlatformManager;
|
|
@@ -16,13 +16,7 @@ const configureFn = async (c, parentTask, originTask) => {
|
|
|
16
16
|
logTask('taskRnvConfigure');
|
|
17
17
|
await executeTask(c, TASK_PLATFORM_CONFIGURE, TASK_CONFIGURE, originTask);
|
|
18
18
|
await copySharedPlatforms(c);
|
|
19
|
-
|
|
20
|
-
iconsFolder: '/icons',
|
|
21
|
-
cssOutput: '../../platformAssets/runtime/icons.css',
|
|
22
|
-
jsonOutput: '/icons.json',
|
|
23
|
-
maskList: c.buildConfig.common.svgIconsMaskList || [],
|
|
24
|
-
});
|
|
25
|
-
await generateSvgSpriteMapHook(c);
|
|
19
|
+
(0, generateSvgSpriteMap_1.generateSvgSpriteMap)(c);
|
|
26
20
|
if (c.program.only && !!parentTask)
|
|
27
21
|
return true;
|
|
28
22
|
switch (c.platform) {
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateSvgSpriteMap = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const child_process_1 = require("child_process");
|
|
10
|
+
const getSvgData = (matches) => {
|
|
11
|
+
const xlmns = 'http://www.w3.org/2000/svg';
|
|
12
|
+
const xlmnsXlink = 'http://www.w3.org/1999/xlink';
|
|
13
|
+
return `\
|
|
14
|
+
<svg version="1.1" xmlns="${xlmns}" xmlns:xlink="${xlmnsXlink}" ${matches.groups.viewbox}>
|
|
15
|
+
${matches.groups.content}
|
|
16
|
+
</svg>`;
|
|
17
|
+
};
|
|
18
|
+
const getSpriteBgStyle = (name, data, prefix = 'icon-') => `.${prefix}${name} {
|
|
19
|
+
background-image: url("data:image/svg+xml,${encodeURIComponent(data)}");
|
|
20
|
+
}`;
|
|
21
|
+
const getSpriteMaskStyle = (name, data, prefix = 'icon-mask-') => `.${prefix}${name} {
|
|
22
|
+
-webkit-mask-image: url("data:image/svg+xml,${encodeURIComponent(data)}");
|
|
23
|
+
}`;
|
|
24
|
+
const generateSvgSpriteMap = (c) => {
|
|
25
|
+
const config = {
|
|
26
|
+
iconsFolder: '/icons',
|
|
27
|
+
cssOutput: '../../platformAssets/runtime/icons.css',
|
|
28
|
+
jsonOutput: '/icons.json',
|
|
29
|
+
maskList: c.buildConfig.common.svgIconsMaskList || [],
|
|
30
|
+
};
|
|
31
|
+
const projectPaths = c.paths.project;
|
|
32
|
+
const iconsPath = path_1.default.join(projectPaths.dir, config.iconsFolder);
|
|
33
|
+
const rnvBuildDirPath = `${projectPaths.builds.dir}/${c.runtime.appId}_${c.platform}`;
|
|
34
|
+
const spriteMapCSSPath = path_1.default.join(`${rnvBuildDirPath}`, config.cssOutput);
|
|
35
|
+
const iconsFolderContent = fs_1.default.readdirSync(iconsPath);
|
|
36
|
+
const hasSvgExtension = (filePath) => filePath.toLowerCase().endsWith('.svg');
|
|
37
|
+
if (!iconsFolderContent.some(hasSvgExtension)) {
|
|
38
|
+
fs_1.default.writeFileSync(spriteMapCSSPath, '');
|
|
39
|
+
console.log('No SVG files found. Skipping generating svg spritemap.');
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const optimisedPath = path_1.default.join(iconsPath, '_optimised');
|
|
43
|
+
const configPath = path_1.default.join(iconsPath, '.svgo.yml');
|
|
44
|
+
(0, child_process_1.execSync)(`npx svgo -f "${iconsPath}" -o "${optimisedPath}" --config="${configPath}" --multipass`);
|
|
45
|
+
const files = fs_1.default.readdirSync(optimisedPath);
|
|
46
|
+
const spriteNames = {};
|
|
47
|
+
const svgSymbols = files.filter((name) => name.endsWith('.svg')).map((fileName) => {
|
|
48
|
+
const maskListIncludesFileName = config.maskList.includes(fileName);
|
|
49
|
+
const spriteName = fileName
|
|
50
|
+
.replace('.svg', '')
|
|
51
|
+
.replace(' ', '-')
|
|
52
|
+
.toLowerCase();
|
|
53
|
+
spriteNames[spriteName] = '';
|
|
54
|
+
if (maskListIncludesFileName) {
|
|
55
|
+
spriteNames[`mask-${spriteName}`] = '';
|
|
56
|
+
}
|
|
57
|
+
const icon = fs_1.default.readFileSync(path_1.default.join(optimisedPath, fileName)).toString().trim();
|
|
58
|
+
const matches = icon.match(/<svg.*(?<viewbox>viewBox="[\d ]+")[^>]*>(?<content>.*)<\/svg>$/s);
|
|
59
|
+
if (!matches) {
|
|
60
|
+
return '';
|
|
61
|
+
}
|
|
62
|
+
const svgData = getSvgData(matches);
|
|
63
|
+
const spriteBgStyle = getSpriteBgStyle(spriteName, svgData);
|
|
64
|
+
return maskListIncludesFileName
|
|
65
|
+
? [spriteBgStyle, getSpriteMaskStyle(spriteName, svgData)].join('\n\n')
|
|
66
|
+
: spriteBgStyle;
|
|
67
|
+
});
|
|
68
|
+
const spriteNamesJsonPath = path_1.default.join(projectPaths.assets.dir, config.jsonOutput);
|
|
69
|
+
const indentSpaces = 4;
|
|
70
|
+
fs_1.default.writeFileSync(spriteNamesJsonPath, JSON.stringify(spriteNames, null, indentSpaces));
|
|
71
|
+
fs_1.default.writeFileSync(spriteMapCSSPath, svgSymbols.join('\n\n'));
|
|
72
|
+
(0, child_process_1.execSync)(`rm -rf ${optimisedPath}`);
|
|
73
|
+
};
|
|
74
|
+
exports.generateSvgSpriteMap = generateSvgSpriteMap;
|
|
@@ -66,7 +66,7 @@ function generateConfig(config) {
|
|
|
66
66
|
const platformSchemeAppIdObj = {
|
|
67
67
|
platform: config.platform,
|
|
68
68
|
scheme: config.scheme,
|
|
69
|
-
|
|
69
|
+
flavour: config.appConfigId,
|
|
70
70
|
};
|
|
71
71
|
const buildVersion = smartapps_bigscreen_rnv_build_engine_1.Resolvers.resolveBuildVersion(platformSchemeAppIdObj);
|
|
72
72
|
const baseUrl = smartapps_bigscreen_rnv_build_engine_1.Resolvers.resolveBaseUrl(platformSchemeAppIdObj);
|
package/jest.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@24i/smartapps-bigscreen-rnv-build-engine",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2-alpha.1449+cb3bea44",
|
|
4
4
|
"description": "Package with build engine for SmartApps BIGscreen projects...",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,16 +20,15 @@
|
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/inquirer": "7.3.3",
|
|
22
22
|
"@types/mini-css-extract-plugin": "1.2.2",
|
|
23
|
-
"@types/node": "16.
|
|
23
|
+
"@types/node": "16.7.10",
|
|
24
24
|
"@types/semver": "7.3.8",
|
|
25
|
-
"@types/ssh2": "0.5.
|
|
25
|
+
"@types/ssh2": "0.5.48",
|
|
26
26
|
"@types/tapable": "1.0.6",
|
|
27
27
|
"@types/webpack": "4.41.26",
|
|
28
28
|
"nock": "13.1.3"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@24i/smartapps-bigscreen-device": ">=0.8.4",
|
|
32
|
-
"@24i/smartapps-bigscreen-icon": "0.8.6",
|
|
33
32
|
"core-js": "3.15.2",
|
|
34
33
|
"coveralls": "3.1.1",
|
|
35
34
|
"css-hot-loader": "1.4.4",
|
|
@@ -59,5 +58,5 @@
|
|
|
59
58
|
"keywords": [],
|
|
60
59
|
"author": "24i",
|
|
61
60
|
"license": "ISC",
|
|
62
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "cb3bea440985299766873a0a372ada4364f4b31f"
|
|
63
62
|
}
|