@24i/smartapps-bigscreen-rnv-build-engine 0.17.26-alpha.2754 → 0.17.26
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/README.md +3 -3
- package/dist/src/resolvers/index.js +3 -1
- package/dist/src/resolvers/resolveZippedDirRelativePath.js +32 -0
- package/dist/src/scripts/buildProductionPackagesAll.js +5 -14
- package/dist/src/scripts/release/productionPackages/deployProductionPackages.js +52 -0
- package/dist/src/scripts/release/productionPackages/notifySlack.js +29 -0
- package/dist/src/scripts/releaseAllWithScheme.js +1 -3
- package/dist/src/scripts/releaseAllWithSchemes.js +1 -3
- package/dist/src/scripts/releaseProductionPackagesAll.js +37 -4
- package/dist/src/scripts/smokeTest/smokeTestUtils.js +2 -1
- package/dist/src/tasks/deploy/aswS3/aws.js +4 -4
- package/dist/src/tasks/deploy/aswS3/deployS3.js +6 -4
- package/dist/src/tasks/deploy/aswS3/distToLiveS3.js +3 -1
- package/dist/templates/platforms/_shared/webpack.base.js +3 -1
- package/package.json +1 -1
- package/dist/src/scripts/release/appCenter/appCenter.js +0 -17
- package/dist/src/scripts/release/appCenter/deployProductionPackagesToAppCenter.js +0 -126
- package/dist/src/scripts/release/appCenter/deployToAppCenter.js +0 -76
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ which is used instead of core ReNative engine to fulfill the needs of SmartApps
|
|
|
30
30
|
it
|
|
31
31
|
- **builds** applications for requested platforms
|
|
32
32
|
- **deploys** the built applications to `AWS S3` (or to server configured to host `HbbTV` applications)
|
|
33
|
-
- **releases** new versions to `
|
|
33
|
+
- **releases** new versions to `GitHub`
|
|
34
34
|
- sends **Slack notifications** for `release candidate` and `release` builds
|
|
35
35
|
- supports `Sentry.io` runtime **error logging**
|
|
36
36
|
|
|
@@ -210,12 +210,12 @@ It allows us to extend the number of platforms we build for
|
|
|
210
210
|
|
|
211
211
|
Using the custom engine allows us to change the build steps defined in core ReNative engine.
|
|
212
212
|
Also, custom engine is prepared for deploying the built applications to `AWS S3` and to server specially configured for `HbbTV` builds.
|
|
213
|
-
Our custom build engine is also configured to deploy releases to `
|
|
213
|
+
Our custom build engine is also configured to deploy releases to `GitHub` and `Sentry`.
|
|
214
214
|
|
|
215
215
|
- added support for more platforms (see [supported platforms](#supported-platforms))
|
|
216
216
|
- overwritten rnv tasks (such us `build`, `deploy`)
|
|
217
217
|
- added automatic installation of `Tizen` and `webOS` SDKs before building the packages
|
|
218
|
-
- deploy to `AWS S3`, `
|
|
218
|
+
- deploy to `AWS S3`, `GitHub`, `Sentry`
|
|
219
219
|
- added support for `Slack` notifications for `release candidate` and `release` builds
|
|
220
220
|
|
|
221
221
|
Inside [src/tasks/](src/tasks) folder, there is a source code for **ReNative tasks** which overrides core ReNative tasks.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getProductionZipFileRelativePath = exports.resolveZippedPlatformBuildsRelativeFilePath = exports.resolvePackageVersions = exports.resolveBuildFileExtension = exports.resolveUsedFlavours = exports.resolveSupportedFlavoursForPlatform = exports.resolveSupportedPlatforms = exports.getBaseConfig = exports.resolveBuildFileName = exports.resolveBuildFileBaseName = exports.resolveHbbtvDeployConfig = exports.resolveHbbtvDeployUrl = exports.resolveHbbtvRemoteBuildDirRelativePath = exports.resolveDeployLocations = exports.resolveBuildVersionOffset = exports.resolveBuildVersion = exports.resolveBuildEnvName = exports.resolveS3BucketAppPath = exports.resolveProductionPackagesBaseUrl = exports.resolveBaseUrl = void 0;
|
|
3
|
+
exports.getZippedDirRelativePath = exports.getProductionZipFileRelativePath = exports.resolveZippedPlatformBuildsRelativeFilePath = exports.resolvePackageVersions = exports.resolveBuildFileExtension = exports.resolveUsedFlavours = exports.resolveSupportedFlavoursForPlatform = exports.resolveSupportedPlatforms = exports.getBaseConfig = exports.resolveBuildFileName = exports.resolveBuildFileBaseName = exports.resolveHbbtvDeployConfig = exports.resolveHbbtvDeployUrl = exports.resolveHbbtvRemoteBuildDirRelativePath = exports.resolveDeployLocations = exports.resolveBuildVersionOffset = exports.resolveBuildVersion = exports.resolveBuildEnvName = exports.resolveS3BucketAppPath = exports.resolveProductionPackagesBaseUrl = 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
|
Object.defineProperty(exports, "resolveProductionPackagesBaseUrl", { enumerable: true, get: function () { return resolveBaseUrl_1.resolveProductionPackagesBaseUrl; } });
|
|
@@ -40,3 +40,5 @@ var resolveZippedPlatformBuildsRelativeFilePath_1 = require("./resolveZippedPlat
|
|
|
40
40
|
Object.defineProperty(exports, "resolveZippedPlatformBuildsRelativeFilePath", { enumerable: true, get: function () { return resolveZippedPlatformBuildsRelativeFilePath_1.resolveZippedPlatformBuildsRelativeFilePath; } });
|
|
41
41
|
var resolveProductionZipFileRelativePath_1 = require("./resolveProductionZipFileRelativePath");
|
|
42
42
|
Object.defineProperty(exports, "getProductionZipFileRelativePath", { enumerable: true, get: function () { return resolveProductionZipFileRelativePath_1.getProductionZipFileRelativePath; } });
|
|
43
|
+
var resolveZippedDirRelativePath_1 = require("./resolveZippedDirRelativePath");
|
|
44
|
+
Object.defineProperty(exports, "getZippedDirRelativePath", { enumerable: true, get: function () { return resolveZippedDirRelativePath_1.getZippedDirRelativePath; } });
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.getZippedDirRelativePath = void 0;
|
|
27
|
+
const path = __importStar(require("path"));
|
|
28
|
+
const getZippedDirRelativePath = (c) => {
|
|
29
|
+
const { platformBuildsDir } = c.buildConfig.paths;
|
|
30
|
+
return path.join(platformBuildsDir, 'zipped_production_packages');
|
|
31
|
+
};
|
|
32
|
+
exports.getZippedDirRelativePath = getZippedDirRelativePath;
|
|
@@ -32,10 +32,6 @@ const constants_1 = require("../constants");
|
|
|
32
32
|
const buildProductionPackages_1 = require("../constants/buildProductionPackages");
|
|
33
33
|
const resolvers_1 = require("../resolvers");
|
|
34
34
|
const getArgs_1 = require("./utils/getArgs");
|
|
35
|
-
const getZippedDirRelativePath = (c) => {
|
|
36
|
-
const { platformBuildsDir } = c.buildConfig.paths;
|
|
37
|
-
return path.join(platformBuildsDir, 'zipped_production_packages');
|
|
38
|
-
};
|
|
39
35
|
const buildProductionTask = (options, c) => {
|
|
40
36
|
const { scheme, platform, flavour } = options;
|
|
41
37
|
const { platformBuildsDir } = c.buildConfig.paths;
|
|
@@ -45,20 +41,20 @@ const buildProductionTask = (options, c) => {
|
|
|
45
41
|
fs.rmSync(buildDirPath, { recursive: true, force: true });
|
|
46
42
|
const cmd = `npx rnv build -s ${scheme} -p ${platform} -c ${flavour} --ci --mono --productionPackagesHostedUrl`;
|
|
47
43
|
(0, child_process_1.execSync)(cmd, { stdio: 'inherit' });
|
|
48
|
-
const zippedDir = path.join(getZippedDirRelativePath(c), platform);
|
|
44
|
+
const zippedDir = path.join((0, resolvers_1.getZippedDirRelativePath)(c), platform);
|
|
49
45
|
fse.copySync(buildOutputDirPath, zippedDir);
|
|
50
46
|
};
|
|
51
47
|
const buildProductionPackagesAll = () => {
|
|
52
48
|
console.log('buildProductionPackagesAll');
|
|
53
|
-
const {
|
|
54
|
-
if (!
|
|
49
|
+
const { scheme, include, exclude } = (0, getArgs_1.getArgs)();
|
|
50
|
+
if (!scheme) {
|
|
55
51
|
throw new Error('Missing scheme parameter');
|
|
56
52
|
}
|
|
57
|
-
if (
|
|
53
|
+
if (scheme !== constants_1.BuildSchemes.RELEASE_PROD_DIST) {
|
|
58
54
|
throw new Error(`Supported only "${constants_1.BuildSchemes.RELEASE_PROD_DIST}" scheme`);
|
|
59
55
|
}
|
|
60
56
|
const c = (0, resolvers_1.getBaseConfig)();
|
|
61
|
-
c.runtime.scheme =
|
|
57
|
+
c.runtime.scheme = scheme;
|
|
62
58
|
const platforms = (0, resolvers_1.resolveSupportedPlatforms)(c);
|
|
63
59
|
const skipPlatforms = platforms.filter((platform) => {
|
|
64
60
|
if (!buildProductionPackages_1.SUPPORTED_PACKAGE_PLATFORMS.includes(platform)) {
|
|
@@ -72,11 +68,6 @@ const buildProductionPackagesAll = () => {
|
|
|
72
68
|
return false;
|
|
73
69
|
});
|
|
74
70
|
(0, forEachSupportedPlatformFlavour_1.forEachSupportedPlatformFlavour)(c, (options) => buildProductionTask(options, c), { ignoredPlatforms: skipPlatforms });
|
|
75
|
-
const zippedDirPath = path.resolve(getZippedDirRelativePath(c));
|
|
76
|
-
const zipFilePath = path.resolve((0, resolvers_1.getProductionZipFileRelativePath)(c));
|
|
77
|
-
fs.rmSync(zipFilePath, { force: true });
|
|
78
|
-
(0, child_process_1.execSync)(`zip -r ${zipFilePath} *`, { cwd: `${zippedDirPath}` });
|
|
79
|
-
fs.rmSync(zippedDirPath, { recursive: true, force: true });
|
|
80
71
|
return true;
|
|
81
72
|
};
|
|
82
73
|
const startTimestamp = Date.now();
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.deployProductionPackages = void 0;
|
|
27
|
+
const path = __importStar(require("path"));
|
|
28
|
+
const fs = __importStar(require("fs"));
|
|
29
|
+
const resolvers_1 = require("../../../resolvers");
|
|
30
|
+
const aws = __importStar(require("../../../tasks/deploy/aswS3/aws"));
|
|
31
|
+
const formatDateTime = (date) => {
|
|
32
|
+
const year = date.getFullYear();
|
|
33
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
34
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
35
|
+
const h = String(date.getHours()).padStart(2, '0');
|
|
36
|
+
const m = String(date.getMinutes()).padStart(2, '0');
|
|
37
|
+
const s = String(date.getSeconds()).padStart(2, '0');
|
|
38
|
+
return `${year}-${month}-${day}T${h}-${m}-${s}`;
|
|
39
|
+
};
|
|
40
|
+
const deployProductionPackages = (c) => {
|
|
41
|
+
const originalZipPath = (0, resolvers_1.getProductionZipFileRelativePath)(c);
|
|
42
|
+
const { dir, name } = path.parse(originalZipPath);
|
|
43
|
+
const fileName = `${name}_${formatDateTime(new Date())}`;
|
|
44
|
+
const zipPath = path.join(dir, `${fileName}.zip`);
|
|
45
|
+
fs.renameSync(originalZipPath, zipPath);
|
|
46
|
+
const bucketName = c.buildConfig?.common.deploy?.aws3?.bucketName || '';
|
|
47
|
+
const acl = c.buildConfig?.common.deploy?.aws3?.acl ?? true;
|
|
48
|
+
const destinationPath = `${bucketName}/production_builds/`;
|
|
49
|
+
aws.cp(zipPath, destinationPath, acl);
|
|
50
|
+
return fileName;
|
|
51
|
+
};
|
|
52
|
+
exports.deployProductionPackages = deployProductionPackages;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.notifySlack = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const slackBlockKitBuilder_1 = require("../../utils/slackBlockKitBuilder");
|
|
6
|
+
const getSlackPayload = (appName, fileName, filePath) => {
|
|
7
|
+
return {
|
|
8
|
+
blocks: [
|
|
9
|
+
slackBlockKitBuilder_1.Divider.plain(),
|
|
10
|
+
slackBlockKitBuilder_1.Section.mrkdwn(`${appName} Production Packages`),
|
|
11
|
+
slackBlockKitBuilder_1.Context.mrkdwns([fileName]),
|
|
12
|
+
slackBlockKitBuilder_1.Actions.buttons([{
|
|
13
|
+
text: 'Download Production Packages',
|
|
14
|
+
url: filePath,
|
|
15
|
+
}]),
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
const notifySlack = (c, fileName) => {
|
|
20
|
+
const appName = c.buildConfig.common.appName ?? '';
|
|
21
|
+
const webHookUrl = c.buildConfig.common.deploy.slack?.webhookUrl ?? '';
|
|
22
|
+
const hostedBaseUrl = c.buildConfig?.common?.hostedUrl?.baseUrl;
|
|
23
|
+
const filePath = `${hostedBaseUrl}/production_builds/${fileName}.zip`;
|
|
24
|
+
const data = JSON.stringify(getSlackPayload(appName, fileName, filePath));
|
|
25
|
+
const contentType = '"Content-type: application/json"';
|
|
26
|
+
const cmd = `curl -X POST -H ${contentType} --data '${data}' ${webHookUrl}`;
|
|
27
|
+
(0, child_process_1.execSync)(cmd, { stdio: 'inherit' });
|
|
28
|
+
};
|
|
29
|
+
exports.notifySlack = notifySlack;
|
|
@@ -5,7 +5,6 @@ const forEachSupportedPlatformFlavour_1 = require("../utils/forEachSupportedPlat
|
|
|
5
5
|
const resolvers_1 = require("../resolvers");
|
|
6
6
|
const zipBuildsByPlatforms_1 = require("../utils/zipBuildsByPlatforms");
|
|
7
7
|
const deleteSourceMaps_1 = require("./release/deleteSourceMaps");
|
|
8
|
-
const deployToAppCenter_1 = require("./release/appCenter/deployToAppCenter");
|
|
9
8
|
const githubRelease_1 = require("./release/githubRelease");
|
|
10
9
|
const notifySlack_1 = require("./release/notifySlack/notifySlack");
|
|
11
10
|
const sentryRelease_1 = require("./release/sentryRelease");
|
|
@@ -43,11 +42,10 @@ const doStagingDistributionRelease = (c) => {
|
|
|
43
42
|
const doProductionDistributionRelease = (c) => {
|
|
44
43
|
console.log('doProductionDistributionRelease');
|
|
45
44
|
(0, zipBuildsByPlatforms_1.zipBuildsByPlatforms)(c);
|
|
46
|
-
deployBuilds(c);
|
|
47
45
|
(0, sentryRelease_1.sentryRelease)(c);
|
|
48
46
|
(0, deleteSourceMaps_1.deleteSourceMaps)(c);
|
|
47
|
+
deployBuilds(c);
|
|
49
48
|
(0, githubRelease_1.githubRelease)(c);
|
|
50
|
-
(0, deployToAppCenter_1.deployToAppCenter)(c);
|
|
51
49
|
(0, notifySlack_1.notifySlack)(c, [c.runtime.scheme]);
|
|
52
50
|
return true;
|
|
53
51
|
};
|
|
@@ -5,7 +5,6 @@ const forEachSupportedPlatformFlavour_1 = require("../utils/forEachSupportedPlat
|
|
|
5
5
|
const resolvers_1 = require("../resolvers");
|
|
6
6
|
const zipStagingProdBuildsByPlatforms_1 = require("../utils/zipStagingProdBuildsByPlatforms");
|
|
7
7
|
const deleteSourceMaps_1 = require("./release/deleteSourceMaps");
|
|
8
|
-
const deployToAppCenter_1 = require("./release/appCenter/deployToAppCenter");
|
|
9
8
|
const githubRelease_1 = require("./release/githubRelease");
|
|
10
9
|
const notifySlack_1 = require("./release/notifySlack/notifySlack");
|
|
11
10
|
const sentryRelease_1 = require("./release/sentryRelease");
|
|
@@ -62,11 +61,10 @@ const doDistributionRelease = (c, schemes) => {
|
|
|
62
61
|
if (prodScheme) {
|
|
63
62
|
c.runtime.scheme = prodScheme.type;
|
|
64
63
|
(0, zipStagingProdBuildsByPlatforms_1.zipStagingProdBuildsByPlatforms)(c, [stagingScheme?.type, prodScheme.type]);
|
|
65
|
-
deployBuilds(c);
|
|
66
64
|
(0, sentryRelease_1.sentryRelease)(c);
|
|
67
65
|
(0, deleteSourceMaps_1.deleteSourceMaps)(c);
|
|
66
|
+
deployBuilds(c);
|
|
68
67
|
(0, githubRelease_1.githubRelease)(c);
|
|
69
|
-
(0, deployToAppCenter_1.deployToAppCenter)(c);
|
|
70
68
|
}
|
|
71
69
|
const schemeArr = schemes.map((scheme) => scheme?.type).filter(Boolean);
|
|
72
70
|
(0, notifySlack_1.notifySlack)(c, schemeArr);
|
|
@@ -1,10 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
26
|
+
const child_process_1 = require("child_process");
|
|
27
|
+
const fs = __importStar(require("fs"));
|
|
28
|
+
const path = __importStar(require("path"));
|
|
29
|
+
const deployProductionPackages_1 = require("./release/productionPackages/deployProductionPackages");
|
|
30
|
+
const notifySlack_1 = require("./release/productionPackages/notifySlack");
|
|
31
|
+
const resolvers_1 = require("../resolvers");
|
|
5
32
|
const releaseProductionPackagesAll = () => {
|
|
6
|
-
const c = (0,
|
|
7
|
-
(0,
|
|
33
|
+
const c = (0, resolvers_1.getBaseConfig)();
|
|
34
|
+
const zippedDirPath = path.resolve((0, resolvers_1.getZippedDirRelativePath)(c));
|
|
35
|
+
const zipFilePath = path.resolve((0, resolvers_1.getProductionZipFileRelativePath)(c));
|
|
36
|
+
fs.rmSync(zipFilePath, { force: true });
|
|
37
|
+
(0, child_process_1.execSync)(`zip -r ${zipFilePath} *`, { cwd: `${zippedDirPath}` });
|
|
38
|
+
fs.rmSync(zippedDirPath, { recursive: true, force: true });
|
|
39
|
+
const fileName = (0, deployProductionPackages_1.deployProductionPackages)(c);
|
|
40
|
+
(0, notifySlack_1.notifySlack)(c, fileName);
|
|
8
41
|
};
|
|
9
42
|
const startTimestamp = Date.now();
|
|
10
43
|
releaseProductionPackagesAll();
|
|
@@ -93,7 +93,8 @@ const uploadLogsZipToS3 = (c, zipFilePath) => {
|
|
|
93
93
|
const zipFileName = path.parse(zipFilePath).base;
|
|
94
94
|
const bucketName = c.buildConfig?.common.deploy?.aws3?.bucketName || '';
|
|
95
95
|
const uploadPath = `${bucketName}/${logsDirPathOnS3()}/${zipFileName}`;
|
|
96
|
-
|
|
96
|
+
const acl = c.buildConfig?.common.deploy?.aws3?.acl ?? true;
|
|
97
|
+
aws.cp(zipFilePath, uploadPath, acl);
|
|
97
98
|
};
|
|
98
99
|
exports.uploadLogsZipToS3 = uploadLogsZipToS3;
|
|
99
100
|
const resolveLogsZipUrl = (c, zipFileName) => {
|
|
@@ -14,16 +14,16 @@ const ls = (remotePath) => {
|
|
|
14
14
|
runCmdSyncSilent(`aws s3 ls s3://${remotePath}`);
|
|
15
15
|
};
|
|
16
16
|
exports.ls = ls;
|
|
17
|
-
const cp = (source, destination) => {
|
|
18
|
-
let cmd = `aws s3 cp ${source} s3://${destination} --acl public-read`;
|
|
17
|
+
const cp = (source, destination, useAcl = true) => {
|
|
18
|
+
let cmd = `aws s3 cp ${source} s3://${destination} ${useAcl ? '--acl public-read' : ''}`;
|
|
19
19
|
if ((0, fsUtils_1.isDir)(source)) {
|
|
20
20
|
cmd += RECURSIVE_FLAG;
|
|
21
21
|
}
|
|
22
22
|
runCmdSync(cmd);
|
|
23
23
|
};
|
|
24
24
|
exports.cp = cp;
|
|
25
|
-
const cpRemote = (source, destination) => {
|
|
26
|
-
let cmd = `aws s3 cp s3://${source} s3://${destination} --acl public-read`;
|
|
25
|
+
const cpRemote = (source, destination, useAcl = true) => {
|
|
26
|
+
let cmd = `aws s3 cp s3://${source} s3://${destination} ${useAcl ? '--acl public-read' : ''}`;
|
|
27
27
|
if (source.endsWith('/')) {
|
|
28
28
|
cmd += RECURSIVE_FLAG;
|
|
29
29
|
}
|
|
@@ -37,13 +37,15 @@ const uploadPackage = (c, sourcePath, uploadPath) => {
|
|
|
37
37
|
const packageLocalPath = `"${packageOutputDirPath}/${packageFileName}"`;
|
|
38
38
|
const packageRemotePath = `"${uploadPath}/build/${packageFileName}"`;
|
|
39
39
|
rnv_1.Logger.logDebug(`uploadPackage: src: ${packageLocalPath}, dest: ${packageRemotePath}`);
|
|
40
|
-
|
|
40
|
+
const acl = c.buildConfig?.common.deploy?.aws3?.acl ?? true;
|
|
41
|
+
aws.cp(packageLocalPath, packageRemotePath, acl);
|
|
41
42
|
};
|
|
42
|
-
const uploadPublicDir = (sourcePath, uploadPath) => {
|
|
43
|
+
const uploadPublicDir = (c, sourcePath, uploadPath) => {
|
|
43
44
|
const publicDirLocalPath = path.join(sourcePath, 'project', 'public');
|
|
44
45
|
const publicDirRemotePath = `${uploadPath}/public`;
|
|
45
46
|
rnv_1.Logger.logDebug(`uploadPublicDir: src: ${publicDirLocalPath}, dest: ${publicDirRemotePath}`);
|
|
46
|
-
|
|
47
|
+
const acl = c.buildConfig?.common.deploy?.aws3?.acl ?? true;
|
|
48
|
+
aws.cp(publicDirLocalPath, publicDirRemotePath, acl);
|
|
47
49
|
};
|
|
48
50
|
const deployToS3 = async (c) => {
|
|
49
51
|
rnv_1.Logger.logTask('deployToS3');
|
|
@@ -67,7 +69,7 @@ const deployToS3 = async (c) => {
|
|
|
67
69
|
return true;
|
|
68
70
|
}
|
|
69
71
|
const sourceDirPath = isBuildHosted ? `${sourcePath}-public` : sourcePath;
|
|
70
|
-
uploadPublicDir(sourceDirPath, uploadPath);
|
|
72
|
+
uploadPublicDir(c, sourceDirPath, uploadPath);
|
|
71
73
|
process.stdout.write('Deploy done.\n');
|
|
72
74
|
return true;
|
|
73
75
|
};
|
|
@@ -61,13 +61,15 @@ const checkDistVersionAvailability = (options, version) => {
|
|
|
61
61
|
};
|
|
62
62
|
exports.checkDistVersionAvailability = checkDistVersionAvailability;
|
|
63
63
|
const distToLiveS3 = (options, version, copyIndexOnly) => {
|
|
64
|
+
const c = (0, resolveGenericRnvConfig_1.getBaseConfig)();
|
|
64
65
|
const uploadPath = getUploadPath(options, version);
|
|
65
66
|
if (!uploadPath)
|
|
66
67
|
return false;
|
|
67
68
|
const indexPath = copyIndexOnly ? 'index.html' : '';
|
|
68
69
|
const copyFrom = `${uploadPath}/public/${indexPath}`;
|
|
69
70
|
const copyTo = `${uploadPath.replace(/dist\/v.*/, 'live')}/public/${indexPath}`;
|
|
70
|
-
|
|
71
|
+
const acl = c.buildConfig?.common.deploy?.aws3?.acl ?? true;
|
|
72
|
+
aws.cpRemote(copyFrom, copyTo, acl);
|
|
71
73
|
process.stdout.write('Publish done.\n');
|
|
72
74
|
return true;
|
|
73
75
|
};
|
|
@@ -142,8 +142,10 @@ function generateConfig(config) {
|
|
|
142
142
|
},
|
|
143
143
|
}),
|
|
144
144
|
webpack: new webpack_1.default.DefinePlugin({
|
|
145
|
+
WEBPACK_INJECTION_APP_ID: JSON.stringify(buildConfig.platforms[PLATFORM].id || buildConfig.common.id || ''),
|
|
145
146
|
WEBPACK_INJECTION_APP_NAME: JSON.stringify(buildConfig.common.appName || ''),
|
|
146
147
|
WEBPACK_INJECTION_APP_TITLE: JSON.stringify(buildConfig.common.title || ''),
|
|
148
|
+
WEBPACK_INJECTION_APP_STORE_URL: JSON.stringify(buildConfig.platforms[PLATFORM].storeUrl || ''),
|
|
147
149
|
WEBPACK_INJECTION_APP_CONFIG_ID: JSON.stringify(config.appConfigId || ''),
|
|
148
150
|
WEBPACK_INJECTION_APP_CREATED: JSON.stringify(new Date().toISOString()),
|
|
149
151
|
WEBPACK_INJECTION_APP_SCHEME: JSON.stringify(config.scheme || ''),
|
|
@@ -237,7 +239,7 @@ function generateConfig(config) {
|
|
|
237
239
|
output: {
|
|
238
240
|
environment: outputEnvironment,
|
|
239
241
|
filename: 'content/js/[name].js',
|
|
240
|
-
publicPath: isBuildHosted ? `${baseUrl}/public
|
|
242
|
+
publicPath: isBuildHosted ? `${baseUrl}/public/` : '',
|
|
241
243
|
path: appBuildEngineProjectPublicDir,
|
|
242
244
|
},
|
|
243
245
|
Plugins: plugins,
|
package/package.json
CHANGED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.appCenterRelease = void 0;
|
|
4
|
-
const child_process_1 = require("child_process");
|
|
5
|
-
const appCenterRelease = (params) => {
|
|
6
|
-
const { filePath, releaseNotesPath, buildVersion, token, projectName } = params;
|
|
7
|
-
const app = `24i-Media/${projectName}`;
|
|
8
|
-
(0, child_process_1.execSync)('appcenter distribute release '
|
|
9
|
-
+ `--file "${filePath}" `
|
|
10
|
-
+ `--release-notes-file "${releaseNotesPath}" `
|
|
11
|
-
+ `--build-version "${buildVersion}" `
|
|
12
|
-
+ `--app "${app}" `
|
|
13
|
-
+ `--token "${token}" `
|
|
14
|
-
+ '--group "Collaborators" '
|
|
15
|
-
+ '--disable-telemetry', { stdio: 'inherit' });
|
|
16
|
-
};
|
|
17
|
-
exports.appCenterRelease = appCenterRelease;
|
|
@@ -1,126 +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
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.deployProductionPackagesToAppCenter = void 0;
|
|
27
|
-
const child_process_1 = require("child_process");
|
|
28
|
-
const path = __importStar(require("path"));
|
|
29
|
-
const fs = __importStar(require("fs"));
|
|
30
|
-
const constants_1 = require("../../../constants");
|
|
31
|
-
const buildProductionPackages_1 = require("../../../constants/buildProductionPackages");
|
|
32
|
-
const resolvers_1 = require("../../../resolvers");
|
|
33
|
-
const appCenter_1 = require("./appCenter");
|
|
34
|
-
const ENV_APPCENTER_TOKEN_PRODUCTION_PACKAGES = 'APPCENTER_TOKEN_PRODUCTION_PACKAGES';
|
|
35
|
-
const newLine = '\r\n';
|
|
36
|
-
const formatDateTime = (date) => {
|
|
37
|
-
const year = date.getFullYear();
|
|
38
|
-
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
39
|
-
const day = String(date.getDate()).padStart(2, '0');
|
|
40
|
-
const h = String(date.getHours()).padStart(2, '0');
|
|
41
|
-
const m = String(date.getMinutes()).padStart(2, '0');
|
|
42
|
-
const s = String(date.getSeconds()).padStart(2, '0');
|
|
43
|
-
return `${year}-${month}-${day}T${h}-${m}-${s}`;
|
|
44
|
-
};
|
|
45
|
-
const getAppCenterConfig = (c) => {
|
|
46
|
-
try {
|
|
47
|
-
return c.buildConfig.common.deploy?.productionPackages?.appCenter || null;
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const getPlatformPackagesList = (c) => {
|
|
54
|
-
const scheme = constants_1.BuildSchemes.RELEASE_PROD_DIST;
|
|
55
|
-
const packagesList = [];
|
|
56
|
-
const platforms = (0, resolvers_1.resolveSupportedPlatforms)(c)
|
|
57
|
-
.filter((platform) => buildProductionPackages_1.SUPPORTED_PACKAGE_PLATFORMS.includes(platform));
|
|
58
|
-
platforms.forEach((platform) => {
|
|
59
|
-
const supportedFlavours = (0, resolvers_1.resolveSupportedFlavoursForPlatform)(c, platform);
|
|
60
|
-
const platformObj = {
|
|
61
|
-
platformName: platform,
|
|
62
|
-
packages: supportedFlavours.map((appConfigID) => {
|
|
63
|
-
const config = (0, resolvers_1.getBaseConfig)({
|
|
64
|
-
platform, scheme, appConfigID, productionPackagesHostedUrl: true,
|
|
65
|
-
});
|
|
66
|
-
return {
|
|
67
|
-
name: (0, resolvers_1.resolveBuildFileName)(config),
|
|
68
|
-
flavour: appConfigID,
|
|
69
|
-
hostedUrl: `${(0, resolvers_1.resolveProductionPackagesBaseUrl)(c)}/public`,
|
|
70
|
-
};
|
|
71
|
-
}),
|
|
72
|
-
};
|
|
73
|
-
packagesList.push(platformObj);
|
|
74
|
-
});
|
|
75
|
-
return packagesList;
|
|
76
|
-
};
|
|
77
|
-
const getAppCenterToken = () => process.env[ENV_APPCENTER_TOKEN_PRODUCTION_PACKAGES] || '';
|
|
78
|
-
const deployProductionPackagesToAppCenter = (c) => {
|
|
79
|
-
console.log('deployProductionPackagesToAppCenter');
|
|
80
|
-
const appCenterConfig = getAppCenterConfig(c);
|
|
81
|
-
if (!appCenterConfig) {
|
|
82
|
-
throw new Error('Not found App Center Config (for production packages) in build config');
|
|
83
|
-
}
|
|
84
|
-
const { appName: centerAppName } = appCenterConfig;
|
|
85
|
-
const token = getAppCenterToken();
|
|
86
|
-
const { appName } = c.buildConfig.common;
|
|
87
|
-
if (!centerAppName)
|
|
88
|
-
throw new Error('Missing AppName in appCenterConfig');
|
|
89
|
-
if (!token) {
|
|
90
|
-
throw new Error(`Missing App Center Token. To fix it, set "${ENV_APPCENTER_TOKEN_PRODUCTION_PACKAGES}" env variable`);
|
|
91
|
-
}
|
|
92
|
-
const originalZipPath = (0, resolvers_1.getProductionZipFileRelativePath)(c);
|
|
93
|
-
const { dir, name: fileName } = path.parse(originalZipPath);
|
|
94
|
-
const zipPath = path.join(dir, `${fileName}_${formatDateTime(new Date())}.zip`);
|
|
95
|
-
fs.renameSync(originalZipPath, zipPath);
|
|
96
|
-
const tempReleaseNotesPath = 'RELEASE_NOTES_APPCENTER_PRODUCTION_PACKAGES.md';
|
|
97
|
-
if (fs.existsSync(tempReleaseNotesPath)) {
|
|
98
|
-
fs.unlinkSync(tempReleaseNotesPath);
|
|
99
|
-
}
|
|
100
|
-
const packagesList = getPlatformPackagesList(c);
|
|
101
|
-
const notes = [
|
|
102
|
-
`# ${appName} Production Packages`,
|
|
103
|
-
'',
|
|
104
|
-
'## List of Production Packages',
|
|
105
|
-
...packagesList.reduce((acc, { platformName, packages }) => ([
|
|
106
|
-
...acc,
|
|
107
|
-
`- ${platformName}`,
|
|
108
|
-
...packages.reduce((accPackages, { name, hostedUrl }) => ([
|
|
109
|
-
...accPackages,
|
|
110
|
-
` - ${name}`,
|
|
111
|
-
` - App URL: ${hostedUrl}`,
|
|
112
|
-
]), []),
|
|
113
|
-
]), []),
|
|
114
|
-
];
|
|
115
|
-
const packagesMarkdown = notes.join(newLine);
|
|
116
|
-
(0, child_process_1.execSync)(`echo "${packagesMarkdown}" >> ${tempReleaseNotesPath}`);
|
|
117
|
-
console.log('Deploying Production packages to AppCenter.ms...');
|
|
118
|
-
(0, appCenter_1.appCenterRelease)({
|
|
119
|
-
projectName: centerAppName,
|
|
120
|
-
buildVersion: '0',
|
|
121
|
-
filePath: zipPath,
|
|
122
|
-
releaseNotesPath: tempReleaseNotesPath,
|
|
123
|
-
token,
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
exports.deployProductionPackagesToAppCenter = deployProductionPackagesToAppCenter;
|
|
@@ -1,76 +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
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.deployToAppCenter = void 0;
|
|
27
|
-
const child_process_1 = require("child_process");
|
|
28
|
-
const fs = __importStar(require("fs"));
|
|
29
|
-
const rnv_1 = require("rnv");
|
|
30
|
-
const resolvers_1 = require("../../../resolvers");
|
|
31
|
-
const urlsMarkdown_1 = require("../urlsMarkdown");
|
|
32
|
-
const appCenter_1 = require("./appCenter");
|
|
33
|
-
const getAppCenterConfigByPlatformName = (c, platformName) => {
|
|
34
|
-
try {
|
|
35
|
-
return c.buildConfig.platforms[platformName]?.deploy?.appCenter || null;
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
const getAppCenterTokenByPlatform = (platformName = '') => {
|
|
42
|
-
const envVariableName = `APPCENTER_TOKEN_${platformName.toUpperCase()}`;
|
|
43
|
-
return process.env[envVariableName] || '';
|
|
44
|
-
};
|
|
45
|
-
const processPlatform = (c, platformName) => {
|
|
46
|
-
const { getConfigProp } = rnv_1.Common;
|
|
47
|
-
const appCenterConfig = getAppCenterConfigByPlatformName(c, platformName);
|
|
48
|
-
if (!appCenterConfig)
|
|
49
|
-
return;
|
|
50
|
-
const { appName } = appCenterConfig;
|
|
51
|
-
const token = getAppCenterTokenByPlatform(platformName);
|
|
52
|
-
const zipPath = (0, resolvers_1.resolveZippedPlatformBuildsRelativeFilePath)(c, platformName);
|
|
53
|
-
const buildVersion = getConfigProp(c, platformName, 'packageVersion', '');
|
|
54
|
-
const releaseNotesPath = getConfigProp(c, platformName, 'releaseNotes', {}).relativePath || '';
|
|
55
|
-
if (!appName || !token || !releaseNotesPath || !zipPath || !buildVersion)
|
|
56
|
-
return;
|
|
57
|
-
const tempReleaseNotesPath = `RELEASE_NOTES_APPCENTER_${platformName.toUpperCase()}.md`;
|
|
58
|
-
if (fs.existsSync(tempReleaseNotesPath)) {
|
|
59
|
-
fs.unlinkSync(tempReleaseNotesPath);
|
|
60
|
-
}
|
|
61
|
-
(0, child_process_1.execSync)(`cat ${releaseNotesPath} >> ${tempReleaseNotesPath}`);
|
|
62
|
-
const urlsMarkdown = (0, urlsMarkdown_1.getUrlsMarkdown)(c, [platformName]);
|
|
63
|
-
(0, child_process_1.execSync)(`echo "${urlsMarkdown}" >> ${tempReleaseNotesPath}`);
|
|
64
|
-
console.log(`Deploying ${platformName} platform to AppCenter.ms...`);
|
|
65
|
-
(0, appCenter_1.appCenterRelease)({
|
|
66
|
-
projectName: appName,
|
|
67
|
-
buildVersion,
|
|
68
|
-
filePath: zipPath,
|
|
69
|
-
releaseNotesPath: tempReleaseNotesPath,
|
|
70
|
-
token,
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
const deployToAppCenter = (c) => {
|
|
74
|
-
(0, resolvers_1.resolveSupportedPlatforms)(c).forEach((platformName) => processPlatform(c, platformName));
|
|
75
|
-
};
|
|
76
|
-
exports.deployToAppCenter = deployToAppCenter;
|