react-native-update-cli 2.15.1 → 2.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +18 -0
  2. package/README.zh-CN.md +18 -0
  3. package/cli.json +0 -14
  4. package/lib/bin-cresc.d.ts +1 -0
  5. package/lib/bin-cresc.js +7 -0
  6. package/lib/bin.js +2 -2
  7. package/lib/bundle-runner.d.ts +19 -5
  8. package/lib/bundle-runner.js +164 -27
  9. package/lib/bundle.js +9 -12
  10. package/lib/diff.js +4 -0
  11. package/lib/install.js +30 -3
  12. package/lib/locales/en.d.ts +2 -0
  13. package/lib/locales/en.js +2 -0
  14. package/lib/locales/zh.d.ts +2 -0
  15. package/lib/locales/zh.js +2 -0
  16. package/lib/package.js +5 -1
  17. package/lib/provider.js +1 -2
  18. package/lib/types.d.ts +0 -1
  19. package/lib/utils/app-info-parser/aab.js +4 -4
  20. package/lib/utils/app-info-parser/xml-parser/manifest.js +3 -1
  21. package/lib/utils/constants.d.ts +1 -1
  22. package/lib/utils/constants.js +2 -1
  23. package/lib/utils/zip-entries.js +4 -0
  24. package/lib/versions.d.ts +2 -0
  25. package/lib/versions.js +12 -3
  26. package/package.json +5 -5
  27. package/src/bin-cresc.ts +8 -0
  28. package/src/bin.ts +2 -2
  29. package/src/bundle-runner.ts +267 -44
  30. package/src/bundle.ts +4 -20
  31. package/src/diff.ts +6 -1
  32. package/src/install.ts +32 -3
  33. package/src/locales/en.ts +3 -0
  34. package/src/locales/zh.ts +3 -0
  35. package/src/package.ts +3 -3
  36. package/src/provider.ts +0 -1
  37. package/src/types.ts +0 -1
  38. package/src/utils/app-info-parser/aab.ts +4 -4
  39. package/src/utils/app-info-parser/xml-parser/manifest.ts +6 -3
  40. package/src/utils/constants.ts +5 -1
  41. package/src/utils/zip-entries.ts +4 -0
  42. package/src/versions.ts +10 -6
  43. package/lib/utils/sentry-release.d.ts +0 -15
  44. package/lib/utils/sentry-release.js +0 -262
  45. package/src/utils/sentry-release.ts +0 -381
package/src/install.ts CHANGED
@@ -1,21 +1,50 @@
1
1
  import { spawnSync } from 'child_process';
2
2
  import path from 'path';
3
3
  import type { CommandContext } from './types';
4
+ import { scriptName } from './utils/constants';
5
+ import { t } from './utils/i18n';
4
6
  import { getInstallCommand } from './utils/runtime';
5
7
 
