@24i/smartapps-bigscreen-rnv-build-engine 0.8.6-alpha.1408 → 0.8.6

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveZippedPlatformBuildsRelativeFilePath = exports.resolveUsedFlavours = exports.resolveSupportedPlatforms = exports.getBaseConfig = exports.resolveBuildFileName = exports.resolveHbbtvDeployConfig = exports.resolveHbbtvDeployUrl = exports.resolveHbbtvRemoteBuildDirRelativePath = exports.resolveDeployLocations = exports.resolveBuildVersionOffset = exports.resolveBuildVersion = exports.resolveBaseUrl = void 0;
3
+ exports.resolveZippedPlatformBuildsRelativeFilePath = exports.getBaseConfig = exports.resolveHbbtvDeployConfig = exports.resolveHbbtvDeployUrl = exports.resolveHbbtvRemoteBuildDirRelativePath = exports.resolveDeployLocations = exports.resolveBuildVersionOffset = exports.resolveBuildVersion = exports.resolveBaseUrl = void 0;
4
4
  var resolveBaseUrl_1 = require("./resolveBaseUrl");
5
5
  Object.defineProperty(exports, "resolveBaseUrl", { enumerable: true, get: function () { return resolveBaseUrl_1.resolveBaseUrl; } });
6
6
  var resolveBuildVersion_1 = require("./resolveBuildVersion");
@@ -15,13 +15,7 @@ var resolveHbbtvDeployUrl_1 = require("./resolveHbbtvDeployUrl");
15
15
  Object.defineProperty(exports, "resolveHbbtvDeployUrl", { enumerable: true, get: function () { return resolveHbbtvDeployUrl_1.resolveHbbtvDeployUrl; } });
16
16
  var resolveHbbtvDeployConfig_1 = require("./resolveHbbtvDeployConfig");
17
17
  Object.defineProperty(exports, "resolveHbbtvDeployConfig", { enumerable: true, get: function () { return resolveHbbtvDeployConfig_1.resolveHbbtvDeployConfig; } });
18
- var resolveBuildFileName_1 = require("./resolveBuildFileName");
19
- Object.defineProperty(exports, "resolveBuildFileName", { enumerable: true, get: function () { return resolveBuildFileName_1.resolveBuildFileName; } });
20
18
  var resolveGenericRnvConfig_1 = require("./resolveGenericRnvConfig");
21
19
  Object.defineProperty(exports, "getBaseConfig", { enumerable: true, get: function () { return resolveGenericRnvConfig_1.getBaseConfig; } });
22
- var resolveSupportedPlatforms_1 = require("./resolveSupportedPlatforms");
23
- Object.defineProperty(exports, "resolveSupportedPlatforms", { enumerable: true, get: function () { return resolveSupportedPlatforms_1.resolveSupportedPlatforms; } });
24
- var resolveUsedFlavours_1 = require("./resolveUsedFlavours");
25
- Object.defineProperty(exports, "resolveUsedFlavours", { enumerable: true, get: function () { return resolveUsedFlavours_1.resolveUsedFlavours; } });
26
20
  var resolveZippedPlatformBuildsRelativeFilePath_1 = require("./resolveZippedPlatformBuildsRelativeFilePath");
27
21
  Object.defineProperty(exports, "resolveZippedPlatformBuildsRelativeFilePath", { enumerable: true, get: function () { return resolveZippedPlatformBuildsRelativeFilePath_1.resolveZippedPlatformBuildsRelativeFilePath; } });
@@ -1,10 +1,29 @@
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
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  exports.resolveDeployLocations = void 0;
23
+ const fs = __importStar(require("fs"));
4
24
  const resolveBuildVersion_1 = require("./resolveBuildVersion");
5
25
  const resolveBaseUrl_1 = require("./resolveBaseUrl");
6
26
  const resolveHbbtvDeployUrl_1 = require("./resolveHbbtvDeployUrl");
7
- const resolveBuildFileName_1 = require("./resolveBuildFileName");
8
27
  const constants_1 = require("../constants");
9
28
  const getBuildVersion = (c) => {
10
29
  const { platform, runtime } = c;
@@ -39,7 +58,9 @@ const makeUrls = (c, platformName, flavourName) => {
39
58
  });
40
59
  if (!baseUrl)
41
60
  return null;
42
- const packageFileName = resolveBuildFileName_1.resolveBuildFileName(c);
61
+ const packageOutputDirPath = `platformBuilds/${flavourName}_${platformName}/output`;
62
+ const outputFilenameList = fs.readdirSync(packageOutputDirPath);
63
+ const packageFileName = outputFilenameList[0];
43
64
  const packageUrl = packageFileName ? `${baseUrl}/build/${packageFileName}` : '';
