@24i/smartapps-bigscreen-rnv-build-engine 0.0.2-alpha.1321 → 0.0.2-alpha.1323

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/src/index.js +3 -1
  2. package/dist/src/tasks/deploy/aswS3/deployS3.js +3 -2
  3. package/dist/src/tasks/deploy/hbbtv/deployHbbtv.js +12 -9
  4. package/dist/src/tasks/task.rnv.build.js +17 -15
  5. package/dist/src/tasks/task.rnv.configure.js +3 -1
  6. package/dist/src/tasks/task.rnv.configureSoft.js +3 -1
  7. package/dist/src/tasks/task.rnv.deploy.js +5 -2
  8. package/dist/src/tasks/task.rnv.hooks.run.js +4 -2
  9. package/dist/src/utils/forEachSupportedPlatformFlavour.js +8 -8
  10. package/dist/src/utils/getBaseConfig.js +5 -3
  11. package/dist/src/utils/getDeployLocations.js +1 -3
  12. package/dist/src/utils/getVersionOffset.js +4 -4
  13. package/dist/src/utils/replaceRelevantStringsInConfig/replaceTemplateString.js +2 -2
  14. package/engine/src/enginePlatforms.js +16 -0
  15. package/engine/src/index.js +67 -0
  16. package/engine/src/scripts/buildAllWithScheme.js +29 -0
  17. package/engine/src/scripts/gitReleaser/afterVersionBump.js +24 -0
  18. package/engine/src/scripts/gitReleaser/beforeVersionBump.js +15 -0
  19. package/engine/src/scripts/gitReleaser/checkReleaseNotes.js +22 -0
  20. package/engine/src/scripts/gitReleaser/pushRelease.js +41 -0
  21. package/engine/src/scripts/gitReleaser/pushReleaseCandidate.js +8 -0
  22. package/engine/src/scripts/gitReleaser/pushReleaseNotes.js +53 -0
  23. package/engine/src/scripts/release/deleteSourceMaps.js +14 -0
  24. package/engine/src/scripts/release/deployToAppCenter.js +79 -0
  25. package/engine/src/scripts/release/githubRelease.js +138 -0
  26. package/engine/src/scripts/release/notifySlack/makePayload.js +103 -0
  27. package/engine/src/scripts/release/notifySlack/notifySlack.js +26 -0
  28. package/engine/src/scripts/release/notifySlack/slackBlockKitBuilder.js +44 -0
  29. package/engine/src/scripts/release/sentryRelease.js +79 -0
  30. package/engine/src/scripts/release/urlsMarkdown.js +85 -0
  31. package/engine/src/scripts/releaseAllWithScheme.js +91 -0
  32. package/engine/src/scripts/utils/cmdUtils.js +16 -0
  33. package/engine/src/scripts/utils/fsUtils.js +14 -0
  34. package/engine/src/scripts/utils/gitUtils.js +94 -0
  35. package/engine/src/scripts/utils/index.js +11 -0
  36. package/engine/src/scripts/utils/stringUtils.js +5 -0
  37. package/engine/src/sdks/index.js +22 -0
  38. package/engine/src/sdks/sdk-tizen/index.js +287 -0
  39. package/engine/src/sdks/sdk-webos/index.js +201 -0
  40. package/engine/src/sdks/sdk-webpack/index.js +45 -0
  41. package/engine/src/sdks/sdkUtils.js +22 -0
  42. package/engine/src/tasks/deploy/aswS3/aws.js +27 -0
  43. package/engine/src/tasks/deploy/aswS3/deployS3.js +71 -0
  44. package/engine/src/tasks/deploy/hbbtv/deployHbbtv.js +144 -0
  45. package/engine/src/tasks/engineTasks.js +23 -0
  46. package/engine/src/tasks/task.rnv.build.js +126 -0
  47. package/engine/src/tasks/task.rnv.configure.js +52 -0
  48. package/engine/src/tasks/task.rnv.configureSoft.js +31 -0
  49. package/engine/src/tasks/task.rnv.deploy.js +40 -0
  50. package/engine/src/tasks/task.rnv.hooks.run.js +61 -0
  51. package/engine/src/tasks/task.rnv.package.js +27 -0
  52. package/engine/src/tasks/task.rnv.project.configure.js +109 -0
  53. package/engine/src/tasks/task.rnv.start.js +52 -0
  54. package/engine/src/utils/forEachSupportedPlatformFlavour.js +29 -0
  55. package/engine/src/utils/getBaseConfig.js +57 -0
  56. package/engine/src/utils/getDeployLocations.js +78 -0
  57. package/engine/src/utils/getVersionOffset.js +39 -0
  58. package/engine/src/utils/replaceRelevantStringsInConfig/index.js +1 -0
  59. package/engine/src/utils/replaceRelevantStringsInConfig/replaceRelevantStringsInConfig.js +36 -0
  60. package/engine/src/utils/replaceRelevantStringsInConfig/replaceTemplateString.js +70 -0
  61. package/engine/src/utils/resolveBaseUrl.js +35 -0
  62. package/engine/src/utils/resolveBuildVersion.js +47 -0
  63. package/engine/src/utils/zipBuildsByPlatforms.js +70 -0
  64. package/package.json +4 -3