8
+ // package names / version specs only — rejects shell metacharacters since
9
+ // Windows needs shell: true to run package manager .cmd shims
10
+ const SAFE_PACKAGE_ARG = /^[@a-z0-9^~._/-]+$/i;
11
+
6
12
  export const installCommands = {
7
13
  install: async ({ args }: CommandContext) => {
8
14
  if (args.length === 0) {
9
- return;
15
+ throw new Error(t('installPackageRequired', { scriptName }));
16
+ }
17
+ for (const arg of args) {
18
+ if (!SAFE_PACKAGE_ARG.test(arg)) {
19
+ throw new Error(t('installPackageRequired', { scriptName }));
20
+ }
10
21
  }
11
22
 
12
23
  const cliDir = path.resolve(__dirname, '..');
13
24
  const installCommand = getInstallCommand(args, cliDir);
14
25
 
15
- spawnSync(installCommand.command, installCommand.args, {
26
+ const result = spawnSync(installCommand.command, installCommand.args, {
16
27
  cwd: cliDir,
17
28
  stdio: 'inherit',
18
- shell: true,
29
+ // package manager executables are .cmd shims on Windows
30
+ shell: process.platform === 'win32',
19
31
  });
32
+
33
+ if (result.error) {
34
+ throw new Error(
35
+ t('installFailed', {
36
+ packages: args.join(' '),
37
+ error: result.error.message,
38
+ }),
39
+ );
40
+ }
41
+ if (result.status !== 0) {
42
+ throw new Error(
43
+ t('installFailed', {
44
+ packages: args.join(' '),
45
+ error: `${installCommand.command} exited with code ${result.status}`,
46
+ }),
47
+ );
48
+ }
20
49
  },
21
50
  };
package/src/locales/en.ts CHANGED
@@ -182,6 +182,9 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
182
182
  nodeHdiffpatchRequired:
183
183
  'This function needs "node-hdiffpatch". Please run "{{scriptName}} install node-hdiffpatch" to install',
184
184
  apkExtracted: 'APK extracted to {{output}}',
185
+ installPackageRequired:
186
+ 'Please specify the package to install, e.g. "{{scriptName}} install node-hdiffpatch"',
187
+ installFailed: 'Failed to install {{packages}}: {{error}}',
185
188
  proxyNetworkError:
186
189
  'Network error — likely caused by a proxy/VPN. Please try disabling your proxy and retry.',
187
190
  proxyNetworkErrorTips:
package/src/locales/zh.ts CHANGED
@@ -168,6 +168,9 @@ export default {
168
168
  nodeHdiffpatchRequired:
169
169
  '此功能需要 "node-hdiffpatch"。请运行 "{{scriptName}} install node-hdiffpatch" 来安装',
170
170
  apkExtracted: 'APK 已提取到 {{output}}',
171
+ installPackageRequired:
172
+ '请指定要安装的包,例如 "{{scriptName}} install node-hdiffpatch"',
173
+ installFailed: '安装 {{packages}} 失败: {{error}}',
171
174
  proxyNetworkError:
172
175
  '网络连接异常,可能是代理/VPN 导致。请尝试关闭代理后重试。',
173
176
  proxyNetworkErrorTips:
package/src/package.ts CHANGED
@@ -375,10 +375,10 @@ export const packageCommands = {
375
375
  throw new Error(t('noPackagesFound', { appId }));
376
376
  }
377
377
 
378
+ const allPkgsMap = new Map(allPkgs.map((pkg) => [pkg.name, pkg]));
379
+
378
380
  packageIds = packageVersions.map((packageVersion) => {
379
- const selectedPackage = allPkgs.find(
380
- (pkg) => pkg.name === packageVersion,
381
- );
381
+ const selectedPackage = allPkgsMap.get(packageVersion);
382
382
  if (!selectedPackage) {
383
383
  throw new Error(t('packageNotFound', { packageVersion }));
384
384
  }
package/src/provider.ts CHANGED
@@ -92,7 +92,6 @@ export class CLIProviderImpl implements CLIProvider {
92
92
  hermes: options.hermes || false,
93
93
  sentryRelease: options.sentryRelease,
94
94
  sentryDist: options.sentryDist,
95
- sentryFlavor: options.sentryFlavor,
96
95
  });
97
96
 
98
97
  const { bundleCommands } = await import('./bundle');
package/src/types.ts CHANGED
@@ -58,7 +58,6 @@ export interface BundleOptions {
58
58
  hermes?: boolean;
59
59
  sentryRelease?: string;
60
60
  sentryDist?: string;
61
- sentryFlavor?: string;
62
61
  }
63
62
 
64
63
  export interface PublishOptions {
@@ -57,8 +57,8 @@ export class AabParser extends Zip {
57
57
  });
58
58
 
59
59
  // Create a temp file for the .apks output
60
- const tempDir = os.tmpdir();
61
- const tempApksPath = path.join(tempDir, `temp-${Date.now()}.apks`);
60
+ const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'bundletool-'));
61
+ const tempApksPath = path.join(tempDir, 'output.apks');
62
62
 
63
63
  const needsNpxDownload = async () => {
64
64
  try {
@@ -155,8 +155,8 @@ export class AabParser extends Zip {
155
155
  });
156
156
  } finally {
157
157
  // Cleanup
158
- if (await fs.pathExists(tempApksPath)) {
159
- await fs.remove(tempApksPath);
158
+ if (await fs.pathExists(tempDir)) {
159
+ await fs.remove(tempDir);
160
160
  }
161
161
  }
162
162
  }
@@ -15,9 +15,12 @@ export class ManifestParser {
15
15
 
16
16
  private collapseAttributes(element: any) {
17
17
  const collapsed: Record<string, any> = Object.create(null);
18
- for (const attr of Array.from(
19
- element.attributes as Array<{ name: string; typedValue: { value: any } }>,
20
- )) {
18
+ const attributes = element.attributes as Array<{
19
+ name: string;
20
+ typedValue: { value: any };
21
+ }>;
22
+ for (let i = 0, len = attributes.length; i < len; i++) {
23
+ const attr = attributes[i];
21
24
  collapsed[attr.name] = attr.typedValue.value;
22
25
  }
23
26
  return collapsed;
@@ -1,6 +1,10 @@
1
1
  import path from 'path';
2
2
 
3
- export const scriptName = path.basename(process.argv[1]) as 'cresc' | 'pushy';
3
+ export const scriptName =
4
+ process.env.RNU_BRAND === 'cresc' ||
5
+ path.basename(process.argv[1] ?? '') === 'cresc'
6
+ ? 'cresc'
7
+ : 'pushy';
4
8
  export const IS_CRESC = scriptName === 'cresc';
5
9
 
6
10
  export const ppkBundleFileNames = ['index.bundlejs', 'bundle.harmony.js'];
@@ -152,6 +152,7 @@ export async function enumZipEntries(
152
152
  zipfile.openReadStream(entry, async (err, readStream) => {
153
153
  if (err) return rej(err);
154
154
  const writeStream = fs.createWriteStream(tempZipPath);
155
+ readStream.on('error', rej);
155
156
  readStream.pipe(writeStream);
156
157
  writeStream.on('finish', () => res(void 0));
157
158
  writeStream.on('error', rej);
@@ -169,6 +170,9 @@ export async function enumZipEntries(
169
170
  }
170
171
  } catch (error) {
171
172
  console.error(t('processingError', { error }));
173
+ zipfile.close();
174
+ reject(error);
175
+ return;
172
176
  }
173
177
 
174
178
  zipfile.readEntry();
package/src/versions.ts CHANGED
@@ -48,7 +48,7 @@ interface DepsChangeSummary {
48
48
  changed: number;
49
49
  }
50
50
 
51
- function normalizeDeps(input: unknown): Deps | undefined {
51
+ export function normalizeDeps(input: unknown): Deps | undefined {
52
52
  if (!input) {
53
53
  return undefined;
54
54
  }
@@ -384,7 +384,7 @@ async function chooseVersion(appId: string) {
384
384
  default: {
385
385
  const versionId = Number.parseInt(cmd, 10);
386
386
  const v = data.find(
387
- (version: Version) => version.id === String(versionId),
387
+ (version: Version) => String(version.id) === String(versionId),
388
388
  );
389
389
  if (v) {
390
390
  return v;
@@ -413,6 +413,7 @@ export const bindVersionToPackages = async ({
413
413
  if (rollout !== undefined) {
414
414
  console.log(
415
415
  `${t('rolloutConfigSet', {
416
+ version: versionId,
416
417
  versions: pkgs.map((pkg: Package) => pkg.name).join(', '),
417
418
  rollout: rollout,
418
419
  })}`,
@@ -588,6 +589,10 @@ export const versionCommands = {
588
589
  throw new Error(t('noPackagesFound', { appId }));
589
590
  }
590
591
 
592
+ const pkgMap = new Map(
593
+ allPkgs.map((pkg: Package) => [String(pkg.id), pkg]),
594
+ );
595
+
591
596
  let pkgsToBind: Package[] = [];
592
597
 
593
598
  if (minPkgVersion) {
@@ -641,9 +646,7 @@ export const versionCommands = {
641
646
  if (!pkgId) {
642
647
  throw new Error(t('packageIdRequired'));
643
648
  }
644
- const pkg = allPkgs.find(
645
- (pkg: Package) => String(pkg.id) === String(pkgId),
646
- );
649
+ const pkg = pkgMap.get(String(pkgId));
647
650
  if (pkg) {
648
651
  pkgsToBind = [pkg];
649
652
  } else {
@@ -662,7 +665,8 @@ export const versionCommands = {
662
665
 
663
666
  await bindVersionToPackages({
664
667
  appId: String(appId),
665
- versionId: String(versionId),
668
+ // keep null as-is: `--versionId null` means unbinding the version
669
+ versionId: versionId ?? null,
666
670
  pkgs: pkgsToBind,
667
671
  rollout,
668
672
  dryRun: options.dryRun,
@@ -1,15 +0,0 @@
1
- export interface SentryReleaseOptions {
2
- sentryRelease?: string;
3
- sentryDist?: string;
4
- sentryFlavor?: string;
5
- }
6
- export interface ResolvedSentryRelease {
7
- release: string;
8
- dist?: string;
9
- }
10
- export declare function resolveAndroidSentryReleaseAndDist({ projectRoot, flavor, dist, }?: {
11
- projectRoot?: string;
12
- flavor?: string;
13
- dist?: string;
14
- }): Promise<ResolvedSentryRelease | undefined>;
15
- export declare function resolveSentryReleaseAndDist(platform: string, fallbackVersion: string, options?: SentryReleaseOptions, projectRoot?: string): Promise<ResolvedSentryRelease>;
@@ -1,262 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: Object.getOwnPropertyDescriptor(all, name).get
9
- });
10
- }
11
- _export(exports, {
12
- get resolveAndroidSentryReleaseAndDist () {
13
- return resolveAndroidSentryReleaseAndDist;
14
- },
15
- get resolveSentryReleaseAndDist () {
16
- return resolveSentryReleaseAndDist;
17
- }
18
- });
19
- const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
20
- const _path = /*#__PURE__*/ _interop_require_default(require("path"));
21
- function _interop_require_default(obj) {
22
- return obj && obj.__esModule ? obj : {
23
- default: obj
24
- };
25
- }
26
- function _getRequireWildcardCache(nodeInterop) {
27
- if (typeof WeakMap !== "function") return null;
28
- var cacheBabelInterop = new WeakMap();
29
- var cacheNodeInterop = new WeakMap();
30
- return (_getRequireWildcardCache = function(nodeInterop) {
31
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
32
- })(nodeInterop);
33
- }
34
- function _interop_require_wildcard(obj, nodeInterop) {
35
- if (!nodeInterop && obj && obj.__esModule) {
36
- return obj;
37
- }
38
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
39
- return {
40
- default: obj
41
- };
42
- }
43
- var cache = _getRequireWildcardCache(nodeInterop);
44
- if (cache && cache.has(obj)) {
45
- return cache.get(obj);
46
- }
47
- var newObj = {
48
- __proto__: null
49
- };
50
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
51
- for(var key in obj){
52
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
53
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
54
- if (desc && (desc.get || desc.set)) {
55
- Object.defineProperty(newObj, key, desc);
56
- } else {
57
- newObj[key] = obj[key];
58
- }
59
- }
60
- }
61
- newObj.default = obj;
62
- if (cache) {
63
- cache.set(obj, newObj);
64
- }
65
- return newObj;
66
- }
67
- const g2js = require('gradle-to-js/lib/parser');
68
- const properties = require('properties');
69
- function normalizeString(value) {
70
- const normalized = value == null ? void 0 : value.trim();
71
- return normalized ? normalized : undefined;
72
- }
73
- function firstString(...values) {
74
- return values.map(normalizeString).find(Boolean);
75
- }
76
- function asObject(value) {
77
- if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
78
- return value;
79
- }
80
- return undefined;
81
- }
82
- function asGradleScalar(value) {
83
- if (typeof value === 'string') {
84
- return normalizeString(value);
85
- }
86
- if (typeof value === 'number' || typeof value === 'boolean') {
87
- return String(value);
88
- }
89
- return undefined;
90
- }
91
- function getObjectValue(object, key) {
92
- return object == null ? void 0 : object[key];
93
- }
94
- function getObjectBlock(object, key) {
95
- return asObject(getObjectValue(object, key));
96
- }
97
- function findKeyCaseInsensitive(object, key) {
98
- const normalized = key.toLowerCase();
99
- return Object.keys(object != null ? object : {}).find((candidate)=>candidate.toLowerCase() === normalized);
100
- }
101
- function getBlockCaseInsensitive(object, key) {
102
- if (!key) {
103
- return undefined;
104
- }
105
- const resolvedKey = findKeyCaseInsensitive(object, key);
106
- return resolvedKey ? getObjectBlock(object, resolvedKey) : undefined;
107
- }
108
- function parsePropertiesFile(filePath) {
109
- if (!_fsextra.existsSync(filePath)) {
110
- return {};
111
- }
112
- try {
113
- return properties.parse(_fsextra.readFileSync(filePath, 'utf8'));
114
- } catch (unused) {
115
- return {};
116
- }
117
- }
118
- async function parseGradleFile(filePath) {
119
- if (!_fsextra.existsSync(filePath)) {
120
- return {};
121
- }
122
- try {
123
- var _asObject;
124
- return (_asObject = asObject(await g2js.parseFile(filePath))) != null ? _asObject : {};
125
- } catch (unused) {
126
- return {};
127
- }
128
- }
129
- function readGradleProperties(projectRoot) {
130
- return {
131
- ...parsePropertiesFile(_path.default.join(projectRoot, 'gradle.properties')),
132
- ...parsePropertiesFile(_path.default.join(projectRoot, 'android', 'gradle.properties'))
133
- };
134
- }
135
- function findExtValue(propertyName, context) {
136
- var _ref, _ref1, _getObjectValue;
137
- const appExt = getObjectBlock(context.appConfig, 'ext');
138
- const rootExt = getObjectBlock(context.rootConfig, 'ext');
139
- const buildscriptExt = getObjectBlock(getObjectBlock(context.rootConfig, 'buildscript'), 'ext');
140
- return (_ref = (_ref1 = (_getObjectValue = getObjectValue(appExt, propertyName)) != null ? _getObjectValue : getObjectValue(rootExt, propertyName)) != null ? _ref1 : getObjectValue(buildscriptExt, propertyName)) != null ? _ref : getObjectValue(context.gradleProperties, propertyName);
141
- }
142
- function resolveGradleScalar(value, context) {
143
- const raw = asGradleScalar(value);
144
- if (!raw) {
145
- return undefined;
146
- }
147
- const extReference = raw.match(/^(?:rootProject\.|project\.)?ext\.([A-Za-z_][\w]*)$/);
148
- if (extReference) {
149
- return resolveGradleScalar(findExtValue(extReference[1], context), context);
150
- }
151
- const directProperty = getObjectValue(context.gradleProperties, raw);
152
- if (directProperty !== undefined) {
153
- return resolveGradleScalar(directProperty, context);
154
- }
155
- if (/[(){}?=]/.test(raw) || raw.includes(' ')) {
156
- return undefined;
157
- }
158
- return raw;
159
- }
160
- function pickAndroidVariant(productFlavors, buildTypes, flavorOrVariant) {
161
- const defaultBuildTypeName = findKeyCaseInsensitive(buildTypes, 'release');
162
- if (!flavorOrVariant) {
163
- const flavorNames = Object.keys(productFlavors != null ? productFlavors : {});
164
- const onlyFlavor = flavorNames.length === 1 ? flavorNames[0] : undefined;
165
- return {
166
- flavorConfig: getBlockCaseInsensitive(productFlavors, onlyFlavor),
167
- buildTypeConfig: getBlockCaseInsensitive(buildTypes, defaultBuildTypeName)
168
- };
169
- }
170
- const exactFlavor = findKeyCaseInsensitive(productFlavors, flavorOrVariant);
171
- if (exactFlavor) {
172
- return {
173
- flavorConfig: getObjectBlock(productFlavors, exactFlavor),
174
- buildTypeConfig: getBlockCaseInsensitive(buildTypes, defaultBuildTypeName)
175
- };
176
- }
177
- const exactBuildType = findKeyCaseInsensitive(buildTypes, flavorOrVariant);
178
- if (exactBuildType) {
179
- return {
180
- buildTypeConfig: getObjectBlock(buildTypes, exactBuildType)
181
- };
182
- }
183
- for (const buildTypeName of Object.keys(buildTypes != null ? buildTypes : {}).sort((a, b)=>b.length - a.length)){
184
- if (flavorOrVariant.toLowerCase().endsWith(buildTypeName.toLowerCase()) && flavorOrVariant.length > buildTypeName.length) {
185
- const flavorName = flavorOrVariant.slice(0, flavorOrVariant.length - buildTypeName.length);
186
- const variantFlavor = findKeyCaseInsensitive(productFlavors, flavorName);
187
- if (variantFlavor) {
188
- return {
189
- flavorConfig: getObjectBlock(productFlavors, variantFlavor),
190
- buildTypeConfig: getObjectBlock(buildTypes, buildTypeName)
191
- };
192
- }
193
- }
194
- }
195
- return undefined;
196
- }
197
- function appendResolvedSuffix(value, suffixSource, context) {
198
- const suffix = resolveGradleScalar(suffixSource, context);
199
- return suffix ? `${value}${suffix}` : value;
200
- }
201
- async function resolveAndroidSentryReleaseAndDist({ projectRoot = process.cwd(), flavor, dist } = {}) {
202
- var _ref, _resolveGradleScalar, _resolveGradleScalar1, _ref1, _normalizeString;
203
- const appGradlePath = _path.default.join(projectRoot, 'android', 'app', 'build.gradle');
204
- const rootGradlePath = _path.default.join(projectRoot, 'android', 'build.gradle');
205
- const appConfig = await parseGradleFile(appGradlePath);
206
- const rootConfig = await parseGradleFile(rootGradlePath);
207
- const androidConfig = getObjectBlock(appConfig, 'android');
208
- const defaultConfig = getObjectBlock(androidConfig, 'defaultConfig');
209
- if (!androidConfig || !defaultConfig) {
210
- return undefined;
211
- }
212
- const context = {
213
- appConfig,
214
- rootConfig,
215
- gradleProperties: readGradleProperties(projectRoot)
216
- };
217
- const selection = pickAndroidVariant(getObjectBlock(androidConfig, 'productFlavors'), getObjectBlock(androidConfig, 'buildTypes'), normalizeString(flavor));
218
- if (!selection) {
219
- return undefined;
220
- }
221
- const { flavorConfig, buildTypeConfig } = selection;
222
- let applicationId = (_ref = (_resolveGradleScalar = resolveGradleScalar(getObjectValue(flavorConfig, 'applicationId'), context)) != null ? _resolveGradleScalar : resolveGradleScalar(getObjectValue(defaultConfig, 'applicationId'), context)) != null ? _ref : resolveGradleScalar(getObjectValue(androidConfig, 'namespace'), context);
223
- let versionName = (_resolveGradleScalar1 = resolveGradleScalar(getObjectValue(flavorConfig, 'versionName'), context)) != null ? _resolveGradleScalar1 : resolveGradleScalar(getObjectValue(defaultConfig, 'versionName'), context);
224
- const versionCode = (_ref1 = (_normalizeString = normalizeString(dist)) != null ? _normalizeString : resolveGradleScalar(getObjectValue(flavorConfig, 'versionCode'), context)) != null ? _ref1 : resolveGradleScalar(getObjectValue(defaultConfig, 'versionCode'), context);
225
- if (!applicationId || !versionName || !versionCode) {
226
- return undefined;
227
- }
228
- applicationId = appendResolvedSuffix(applicationId, getObjectValue(flavorConfig, 'applicationIdSuffix'), context);
229
- applicationId = appendResolvedSuffix(applicationId, getObjectValue(buildTypeConfig, 'applicationIdSuffix'), context);
230
- versionName = appendResolvedSuffix(versionName, getObjectValue(flavorConfig, 'versionNameSuffix'), context);
231
- versionName = appendResolvedSuffix(versionName, getObjectValue(buildTypeConfig, 'versionNameSuffix'), context);
232
- return {
233
- release: `${applicationId}@${versionName}+${versionCode}`,
234
- dist: versionCode
235
- };
236
- }
237
- async function resolveSentryReleaseAndDist(platform, fallbackVersion, options = {}, projectRoot = process.cwd()) {
238
- const releaseOverride = firstString(options.sentryRelease, process.env.SENTRY_RELEASE);
239
- const distOverride = firstString(options.sentryDist, process.env.SENTRY_DIST);
240
- if (releaseOverride) {
241
- return {
242
- release: releaseOverride,
243
- dist: distOverride
244
- };
245
- }
246
- if (platform === 'android') {
247
- const androidRelease = await resolveAndroidSentryReleaseAndDist({
248
- projectRoot,
249
- flavor: firstString(options.sentryFlavor, process.env.PUSHY_SENTRY_FLAVOR, process.env.SENTRY_FLAVOR),
250
- dist: distOverride
251
- });
252
- if (androidRelease) {
253
- console.log(`[pushy/sentry] Using Android native release=${androidRelease.release}, dist=${androidRelease.dist}`);
254
- return androidRelease;
255
- }
256
- }
257
- console.warn(`[pushy/sentry] Falling back to Pushy version "${fallbackVersion}" as Sentry release. ` + 'Set --sentry-release/--sentry-dist, SENTRY_RELEASE/SENTRY_DIST, or --sentry-flavor/PUSHY_SENTRY_FLAVOR for OTA symbolication.');
258
- return {
259
- release: fallbackVersion,
260
- dist: distOverride
261
- };
262
- }