@24i/smartapps-bigscreen-rnv-build-engine 0.17.6-alpha.10 → 0.17.6-alpha.12

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.
@@ -27,10 +27,9 @@ exports.getProductionZipFileRelativePath = void 0;
27
27
  const path = __importStar(require("path"));
28
28
  const getProductionZipFileRelativePath = (c) => {
29
29
  const { appNameInFileName } = c.buildConfig.common;
30
- const buildVersion = c.buildConfig.common.packageVersion;
31
30
  const { platformBuildsDir } = c.buildConfig.paths;
32
31
  const platformBuildsDirPath = path.join(platformBuildsDir);
33
- const zipFileName = `${appNameInFileName}.production_packages_v${buildVersion}.zip`;
32
+ const zipFileName = `${appNameInFileName}.production_packages.zip`;
34
33
  return path.join(platformBuildsDirPath, zipFileName);
35
34
  };
36
35
  exports.getProductionZipFileRelativePath = getProductionZipFileRelativePath;
@@ -32,8 +32,8 @@ const resolvers_1 = require("../resolvers");
32
32
  const getProgressMessage = ({ schemes, schemeIndex, platforms, platformIndex, flavours, flavourIndex, }) => {
33
33
  let string = `\nProcessing`;
34
34
  string += ` "${platforms[platformIndex]}" platform`;
35
- string += ` (${platformIndex + 1}/${platforms.length})`;
36
- string += ` with "${schemes[schemeIndex]}" scheme"`;
35
+ string += ` (${platformIndex + 1}/${platforms.length}),`;
36
+ string += ` "${schemes[schemeIndex]}" scheme"`;
37
37
  string += ` (${schemeIndex + 1}/${schemes.length}),`;
38
38
  string += ` and its "${flavours[flavourIndex]}" flavour`;
39
39
  string += ` (${flavourIndex + 1}/${flavours.length})...`;
@@ -25,12 +25,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.deployProductionPackagesToAppCenter = void 0;
27
27
  const child_process_1 = require("child_process");
28
+ const path = __importStar(require("path"));
28
29
  const fs = __importStar(require("fs"));
29
30
  const constants_1 = require("../../../constants");
30
31
  const buildProductionPackages_1 = require("../../../constants/buildProductionPackages");
31
32
  const resolvers_1 = require("../../../resolvers");
32
33
  const appCenter_1 = require("./appCenter");
34
+ const ENV_APPCENTER_TOKEN_PRODUCTION_PACKAGES = 'APPCENTER_TOKEN_PRODUCTION_PACKAGES';
33
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
+ };
34
45
  const getAppCenterConfig = (c) => {
35
46
  try {
36
47
  return c.buildConfig.common.deploy?.productionPackages?.appCenter || null;
@@ -64,7 +75,7 @@ const getPlatformPackagesList = (c) => {
64
75
  return packagesList;
65
76
  };
66
77
  const getAppCenterToken = () => {
67
- return process.env['APPCENTER_TOKEN_PRODUCTION_PACKAGES'] || '';
78
+ return process.env[ENV_APPCENTER_TOKEN_PRODUCTION_PACKAGES] || '';
68
79
  };
69
80
  const deployProductionPackagesToAppCenter = (c) => {
70
81
  console.log('deployProductionPackagesToAppCenter');
@@ -74,16 +85,15 @@ const deployProductionPackagesToAppCenter = (c) => {
74
85
  }
75
86
  const { appName: centerAppName } = appCenterConfig;
76
87
  const token = getAppCenterToken();
77
- const zipPath = (0, resolvers_1.getProductionZipFileRelativePath)(c);
78
- const { appName, packageVersion } = c.buildConfig.common;
88
+ const { appName } = c.buildConfig.common;
79
89
  if (!centerAppName)
80
- throw new Error('Missing centerAppName in appCenterConfig');
90
+ throw new Error('Missing AppName in appCenterConfig');
81
91
  if (!token)
82
- throw new Error('Missing App Center Token');
83
- if (!zipPath)
84
- throw new Error('Missing path of zip file to be upload to the App Center');
85
- if (!packageVersion)
86
- throw new Error('Missing packageVersion to be send to the App Center');
92
+ throw new Error(`Missing App Center Token. To fix it, set "${ENV_APPCENTER_TOKEN_PRODUCTION_PACKAGES}" env variable`);
93
+ const originalZipPath = (0, resolvers_1.getProductionZipFileRelativePath)(c);
94
+ const { dir, name } = path.parse(originalZipPath);
95
+ const zipPath = path.join(dir, `${name}_${formatDateTime(new Date())}.zip`);
96
+ fs.renameSync(originalZipPath, zipPath);
87
97
  const tempReleaseNotesPath = `RELEASE_NOTES_APPCENTER_PRODUCTION_PACKAGES.md`;
88
98
  if (fs.existsSync(tempReleaseNotesPath)) {
89
99
  fs.unlinkSync(tempReleaseNotesPath);
@@ -108,7 +118,7 @@ const deployProductionPackagesToAppCenter = (c) => {
108
118
  console.log(`Deploying Production packages to AppCenter.ms...`);
109
119
  (0, appCenter_1.appCenterRelease)({
110
120
  projectName: centerAppName,
111
- buildVersion: packageVersion,
121
+ buildVersion: '0',
112
122
  filePath: zipPath,
113
123
  releaseNotesPath: tempReleaseNotesPath,
114
124
  token,
@@ -49,7 +49,7 @@ const getLocalBuildPackagePath = (c) => {
49
49
  const { runtime, platform } = c;
50
50
  const schemeDirName = c.program.schemeFolder ? (0, getSafeSchemeString_1.getSafeSchemeString)(runtime.scheme) : '';
51
51
  const appDirPath = path.join(c.paths.project.builds.dir, schemeDirName, `${runtime.appId}_${platform}`);
52
- path.join(appDirPath, 'output', (0, resolvers_1.resolveBuildFileName)(c));
52
+ return path.join(appDirPath, 'output', (0, resolvers_1.resolveBuildFileName)(c));
53
53
  };
54
54
  const resolveRemotePaths = (c) => {
55
55
  const { scheme, appId } = c.runtime;
@@ -42,8 +42,8 @@ const getPlatformBuildsPaths = (c, platformName, scheme) => {
42
42
  const platformBuildsGlob = `${outputGlob}/*.${(0, index_1.resolveBuildFileExtension)(platformName)}`;
43
43
  try {
44
44
  const buildsPathsCandidates = glob.sync(platformBuildsGlob) || [];
45
- const platformBuilsPaths = buildsPathsCandidates.filter((path) => path.includes(platformName));
46
- return platformBuilsPaths;
45
+ const platformBuildsPaths = buildsPathsCandidates.filter((path) => path.includes(platformName));
46
+ return platformBuildsPaths;
47
47
  }
48
48
  catch (e) {
49
49
  return [];
@@ -104,7 +104,7 @@ const processPlatform = (c, platformName, schemes) => {
104
104
  (0, fs_1.rmdirSync)(tempPlatformDir, { recursive: true });
105
105
  };
106
106
  const zipStagingProdBuildsByPlatforms = (c, schemes) => {
107
- const [stagingScheme, prodScheme] = schemes;
107
+ const [, prodScheme] = schemes;
108
108
  if (!prodScheme) {
109
109
  throw new Error('Missing production scheme.');
110
110
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@24i/smartapps-bigscreen-rnv-build-engine",
3
- "version": "0.17.6-alpha.10",
3
+ "version": "0.17.6-alpha.12",
4
4
  "description": "Package with build engine for SmartApps BIGscreen projects...",
5
5
  "main": "dist/src/index.js",
6
6
  "scripts": {