@@ -0,0 +1,27 @@
1
+ import { execSync } from 'child_process';
2
+ import fs from 'fs';
3
+
4
+ const runCmdSync = (cmd, options) => execSync(cmd, { stdio: 'inherit' });
5
+
6
+ const isDir = (path) => fs.existsSync(path) && fs.lstatSync(path).isDirectory();
7
+
8
+ const cp = (source, destination) => {
9
+ let cmd = `aws s3 cp ${source} s3://${destination} --acl public-read`;
10
+ if (isDir(source)) {
11
+ cmd += ' --recursive';
12
+ }
13
+ runCmdSync(cmd);
14
+ };
15
+
16
+ const rm = (remoteDirPath) => {
17
+ let cmd = `aws s3 rm s3://${remoteDirPath}`;
18
+ if (remoteDirPath.endsWith('/')) {
19
+ cmd += ' --recursive';
20
+ }
21
+ runCmdSync(cmd);
22
+ };
23
+
24
+ export {
25
+ cp,
26
+ rm,
27
+ };
@@ -0,0 +1,71 @@
1
+ import path from 'path';
2
+ import fs from 'fs';
3
+ import { Common } from 'rnv';
4
+ import { resolveBaseUrl } from '../../../utils/resolveBaseUrl';
5
+ import * as aws from './aws';
6
+
7
+ const { getConfigProp } = Common;
8
+
9
+ const uploadPackage = (c, sourcePath, uploadPath) => {
10
+ const packageOutputDirPath = `${sourcePath}/output`;
11
+ const outputFilenameList = fs.readdirSync(packageOutputDirPath);
12
+ const packageFileName = outputFilenameList[0];
13
+
14
+ const packageLocalPath = `"${packageOutputDirPath}/${packageFileName}"`;
15
+ const packageRemotePath = `"${uploadPath}/build/${packageFileName}"`;
16
+
17
+ aws.cp(packageLocalPath, packageRemotePath);
18
+ };
19
+
20
+ const uploadPublicDir = (sourcePath, uploadPath) => {
21
+ const publicDirLocalPath = path.join(sourcePath, 'project', 'public');
22
+ const publicDirRemotePath = `${uploadPath}/public`;
23
+
24
+ aws.cp(publicDirLocalPath, publicDirRemotePath);
25
+ };
26
+
27
+ const urlToS3Protocol = (url) => {
28
+ const hostWithPath = url.split('://')[1];
29
+ const bucketHostnameAwsPostfix = '.s3.amazonaws.com';
30
+
31
+ return hostWithPath.replace(bucketHostnameAwsPostfix, '');
32
+ };
33
+
34
+ const deployToS3 = async (c) => {
35
+ const { platform, runtime } = c;
36
+ const sourcePath = runtime.appDir;
37
+
38
+ const { isBuildHosted } = getConfigProp(c, platform, 'webpackConfig', {});
39
+ const baseUrl = resolveBaseUrl({
40
+ platform,
41
+ scheme: runtime.scheme || '',
42
+ appConfigId: runtime.appId,
43
+ });
44
+
45
+ if (!baseUrl) {
46
+ return false;
47
+ }
48
+
49
+ const uploadPath = urlToS3Protocol(baseUrl);
50
+
51
+ aws.rm(`${uploadPath}/`);
52
+ uploadPackage(c, sourcePath, uploadPath);
53
+
54
+ if (platform === 'hbbtv') {
55
+ // eslint-disable-next-line max-len
56
+ process.stdout.write(`For ${platform} platform, only ZIP package deployment is configured. Skipping deploying app content to AWS S3.\n`);
57
+ process.stdout.write('Deploy done.\n');
58
+ return true;
59
+ }
60
+
61
+ const sourceDirPath = isBuildHosted ? `${sourcePath}-public` : sourcePath;
62
+
63
+ uploadPublicDir(sourceDirPath, uploadPath);
64
+ process.stdout.write('Deploy done.\n');
65
+
66
+ return true;
67
+ };
68
+
69
+ export {
70
+ deployToS3,
71
+ };
@@ -0,0 +1,144 @@
1
+ import path from 'path';
2
+ import fs from 'fs';
3
+ import { Common } from 'rnv';
4
+ import { NodeSSH } from 'node-ssh';
5
+ import { getBaseConfig } from '../../../utils/getBaseConfig';
6
+
7
+ const { getConfigProp } = Common;
8
+
9
+ const deployConfig = {
10
+ host: 'nxg-bigscreen-test.24imedia.tv',
11
+ username: 'admin',
12
+ privateKeyRelativePath: 'certificates/id_rsa_24i_smartapps_bigscreen',
13
+ passphrase: '>>> please set the value via process.env.CI_SSH_KEY_PASSPHRASE <<<',
14
+ hostHomeDir: '/home/admin',
15
+ dockerHtmlRootDir: '/usr/share/nginx/html',
16
+ dockerContainerName: '24inginx',
17
+ };
18
+
19
+ const getSshKeyAbsolutePath = (c, sshKeyRelativePath) => {
20
+ if (!sshKeyRelativePath) return '';
21
+ return path.join(c.paths.project.dir, sshKeyRelativePath);
22
+ };
23
+
24
+ const makeSshConnection = async (c) => {
25
+ const { host, username, privateKeyRelativePath } = deployConfig;
26
+
27
+ const privateKey = getSshKeyAbsolutePath(c, privateKeyRelativePath);
28
+ const passphrase = process.env.CI_SSH_KEY_PASSPHRASE;
29
+
30
+ if (!privateKey || !passphrase) {
31
+ return null;
32
+ }
33
+
34
+ const ssh = new NodeSSH();
35
+ await ssh.connect({ host, username, privateKey, passphrase });
36
+ return ssh;
37
+ };
38
+
39
+ const getBuildPackageFileName = (c) => {
40
+ const packageOutputDirPath = `${c.runtime.appDir}/output`;
41
+ const outputFilenameList = fs.readdirSync(packageOutputDirPath);
42
+ return outputFilenameList[0];
43
+ };
44
+
45
+ const getLocalBuildPackagePath = (c) => {
46
+ const fileName = getBuildPackageFileName(c);
47
+ return path.join(c.runtime.appDir, 'output', fileName);
48
+ };
49
+
50
+ const getRemoteBuildDirRelativePath = (c, scheme = '', appConfigId = '') => {
51
+ const { projectDirName } = getConfigProp(c, 'hbbtv', 'deploy', {});
52
+ const appId = c.runtime.appId || appConfigId;
53
+ const version = getConfigProp(c, 'hbbtv', 'packageVersion', '');
54
+
55
+ if (!projectDirName || !appId) {
56
+ return '';
57
+ }
58
+
59
+ switch (c.runtime.scheme || scheme) {
60
+ case 'dev:latest': return `${projectDirName}/${appId}/latest/dev`;
61
+ case 'rc:latest': return `${projectDirName}/${appId}/latest/rc`;
62
+ case 'release:latest': return `${projectDirName}/${appId}/latest/release`;
63
+ case 'release:dist': return `${projectDirName}/${appId}/dist/v${version}`;
64
+ default: return '';
65
+ }
66
+ };
67
+
68
+ const resolveRemotePaths = (c) => {
69
+ const remoteBuildDirRelativePath = getRemoteBuildDirRelativePath(c);
70
+ const { hostHomeDir, dockerHtmlRootDir } = deployConfig;
71
+ const hostTempDirName = 'travis-ci-temp';
72
+
73
+ return {
74
+ serverTempDirPath: `${hostHomeDir}/${hostTempDirName}/${remoteBuildDirRelativePath}`,
75
+ dockerProjectDirPath: `${dockerHtmlRootDir}/${remoteBuildDirRelativePath}`,
76
+ };
77
+ };
78
+
79
+ const log = (msg) => process.stdout.write(msg);
80
+
81
+ const getHbbTVDeployUrl = (c = getBaseConfig(), scheme = '', appConfigId = '') => {
82
+ const { host } = deployConfig;
83
+ const remoteDirRelativePath = getRemoteBuildDirRelativePath(c, scheme, appConfigId);
84
+
85
+ return `http://${host}/${remoteDirRelativePath}/public/index.html`;
86
+ };
87
+
88
+ const deployHbbTV = async (c) => {
89
+ if (c.platform !== 'hbbtv') return;
90
+
91
+ log('HbbTV deploy via SSH.\n\n');
92
+
93
+ const remotePaths = resolveRemotePaths(c);
94
+ const { dockerContainerName, host } = deployConfig;
95
+
96
+ const remotePackagePath = `${remotePaths.serverTempDirPath}/${getBuildPackageFileName(c)}`;
97
+ const dockerExecPrefix = `docker exec -t ${dockerContainerName}`;
98
+ const dockerAppDirPath = remotePaths.dockerProjectDirPath;
99
+
100
+ log('Creating connection...\n');
101
+ const ssh = await makeSshConnection(c);
102
+
103
+ if (ssh === null) {
104
+ //eslint-disable-next-line max-len
105
+ throw new Error('Connection failed - check "privateKeyRelativePath" or "process.env.CI_SSH_KEY_PASSPHRASE" deploy params.');
106
+ }
107
+
108
+ log('Clearing temporary dir on host side...\n');
109
+ await ssh.execCommand(`rm -Rf ${remotePaths.serverTempDirPath}`);
110
+
111
+ log('Transferring build package from local machine to host...\n');
112
+ await ssh.putFile(getLocalBuildPackagePath(c), remotePackagePath);
113
+
114
+ log('Unzipping transferred build package...\n');
115
+ await ssh.execCommand(`unzip ${remotePackagePath}`, { cwd: remotePaths.serverTempDirPath });
116
+
117
+ log('Removing transferred build package...\n');
118
+ await ssh.execCommand(`rm ${remotePackagePath}`);
119
+
120
+ log('Clearing docker dir on host side...\n');
121
+ await ssh.execCommand(`${dockerExecPrefix} rm -rf ${dockerAppDirPath}`);
122
+
123
+ const indexHtmlParentDirPath = `${dockerAppDirPath}/public`;
124
+
125
+ log('Creating requested path for build in docker...\n');
126
+ await ssh.execCommand(`${dockerExecPrefix} mkdir -p ${indexHtmlParentDirPath}`);
127
+
128
+ log('Copying unzipped build package from host to host\'s docker path...\n');
129
+ const sourcePath = `${remotePaths.serverTempDirPath}/.`;
130
+ const destPath = `${dockerContainerName}:${indexHtmlParentDirPath}`;
131
+ const cmd = `docker cp ${sourcePath} ${destPath}`;
132
+ await ssh.execCommand(cmd);
133
+
134
+ log('Clearing temporary dir on host side...\n');
135
+ await ssh.execCommand(`rm -Rf ${remotePaths.serverTempDirPath}`);
136
+
137
+ log(`\nThe build is deployed at ${getHbbTVDeployUrl(c)}\n`);
138
+ log('Deploy done.\n');
139
+ };
140
+
141
+ export {
142
+ deployHbbTV,
143
+ getHbbTVDeployUrl,
144
+ };
@@ -0,0 +1,23 @@
1
+ import buildTask from './task.rnv.build';
2
+ import configureTask from './task.rnv.configure';
3
+ import deployTask from './task.rnv.deploy';
4
+ import packageTask from './task.rnv.package';
5
+ import startTask from './task.rnv.start';
6
+ import projectConfigureTask from './task.rnv.project.configure';
7
+ import configureSoftTask from './task.rnv.configureSoft';
8
+ import hooksRunTask from './task.rnv.hooks.run';
9
+
10
+ const engineTaskList = [
11
+ buildTask,
12
+ configureTask,
13
+ deployTask,
14
+ packageTask,
15
+ startTask,
16
+ projectConfigureTask,
17
+ configureSoftTask,
18
+ hooksRunTask,
19
+ ];
20
+
21
+ export {
22
+ engineTaskList,
23
+ };
@@ -0,0 +1,126 @@
1
+ import { execSync } from 'child_process';
2
+ import fs from 'fs';
3
+ import { TaskManager, Constants, Logger, PlatformManager } from 'rnv';
4
+ import { getConfigProp, getPlatformBuildDir, getPlatformProjectDir } from 'rnv/dist/core/common';
5
+ import { enginePlatforms, enginePlatformList } from '../enginePlatforms';
6
+ import { handlePlatformSdk, SDKTizen, SDKWebos, SDKWebpack } from '../sdks';
7
+ import { resolveBuildVersion } from '../utils/resolveBuildVersion';
8
+
9
+ const { logErrorPlatform } = PlatformManager;
10
+ const { logTask } = Logger;
11
+ const { buildWeb } = SDKWebpack;
12
+ const { buildTizenProject } = SDKTizen;
13
+ const { buildWebOSProject } = SDKWebos;
14
+ const { executeOrSkipTask } = TaskManager;
15
+
16
+ const { TASK_BUILD, TASK_PACKAGE, PARAMS } = Constants;
17
+
18
+ const getPackageExtensionByPlatform = (platform = '') => {
19
+ switch (platform) {
20
+ case 'tizen':
21
+ return 'wgt';
22
+ case 'webos':
23
+ return 'ipk';
24
+ default:
25
+ return 'zip';
26
+ }
27
+ };
28
+
29
+ const getBuildVersionForFileName = (c) => {
30
+ const { platform, runtime } = c;
31
+ const { scheme, appId } = runtime;
32
+
33
+ switch (c.runtime.scheme) {
34
+ case 'dev:latest':
35
+ return 'latest.dev';
36
+ case 'rc:latest':
37
+ return 'latest.rc';
38
+ case 'release:latest':
39
+ return 'latest.release';
40
+ default:
41
+ return resolveBuildVersion({
42
+ platform,
43
+ scheme,
44
+ appConfigId: appId,
45
+ });
46
+ }
47
+ };
48
+
49
+ const makeBuildName = (c) => {
50
+ const platformName = c.platform;
51
+
52
+ const appNameInFileName = getConfigProp(c, platformName, 'appNameInFileName', '');
53
+ const buildVersion = getBuildVersionForFileName(c);
54
+ const appConfigId = c.runtime.appId || '';
55
+ const extension = getPackageExtensionByPlatform(platformName);
56
+
57
+ return `${appNameInFileName}_${platformName}_${buildVersion}_${appConfigId}.${extension}`;
58
+ };
59
+
60
+ const makeZipOutput = (c) => {
61
+ const platformBuildDir = getPlatformBuildDir(c);
62
+ const copiedProjectBuildDir = `${platformBuildDir}/build`;
63
+
64
+ const defaultZipFileName = `${c.platform}_${c.runtime.appId}.zip`;
65
+ const fileName = makeBuildName(c) || defaultZipFileName;
66
+
67
+ execSync(`cp -r ${getPlatformProjectDir(c)}/public ${copiedProjectBuildDir}`);
68
+ execSync(`rm -rf ${platformBuildDir}/output`);
69
+ execSync(`mkdir ${platformBuildDir}/output`);
70
+ execSync(`zip -r ../output/${fileName} *`, { cwd: copiedProjectBuildDir });
71
+ execSync(`rm -rf ${copiedProjectBuildDir}`);
72
+ };
73
+
74
+ const renameOutput = (c) => {
75
+ const packageOutputDirPath = `${c.runtime.appDir}/output`;
76
+ if (!fs.existsSync(packageOutputDirPath)) return;
77
+
78
+ const outputFilenameList = fs.readdirSync(packageOutputDirPath);
79
+ const packageFileName = outputFilenameList[0];
80
+ const newFilename = makeBuildName(c);
81
+
82
+ if (newFilename) {
83
+ const oldPath = `${packageOutputDirPath}/${packageFileName}`;
84
+ const newPath = `${packageOutputDirPath}/${newFilename}`;
85
+ fs.renameSync(oldPath, newPath);
86
+ }
87
+ };
88
+
89
+ export const taskRnvBuild = async (c, parentTask, originTask) => {
90
+ logTask('taskRnvBuild', `parent:${parentTask}`);
91
+ const { platform } = c;
92
+
93
+ c.runtime.forceBundleAssets = true;
94
+
95
+ await handlePlatformSdk(c); // handling SDKs here to reduce rnv messages and prompts
96
+ await executeOrSkipTask(c, TASK_PACKAGE, TASK_BUILD, originTask);
97
+
98
+ switch (platform) {
99
+ case enginePlatforms.ENTONE:
100
+ case enginePlatforms.HBBTV:
101
+ case enginePlatforms.WEBTV:
102
+ await buildWeb(c);
103
+ makeZipOutput(c);
104
+ return;
105
+ case enginePlatforms.TIZEN:
106
+ await buildTizenProject(c, platform);
107
+ renameOutput(c);
108
+ return;
109
+ case enginePlatforms.WEBOS:
110
+ await buildWebOSProject(c, platform);
111
+ renameOutput(c);
112
+ return;
113
+ default:
114
+ logErrorPlatform(c);
115
+ }
116
+ };
117
+
118
+ // keeping default export due to rnv
119
+ // eslint-disable-next-line import/no-default-export
120
+ export default {
121
+ description: 'Build project binary',
122
+ fn: taskRnvBuild,
123
+ task: 'build',
124
+ params: PARAMS.withBase(PARAMS.withConfigure()),
125
+ platforms: enginePlatformList,
126
+ };
@@ -0,0 +1,52 @@
1
+ import { TaskManager, Constants, Logger, PlatformManager } from 'rnv';
2
+ import { generateSvgSpriteMap } from '@24i/smartapps-bigscreen-icon/hooks/generateSvgSpritemap';
3
+ import { enginePlatformList, enginePlatforms } from '../enginePlatforms';
4
+ import { SDKTizen, SDKWebos, SDKWebpack } from '../sdks';
5
+
6
+ const { logErrorPlatform, copySharedPlatforms } = PlatformManager;
7
+ const { logTask } = Logger;
8
+ const { TASK_PLATFORM_CONFIGURE, TASK_CONFIGURE, PARAMS } = Constants;
9
+ const { configureWebProject } = SDKWebpack;
10
+ const { configureTizenProject } = SDKTizen;
11
+ const { configureWebOSProject } = SDKWebos;
12
+ const { executeTask } = TaskManager;
13
+
14
+ export const taskRnvConfigure = async (c, parentTask, originTask) => {
15
+ logTask('taskRnvConfigure');
16
+
17
+ await executeTask(c, TASK_PLATFORM_CONFIGURE, TASK_CONFIGURE, originTask);
18
+ await copySharedPlatforms(c);
19
+
20
+ const generateSvgSpriteMapHook = generateSvgSpriteMap({
21
+ iconsFolder: '/icons', // relative to project path
22
+ cssOutput: '../../platformAssets/runtime/icons.css', // relative to build dir path
23
+ jsonOutput: '/icons.json', // relative to platformAssets dir
24
+ maskList: c.buildConfig?.common?.svgIconsMaskList || [],
25
+ });
26
+ await generateSvgSpriteMapHook(c);
27
+
28
+ if (c.program.only && !!parentTask) return true;
29
+
30
+ switch (c.platform) {
31
+ case enginePlatforms.ENTONE:
32
+ case enginePlatforms.HBBTV:
33
+ case enginePlatforms.WEBTV:
34
+ return configureWebProject(c);
35
+ case enginePlatforms.TIZEN:
36
+ return configureTizenProject(c);
37
+ case enginePlatforms.WEBOS:
38
+ return configureWebOSProject(c);
39
+ default:
40
+ return logErrorPlatform(c);
41
+ }
42
+ };
43
+
44
+ // keeping default export due to rnv
45
+ // eslint-disable-next-line import/no-default-export
46
+ export default {
47
+ description: 'Configure current project',
48
+ fn: taskRnvConfigure,
49
+ task: 'configure',
50
+ params: PARAMS.withBase(PARAMS.withConfigure()),
51
+ platforms: enginePlatformList,
52
+ };
@@ -0,0 +1,31 @@
1
+ import { logTask } from 'rnv/dist/core/systemManager/logger';
2
+ import { isBuildSchemeSupported } from 'rnv/dist/core/configManager/schemeParser';
3
+ import { isPlatformSupported } from 'rnv/dist/core/platformManager';
4
+ import { configureRuntimeDefaults } from 'rnv/dist/core/runtimeManager';
5
+ import { executeTask } from 'rnv/dist/core/taskManager';
6
+ import { TASK_APP_CONFIGURE, TASK_CONFIGURE_SOFT, PARAMS } from 'rnv/dist/core/constants';
7
+ import { checkSdk } from 'rnv/dist/core/sdkManager/installer';
8
+ import { replaceRelevantStringsInConfig } from '../utils/replaceRelevantStringsInConfig';
9
+
10
+ export const taskRnvConfigureSoft = async (c, parentTask, originTask) => {
11
+ logTask('taskRnvConfigureSoft');
12
+
13
+ await configureRuntimeDefaults(c);
14
+ await executeTask(c, TASK_APP_CONFIGURE, parentTask, originTask);
15
+ await isPlatformSupported(c);
16
+ await isBuildSchemeSupported(c);
17
+ await checkSdk(c);
18
+ await configureRuntimeDefaults(c);
19
+ replaceRelevantStringsInConfig(c);
20
+ return true;
21
+ };
22
+
23
+ // keeping default export due to rnv
24
+ // eslint-disable-next-line import/no-default-export
25
+ export default {
26
+ description: 'Configure system and project wothout recreating files (used for --only)',
27
+ fn: taskRnvConfigureSoft,
28
+ task: TASK_CONFIGURE_SOFT,
29
+ params: PARAMS.withBase(),
30
+ platforms: [],
31
+ };
@@ -0,0 +1,40 @@
1
+ import { TaskManager, Constants, Logger, PlatformManager } from 'rnv';
2
+ import { enginePlatformList, enginePlatforms } from '../enginePlatforms';
3
+ import { deployToS3 } from './deploy/aswS3/deployS3';
4
+ import { deployHbbTV } from './deploy/hbbtv/deployHbbtv';
5
+
6
+ const { logErrorPlatform } = PlatformManager;
7
+ const { logTask } = Logger;
8
+ const { TASK_EXPORT, TASK_DEPLOY, PARAMS } = Constants;
9
+ const { executeOrSkipTask } = TaskManager;
10
+
11
+ export const taskRnvDeploy = async (c, parentTask, originTask) => {
12
+ logTask('taskRnvDeploy', `parent:${parentTask}`);
13
+
14
+ await executeOrSkipTask(c, TASK_EXPORT, TASK_DEPLOY, originTask);
15
+
16
+ switch (c.platform) {
17
+ case enginePlatforms.HBBTV:
18
+ await deployHbbTV(c);
19
+ await deployToS3(c);
20
+ return true;
21
+ case enginePlatforms.ENTONE:
22
+ case enginePlatforms.TIZEN:
23
+ case enginePlatforms.WEBOS:
24
+ case enginePlatforms.WEBTV:
25
+ return deployToS3(c);
26
+ default:
27
+ logErrorPlatform(c);
28
+ return false;
29
+ }
30
+ };
31
+
32
+ // keeping default export due to rnv
33
+ // eslint-disable-next-line import/no-default-export
34
+ export default {
35
+ description: 'Deploy the binary via selected deployment integration or build hook',
36
+ fn: taskRnvDeploy,
37
+ task: 'deploy',
38
+ params: PARAMS.withBase(PARAMS.withConfigure()),
39
+ platforms: enginePlatformList,
40
+ };
@@ -0,0 +1,61 @@
1
+ import inquirer from 'inquirer';
2
+ import { logTask, logInfo } from 'rnv/dist/core/systemManager/logger';
3
+ import { buildHooks } from 'rnv/dist/core/projectManager/buildHooks';
4
+ import { executeTask } from 'rnv/dist/core/taskManager';
5
+ import { fsExistsSync } from 'rnv/dist/core/systemManager/fileutils';
6
+ import {
7
+ TASK_HOOKS_RUN, TASK_PROJECT_CONFIGURE, PARAMS, PARAM_KEYS,
8
+ } from 'rnv/dist/core/constants';
9
+
10
+ export const taskRnvHooksRun = async (c, parentTask, originTask) => {
11
+ logTask('taskRnvHooksRun');
12
+
13
+ if (fsExistsSync(c.paths.project.config)) {
14
+ await executeTask(c, TASK_PROJECT_CONFIGURE, TASK_HOOKS_RUN, originTask);
15
+ } else {
16
+ logInfo('Your are running your buildHook outside of renative project');
17
+ }
18
+
19
+ await buildHooks(c);
20
+
21
+ if (!c.buildHooks) {
22
+ return Promise.reject(new Error('Build hooks have not been compiled properly!'));
23
+ }
24
+
25
+ let hookName = c.program?.exeMethod;
26
+ let showHookList = false;
27
+ if (!hookName || hookName === true) {
28
+ showHookList = true;
29
+ } else if (!c.buildHooks[hookName]) {
30
+ showHookList = true;
31
+ }
32
+
33
+ if (showHookList) {
34
+ const hooksList = Object.keys(c.buildHooks);
35
+
36
+ const { selectedHook } = await inquirer.prompt({
37
+ name: 'selectedHook',
38
+ type: 'list',
39
+ message: 'Pick an available hook:',
40
+ choices: hooksList
41
+ });
42
+ hookName = selectedHook;
43
+ }
44
+ await c.buildHooks[hookName](c);
45
+
46
+ return true;
47
+ };
48
+
49
+ // keeping default export due to rnv
50
+ // eslint-disable-next-line import/no-default-export
51
+ export default {
52
+ description: 'Run specific build hook',
53
+ fn: taskRnvHooksRun,
54
+ task: TASK_HOOKS_RUN,
55
+ params: PARAMS.withBase([PARAM_KEYS.exeMethod]),
56
+ platforms: [],
57
+ skipAppConfig: true,
58
+ skipPlatforms: true,
59
+ forceBuildHookRebuild: true,
60
+ isGlobalScope: true
61
+ };
@@ -0,0 +1,27 @@
1
+ import { TaskManager, Constants, Logger } from 'rnv';
2
+ import { getConfigProp } from 'rnv/dist/core/common';
3
+ import { configureFilesystem } from 'rnv/dist/core/systemManager/fileutils';
4
+ import { doResolve } from 'rnv/dist/core/systemManager/resolve';
5
+ import { isSystemWin } from 'rnv/dist/core/systemManager/utils';
6
+ import { enginePlatformList } from '../enginePlatforms';
7
+
8
+ const { logTask } = Logger;
9
+ const { TASK_PACKAGE, TASK_CONFIGURE, PARAMS } = Constants;
10
+ const { executeOrSkipTask } = TaskManager;
11
+
12
+ export const taskRnvPackage = async (c, parentTask, originTask) => {
13
+ logTask('taskRnvPackage', `parent:${parentTask}`);
14
+
15
+ configureFilesystem(getConfigProp, doResolve, isSystemWin); // rnv fix for initializeBuilder
16
+
17
+ await executeOrSkipTask(c, TASK_CONFIGURE, TASK_PACKAGE, originTask);
18
+ return true;
19
+ };
20
+
21
+ export default {
22
+ description: 'Package source files into bundle',
23
+ fn: taskRnvPackage,
24
+ task: 'package',
25
+ params: PARAMS.withBase(PARAMS.withConfigure()),
26
+ platforms: enginePlatformList,
27
+ };