44
65
  const indexUrl = isHbbTVPlatform
45
66
  ? resolveHbbtvDeployUrl_1.resolveHbbtvDeployUrl(c, c.runtime.scheme, flavourName)
@@ -51,29 +72,12 @@ const resolveDeployLocations = (c) => {
51
72
  const output = makeOutputObject(buildVersion);
52
73
  const outputPlatforms = output.versions[buildVersion].platforms;
53
74
  const processPlatform = (platformName) => {
54
- const originalPlatform = c.platform;
55
- const isRequiredPlatformSet = originalPlatform === platformName;
56
- if (!isRequiredPlatformSet) {
57
- c.platform = platformName;
58
- }
59
- const processPlatformFlavour = (flavourName) => {
60
- const originalFlavour = c.runtime.appId;
61
- const isRequestedFlavourSet = originalFlavour === flavourName;
62
- if (!isRequestedFlavourSet) {
63
- c.runtime.appId = flavourName;
64
- }
65
- const outputFlavourData = { [flavourName]: makeUrls(c, platformName, flavourName) };
66
- if (!isRequestedFlavourSet) {
67
- c.runtime.appId = originalFlavour;
68
- }
69
- return outputFlavourData;
70
- };
75
+ const processPlatformFlavour = (flavourName) => ({
76
+ [flavourName]: makeUrls(c, platformName, flavourName),
77
+ });
71
78
  const outputPlatformData = getSupportedFlavoursForPlatform(c, platformName)
72
79
  .map(processPlatformFlavour);
73
80
  outputPlatforms[platformName] = Object.assign({}, ...outputPlatformData);
74
- if (!isRequiredPlatformSet) {
75
- c.platform = originalPlatform;
76
- }
77
81
  };
78
82
  getSupportedPlatforms(c).forEach(processPlatform);
79
83
  return output;
@@ -19,16 +19,37 @@ var __importStar = (this && this.__importStar) || function (mod) {
19
19
  return result;
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.getBaseConfig = void 0;
22
+ exports.getBaseConfig = exports.isObject = void 0;
23
23
  const fs = __importStar(require("fs"));
24
24
  const path = __importStar(require("path"));
25
25
  const rnv_1 = require("rnv");
26
26
  const replaceRelevantStringsInConfig_1 = require("../utils/replaceRelevantStringsInConfig");
27
- const mergeDeep_1 = require("../utils/mergeDeep");
27
+ function isObject(item) {
28
+ return (item && typeof item === 'object' && !Array.isArray(item));
29
+ }
30
+ exports.isObject = isObject;
31
+ const mergeDeep = (target, ...sources) => {
32
+ if (!sources.length)
33
+ return target;
34
+ const source = sources.shift();
35
+ if (isObject(target) && isObject(source)) {
36
+ Object.keys(source).forEach((key) => {
37
+ if (isObject(source[key])) {
38
+ if (!target[key])
39
+ Object.assign(target, { [key]: {} });
40
+ mergeDeep(target[key], source[key]);
41
+ }
42
+ else {
43
+ Object.assign(target, { [key]: source[key] });
44
+ }
45
+ });
46
+ }
47
+ return mergeDeep(target, ...sources);
48
+ };
28
49
  const mergeFileJsonIntoObject = (filePath = '', targetObject = {}) => {
29
50
  const fileContentAsString = fs.readFileSync(filePath).toString();
30
51
  const fileContentAsJSON = JSON.parse(fileContentAsString);
31
- mergeDeep_1.mergeDeep(targetObject, fileContentAsJSON);
52
+ mergeDeep(targetObject, fileContentAsJSON);
32
53
  };
33
54
  const getBaseConfig = () => {
34
55
  const c = rnv_1.ConfigManager.createRnvConfig({ ci: true }, process);
@@ -19,7 +19,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
19
19
  return result;
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.isDir = exports.assertPath = exports.getFileContentAsString = void 0;
22
+ exports.assertPath = exports.getFileContentAsString = void 0;
23
23
  const fs = __importStar(require("fs"));
24
24
  const assert_1 = require("assert");
25
25
  const getFileContentAsString = (filePath) => fs.readFileSync(filePath).toString();
@@ -29,5 +29,3 @@ const assertPath = (path) => {
29
29
  assert_1.ok(fs.existsSync(path), errorMsg);
30
30
  };
31
31
  exports.assertPath = assertPath;
32
- const isDir = (verifiedPath) => (fs.existsSync(verifiedPath) && fs.lstatSync(verifiedPath).isDirectory());
33
- exports.isDir = isDir;
@@ -1,12 +1,32 @@
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
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  exports.rm = exports.cp = void 0;
4
23
  const child_process_1 = require("child_process");
5
- const fsUtils_1 = require("../../../scripts/utils/fsUtils");
24
+ const fs = __importStar(require("fs"));
6
25
  const runCmdSync = (cmd) => child_process_1.execSync(cmd, { stdio: 'inherit' });
26
+ const isDir = (path) => fs.existsSync(path) && fs.lstatSync(path).isDirectory();
7
27
  const cp = (source, destination) => {
8
28
  let cmd = `aws s3 cp ${source} s3://${destination} --acl public-read`;
9
- if (fsUtils_1.isDir(source)) {
29
+ if (isDir(source)) {
10
30
  cmd += ' --recursive';
11
31
  }
12
32
  runCmdSync(cmd);
@@ -21,6 +21,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.deployToS3 = void 0;
23
23
  const path = __importStar(require("path"));
24
+ const fs = __importStar(require("fs"));
24
25
  const rnv_1 = require("rnv");
25
26
  const aws = __importStar(require("./aws"));
26
27
  const constants_1 = require("../../../constants");
@@ -28,7 +29,8 @@ const resolvers_1 = require("../../../resolvers");
28
29
  const { getConfigProp } = rnv_1.Common;
29
30
  const uploadPackage = (c, sourcePath, uploadPath) => {
30
31
  const packageOutputDirPath = `${sourcePath}/output`;
31
- const packageFileName = resolvers_1.resolveBuildFileName(c);
32
+ const outputFilenameList = fs.readdirSync(packageOutputDirPath);
33
+ const packageFileName = outputFilenameList[0];
32
34
  const packageLocalPath = `"${packageOutputDirPath}/${packageFileName}"`;
33
35
  const packageRemotePath = `"${uploadPath}/build/${packageFileName}"`;
34
36
  aws.cp(packageLocalPath, packageRemotePath);
@@ -21,6 +21,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.deployHbbTV = void 0;
23
23
  const path = __importStar(require("path"));
24
+ const fs = __importStar(require("fs"));
24
25
  const nodessh = __importStar(require("node-ssh"));
25
26
  const constants_1 = require("../../../constants");
26
27
  const resolvers_1 = require("../../../resolvers");
@@ -40,7 +41,15 @@ const makeSshConnection = async (c) => {
40
41
  await ssh.connect({ host, username, privateKey, passphrase });
41
42
  return ssh;
42
43
  };
43
- const getLocalBuildPackagePath = (c) => (path.join(c.runtime.appDir, 'output', resolvers_1.resolveBuildFileName(c)));
44
+ const getBuildPackageFileName = (c) => {
45
+ const packageOutputDirPath = `${c.runtime.appDir}/output`;
46
+ const outputFilenameList = fs.readdirSync(packageOutputDirPath);
47
+ return outputFilenameList[0];
48
+ };
49
+ const getLocalBuildPackagePath = (c) => {
50
+ const fileName = getBuildPackageFileName(c);
51
+ return path.join(c.runtime.appDir, 'output', fileName);
52
+ };
44
53
  const resolveRemotePaths = (c) => {
45
54
  const remoteBuildDirRelativePath = resolvers_1.resolveHbbtvRemoteBuildDirRelativePath(c);
46
55
  const { hostHomeDir, dockerHtmlRootDir } = resolvers_1.resolveHbbtvDeployConfig();
@@ -58,7 +67,7 @@ const deployHbbTV = async (c) => {
58
67
  log('HbbTV deploy via SSH.\n\n');
59
68
  const remotePaths = resolveRemotePaths(c);
60
69
  const { dockerContainerName } = resolvers_1.resolveHbbtvDeployConfig();
61
- const remotePackagePath = `${remotePaths.serverTempDirPath}/${resolvers_1.resolveBuildFileName(c)}`;
70
+ const remotePackagePath = `${remotePaths.serverTempDirPath}/${getBuildPackageFileName(c)}`;
62
71
  const dockerExecPrefix = `docker exec -t ${dockerContainerName}`;
63
72
  const dockerAppDirPath = remotePaths.dockerProjectDirPath;
64
73
  log('Creating connection...\n');
@@ -26,7 +26,7 @@ const rnv_1 = require("rnv");
26
26
  const constants_1 = require("../constants");
27
27
  const sdks_1 = require("../sdks");
28
28
  const resolvers_1 = require("../resolvers");
29
- const { getPlatformBuildDir, getPlatformProjectDir } = rnv_1.Common;
29
+ const { getConfigProp, getPlatformBuildDir, getPlatformProjectDir } = rnv_1.Common;
30
30
  const { logErrorPlatform } = rnv_1.PlatformManager;
31
31
  const { logTask } = rnv_1.Logger;
32
32
  const { buildWeb } = sdks_1.SDKWebpack;
@@ -34,11 +34,47 @@ const { buildTizenProject } = sdks_1.SDKTizen;
34
34
  const { buildWebOSProject } = sdks_1.SDKWebos;
35
35
  const { executeOrSkipTask } = rnv_1.TaskManager;
36
36
  const { TASK_BUILD, TASK_PACKAGE, PARAMS } = rnv_1.Constants;
37
+ const getPackageExtensionByPlatform = (platform) => {
38
+ switch (platform) {
39
+ case constants_1.Platforms.TIZEN:
40
+ return 'wgt';
41
+ case constants_1.Platforms.WEBOS:
42
+ return 'ipk';
43
+ default:
44
+ return 'zip';
45
+ }
46
+ };
47
+ const getBuildVersionForFileName = (c) => {
48
+ const { platform, runtime } = c;
49
+ const { scheme, appId } = runtime;
50
+ switch (c.runtime.scheme) {
51
+ case 'dev:latest':
52
+ return 'latest.dev';
53
+ case 'rc:latest':
54
+ return 'latest.rc';
55
+ case 'release:latest':
56
+ return 'latest.release';
57
+ default:
58
+ return resolvers_1.resolveBuildVersion({
59
+ platform,
60
+ scheme,
61
+ appConfigId: appId,
62
+ });
63
+ }
64
+ };
65
+ const makeBuildName = (c) => {
66
+ const platformName = c.platform;
67
+ const appNameInFileName = getConfigProp(c, platformName, 'appNameInFileName', '');
68
+ const buildVersion = getBuildVersionForFileName(c);
69
+ const appConfigId = c.runtime.appId || '';
70
+ const extension = getPackageExtensionByPlatform(platformName);
71
+ return `${appNameInFileName}_${platformName}_${buildVersion}_${appConfigId}.${extension}`;
72
+ };
37
73
  const makeZipOutput = (c) => {
38
74
  const platformBuildDir = getPlatformBuildDir(c);
39
75
  const copiedProjectBuildDir = `${platformBuildDir}/build`;
40
76
  const defaultZipFileName = `${c.platform}_${c.runtime.appId}.zip`;
41
- const fileName = resolvers_1.resolveBuildFileName(c) || defaultZipFileName;
77
+ const fileName = makeBuildName(c) || defaultZipFileName;
42
78
  child_process_1.execSync(`cp -r ${getPlatformProjectDir(c)}/public ${copiedProjectBuildDir}`);
43
79
  child_process_1.execSync(`rm -rf ${platformBuildDir}/output`);
44
80
  child_process_1.execSync(`mkdir ${platformBuildDir}/output`);
@@ -51,7 +87,7 @@ const renameOutput = (c) => {
51
87
  return;
52
88
  const outputFilenameList = fs.readdirSync(packageOutputDirPath);
53
89
  const packageFileName = outputFilenameList[0];
54
- const newFilename = resolvers_1.resolveBuildFileName(c);
90
+ const newFilename = makeBuildName(c);
55
91
  if (newFilename) {
56
92
  const oldPath = `${packageOutputDirPath}/${packageFileName}`;
57
93
  const newPath = `${packageOutputDirPath}/${newFilename}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@24i/smartapps-bigscreen-rnv-build-engine",
3
- "version": "0.8.6-alpha.1408+e386ba63",
3
+ "version": "0.8.6",
4
4
  "description": "Package with build engine for SmartApps BIGscreen projects...",
5
5
  "main": "dist/src/index.js",
6
6
  "scripts": {
@@ -61,5 +61,5 @@
61
61
  "keywords": [],
62
62
  "author": "24i",
63
63
  "license": "ISC",
64
- "gitHead": "e386ba634b0045d516281aaf389f75b17ddbd54e"
64
+ "gitHead": "4f5f9dd9c67fdb6c5be89b039b9de9d2595c588a"
65
65
  }
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveBuildFileName = void 0;
4
- const rnv_1 = require("rnv");
5
- const resolveBuildVersion_1 = require("./resolveBuildVersion");
6
- const constants_1 = require("../constants");
7
- const { getConfigProp } = rnv_1.Common;
8
- const getPackageExtensionByPlatform = (platform) => {
9
- switch (platform) {
10
- case constants_1.Platforms.TIZEN:
11
- return 'wgt';
12
- case constants_1.Platforms.WEBOS:
13
- return 'ipk';
14
- default:
15
- return 'zip';
16
- }
17
- };
18
- const getBuildVersionForFileName = (c) => {
19
- const { platform, runtime } = c;
20
- const { scheme, appId } = runtime;
21
- switch (c.runtime.scheme) {
22
- case 'dev:latest':
23
- return 'latest.dev';
24
- case 'rc:latest':
25
- return 'latest.rc';
26
- case 'release:latest':
27
- return 'latest.release';
28
- default:
29
- return resolveBuildVersion_1.resolveBuildVersion({
30
- platform,
31
- scheme,
32
- appConfigId: appId,
33
- });
34
- }
35
- };
36
- const resolveBuildFileName = (c) => {
37
- const platformName = c.platform;
38
- const appNameInFileName = getConfigProp(c, platformName, 'appNameInFileName', '');
39
- const buildVersion = getBuildVersionForFileName(c);
40
- const appConfigId = c.runtime.appId || '';
41
- const extension = getPackageExtensionByPlatform(platformName);
42
- return `${appNameInFileName}_${platformName}_${buildVersion}_${appConfigId}.${extension}`;
43
- };
44
- exports.resolveBuildFileName = resolveBuildFileName;
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveSupportedPlatforms = void 0;
4
- const resolveSupportedPlatforms = (rnvC) => (rnvC.buildConfig.defaults.supportedPlatforms || []);
5
- exports.resolveSupportedPlatforms = resolveSupportedPlatforms;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveUsedFlavours = void 0;
4
- const resolveSupportedPlatforms_1 = require("./resolveSupportedPlatforms");
5
- const compareAlphabetically = (a, b) => {
6
- if (a < b)
7
- return -1;
8
- if (a > b)
9
- return 1;
10
- return 0;
11
- };
12
- const resolveUsedFlavours = (rnvC) => {
13
- const usedFlavours = [];
14
- const supportedPlatforms = resolveSupportedPlatforms_1.resolveSupportedPlatforms(rnvC);
15
- for (let i = 0; i < supportedPlatforms.length; i++) {
16
- const iPlatform = supportedPlatforms[i];
17
- const iPlatformDeployConfig = rnvC.buildConfig.platforms[iPlatform].deploy;
18
- if (iPlatformDeployConfig) {
19
- const configuredFlavoursForPlatform = iPlatformDeployConfig.supportedFlavours || [];
20
- for (let j = 0; j < configuredFlavoursForPlatform.length; j++) {
21
- const jPlatformFlavour = configuredFlavoursForPlatform[j];
22
- if (!usedFlavours.includes(jPlatformFlavour)) {
23
- usedFlavours.push(jPlatformFlavour);
24
- }
25
- }
26
- }
27
- }
28
- return usedFlavours.sort(compareAlphabetically);
29
- };
30
- exports.resolveUsedFlavours = resolveUsedFlavours;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatTableDataSpaces = void 0;
4
- const getLengthOfLongestColumnCell = (tableData, tableColumnIndex) => {
5
- const rowsAmount = tableData.length;
6
- let maxColumnCellLength = 0;
7
- for (let tableRowIndex = 0; tableRowIndex < rowsAmount; tableRowIndex++) {
8
- const cellLength = tableData[tableRowIndex][tableColumnIndex].length;
9
- if (cellLength > maxColumnCellLength) {
10
- maxColumnCellLength = cellLength;
11
- }
12
- }
13
- return maxColumnCellLength;
14
- };
15
- const formatTableColumnSpaces = (tableData, columnIndex) => {
16
- const requestedColumnLength = getLengthOfLongestColumnCell(tableData, columnIndex);
17
- const rowsAmount = tableData.length;
18
- for (let tableRowIndex = 0; tableRowIndex < rowsAmount; tableRowIndex++) {
19
- const rowData = tableData[tableRowIndex];
20
- rowData[columnIndex] = rowData[columnIndex].padEnd(requestedColumnLength);
21
- }
22
- };
23
- const formatTableDataSpaces = (tableData) => {
24
- const columnsAmount = tableData[0].length;
25
- for (let i = 0; i < columnsAmount; i++) {
26
- formatTableColumnSpaces(tableData, i);
27
- }
28
- return tableData;
29
- };
30
- exports.formatTableDataSpaces = formatTableDataSpaces;
@@ -1,88 +0,0 @@
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
- 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 (!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 = makeTableDataByScheme_1.makeTableDataByScheme(rnvC, scheme);
43
- const formattedTableData = 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 = resolvers_1.getBaseConfig();
85
- const markdownFileContentRows = makeMarkdownFileContentRows(rnvC);
86
- processOutput(outputFilePath, markdownFileContentRows.join('\n'));
87
- };
88
- main();
@@ -1,64 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeTableDataByScheme = void 0;
4
- const resolvers_1 = require("../../resolvers");
5
- const constants_1 = require("../../constants");
6
- const makePlatformRowData = (rnvC, deployLocations, tableFlavours, platform) => {
7
- const data = [`**${platform}**`];
8
- const version = Object.keys(deployLocations.versions)[0];
9
- const flavourNotAvailableForPlatformText = '*N/A*';
10
- for (let i = 0; i < tableFlavours.length; i++) {
11
- const flavourUrls = deployLocations.versions[version].platforms[platform][tableFlavours[i]];
12
- if (flavourUrls) {
13
- let { packageUrl, indexUrl } = flavourUrls;
14
- if (rnvC.runtime.scheme === constants_1.BuildSchemes.RELEASE_DIST) {
15
- const versionRegex = /\d{1,4}\.\d{1,4}\.\d{1,4}/g;
16
- const versionPlaceholder = '<VERSION>';
17
- packageUrl = packageUrl.replace(versionRegex, versionPlaceholder);
18
- indexUrl = packageUrl.replace(versionRegex, versionPlaceholder);
19
- }
20
- let s = `[package](${packageUrl})`;
21
- s += ' / ';
22
- s += `[index.html](${indexUrl})`;
23
- data.push(s);
24
- }
25
- else {
26
- data.push(flavourNotAvailableForPlatformText);
27
- }
28
- }
29
- return data;
30
- };
31
- const makeTablePlatformsData = (rnvC, usedFlavours) => {
32
- const supportedPlatforms = resolvers_1.resolveSupportedPlatforms(rnvC);
33
- const deployLocations = resolvers_1.resolveDeployLocations(rnvC);
34
- const data = [];
35
- for (let i = 0; i < supportedPlatforms.length; i++) {
36
- const platform = supportedPlatforms[i];
37
- const rowData = makePlatformRowData(rnvC, deployLocations, usedFlavours, platform);
38
- if (rowData) {
39
- data.push(rowData);
40
- }
41
- }
42
- return data;
43
- };
44
- const makeHeaderData = (tableFlavours) => {
45
- const header = [''].concat(tableFlavours.map((flavour) => `*${flavour}*`));
46
- const headerSeparator = header.map(() => ':---:');
47
- return [
48
- header,
49
- headerSeparator,
50
- ];
51
- };
52
- const makeTableDataByScheme = (rnvC, scheme) => {
53
- const originalScheme = rnvC.runtime.scheme;
54
- const tableData = [];
55
- rnvC.runtime.scheme = scheme;
56
- const usedFlavours = resolvers_1.resolveUsedFlavours(rnvC);
57
- const headerData = makeHeaderData(usedFlavours);
58
- tableData.push(...headerData);
59
- const tablePlatformsData = makeTablePlatformsData(rnvC, usedFlavours);
60
- tableData.push(...tablePlatformsData);
61
- rnvC.runtime.scheme = originalScheme;
62
- return tableData;
63
- };
64
- exports.makeTableDataByScheme = makeTableDataByScheme;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeDeep = void 0;
4
- const isObject = (item) => (item && typeof item === 'object' && !Array.isArray(item));
5
- const mergeDeep = (target, ...sources) => {
6
- if (!sources.length)
7
- return target;
8
- const source = sources.shift();
9
- if (isObject(target) && isObject(source)) {
10
- Object.keys(source).forEach((key) => {
11
- if (isObject(source[key])) {
12
- if (!target[key])
13
- Object.assign(target, { [key]: {} });
14
- mergeDeep(target[key], source[key]);
15
- }
16
- else {
17
- Object.assign(target, { [key]: source[key] });
18
- }
19
- });
20
- }
21
- return mergeDeep(target, ...sources);
22
- };
23
- exports.mergeDeep = mergeDeep;