@24i/smartapps-bigscreen-rnv-build-engine 0.0.2-alpha.1331 → 0.0.2-alpha.1333
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/constants/buildSchemes.js +3 -3
- package/dist/src/constants/index.js +3 -10
- package/dist/src/constants/platforms.js +3 -3
- package/dist/src/index.js +29 -31
- package/dist/src/resolvers/index.js +10 -17
- package/dist/src/resolvers/resolveBaseUrl.js +14 -15
- package/dist/src/resolvers/resolveBuildVersion.js +16 -17
- package/dist/src/resolvers/resolveBuildVersionOffset.js +12 -12
- package/dist/src/resolvers/resolveDeployLocations.js +44 -56
- package/dist/src/resolvers/resolveGenericRnvConfig.js +18 -30
- package/dist/src/resolvers/resolveHbbtvDeployConfig.js +4 -4
- package/dist/src/resolvers/resolveHbbtvDeployUrl.js +7 -7
- package/dist/src/resolvers/resolveHbbtvRemoteBuildDirRelativePath.js +12 -12
- package/dist/src/resolvers/resolveZippedPlatformBuildsRelativeFilePath.js +11 -11
- package/dist/src/scripts/buildAllWithScheme.js +14 -14
- package/dist/src/scripts/gitReleaser/afterVersionBump.js +10 -10
- package/dist/src/scripts/gitReleaser/beforeVersionBump.js +7 -7
- package/dist/src/scripts/gitReleaser/checkReleaseNotes.js +9 -9
- package/dist/src/scripts/gitReleaser/pushRelease.js +17 -17
- package/dist/src/scripts/gitReleaser/pushReleaseCandidate.js +4 -4
- package/dist/src/scripts/gitReleaser/pushReleaseNotes.js +16 -16
- package/dist/src/scripts/release/deleteSourceMaps.js +6 -6
- package/dist/src/scripts/release/deployToAppCenter.js +37 -38
- package/dist/src/scripts/release/githubRelease.js +60 -64
- package/dist/src/scripts/release/notifySlack/makePayload.js +44 -48
- package/dist/src/scripts/release/notifySlack/notifySlack.js +10 -10
- package/dist/src/scripts/release/notifySlack/slackBlockKitBuilder.js +25 -28
- package/dist/src/scripts/release/sentryRelease.js +34 -34
- package/dist/src/scripts/release/urlsMarkdown.js +23 -25
- package/dist/src/scripts/releaseAllWithScheme.js +26 -26
- package/dist/src/scripts/utils/cmdUtils.js +9 -9
- package/dist/src/scripts/utils/fsUtils.js +7 -7
- package/dist/src/scripts/utils/gitUtils.js +50 -50
- package/dist/src/scripts/utils/index.js +8 -8
- package/dist/src/scripts/utils/stringUtils.js +2 -5
- package/dist/src/sdks/index.js +15 -54
- package/dist/src/sdks/sdk-tizen/index.js +154 -254
- package/dist/src/sdks/sdk-webos/index.js +136 -231
- package/dist/src/sdks/sdk-webpack/index.js +20 -69
- package/dist/src/sdks/sdkUtils.js +14 -59
- package/dist/src/tasks/deploy/aswS3/aws.js +9 -9
- package/dist/src/tasks/deploy/aswS3/deployS3.js +44 -83
- package/dist/src/tasks/deploy/hbbtv/deployHbbtv.js +70 -139
- package/dist/src/tasks/engineTasks.js +10 -10
- package/dist/src/tasks/task.rnv.build.js +75 -132
- package/dist/src/tasks/task.rnv.configure.js +39 -88
- package/dist/src/tasks/task.rnv.configureSoft.js +22 -75
- package/dist/src/tasks/task.rnv.deploy.js +28 -78
- package/dist/src/tasks/task.rnv.hooks.run.js +42 -92
- package/dist/src/tasks/task.rnv.package.js +18 -61
- package/dist/src/tasks/task.rnv.project.configure.js +80 -183
- package/dist/src/tasks/task.rnv.start.js +42 -87
- package/dist/src/types/c.js +1 -1
- package/dist/src/types/index.js +1 -1
- package/dist/src/utils/forEachSupportedPlatformFlavour.js +12 -12
- package/dist/src/utils/replaceRelevantStringsInConfig/index.js +2 -9
- package/dist/src/utils/replaceRelevantStringsInConfig/replaceRelevantStringsInConfig.js +10 -11
- package/dist/src/utils/replaceRelevantStringsInConfig/replaceTemplateString.js +23 -29
- package/dist/src/utils/zipBuildsByPlatforms.js +25 -25
- package/dist/templates/platforms/_shared/template.js +56 -41
- package/dist/templates/platforms/_shared/webpack.base.js +119 -139
- package/dist/templates/platforms/entone/webpack.config.dev.js +27 -22
- package/dist/templates/platforms/entone/webpack.config.prod.js +21 -20
- package/dist/templates/platforms/hbbtv/webpack.config.dev.js +42 -24
- package/dist/templates/platforms/hbbtv/webpack.config.prod.js +36 -22
- package/dist/templates/platforms/tizen/webpack.config.dev.js +28 -22
- package/dist/templates/platforms/tizen/webpack.config.prod.js +21 -20
- package/dist/templates/platforms/webos/webpack.config.dev.js +31 -24
- package/dist/templates/platforms/webos/webpack.config.prod.js +23 -22
- package/dist/templates/platforms/webtv/webpack.config.dev.js +27 -22
- package/dist/templates/platforms/webtv/webpack.config.prod.js +21 -20
- package/dist/types/src/scripts/release/notifySlack/makePayload.d.ts +9 -3
- package/package.json +3 -3
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveZippedPlatformBuildsRelativeFilePath = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return relativePathToDir
|
|
4
|
+
const common_1 = require("rnv/dist/core/common");
|
|
5
|
+
const resolveZippedPlatformBuildsRelativeFilePath = (c, platformName) => {
|
|
6
|
+
const { platformBuildsDir } = c.buildConfig.paths;
|
|
7
|
+
const appNameInFileName = common_1.getConfigProp(c, platformName, 'appNameInFileName', '');
|
|
8
|
+
const buildVersion = common_1.getConfigProp(c, platformName, 'packageVersion', '');
|
|
9
|
+
const zippedFilesParentDir = 'zipped_by_platform';
|
|
10
|
+
const fileExtension = 'zip';
|
|
11
|
+
const relativePathToDir = `${platformBuildsDir}/${zippedFilesParentDir}`;
|
|
12
|
+
const zipFileName = `${appNameInFileName}_${platformName}_${buildVersion}.${fileExtension}`;
|
|
13
|
+
return `${relativePathToDir}/${zipFileName}`;
|
|
14
14
|
};
|
|
15
15
|
exports.resolveZippedPlatformBuildsRelativeFilePath = resolveZippedPlatformBuildsRelativeFilePath;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const child_process_1 = require("child_process");
|
|
4
|
+
const forEachSupportedPlatformFlavour_1 = require("../utils/forEachSupportedPlatformFlavour");
|
|
5
|
+
const resolvers_1 = require("../resolvers");
|
|
6
|
+
const buildTask = (options) => {
|
|
7
|
+
const { scheme, platform, flavour } = options;
|
|
8
|
+
const cmd = `npx rnv build -s ${scheme} -p ${platform} -c ${flavour} --ci`;
|
|
9
9
|
child_process_1.execSync(cmd, { stdio: 'inherit' });
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const buildAllWithScheme = () => {
|
|
12
|
+
const scheme = process.argv[2];
|
|
13
13
|
if (!scheme) {
|
|
14
14
|
throw new Error('No scheme name to use found! Please use rnv scheme name as a param.');
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
const c = resolvers_1.getBaseConfig();
|
|
17
17
|
c.runtime.scheme = scheme;
|
|
18
18
|
forEachSupportedPlatformFlavour_1.forEachSupportedPlatformFlavour(c, buildTask);
|
|
19
19
|
return true;
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
const startTimestamp = Date.now();
|
|
22
22
|
buildAllWithScheme();
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
console.log(
|
|
23
|
+
const msPerSecond = 1000;
|
|
24
|
+
const scriptTotalTimeInSeconds = Math.ceil((Date.now() - startTimestamp) / msPerSecond);
|
|
25
|
+
console.log(`buildAllWithScheme: done in ${scriptTotalTimeInSeconds} second(s)!`);
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a, _b, _c;
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const resolvers_1 = require("../../resolvers");
|
|
5
|
+
const gitUtils_1 = require("../utils/gitUtils");
|
|
6
|
+
const c = resolvers_1.getBaseConfig();
|
|
7
|
+
const { branchNames = {}, commitTitles = {} } = ((_b = (_a = c.buildConfig) === null || _a === void 0 ? void 0 : _a.common) === null || _b === void 0 ? void 0 : _b.git) || {};
|
|
8
|
+
const { packageVersion = '' } = ((_c = c.buildConfig) === null || _c === void 0 ? void 0 : _c.common) || {};
|
|
9
|
+
const newReleaseBranchName = branchNames.rc;
|
|
10
10
|
gitUtils_1.createBranch(newReleaseBranchName);
|
|
11
11
|
gitUtils_1.checkout(newReleaseBranchName);
|
|
12
12
|
gitUtils_1.addAll();
|
|
13
|
-
|
|
13
|
+
const withNoVerifyFlag = true;
|
|
14
14
|
console.log('Creating commit with changed version...');
|
|
15
15
|
gitUtils_1.commit(commitTitles.versionBump, withNoVerifyFlag);
|
|
16
|
-
console.log(
|
|
16
|
+
console.log(`Pushing ${newReleaseBranchName} branch...`);
|
|
17
17
|
gitUtils_1.push(newReleaseBranchName, withNoVerifyFlag);
|
|
18
|
-
console.log(
|
|
18
|
+
console.log(`\nDone! The version has been bumped to ${packageVersion} and ${newReleaseBranchName} branch pushed into the remote repository.`);
|
|
19
19
|
console.log('Note: Do not forget to update release notes for upcoming release!');
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a, _b;
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const assert_1 = require("assert");
|
|
5
|
+
const resolvers_1 = require("../../resolvers");
|
|
6
|
+
const gitUtils_1 = require("../utils/gitUtils");
|
|
7
|
+
const { ok } = assert_1.strict;
|
|
8
|
+
const c = resolvers_1.getBaseConfig();
|
|
9
|
+
const { branchNames = {}, commitTitles = {} } = ((_b = (_a = c.buildConfig) === null || _a === void 0 ? void 0 : _a.common) === null || _b === void 0 ? void 0 : _b.git) || {};
|
|
10
10
|
ok(branchNames.dev);
|
|
11
11
|
ok(branchNames.rc);
|
|
12
12
|
ok(commitTitles.versionBump);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.checkReleaseNotes = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const assert_1 = require("assert");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const { ok } = assert_1.strict;
|
|
7
|
+
const checkReleaseNotes = (c) => {
|
|
8
8
|
var _a, _b;
|
|
9
|
-
|
|
9
|
+
const { relativePath, requiredRows = [] } = ((_b = (_a = c.buildConfig) === null || _a === void 0 ? void 0 : _a.common) === null || _b === void 0 ? void 0 : _b.releaseNotes) || {};
|
|
10
10
|
utils_1.fsUtils.assertPath(relativePath);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const fileContent = utils_1.fsUtils.getFileContentAsString(relativePath);
|
|
12
|
+
const assertFileContentRow = (expectedRowContent) => {
|
|
13
|
+
const errorMsg = `${relativePath} should contain following row: "${expectedRowContent}"`;
|
|
14
14
|
ok(fileContent.includes(expectedRowContent), errorMsg);
|
|
15
15
|
};
|
|
16
16
|
requiredRows.forEach(assertFileContentRow);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a, _b;
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const assert_1 = require("assert");
|
|
5
|
+
const resolvers_1 = require("../../resolvers");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
|
+
const checkReleaseNotes_1 = require("./checkReleaseNotes");
|
|
8
|
+
const { ok } = assert_1.strict;
|
|
9
|
+
const c = resolvers_1.getBaseConfig();
|
|
10
|
+
const { branchNames = {}, pullRequestTitles } = ((_b = (_a = c.buildConfig) === null || _a === void 0 ? void 0 : _a.common) === null || _b === void 0 ? void 0 : _b.git) || {};
|
|
11
|
+
const rcBranchName = branchNames.rc;
|
|
12
|
+
const distBranchName = branchNames.dist;
|
|
13
|
+
const devBranchName = branchNames.dev;
|
|
14
14
|
ok(rcBranchName);
|
|
15
15
|
ok(distBranchName);
|
|
16
16
|
ok(devBranchName);
|
|
@@ -18,16 +18,16 @@ utils_1.gitUtils.assertCurrentBranch(rcBranchName);
|
|
|
18
18
|
utils_1.gitUtils.assertEmptyStatusList();
|
|
19
19
|
utils_1.gitUtils.assertRemoteBranch(rcBranchName);
|
|
20
20
|
utils_1.gitUtils.assertRemoteBranch(distBranchName);
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const distributionPrTitle = pullRequestTitles.rcToDist;
|
|
22
|
+
const developmentPrTitle = pullRequestTitles.rcToDev;
|
|
23
23
|
ok(distributionPrTitle);
|
|
24
24
|
ok(developmentPrTitle);
|
|
25
25
|
utils_1.gitUtils.pull();
|
|
26
26
|
checkReleaseNotes_1.checkReleaseNotes(c);
|
|
27
|
-
console.log(
|
|
28
|
-
console.log(
|
|
27
|
+
console.log(`Creating Pull Request from ${rcBranchName} branch to ${distBranchName} branch...`);
|
|
28
|
+
console.log(`Applied PR title: "${distributionPrTitle}"`);
|
|
29
29
|
utils_1.gitUtils.pullRequest(rcBranchName, distBranchName, distributionPrTitle);
|
|
30
|
-
console.log(
|
|
31
|
-
console.log(
|
|
30
|
+
console.log(`\nCreating Pull Request from ${rcBranchName} branch to ${devBranchName} branch...`);
|
|
31
|
+
console.log(`Applied PR title: "${developmentPrTitle}"`);
|
|
32
32
|
utils_1.gitUtils.pullRequest(rcBranchName, devBranchName, developmentPrTitle);
|
|
33
33
|
console.log('\nDone! Pull requests have been created!');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
3
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const child_process_1 = require("child_process");
|
|
4
4
|
console.log('Bumping the version...');
|
|
5
|
-
|
|
6
|
-
child_process_1.execSync(
|
|
5
|
+
const bumpType = process.argv[2] || 'patch';
|
|
6
|
+
child_process_1.execSync(`npm --no-git-tag-version version ${bumpType}`, { stdio: 'inherit' });
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a, _b, _c, _d;
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const assert_1 = require("assert");
|
|
5
|
+
const resolvers_1 = require("../../resolvers");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
|
+
const checkReleaseNotes_1 = require("./checkReleaseNotes");
|
|
8
|
+
const { ok } = assert_1.strict;
|
|
9
|
+
const c = resolvers_1.getBaseConfig();
|
|
10
|
+
const { branchNames = {}, commitTitles = {}, pullRequestTitles = {}, } = ((_b = (_a = c.buildConfig) === null || _a === void 0 ? void 0 : _a.common) === null || _b === void 0 ? void 0 : _b.git) || {};
|
|
11
|
+
const { relativePath = [] } = ((_d = (_c = c.buildConfig) === null || _c === void 0 ? void 0 : _c.common) === null || _d === void 0 ? void 0 : _d.releaseNotes) || {};
|
|
12
|
+
const rcBranchName = branchNames.rc;
|
|
13
|
+
const releaseNotesBranchName = branchNames.rcReleaseNotes;
|
|
14
|
+
const commitTitle = commitTitles.rcReleaseNotes;
|
|
15
|
+
const prTitle = pullRequestTitles.releaseNotesToRc;
|
|
16
16
|
ok(relativePath);
|
|
17
17
|
ok(releaseNotesBranchName);
|
|
18
18
|
ok(commitTitle);
|
|
@@ -21,13 +21,13 @@ utils_1.gitUtils.assertCurrentBranch(rcBranchName);
|
|
|
21
21
|
utils_1.gitUtils.assertRemoteBranch(rcBranchName);
|
|
22
22
|
checkReleaseNotes_1.checkReleaseNotes(c);
|
|
23
23
|
utils_1.gitUtils.pull();
|
|
24
|
-
|
|
24
|
+
const changedFilesCount = utils_1.gitUtils.statusList().length;
|
|
25
25
|
if (changedFilesCount === 0) {
|
|
26
|
-
console.log(
|
|
26
|
+
console.log(`It seems ${relativePath} file has been updated before.`);
|
|
27
27
|
console.log('Skipping making a commit, if needed, please continue on your own (manually).');
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
30
|
-
ok(changedFilesCount === 1,
|
|
30
|
+
ok(changedFilesCount === 1, `Only ${relativePath} should contain changes!`);
|
|
31
31
|
utils_1.gitUtils.createBranch(releaseNotesBranchName);
|
|
32
32
|
utils_1.gitUtils.checkout(releaseNotesBranchName);
|
|
33
33
|
utils_1.gitUtils.add([relativePath]);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deleteSourceMaps = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
executeSync(
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const executeSync = (cmd) => child_process_1.execSync(cmd, { stdio: 'inherit' });
|
|
6
|
+
const deleteSourceMaps = (c) => {
|
|
7
|
+
const { platformBuildsDir } = c.buildConfig.paths;
|
|
8
|
+
executeSync(`find ${platformBuildsDir} -type f -iname "*.map" -delete`);
|
|
9
9
|
console.log('Source Maps deleted...');
|
|
10
10
|
};
|
|
11
11
|
exports.deleteSourceMaps = deleteSourceMaps;
|
|
@@ -2,26 +2,26 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.deployToAppCenter = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const common_1 = require("rnv/dist/core/common");
|
|
10
|
+
const resolvers_1 = require("../../resolvers");
|
|
11
|
+
const urlsMarkdown_1 = require("./urlsMarkdown");
|
|
12
|
+
const appCenterRelease = (params) => {
|
|
13
|
+
const { filePath, releaseNotesPath, buildVersion, token, projectName, group = 'Collaborators', organizationName = '24i-Media', } = params;
|
|
14
|
+
const app = `${organizationName}/${projectName}`;
|
|
15
15
|
child_process_1.execSync('appcenter distribute release '
|
|
16
|
-
+
|
|
17
|
-
+
|
|
18
|
-
+
|
|
19
|
-
+
|
|
20
|
-
+
|
|
21
|
-
+
|
|
16
|
+
+ `--file "${filePath}" `
|
|
17
|
+
+ `--release-notes-file "${releaseNotesPath}" `
|
|
18
|
+
+ `--build-version "${buildVersion}" `
|
|
19
|
+
+ `--app "${app}" `
|
|
20
|
+
+ `--token "${token}" `
|
|
21
|
+
+ `--group "${group}" `
|
|
22
22
|
+ '--disable-telemetry', { stdio: 'inherit' });
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
const getAppCenterConfigByPlatformName = (c, platformName) => {
|
|
25
25
|
try {
|
|
26
26
|
return c.buildConfig.platforms[platformName].deploy.appCenter || null;
|
|
27
27
|
}
|
|
@@ -29,40 +29,39 @@ var getAppCenterConfigByPlatformName = function (c, platformName) {
|
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var envVariableName = "APPCENTER_TOKEN_" + platformName.toUpperCase();
|
|
32
|
+
const getTokenByPlatform = (platformName = '') => {
|
|
33
|
+
const envVariableName = `APPCENTER_TOKEN_${platformName.toUpperCase()}`;
|
|
35
34
|
return process.env[envVariableName] || '';
|
|
36
35
|
};
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
const processPlatform = (c, platformName) => {
|
|
37
|
+
const appCenterConfig = getAppCenterConfigByPlatformName(c, platformName);
|
|
39
38
|
if (!appCenterConfig)
|
|
40
39
|
return;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
const { appName } = appCenterConfig;
|
|
41
|
+
const token = getTokenByPlatform(platformName);
|
|
42
|
+
const zipPath = resolvers_1.resolveZippedPlatformBuildsRelativeFilePath(c, platformName);
|
|
43
|
+
const buildVersion = common_1.getConfigProp(c, platformName, 'packageVersion', '');
|
|
44
|
+
const releaseNotesPath = common_1.getConfigProp(c, platformName, 'releaseNotes', {}).relativePath || '';
|
|
46
45
|
if (!appName || !token || !releaseNotesPath || !zipPath || !buildVersion)
|
|
47
46
|
return;
|
|
48
|
-
|
|
49
|
-
if (fs_1
|
|
50
|
-
fs_1
|
|
47
|
+
const tempReleaseNotesPath = `RELEASE_NOTES_APPCENTER_${platformName.toUpperCase()}.md`;
|
|
48
|
+
if (fs_1.default.existsSync(tempReleaseNotesPath)) {
|
|
49
|
+
fs_1.default.unlinkSync(tempReleaseNotesPath);
|
|
51
50
|
}
|
|
52
|
-
child_process_1.execSync(
|
|
53
|
-
|
|
54
|
-
child_process_1.execSync(
|
|
55
|
-
console.log(
|
|
51
|
+
child_process_1.execSync(`cat ${releaseNotesPath} >> ${tempReleaseNotesPath}`);
|
|
52
|
+
const urlsMarkdown = urlsMarkdown_1.getUrlsMarkdown(c, [platformName]);
|
|
53
|
+
child_process_1.execSync(`echo "${urlsMarkdown}" >> ${tempReleaseNotesPath}`);
|
|
54
|
+
console.log(`Deploying ${platformName} platform to AppCenter.ms...`);
|
|
56
55
|
appCenterRelease({
|
|
57
56
|
projectName: appName,
|
|
58
|
-
buildVersion
|
|
57
|
+
buildVersion,
|
|
59
58
|
filePath: zipPath,
|
|
60
59
|
releaseNotesPath: tempReleaseNotesPath,
|
|
61
|
-
token
|
|
60
|
+
token,
|
|
62
61
|
});
|
|
63
62
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
supportedPlatforms.forEach(
|
|
63
|
+
const deployToAppCenter = (c) => {
|
|
64
|
+
const { supportedPlatforms = [] } = c.buildConfig.defaults || {};
|
|
65
|
+
supportedPlatforms.forEach((platformName) => processPlatform(c, platformName));
|
|
67
66
|
};
|
|
68
67
|
exports.deployToAppCenter = deployToAppCenter;
|
|
@@ -2,36 +2,33 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.githubRelease = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const assert_1 = require("assert");
|
|
10
|
+
const path_1 = require("path");
|
|
11
|
+
const resolvers_1 = require("../../resolvers");
|
|
12
|
+
const urlsMarkdown_1 = require("./urlsMarkdown");
|
|
13
|
+
const { ok } = assert_1.strict;
|
|
14
|
+
const token = process.env.GITHUB_TOKEN;
|
|
15
|
+
const targetCommit = process.env.TRAVIS_COMMIT;
|
|
16
|
+
const githubContentType = 'application/vnd.github.v3+json';
|
|
17
|
+
const githubReleaseNotesPath = 'RELEASE_NOTES_GITHUB.md';
|
|
18
|
+
const handleResponseErrors = (response) => {
|
|
19
|
+
const { errors, message } = response;
|
|
20
20
|
if (message && !errors)
|
|
21
|
-
throw new Error(
|
|
21
|
+
throw new Error(`GitHub error: ${message}`);
|
|
22
22
|
if (!errors)
|
|
23
23
|
return;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
31
|
-
var errorsDetails = errors.map(makeErrorDetailString);
|
|
32
|
-
throw new Error("GitHub error: " + (message || '') + "\n" + errorsDetails.join('\n'));
|
|
24
|
+
const makeErrorDetailString = (error = {}) => Object
|
|
25
|
+
.keys(error)
|
|
26
|
+
.map((key) => `${key}: "${error[key]}"`)
|
|
27
|
+
.join(', ');
|
|
28
|
+
const errorsDetails = errors.map(makeErrorDetailString);
|
|
29
|
+
throw new Error(`GitHub error: ${message || ''}\n${errorsDetails.join('\n')}`);
|
|
33
30
|
};
|
|
34
|
-
|
|
31
|
+
const getReleaseNotesPath = (c) => {
|
|
35
32
|
try {
|
|
36
33
|
return c.buildConfig.common.releaseNotes.relativePath || '';
|
|
37
34
|
}
|
|
@@ -39,81 +36,80 @@ var getReleaseNotesPath = function (c) {
|
|
|
39
36
|
return '';
|
|
40
37
|
}
|
|
41
38
|
};
|
|
42
|
-
|
|
43
|
-
if (fs_1
|
|
44
|
-
fs_1
|
|
39
|
+
const deleteFileIfExists = (filePath) => {
|
|
40
|
+
if (fs_1.default.existsSync(filePath)) {
|
|
41
|
+
fs_1.default.unlinkSync(filePath);
|
|
45
42
|
}
|
|
46
43
|
};
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
const makeGitHubReleaseNotes = (c) => {
|
|
45
|
+
const releaseNotesPath = getReleaseNotesPath(c);
|
|
49
46
|
ok(releaseNotesPath, 'The path to the file with release notes is missing!');
|
|
50
47
|
deleteFileIfExists(githubReleaseNotesPath);
|
|
51
|
-
child_process_1.execSync(
|
|
52
|
-
|
|
53
|
-
child_process_1.execSync(
|
|
48
|
+
child_process_1.execSync(`sed '1d;2d' ${releaseNotesPath} >> ${githubReleaseNotesPath}`);
|
|
49
|
+
const textToAppend = urlsMarkdown_1.getUrlsMarkdown(c);
|
|
50
|
+
child_process_1.execSync(`echo "${textToAppend}" >> ${githubReleaseNotesPath}`);
|
|
54
51
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
const createRelease = (c) => {
|
|
53
|
+
const { packageVersion, git = {} } = c.buildConfig.common;
|
|
54
|
+
const versionLabel = `v${packageVersion}`;
|
|
58
55
|
ok(token, 'process.env.GITHUB_TOKEN is not set!');
|
|
59
56
|
ok(targetCommit, 'process.env.TRAVIS_COMMIT is not set!');
|
|
60
57
|
ok(git.owner, 'Missing value for rnv config prop: common.git.owner');
|
|
61
58
|
ok(git.repo, 'Missing value for rnv config prop: common.git.repo');
|
|
62
59
|
ok(packageVersion);
|
|
63
60
|
makeGitHubReleaseNotes(c);
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
const releaseNotesContent = fs_1.default.readFileSync(githubReleaseNotesPath).toString();
|
|
62
|
+
const data = {
|
|
66
63
|
tag_name: versionLabel,
|
|
67
64
|
target_commitish: targetCommit,
|
|
68
65
|
name: versionLabel,
|
|
69
66
|
body: releaseNotesContent,
|
|
70
67
|
draft: false,
|
|
71
|
-
prerelease: false
|
|
68
|
+
prerelease: false,
|
|
72
69
|
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
console.log(
|
|
78
|
-
|
|
79
|
-
|
|
70
|
+
const url = `https://api.github.com/repos/${git.owner}/${git.repo}/releases`;
|
|
71
|
+
const headers = `-H "Accept: ${githubContentType}" -H "Authorization: token ${token}"`;
|
|
72
|
+
const dataStringWithFixedSingleQuotes = JSON.stringify(data).replace(/'/g, "'\\''");
|
|
73
|
+
const cmd = `curl -X POST ${headers} ${url} -d '${dataStringWithFixedSingleQuotes}'`;
|
|
74
|
+
console.log(`Pushing GitHub Release: ${versionLabel}...`);
|
|
75
|
+
const responseString = child_process_1.execSync(cmd, { stdio: 'pipe' }).toString();
|
|
76
|
+
const response = JSON.parse(responseString);
|
|
80
77
|
handleResponseErrors(response);
|
|
81
78
|
console.log('Pushing done.');
|
|
82
79
|
return response;
|
|
83
80
|
};
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
const getFileMimeType = (filepath) => {
|
|
82
|
+
const cmd = `file --mime-type -b ${filepath}`;
|
|
86
83
|
return child_process_1.execSync(cmd, { stdio: 'pipe' })
|
|
87
84
|
.toString()
|
|
88
85
|
.replace(/\r?\n/, '');
|
|
89
86
|
};
|
|
90
|
-
|
|
91
|
-
if (uploadUrl === void 0) { uploadUrl = ''; }
|
|
87
|
+
const uploadAsset = (uploadUrl = '', filePath) => {
|
|
92
88
|
if (!uploadUrl)
|
|
93
89
|
return null;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
console.log(
|
|
98
|
-
|
|
99
|
-
|
|
90
|
+
const url = `${uploadUrl.replace('{?name,label}', '')}`;
|
|
91
|
+
const headers = `-H "Accept: ${githubContentType}" -H "Authorization: token ${token}" -H "content-type: ${getFileMimeType(filePath)}" -H "content-length: ${fs_1.default.statSync(filePath).size}"`;
|
|
92
|
+
const cmd = `curl --data-binary @"${filePath}" ${headers} ${url}?name=${path_1.basename(filePath)}`;
|
|
93
|
+
console.log(`Uploading ${filePath} asset to created GitHub Release...`);
|
|
94
|
+
const responseString = child_process_1.execSync(cmd, { stdio: 'pipe' }).toString();
|
|
95
|
+
const uploadResponse = JSON.parse(responseString);
|
|
100
96
|
handleResponseErrors(uploadResponse);
|
|
101
97
|
console.log('Uploading done.');
|
|
102
98
|
return uploadResponse;
|
|
103
99
|
};
|
|
104
|
-
|
|
105
|
-
|
|
100
|
+
const uploadZipWithPlatformBuilds = (c, platformName, githubUploadUrl) => {
|
|
101
|
+
const zipFilePath = resolvers_1.resolveZippedPlatformBuildsRelativeFilePath(c, platformName);
|
|
106
102
|
if (zipFilePath) {
|
|
107
103
|
uploadAsset(githubUploadUrl, zipFilePath);
|
|
108
104
|
}
|
|
109
105
|
};
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
106
|
+
const githubRelease = (c) => {
|
|
107
|
+
const releaseResponse = createRelease(c) || {};
|
|
108
|
+
const uploadUrl = releaseResponse.upload_url;
|
|
113
109
|
ok(uploadUrl, 'Missing "upload_url" in release response!');
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
supportedPlatforms.forEach(
|
|
110
|
+
const { defaults = {} } = c.buildConfig;
|
|
111
|
+
const { supportedPlatforms = [] } = defaults;
|
|
112
|
+
supportedPlatforms.forEach((platformName) => {
|
|
117
113
|
uploadZipWithPlatformBuilds(c, platformName, uploadUrl);
|
|
118
114
|
});
|
|
119
115
|
deleteFileIfExists(githubReleaseNotesPath);
|