@24i/smartapps-bigscreen-rnv-build-engine 0.0.2-alpha.1322 → 0.0.2-alpha.1324
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/index.js +3 -1
- package/dist/src/scripts/buildAllWithScheme.js +2 -1
- package/dist/src/scripts/gitReleaser/afterVersionBump.js +2 -1
- package/dist/src/scripts/gitReleaser/checkReleaseNotes.js +1 -1
- package/dist/src/scripts/gitReleaser/pushReleaseNotes.js +31 -37
- package/dist/src/scripts/release/githubRelease.js +4 -3
- package/dist/src/scripts/release/notifySlack/makePayload.js +1 -0
- package/dist/src/scripts/release/sentryRelease.js +3 -3
- package/dist/src/scripts/release/urlsMarkdown.js +0 -4
- package/dist/src/scripts/releaseAllWithScheme.js +5 -3
- package/dist/src/scripts/utils/gitUtils.js +6 -3
- package/dist/src/sdks/index.js +6 -11
- package/dist/src/sdks/sdk-tizen/index.js +74 -70
- package/dist/src/sdks/sdk-webos/index.js +85 -90
- package/dist/src/sdks/sdk-webpack/index.js +1 -1
- package/dist/src/tasks/deploy/aswS3/aws.js +1 -1
- package/dist/src/tasks/deploy/aswS3/deployS3.js +3 -2
- package/dist/src/tasks/deploy/hbbtv/deployHbbtv.js +13 -10
- package/dist/src/tasks/engineTasks.js +9 -11
- package/dist/src/tasks/task.rnv.build.js +20 -21
- package/dist/src/tasks/task.rnv.configure.js +6 -7
- package/dist/src/tasks/task.rnv.configureSoft.js +6 -7
- package/dist/src/tasks/task.rnv.deploy.js +8 -8
- package/dist/src/tasks/task.rnv.hooks.run.js +7 -8
- package/dist/src/tasks/task.rnv.package.js +6 -7
- package/dist/src/tasks/task.rnv.project.configure.js +17 -16
- package/dist/src/tasks/task.rnv.start.js +15 -15
- package/dist/src/utils/forEachSupportedPlatformFlavour.js +8 -8
- package/dist/src/utils/getBaseConfig.js +5 -3
- package/dist/src/utils/getDeployLocations.js +1 -3
- package/dist/src/utils/getVersionOffset.js +4 -4
- package/dist/src/utils/replaceRelevantStringsInConfig/replaceTemplateString.js +7 -7
- package/dist/templates/platforms/_shared/template.js +5 -2
- package/dist/templates/platforms/_shared/webpack.base.js +9 -6
- package/dist/templates/platforms/entone/webpack.config.dev.js +4 -2
- package/dist/templates/platforms/entone/webpack.config.prod.js +4 -2
- package/dist/templates/platforms/hbbtv/webpack.config.dev.js +8 -3
- package/dist/templates/platforms/hbbtv/webpack.config.prod.js +8 -3
- package/dist/templates/platforms/tizen/webpack.config.dev.js +4 -2
- package/dist/templates/platforms/tizen/webpack.config.prod.js +4 -2
- package/dist/templates/platforms/webos/webpack.config.dev.js +4 -2
- package/dist/templates/platforms/webos/webpack.config.prod.js +4 -2
- package/dist/templates/platforms/webtv/webpack.config.dev.js +4 -2
- package/dist/templates/platforms/webtv/webpack.config.prod.js +4 -2
- package/engine/src/enginePlatforms.js +16 -0
- package/engine/src/index.js +67 -0
- package/engine/src/scripts/buildAllWithScheme.js +30 -0
- package/engine/src/scripts/gitReleaser/afterVersionBump.js +25 -0
- package/engine/src/scripts/gitReleaser/beforeVersionBump.js +15 -0
- package/engine/src/scripts/gitReleaser/checkReleaseNotes.js +22 -0
- package/engine/src/scripts/gitReleaser/pushRelease.js +41 -0
- package/engine/src/scripts/gitReleaser/pushReleaseCandidate.js +8 -0
- package/engine/src/scripts/gitReleaser/pushReleaseNotes.js +49 -0
- package/engine/src/scripts/release/deleteSourceMaps.js +14 -0
- package/engine/src/scripts/release/deployToAppCenter.js +79 -0
- package/engine/src/scripts/release/githubRelease.js +139 -0
- package/engine/src/scripts/release/notifySlack/makePayload.js +99 -0
- package/engine/src/scripts/release/notifySlack/notifySlack.js +28 -0
- package/engine/src/scripts/release/notifySlack/slackBlockKitBuilder.js +44 -0
- package/engine/src/scripts/release/sentryRelease.js +79 -0
- package/engine/src/scripts/release/urlsMarkdown.js +80 -0
- package/engine/src/scripts/releaseAllWithScheme.js +92 -0
- package/engine/src/scripts/utils/cmdUtils.js +16 -0
- package/engine/src/scripts/utils/fsUtils.js +14 -0
- package/engine/src/scripts/utils/gitUtils.js +97 -0
- package/engine/src/scripts/utils/index.js +11 -0
- package/engine/src/scripts/utils/stringUtils.js +5 -0
- package/engine/src/sdks/index.js +22 -0
- package/engine/src/sdks/sdk-tizen/index.js +295 -0
- package/engine/src/sdks/sdk-webos/index.js +182 -0
- package/engine/src/sdks/sdk-webpack/index.js +44 -0
- package/engine/src/sdks/sdkUtils.js +20 -0
- package/engine/src/tasks/deploy/aswS3/aws.js +27 -0
- package/engine/src/tasks/deploy/aswS3/deployS3.js +71 -0
- package/engine/src/tasks/deploy/hbbtv/deployHbbtv.js +144 -0
- package/engine/src/tasks/engineTasks.js +23 -0
- package/engine/src/tasks/task.rnv.build.js +128 -0
- package/engine/src/tasks/task.rnv.configure.js +54 -0
- package/engine/src/tasks/task.rnv.configureSoft.js +33 -0
- package/engine/src/tasks/task.rnv.deploy.js +42 -0
- package/engine/src/tasks/task.rnv.hooks.run.js +63 -0
- package/engine/src/tasks/task.rnv.package.js +31 -0
- package/engine/src/tasks/task.rnv.project.configure.js +127 -0
- package/engine/src/tasks/task.rnv.start.js +58 -0
- package/engine/src/utils/forEachSupportedPlatformFlavour.js +29 -0
- package/engine/src/utils/getBaseConfig.js +57 -0
- package/engine/src/utils/getDeployLocations.js +78 -0
- package/engine/src/utils/getVersionOffset.js +39 -0
- package/engine/src/utils/replaceRelevantStringsInConfig/index.js +1 -0
- package/engine/src/utils/replaceRelevantStringsInConfig/replaceRelevantStringsInConfig.js +36 -0
- package/engine/src/utils/replaceRelevantStringsInConfig/replaceTemplateString.js +73 -0
- package/engine/src/utils/resolveBaseUrl.js +35 -0
- package/engine/src/utils/resolveBuildVersion.js +47 -0
- package/engine/src/utils/zipBuildsByPlatforms.js +69 -0
- package/package.json +12 -7
|
@@ -6,9 +6,11 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
6
6
|
|
|
7
7
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// eslint-disable-next-line import/no-unresolved
|
|
10
|
+
var Configs = require('./webpack.base'); // eslint-disable-next-line import/no-unresolved
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
|
|
13
|
+
var Extend = require('./webpack.extend');
|
|
12
14
|
|
|
13
15
|
var config = _objectSpread({
|
|
14
16
|
currentDir: __dirname,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const enginePlatforms = {
|
|
2
|
+
ENTONE: 'entone',
|
|
3
|
+
HBBTV: 'hbbtv',
|
|
4
|
+
TIZEN: 'tizen',
|
|
5
|
+
WEBOS: 'webos',
|
|
6
|
+
WEBTV: 'webtv',
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const enginePlatformList = Object
|
|
10
|
+
.keys(enginePlatforms)
|
|
11
|
+
.map((platform) => platform);
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
enginePlatforms,
|
|
15
|
+
enginePlatformList,
|
|
16
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { EngineManager, Config } from 'rnv';
|
|
2
|
+
import CNF from '../../renative.engine.json';
|
|
3
|
+
import { enginePlatforms } from './enginePlatforms';
|
|
4
|
+
import { engineTaskList } from './tasks/engineTasks';
|
|
5
|
+
|
|
6
|
+
const { generateEngineTasks } = EngineManager;
|
|
7
|
+
|
|
8
|
+
const generateEngineExtensions = (platformExtensions = []) => {
|
|
9
|
+
const fileExtensions = ['js', 'jsx', 'ts', 'tsx', 'json'];
|
|
10
|
+
const output = [];
|
|
11
|
+
|
|
12
|
+
fileExtensions.forEach((fileExtension) => {
|
|
13
|
+
output.push(fileExtension);
|
|
14
|
+
|
|
15
|
+
platformExtensions.forEach((platformExtension) => {
|
|
16
|
+
output.push(`${platformExtension}.${fileExtension}`);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
return output;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// keeping default export due to rnv
|
|
24
|
+
// eslint-disable-next-line import/no-default-export
|
|
25
|
+
export default {
|
|
26
|
+
initializeRuntimeConfig: (c) => Config.initializeConfig(c),
|
|
27
|
+
tasks: generateEngineTasks(engineTaskList),
|
|
28
|
+
config: CNF,
|
|
29
|
+
projectDirName: 'project',
|
|
30
|
+
serverDirName: 'server',
|
|
31
|
+
ejectPlatform: null,
|
|
32
|
+
platforms: {
|
|
33
|
+
[enginePlatforms.ENTONE]: {
|
|
34
|
+
// NOTE: 'extenstions' is correct property name here.
|
|
35
|
+
// It's a typo in rnv which needs to be fixed in core.
|
|
36
|
+
extenstions: generateEngineExtensions(['entone']),
|
|
37
|
+
defaultPort: 8095,
|
|
38
|
+
|
|
39
|
+
},
|
|
40
|
+
[enginePlatforms.HBBTV]: {
|
|
41
|
+
// NOTE: 'extenstions' is correct property name here.
|
|
42
|
+
// It's a typo in rnv which needs to be fixed in core.
|
|
43
|
+
extenstions: generateEngineExtensions(['hbbtv.tv']),
|
|
44
|
+
defaultPort: 8096,
|
|
45
|
+
|
|
46
|
+
},
|
|
47
|
+
[enginePlatforms.TIZEN]: {
|
|
48
|
+
// NOTE: 'extenstions' is correct property name here.
|
|
49
|
+
// It's a typo in rnv which needs to be fixed in core.
|
|
50
|
+
extenstions: generateEngineExtensions(['tizen.tv']),
|
|
51
|
+
defaultPort: 8087,
|
|
52
|
+
|
|
53
|
+
},
|
|
54
|
+
[enginePlatforms.WEBOS]: {
|
|
55
|
+
// NOTE: 'extenstions' is correct property name here.
|
|
56
|
+
// It's a typo in rnv which needs to be fixed in core.
|
|
57
|
+
extenstions: generateEngineExtensions(['webos.tv']),
|
|
58
|
+
defaultPort: 8088,
|
|
59
|
+
},
|
|
60
|
+
[enginePlatforms.WEBTV]: {
|
|
61
|
+
// NOTE: 'extenstions' is correct property name here.
|
|
62
|
+
// It's a typo in rnv which needs to be fixed in core.
|
|
63
|
+
extenstions: generateEngineExtensions(['webtv']),
|
|
64
|
+
defaultPort: 8080,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import { forEachSupportedPlatformFlavour } from '../utils/forEachSupportedPlatformFlavour';
|
|
3
|
+
import { getBaseConfig } from '../utils/getBaseConfig';
|
|
4
|
+
|
|
5
|
+
const buildTask = (options) => {
|
|
6
|
+
const { scheme, platform, flavour } = options;
|
|
7
|
+
const cmd = `npx rnv build -s ${scheme} -p ${platform} -c ${flavour} --ci`;
|
|
8
|
+
execSync(cmd, { stdio: 'inherit' });
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const buildAllWithScheme = () => {
|
|
12
|
+
const scheme = process.argv[2];
|
|
13
|
+
if (!scheme) {
|
|
14
|
+
throw new Error('No scheme name to use found! Please use rnv scheme name as a param.');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const c = getBaseConfig();
|
|
18
|
+
c.runtime.scheme = scheme;
|
|
19
|
+
|
|
20
|
+
forEachSupportedPlatformFlavour(c, buildTask);
|
|
21
|
+
return true;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const startTimestamp = Date.now();
|
|
25
|
+
|
|
26
|
+
buildAllWithScheme();
|
|
27
|
+
|
|
28
|
+
const msPerSecond = 1000;
|
|
29
|
+
const scriptTotalTimeInSeconds = Math.ceil((Date.now() - startTimestamp) / msPerSecond);
|
|
30
|
+
console.log(`buildAllWithScheme: done in ${scriptTotalTimeInSeconds} second(s)!`);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getBaseConfig } from '../../utils/getBaseConfig';
|
|
2
|
+
import { addAll, checkout, createBranch, commit, push } from '../utils/gitUtils';
|
|
3
|
+
|
|
4
|
+
const c = getBaseConfig();
|
|
5
|
+
|
|
6
|
+
const { branchNames = {}, commitTitles = {} } = c.buildConfig?.common?.git || {};
|
|
7
|
+
const { packageVersion = '' } = c.buildConfig?.common || {};
|
|
8
|
+
|
|
9
|
+
const newReleaseBranchName = branchNames.rc;
|
|
10
|
+
|
|
11
|
+
createBranch(newReleaseBranchName);
|
|
12
|
+
checkout(newReleaseBranchName);
|
|
13
|
+
addAll(); // add version changes into a git stage
|
|
14
|
+
|
|
15
|
+
const withNoVerifyFlag = true;
|
|
16
|
+
|
|
17
|
+
console.log('Creating commit with changed version...');
|
|
18
|
+
commit(commitTitles.versionBump, withNoVerifyFlag);
|
|
19
|
+
|
|
20
|
+
console.log(`Pushing ${newReleaseBranchName} branch...`);
|
|
21
|
+
push(newReleaseBranchName, withNoVerifyFlag);
|
|
22
|
+
|
|
23
|
+
// eslint-disable-next-line max-len
|
|
24
|
+
console.log(`\nDone! The version has been bumped to ${packageVersion} and ${newReleaseBranchName} branch pushed into the remote repository.`);
|
|
25
|
+
console.log('Note: Do not forget to update release notes for upcoming release!');
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { strict } from 'assert';
|
|
2
|
+
import { getBaseConfig } from '../../utils/getBaseConfig';
|
|
3
|
+
import { assertCurrentBranch, assertEmptyStatusList } from '../utils/gitUtils';
|
|
4
|
+
|
|
5
|
+
const { ok } = strict;
|
|
6
|
+
|
|
7
|
+
const c = getBaseConfig();
|
|
8
|
+
const { branchNames = {}, commitTitles = {} } = c.buildConfig?.common?.git || {};
|
|
9
|
+
|
|
10
|
+
ok(branchNames.dev);
|
|
11
|
+
ok(branchNames.rc);
|
|
12
|
+
ok(commitTitles.versionBump);
|
|
13
|
+
|
|
14
|
+
assertCurrentBranch(branchNames.dev);
|
|
15
|
+
assertEmptyStatusList();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { strict } from 'assert';
|
|
2
|
+
import { fsUtils } from '../utils';
|
|
3
|
+
|
|
4
|
+
const { ok } = strict;
|
|
5
|
+
|
|
6
|
+
const checkReleaseNotes = (c) => {
|
|
7
|
+
const { relativePath, requiredRows = [] } = c.buildConfig?.common?.releaseNotes || {};
|
|
8
|
+
|
|
9
|
+
fsUtils.assertPath(relativePath);
|
|
10
|
+
const fileContent = fsUtils.getFileContentAsString(relativePath);
|
|
11
|
+
|
|
12
|
+
const assertFileContentRow = (expectedRowContent) => {
|
|
13
|
+
const errorMsg = `${relativePath} should contain following row: "${expectedRowContent}"`;
|
|
14
|
+
ok(fileContent.includes(expectedRowContent), errorMsg);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
requiredRows.forEach(assertFileContentRow);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
checkReleaseNotes,
|
|
22
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { strict } from 'assert';
|
|
2
|
+
import { getBaseConfig } from '../../utils/getBaseConfig';
|
|
3
|
+
import { gitUtils } from '../utils';
|
|
4
|
+
import { checkReleaseNotes } from './checkReleaseNotes';
|
|
5
|
+
|
|
6
|
+
const { ok } = strict;
|
|
7
|
+
|
|
8
|
+
const c = getBaseConfig();
|
|
9
|
+
const { branchNames = {}, pullRequestTitles } = c.buildConfig?.common?.git || {};
|
|
10
|
+
|
|
11
|
+
const rcBranchName = branchNames.rc;
|
|
12
|
+
const distBranchName = branchNames.dist;
|
|
13
|
+
const devBranchName = branchNames.dev;
|
|
14
|
+
|
|
15
|
+
ok(rcBranchName);
|
|
16
|
+
ok(distBranchName);
|
|
17
|
+
ok(devBranchName);
|
|
18
|
+
|
|
19
|
+
gitUtils.assertCurrentBranch(rcBranchName);
|
|
20
|
+
gitUtils.assertEmptyStatusList();
|
|
21
|
+
gitUtils.assertRemoteBranch(rcBranchName);
|
|
22
|
+
gitUtils.assertRemoteBranch(distBranchName);
|
|
23
|
+
|
|
24
|
+
const distributionPrTitle = pullRequestTitles.rcToDist;
|
|
25
|
+
const developmentPrTitle = pullRequestTitles.rcToDev;
|
|
26
|
+
|
|
27
|
+
ok(distributionPrTitle);
|
|
28
|
+
ok(developmentPrTitle);
|
|
29
|
+
|
|
30
|
+
gitUtils.pull();
|
|
31
|
+
checkReleaseNotes(c);
|
|
32
|
+
|
|
33
|
+
console.log(`Creating Pull Request from ${rcBranchName} branch to ${distBranchName} branch...`);
|
|
34
|
+
console.log(`Applied PR title: "${distributionPrTitle}"`);
|
|
35
|
+
gitUtils.pullRequest(rcBranchName, distBranchName, distributionPrTitle);
|
|
36
|
+
|
|
37
|
+
console.log(`\nCreating Pull Request from ${rcBranchName} branch to ${devBranchName} branch...`);
|
|
38
|
+
console.log(`Applied PR title: "${developmentPrTitle}"`);
|
|
39
|
+
gitUtils.pullRequest(rcBranchName, devBranchName, developmentPrTitle);
|
|
40
|
+
|
|
41
|
+
console.log('\nDone! Pull requests have been created!');
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
|
|
3
|
+
console.log('Bumping the version...');
|
|
4
|
+
const bumpType = process.argv[2] || 'patch'; // major | minor | patch
|
|
5
|
+
execSync(`npm --no-git-tag-version version ${bumpType}`, { stdio: 'inherit' });
|
|
6
|
+
|
|
7
|
+
// If preversion, version, or postversion are in the scripts property of the package.json,
|
|
8
|
+
// they will be executed as part of running npm version.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { strict } from 'assert';
|
|
2
|
+
import { getBaseConfig } from '../../utils/getBaseConfig';
|
|
3
|
+
import { gitUtils } from '../utils';
|
|
4
|
+
import { checkReleaseNotes } from './checkReleaseNotes';
|
|
5
|
+
|
|
6
|
+
const { ok } = strict;
|
|
7
|
+
const c = getBaseConfig();
|
|
8
|
+
const {
|
|
9
|
+
branchNames = {}, commitTitles = {}, pullRequestTitles = {},
|
|
10
|
+
} = c.buildConfig?.common?.git || {};
|
|
11
|
+
const { relativePath = [] } = c.buildConfig?.common?.releaseNotes || {};
|
|
12
|
+
|
|
13
|
+
const rcBranchName = branchNames.rc;
|
|
14
|
+
const releaseNotesBranchName = branchNames.rcReleaseNotes;
|
|
15
|
+
|
|
16
|
+
const commitTitle = commitTitles.rcReleaseNotes;
|
|
17
|
+
const prTitle = pullRequestTitles.releaseNotesToRc;
|
|
18
|
+
|
|
19
|
+
ok(relativePath);
|
|
20
|
+
ok(releaseNotesBranchName);
|
|
21
|
+
ok(commitTitle);
|
|
22
|
+
ok(prTitle);
|
|
23
|
+
|
|
24
|
+
gitUtils.assertCurrentBranch(rcBranchName);
|
|
25
|
+
gitUtils.assertRemoteBranch(rcBranchName);
|
|
26
|
+
|
|
27
|
+
checkReleaseNotes(c);
|
|
28
|
+
gitUtils.pull();
|
|
29
|
+
|
|
30
|
+
const changedFilesCount = gitUtils.statusList().length;
|
|
31
|
+
|
|
32
|
+
if (changedFilesCount === 0) {
|
|
33
|
+
console.log(`It seems ${relativePath} file has been updated before.`);
|
|
34
|
+
console.log('Skipping making a commit, if needed, please continue on your own (manually).');
|
|
35
|
+
} else {
|
|
36
|
+
ok(changedFilesCount === 1, `Only ${relativePath} should contain changes!`);
|
|
37
|
+
|
|
38
|
+
gitUtils.createBranch(releaseNotesBranchName);
|
|
39
|
+
gitUtils.checkout(releaseNotesBranchName);
|
|
40
|
+
|
|
41
|
+
gitUtils.add([relativePath]);
|
|
42
|
+
gitUtils.commit(commitTitle);
|
|
43
|
+
gitUtils.push(releaseNotesBranchName, true); // `true` is for push with --no-verify flag
|
|
44
|
+
|
|
45
|
+
console.log('Creating pull request with updated release notes...');
|
|
46
|
+
gitUtils.pullRequest(releaseNotesBranchName, rcBranchName, prTitle);
|
|
47
|
+
|
|
48
|
+
console.log('Done! Pull request has been created!');
|
|
49
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
|
|
3
|
+
const executeSync = (cmd) => execSync(cmd, { stdio: 'inherit' });
|
|
4
|
+
|
|
5
|
+
const deleteSourceMaps = (c) => {
|
|
6
|
+
const { platformBuildsDir } = c.buildConfig.paths;
|
|
7
|
+
executeSync(`find ${platformBuildsDir} -type f -iname "*.map" -delete`);
|
|
8
|
+
|
|
9
|
+
console.log('Source Maps deleted...');
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
deleteSourceMaps,
|
|
14
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import { getConfigProp } from 'rnv/dist/core/common';
|
|
4
|
+
import { getZippedPlatformBuildsFilePath } from '../../utils/zipBuildsByPlatforms';
|
|
5
|
+
import { getUrlsMarkdown } from './urlsMarkdown';
|
|
6
|
+
|
|
7
|
+
const appCenterRelease = (params) => {
|
|
8
|
+
const {
|
|
9
|
+
filePath, releaseNotesPath, buildVersion, token, projectName,
|
|
10
|
+
group = 'Collaborators', organizationName = '24i-Media',
|
|
11
|
+
} = params;
|
|
12
|
+
const app = `${organizationName}/${projectName}`;
|
|
13
|
+
|
|
14
|
+
execSync(
|
|
15
|
+
'appcenter distribute release '
|
|
16
|
+
+ `--file "${filePath}" `
|
|
17
|
+
+ `--release-notes-file "${releaseNotesPath}" `
|
|
18
|
+
+ `--build-version "${buildVersion}" `
|
|
19
|
+
+ `--app "${app}" `
|
|
20
|
+
+ `--token "${token}" `
|
|
21
|
+
+ `--group "${group}" `
|
|
22
|
+
+ '--disable-telemetry',
|
|
23
|
+
{ stdio: 'inherit' },
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const getAppCenterConfigByPlatformName = (c, platformName) => {
|
|
28
|
+
try {
|
|
29
|
+
return c.buildConfig.platforms[platformName].deploy.appCenter || null;
|
|
30
|
+
} catch (error) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const getTokenByPlatform = (platformName = '') => {
|
|
36
|
+
const envVariableName = `APPCENTER_TOKEN_${platformName.toUpperCase()}`;
|
|
37
|
+
return process.env[envVariableName] || '';
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const processPlatform = (c, platformName) => {
|
|
41
|
+
const appCenterConfig = getAppCenterConfigByPlatformName(c, platformName);
|
|
42
|
+
if (!appCenterConfig) return;
|
|
43
|
+
|
|
44
|
+
const { appName } = appCenterConfig;
|
|
45
|
+
|
|
46
|
+
const token = getTokenByPlatform(platformName);
|
|
47
|
+
const zipPath = getZippedPlatformBuildsFilePath(c, platformName);
|
|
48
|
+
const buildVersion = getConfigProp(c, platformName, 'packageVersion', '');
|
|
49
|
+
const releaseNotesPath = getConfigProp(c, platformName, 'releaseNotes', {}).relativePath || '';
|
|
50
|
+
|
|
51
|
+
if (!appName || !token || !releaseNotesPath || !zipPath || !buildVersion) return;
|
|
52
|
+
|
|
53
|
+
const tempReleaseNotesPath = `RELEASE_NOTES_APPCENTER_${platformName.toUpperCase()}.md`;
|
|
54
|
+
if (fs.existsSync(tempReleaseNotesPath)) {
|
|
55
|
+
fs.unlinkSync(tempReleaseNotesPath);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
execSync(`cat ${releaseNotesPath} >> ${tempReleaseNotesPath}`);
|
|
59
|
+
const urlsMarkdown = getUrlsMarkdown(c, [platformName]);
|
|
60
|
+
execSync(`echo "${urlsMarkdown}" >> ${tempReleaseNotesPath}`);
|
|
61
|
+
|
|
62
|
+
console.log(`Deploying ${platformName} platform to AppCenter.ms...`);
|
|
63
|
+
appCenterRelease({
|
|
64
|
+
projectName: appName,
|
|
65
|
+
buildVersion,
|
|
66
|
+
filePath: zipPath,
|
|
67
|
+
releaseNotesPath: tempReleaseNotesPath,
|
|
68
|
+
token,
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const deployToAppCenter = (c) => {
|
|
73
|
+
const { supportedPlatforms = [] } = c.buildConfig.defaults || {};
|
|
74
|
+
supportedPlatforms.forEach((platformName) => processPlatform(c, platformName));
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export {
|
|
78
|
+
deployToAppCenter,
|
|
79
|
+
};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import { strict } from 'assert';
|
|
4
|
+
import { basename } from 'path';
|
|
5
|
+
import { getZippedPlatformBuildsFilePath } from '../../utils/zipBuildsByPlatforms';
|
|
6
|
+
import { getUrlsMarkdown } from './urlsMarkdown';
|
|
7
|
+
|
|
8
|
+
const { ok } = strict;
|
|
9
|
+
|
|
10
|
+
const token = process.env.GITHUB_TOKEN;
|
|
11
|
+
const targetCommit = process.env.TRAVIS_COMMIT;
|
|
12
|
+
|
|
13
|
+
const githubContentType = 'application/vnd.github.v3+json';
|
|
14
|
+
const githubReleaseNotesPath = 'RELEASE_NOTES_GITHUB.md';
|
|
15
|
+
|
|
16
|
+
const handleResponseErrors = (response) => {
|
|
17
|
+
const { errors, message } = response;
|
|
18
|
+
|
|
19
|
+
if (message && !errors) throw new Error(`GitHub error: ${message}`);
|
|
20
|
+
if (!errors) return;
|
|
21
|
+
|
|
22
|
+
const makeErrorDetailString = (error = {}) => Object
|
|
23
|
+
.keys(error)
|
|
24
|
+
.map((key) => `${key}: "${error[key]}"`)
|
|
25
|
+
.join(', ');
|
|
26
|
+
|
|
27
|
+
const errorsDetails = errors.map(makeErrorDetailString);
|
|
28
|
+
throw new Error(`GitHub error: ${message || ''}\n${errorsDetails.join('\n')}`);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const getReleaseNotesPath = (c) => {
|
|
32
|
+
try {
|
|
33
|
+
return c.buildConfig.common.releaseNotes.relativePath || '';
|
|
34
|
+
} catch (error) {
|
|
35
|
+
return '';
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const deleteFileIfExists = (filePath) => {
|
|
40
|
+
if (fs.existsSync(filePath)) {
|
|
41
|
+
fs.unlinkSync(filePath);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const makeGitHubReleaseNotes = (c) => {
|
|
46
|
+
const releaseNotesPath = getReleaseNotesPath(c);
|
|
47
|
+
ok(releaseNotesPath, 'The path to the file with release notes is missing!');
|
|
48
|
+
|
|
49
|
+
deleteFileIfExists(githubReleaseNotesPath);
|
|
50
|
+
// copy without first two lines
|
|
51
|
+
execSync(`sed '1d;2d' ${releaseNotesPath} >> ${githubReleaseNotesPath}`);
|
|
52
|
+
const textToAppend = getUrlsMarkdown(c);
|
|
53
|
+
execSync(`echo "${textToAppend}" >> ${githubReleaseNotesPath}`);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const createRelease = (c) => {
|
|
57
|
+
const { packageVersion, git = {} } = c.buildConfig.common;
|
|
58
|
+
const versionLabel = `v${packageVersion}`;
|
|
59
|
+
|
|
60
|
+
ok(token, 'process.env.GITHUB_TOKEN is not set!');
|
|
61
|
+
ok(targetCommit, 'process.env.TRAVIS_COMMIT is not set!');
|
|
62
|
+
ok(git.owner, 'Missing value for rnv config prop: common.git.owner');
|
|
63
|
+
ok(git.repo, 'Missing value for rnv config prop: common.git.repo');
|
|
64
|
+
ok(packageVersion);
|
|
65
|
+
|
|
66
|
+
makeGitHubReleaseNotes(c);
|
|
67
|
+
const releaseNotesContent = fs.readFileSync(githubReleaseNotesPath).toString();
|
|
68
|
+
|
|
69
|
+
const data = {
|
|
70
|
+
tag_name: versionLabel,
|
|
71
|
+
target_commitish: targetCommit,
|
|
72
|
+
name: versionLabel,
|
|
73
|
+
body: releaseNotesContent,
|
|
74
|
+
draft: false,
|
|
75
|
+
prerelease: false,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const url = `https://api.github.com/repos/${git.owner}/${git.repo}/releases`;
|
|
79
|
+
const headers = `-H "Accept: ${githubContentType}" -H "Authorization: token ${token}"`;
|
|
80
|
+
const dataStringWithFixedSingleQuotes = JSON.stringify(data).replace(/'/g, "'\\''");
|
|
81
|
+
const cmd = `curl -X POST ${headers} ${url} -d '${dataStringWithFixedSingleQuotes}'`;
|
|
82
|
+
|
|
83
|
+
console.log(`Pushing GitHub Release: ${versionLabel}...`);
|
|
84
|
+
const responseString = execSync(cmd, { stdio: 'pipe' }).toString();
|
|
85
|
+
const response = JSON.parse(responseString);
|
|
86
|
+
handleResponseErrors(response);
|
|
87
|
+
console.log('Pushing done.');
|
|
88
|
+
|
|
89
|
+
return response;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const getFileMimeType = (filepath) => {
|
|
93
|
+
const cmd = `file --mime-type -b ${filepath}`;
|
|
94
|
+
return execSync(cmd, { stdio: 'pipe' })
|
|
95
|
+
.toString()
|
|
96
|
+
.replace(/\r?\n/, '');
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const uploadAsset = (uploadUrl = '', filePath) => {
|
|
100
|
+
if (!uploadUrl) return null;
|
|
101
|
+
const url = `${uploadUrl.replace('{?name,label}', '')}`;
|
|
102
|
+
// eslint-disable-next-line max-len
|
|
103
|
+
const headers = `-H "Accept: ${githubContentType}" -H "Authorization: token ${token}" -H "content-type: ${getFileMimeType(filePath)}" -H "content-length: ${fs.statSync(filePath).size}"`;
|
|
104
|
+
const cmd = `curl --data-binary @"${filePath}" ${headers} ${url}?name=${basename(filePath)}`;
|
|
105
|
+
|
|
106
|
+
console.log(`Uploading ${filePath} asset to created GitHub Release...`);
|
|
107
|
+
const responseString = execSync(cmd, { stdio: 'pipe' }).toString();
|
|
108
|
+
const uploadResponse = JSON.parse(responseString);
|
|
109
|
+
handleResponseErrors(uploadResponse);
|
|
110
|
+
console.log('Uploading done.');
|
|
111
|
+
|
|
112
|
+
return uploadResponse;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const uploadZipWithPlatformBuilds = (c, platformName, githubUploadUrl) => {
|
|
116
|
+
const zipFilePath = getZippedPlatformBuildsFilePath(c, platformName);
|
|
117
|
+
|
|
118
|
+
if (zipFilePath) {
|
|
119
|
+
uploadAsset(githubUploadUrl, zipFilePath);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const githubRelease = (c) => {
|
|
124
|
+
const releaseResponse = createRelease(c) || {};
|
|
125
|
+
const uploadUrl = releaseResponse.upload_url;
|
|
126
|
+
ok(uploadUrl, 'Missing "upload_url" in release response!');
|
|
127
|
+
|
|
128
|
+
const { defaults = {} } = c.buildConfig;
|
|
129
|
+
const { supportedPlatforms = [] } = defaults;
|
|
130
|
+
|
|
131
|
+
supportedPlatforms.forEach((platformName) => {
|
|
132
|
+
uploadZipWithPlatformBuilds(c, platformName, uploadUrl);
|
|
133
|
+
});
|
|
134
|
+
deleteFileIfExists(githubReleaseNotesPath);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export {
|
|
138
|
+
githubRelease,
|
|
139
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Section, Actions, Divider, Context } from './slackBlockKitBuilder';
|
|
2
|
+
import { getDeployLocations } from '../../../utils/getDeployLocations';
|
|
3
|
+
|
|
4
|
+
const getVersionsObject = (c) => {
|
|
5
|
+
const { versions = [] } = getDeployLocations(c) || {};
|
|
6
|
+
return versions;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const getVersion = (c) => Object.keys(getVersionsObject(c))[0] || '';
|
|
10
|
+
|
|
11
|
+
const getPlatformsObject = (c) => {
|
|
12
|
+
const version = getVersion(c);
|
|
13
|
+
const { platforms = {} } = getVersionsObject(c)[version] || {};
|
|
14
|
+
return platforms;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const getCommonAppName = (c) => {
|
|
18
|
+
try { return c.buildConfig.common.appName; } catch (error) { return ''; }
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const makeFlavoursMarkdown = (platformName, entries) => entries
|
|
22
|
+
.map(([flavour, flavourData]) => {
|
|
23
|
+
const { indexUrl, packageUrl } = flavourData;
|
|
24
|
+
return `- *${flavour}* [<${packageUrl}|Download>] [<${indexUrl}|Open deployed index.html>]`;
|
|
25
|
+
})
|
|
26
|
+
.join('\n');
|
|
27
|
+
|
|
28
|
+
const makePackagePayload = (c, platformName) => {
|
|
29
|
+
const platformData = getPlatformsObject(c)[platformName];
|
|
30
|
+
const flavoursEntries = Object.entries(platformData);
|
|
31
|
+
|
|
32
|
+
return [
|
|
33
|
+
Divider.plain(),
|
|
34
|
+
Context.mrkdwns([`Platform: *${platformName}*`]),
|
|
35
|
+
Context.mrkdwns([makeFlavoursMarkdown(platformName, flavoursEntries)]),
|
|
36
|
+
];
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const makePackagesPayload = (c) => {
|
|
40
|
+
const platformList = Object.keys(getPlatformsObject(c));
|
|
41
|
+
return platformList
|
|
42
|
+
.map((platformName) => makePackagePayload(c, platformName))
|
|
43
|
+
.flat();
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const makeHeaderPayload = (c, { title = '', buttons }) => {
|
|
47
|
+
const { travisBuild, gitHubRelease } = buttons || {};
|
|
48
|
+
const { owner, repo } = c.buildConfig.common.git || {};
|
|
49
|
+
const version = getVersion(c);
|
|
50
|
+
|
|
51
|
+
return [
|
|
52
|
+
Divider.plain(),
|
|
53
|
+
Section.mrkdwn(title),
|
|
54
|
+
Context.mrkdwns([`Version: *${version}*`]),
|
|
55
|
+
Actions.buttons([
|
|
56
|
+
travisBuild ? {
|
|
57
|
+
text: 'View Travis Build Log',
|
|
58
|
+
// eslint-disable-next-line max-len
|
|
59
|
+
url: process.env.TRAVIS_BUILD_WEB_URL || `https://travis-ci.com/github/${owner}/${repo}/branches`,
|
|
60
|
+
} : null,
|
|
61
|
+
gitHubRelease ? {
|
|
62
|
+
text: 'View GitHub Release',
|
|
63
|
+
url: `https://github.com/${owner}/${repo}/releases/tag/${version}`,
|
|
64
|
+
} : null,
|
|
65
|
+
].filter(Boolean)),
|
|
66
|
+
];
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const makePayload = (c, title, buttons) => ({
|
|
70
|
+
blocks: [
|
|
71
|
+
...makeHeaderPayload(c, { title, buttons }),
|
|
72
|
+
...makePackagesPayload(c),
|
|
73
|
+
],
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const makeDevelopmentPayload = (c) => {
|
|
77
|
+
const title = `There are new *development* builds for *${getCommonAppName(c)}* app!`;
|
|
78
|
+
const buttons = { travisBuild: true };
|
|
79
|
+
return makePayload(c, title, buttons);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const makeReleaseCandidatePayload = (c) => {
|
|
83
|
+
const title = `There are new *release candidate* builds for *${getCommonAppName(c)}* app!`;
|
|
84
|
+
const buttons = { travisBuild: true };
|
|
85
|
+
return makePayload(c, title, buttons);
|
|
86
|
+
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const makeDistributionPayload = (c) => {
|
|
90
|
+
const title = `There are new *distribution* builds for *${getCommonAppName(c)}* app!`;
|
|
91
|
+
const buttons = { travisBuild: true, gitHubRelease: true };
|
|
92
|
+
return makePayload(c, title, buttons);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export {
|
|
96
|
+
makeDevelopmentPayload,
|
|
97
|
+
makeReleaseCandidatePayload,
|
|
98
|
+
makeDistributionPayload,
|
|
99
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import * as payload from './makePayload';
|
|
3
|
+
|
|
4
|
+
const getPayload = (c) => {
|
|
5
|
+
const releaseType = c.runtime.scheme;
|
|
6
|
+
|
|
7
|
+
switch (releaseType) {
|
|
8
|
+
case 'dev:latest': return payload.makeDevelopmentPayload(c);
|
|
9
|
+
case 'rc:latest': return payload.makeReleaseCandidatePayload(c);
|
|
10
|
+
case 'release:dist': return payload.makeDistributionPayload(c);
|
|
11
|
+
default: throw new Error(
|
|
12
|
+
'Notify Slack: unsupported or undefined release type! Did you pass it as an argument?',
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const notifySlack = (c) => {
|
|
18
|
+
const contentType = '"Content-type: application/json"';
|
|
19
|
+
const data = `--data '${JSON.stringify(getPayload(c))}'`;
|
|
20
|
+
const webHookUrl = c.buildConfig?.common?.deploy?.slack?.webhookUrl || '';
|
|
21
|
+
|
|
22
|
+
const cmd = `curl -X POST -H ${contentType} ${data} ${webHookUrl}`;
|
|
23
|
+
execSync(cmd, { stdio: 'inherit' });
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
notifySlack,
|
|
28
|
+
};
|