react-native-update-cli 2.15.0 → 2.15.1

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/cli.json CHANGED
@@ -297,6 +297,30 @@
297
297
  },
298
298
  "dryRun": {
299
299
  "default": false
300
+ },
301
+ "sentry-release": {
302
+ "hasValue": true,
303
+ "description": "Sentry release for source map upload"
304
+ },
305
+ "sentryRelease": {
306
+ "hasValue": true,
307
+ "description": "Sentry release for source map upload"
308
+ },
309
+ "sentry-dist": {
310
+ "hasValue": true,
311
+ "description": "Sentry dist for source map upload"
312
+ },
313
+ "sentryDist": {
314
+ "hasValue": true,
315
+ "description": "Sentry dist for source map upload"
316
+ },
317
+ "sentry-flavor": {
318
+ "hasValue": true,
319
+ "description": "Android product flavor or variant for native Sentry release/dist"
320
+ },
321
+ "sentryFlavor": {
322
+ "hasValue": true,
323
+ "description": "Android product flavor or variant for native Sentry release/dist"
300
324
  }
301
325
  }
302
326
  },
@@ -1,3 +1,4 @@
1
+ import { type SentryReleaseOptions } from './utils/sentry-release';
1
2
  export interface BundleCliOptions {
2
3
  taro?: boolean;
3
4
  expo?: boolean;
@@ -19,11 +20,25 @@ type ResolvedExpoCli = {
19
20
  cliPath: string;
20
21
  usingExpo: boolean;
21
22
  };
23
+ type SentryUploadArtifacts = {
24
+ bundlePath: string;
25
+ sourcemapPath: string;
26
+ };
27
+ type BuildSentrySourcemapsUploadArgsOptions = {
28
+ sentryCliPath: string;
29
+ bundlePath: string;
30
+ sourcemapPath: string;
31
+ release: string;
32
+ dist?: string;
33
+ stripPrefix?: string;
34
+ useStandaloneSourcemapsCommand?: boolean;
35
+ };
22
36
  export declare function hasProjectDependency(dependencyName: string, projectRoot?: string): boolean;
23
37
  export declare function resolveExpoCli(projectRoot?: string): ResolvedExpoCli;
24
38
  export declare function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputFolder, platform, sourcemapOutput, config, forceHermes, cli, isSentry, }: RunBundleCommandOptions): Promise<void>;
25
39
  export declare function resolveHermesCommand(projectRoot?: string): string;
26
40
  export declare function copyDebugidForSentry(bundleName: string, outputFolder: string, sourcemapOutput: string): Promise<void>;
27
- export declare function buildSentrySourcemapsUploadArgs(sentryCliPath: string, bundleName: string, outputFolder: string, version: string, useStandaloneSourcemapsCommand?: boolean): string[];
28
- export declare function uploadSourcemapForSentry(bundleName: string, outputFolder: string, sourcemapOutput: string, version: string): Promise<void>;
41
+ export declare function prepareSentryUploadArtifacts(bundleName: string, outputFolder: string, platform: string): SentryUploadArtifacts;
42
+ export declare function buildSentrySourcemapsUploadArgs({ sentryCliPath, bundlePath, sourcemapPath, release, dist, stripPrefix, useStandaloneSourcemapsCommand, }: BuildSentrySourcemapsUploadArgsOptions): string[];
43
+ export declare function uploadSourcemapForSentry(bundleName: string, outputFolder: string, sourcemapOutput: string, version: string, platform?: string, sentryOptions?: SentryReleaseOptions): Promise<void>;
29
44
  export {};
@@ -18,6 +18,9 @@ _export(exports, {
18
18
  get hasProjectDependency () {
19
19
  return hasProjectDependency;
20
20
  },
21
+ get prepareSentryUploadArtifacts () {
22
+ return prepareSentryUploadArtifacts;
23
+ },
21
24
  get resolveExpoCli () {
22
25
  return resolveExpoCli;
23
26
  },
@@ -38,6 +41,7 @@ const _os = /*#__PURE__*/ _interop_require_default(require("os"));
38
41
  const _path = /*#__PURE__*/ _interop_require_default(require("path"));
39
42
  const _i18n = require("./utils/i18n");
40
43
  const _runtime = require("./utils/runtime");
44
+ const _sentryrelease = require("./utils/sentry-release");
41
45
  function _interop_require_default(obj) {
42
46
  return obj && obj.__esModule ? obj : {
43
47
  default: obj
@@ -92,6 +96,7 @@ const dependencyFields = [
92
96
  'peerDependencies',
93
97
  'optionalDependencies'
94
98
  ];
99
+ const ANDROID_SENTRY_BUNDLE_NAME = 'index.android.bundle';
95
100
  function hasProjectDependency(dependencyName, projectRoot = process.cwd()) {
96
101
  try {
97
102
  const packageJson = JSON.parse(_fsextra.readFileSync(_path.default.join(projectRoot, 'package.json'), 'utf8'));
@@ -450,20 +455,44 @@ async function copyDebugidForSentry(bundleName, outputFolder, sourcemapOutput) {
450
455
  }
451
456
  _fsextra.removeSync(_path.default.join(outputFolder, `${bundleName}.txt.map`));
452
457
  }
453
- function buildSentrySourcemapsUploadArgs(sentryCliPath, bundleName, outputFolder, version, useStandaloneSourcemapsCommand = true) {
458
+ function prepareSentryUploadArtifacts(bundleName, outputFolder, platform) {
459
+ const bundlePath = _path.default.join(outputFolder, bundleName);
460
+ const sourcemapPath = _path.default.join(outputFolder, `${bundleName}.map`);
461
+ if (platform !== 'android' || bundleName === ANDROID_SENTRY_BUNDLE_NAME) {
462
+ return {
463
+ bundlePath,
464
+ sourcemapPath
465
+ };
466
+ }
467
+ const androidBundlePath = _path.default.join(outputFolder, ANDROID_SENTRY_BUNDLE_NAME);
468
+ const androidSourcemapPath = _path.default.join(outputFolder, `${ANDROID_SENTRY_BUNDLE_NAME}.map`);
469
+ _fsextra.copyFileSync(bundlePath, androidBundlePath);
470
+ const sourcemap = JSON.parse(_fsextra.readFileSync(sourcemapPath, 'utf8'));
471
+ sourcemap.file = ANDROID_SENTRY_BUNDLE_NAME;
472
+ _fsextra.writeFileSync(androidSourcemapPath, JSON.stringify(sourcemap));
473
+ return {
474
+ bundlePath: androidBundlePath,
475
+ sourcemapPath: androidSourcemapPath
476
+ };
477
+ }
478
+ function buildSentrySourcemapsUploadArgs({ sentryCliPath, bundlePath, sourcemapPath, release, dist, stripPrefix = process.cwd(), useStandaloneSourcemapsCommand = true }) {
454
479
  const uploadArgs = [
455
480
  '--strip-prefix',
456
- _path.default.join(process.cwd(), outputFolder),
457
- _path.default.join(outputFolder, bundleName),
458
- _path.default.join(outputFolder, `${bundleName}.map`)
481
+ stripPrefix,
482
+ bundlePath,
483
+ sourcemapPath
459
484
  ];
460
485
  if (!useStandaloneSourcemapsCommand) {
461
486
  return [
462
487
  sentryCliPath,
463
488
  'releases',
464
489
  'files',
465
- version,
490
+ release,
466
491
  'upload-sourcemaps',
492
+ ...dist ? [
493
+ '--dist',
494
+ dist
495
+ ] : [],
467
496
  ...uploadArgs
468
497
  ];
469
498
  }
@@ -472,7 +501,11 @@ function buildSentrySourcemapsUploadArgs(sentryCliPath, bundleName, outputFolder
472
501
  'sourcemaps',
473
502
  'upload',
474
503
  '--release',
475
- version,
504
+ release,
505
+ ...dist ? [
506
+ '--dist',
507
+ dist
508
+ ] : [],
476
509
  ...uploadArgs
477
510
  ];
478
511
  }
@@ -487,7 +520,7 @@ function supportsStandaloneSentrySourcemapsUpload(sentryCliPath) {
487
520
  });
488
521
  return !result.error && result.status === 0;
489
522
  }
490
- async function uploadSourcemapForSentry(bundleName, outputFolder, sourcemapOutput, version) {
523
+ async function uploadSourcemapForSentry(bundleName, outputFolder, sourcemapOutput, version, platform = '', sentryOptions = {}) {
491
524
  if (!sourcemapOutput) {
492
525
  return;
493
526
  }
@@ -505,20 +538,29 @@ async function uploadSourcemapForSentry(bundleName, outputFolder, sourcemapOutpu
505
538
  if (!_fsextra.existsSync(sentryCliPath)) {
506
539
  return;
507
540
  }
541
+ const { release, dist } = await (0, _sentryrelease.resolveSentryReleaseAndDist)(platform, version, sentryOptions);
542
+ const { bundlePath, sourcemapPath } = prepareSentryUploadArtifacts(bundleName, outputFolder, platform);
508
543
  assertSuccessfulSyncProcess((0, _runtime.spawnJavaScriptSync)([
509
544
  sentryCliPath,
510
545
  'releases',
511
546
  'set-commits',
512
- version,
547
+ release,
513
548
  '--auto'
514
549
  ], {
515
550
  stdio: 'inherit'
516
551
  }), sentryCliPath);
517
552
  console.log((0, _i18n.t)('sentryReleaseCreated', {
518
- version
553
+ version: release
519
554
  }));
520
555
  console.log((0, _i18n.t)('uploadingSourcemap'));
521
- assertSuccessfulSyncProcess((0, _runtime.spawnJavaScriptSync)(buildSentrySourcemapsUploadArgs(sentryCliPath, bundleName, outputFolder, version, supportsStandaloneSentrySourcemapsUpload(sentryCliPath)), {
556
+ assertSuccessfulSyncProcess((0, _runtime.spawnJavaScriptSync)(buildSentrySourcemapsUploadArgs({
557
+ sentryCliPath,
558
+ bundlePath,
559
+ sourcemapPath,
560
+ release,
561
+ dist,
562
+ useStandaloneSourcemapsCommand: supportsStandaloneSentrySourcemapsUpload(sentryCliPath)
563
+ }), {
522
564
  stdio: 'inherit'
523
565
  }), sentryCliPath);
524
566
  }
package/lib/bundle.js CHANGED
@@ -25,6 +25,10 @@ function _interop_require_default(obj) {
25
25
  default: obj
26
26
  };
27
27
  }
28
+ function getAliasedOptionalStringOption(options, key, alias) {
29
+ var _getOptionalStringOption;
30
+ return (_getOptionalStringOption = (0, _options.getOptionalStringOption)(options, key)) != null ? _getOptionalStringOption : (0, _options.getOptionalStringOption)(options, alias);
31
+ }
28
32
  function normalizeBundleOptions(translatedOptions, platform) {
29
33
  return {
30
34
  bundleName: (0, _options.getStringOption)(translatedOptions, 'bundleName', 'index.bundlejs'),
@@ -46,15 +50,18 @@ function normalizeBundleOptions(translatedOptions, platform) {
46
50
  maxPackageVersion: (0, _options.getOptionalStringOption)(translatedOptions, 'maxPackageVersion'),
47
51
  packageVersionRange: (0, _options.getOptionalStringOption)(translatedOptions, 'packageVersionRange'),
48
52
  rollout: (0, _options.getOptionalStringOption)(translatedOptions, 'rollout'),
49
- dryRun: (0, _options.getBooleanOption)(translatedOptions, 'dryRun', false)
53
+ dryRun: (0, _options.getBooleanOption)(translatedOptions, 'dryRun', false),
54
+ sentryRelease: getAliasedOptionalStringOption(translatedOptions, 'sentry-release', 'sentryRelease'),
55
+ sentryDist: getAliasedOptionalStringOption(translatedOptions, 'sentry-dist', 'sentryDist'),
56
+ sentryFlavor: getAliasedOptionalStringOption(translatedOptions, 'sentry-flavor', 'sentryFlavor')
50
57
  };
51
58
  }
52
- async function uploadSentryArtifactsIfNeeded(shouldUpload, bundleName, intermediaDir, sourcemapOutput, versionName) {
59
+ async function uploadSentryArtifactsIfNeeded(shouldUpload, bundleName, intermediaDir, sourcemapOutput, versionName, platform, sentryOptions) {
53
60
  if (!shouldUpload) {
54
61
  return;
55
62
  }
56
63
  await (0, _bundlerunner.copyDebugidForSentry)(bundleName, intermediaDir, sourcemapOutput);
57
- await (0, _bundlerunner.uploadSourcemapForSentry)(bundleName, intermediaDir, sourcemapOutput, versionName);
64
+ await (0, _bundlerunner.uploadSourcemapForSentry)(bundleName, intermediaDir, sourcemapOutput, versionName, platform, sentryOptions);
58
65
  }
59
66
  async function publishBundleVersion(outputPath, platform, payload) {
60
67
  return _versions.versionCommands.publish({
@@ -114,14 +121,22 @@ const bundleCommands = {
114
121
  rollout: normalized.rollout,
115
122
  dryRun: normalized.dryRun
116
123
  });
117
- await uploadSentryArtifactsIfNeeded(bundleParams.sentry, normalized.bundleName, normalized.intermediaDir, sourcemapOutput, versionName);
124
+ await uploadSentryArtifactsIfNeeded(bundleParams.sentry, normalized.bundleName, normalized.intermediaDir, sourcemapOutput, versionName, platform, {
125
+ sentryRelease: normalized.sentryRelease,
126
+ sentryDist: normalized.sentryDist,
127
+ sentryFlavor: normalized.sentryFlavor
128
+ });
118
129
  return;
119
130
  }
120
131
  if (!(0, _options.getBooleanOption)(options, 'no-interactive', false)) {
121
132
  const v = await (0, _utils.question)((0, _i18n.t)('uploadBundlePrompt'));
122
133
  if (v.toLowerCase() === 'y') {
123
134
  const versionName = await publishBundleVersion(realOutput, platform, {});
124
- await uploadSentryArtifactsIfNeeded(bundleParams.sentry, normalized.bundleName, normalized.intermediaDir, sourcemapOutput, versionName);
135
+ await uploadSentryArtifactsIfNeeded(bundleParams.sentry, normalized.bundleName, normalized.intermediaDir, sourcemapOutput, versionName, platform, {
136
+ sentryRelease: normalized.sentryRelease,
137
+ sentryDist: normalized.sentryDist,
138
+ sentryFlavor: normalized.sentryFlavor
139
+ });
125
140
  }
126
141
  }
127
142
  }
package/lib/provider.js CHANGED
@@ -105,7 +105,10 @@ class CLIProviderImpl {
105
105
  taro: options.taro || false,
106
106
  expo: options.expo || false,
107
107
  rncli: options.rncli || false,
108
- hermes: options.hermes || false
108
+ hermes: options.hermes || false,
109
+ sentryRelease: options.sentryRelease,
110
+ sentryDist: options.sentryDist,
111
+ sentryFlavor: options.sentryFlavor
109
112
  });
110
113
  const { bundleCommands } = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./bundle")));
111
114
  await bundleCommands.bundle(context);
package/lib/types.d.ts CHANGED
@@ -47,6 +47,9 @@ export interface BundleOptions {
47
47
  expo?: boolean;
48
48
  rncli?: boolean;
49
49
  hermes?: boolean;
50
+ sentryRelease?: string;
51
+ sentryDist?: string;
52
+ sentryFlavor?: string;
50
53
  }
51
54
  export interface PublishOptions {
52
55
  filePath?: string;
@@ -1,7 +1,7 @@
1
1
  import { checkPlugins } from './check-plugin';
2
2
  export declare function isNonInteractive(): boolean;
3
3
  export declare function question(query: string, password?: boolean): Promise<string>;
4
- export declare function translateOptions<T extends Record<string, unknown>>(options: T): T & Record<string, unknown>;
4
+ export declare function translateOptions<T extends Record<string, unknown>>(options: T, map?: Record<string, string>): T & Record<string, unknown>;
5
5
  export declare function getApkInfo(fn: string): Promise<{
6
6
  versionName: string;
7
7
  buildTime: number;
@@ -69,24 +69,37 @@ async function question(query, password) {
69
69
  replace: password ? '*' : undefined
70
70
  });
71
71
  }
72
- function translateOptions(options) {
73
- const ret = {};
74
- for(const key in options){
75
- const value = options[key];
76
- if (typeof value === 'string') {
77
- ret[key] = value.replace(/\$\{(\w+)\}/g, (placeholder, name)=>{
78
- var _options_name;
79
- const replacement = (_options_name = options[name]) != null ? _options_name : process.env[name];
80
- if (typeof replacement === 'string' || typeof replacement === 'number' || typeof replacement === 'boolean') {
81
- return String(replacement);
82
- }
83
- return placeholder;
84
- });
85
- } else {
86
- ret[key] = value;
72
+ function translateOptions(options, map) {
73
+ if (!map) {
74
+ // Existing logic for template replacement if no map is provided
75
+ const ret = {};
76
+ for(const key in options){
77
+ const value = options[key];
78
+ if (typeof value === 'string') {
79
+ ret[key] = value.replace(/\$\{(\w+)\}/g, (placeholder, name)=>{
80
+ var _options_name;
81
+ const replacement = (_options_name = options[name]) != null ? _options_name : process.env[name];
82
+ if (typeof replacement === 'string' || typeof replacement === 'number' || typeof replacement === 'boolean') {
83
+ return String(replacement);
84
+ }
85
+ return placeholder;
86
+ });
87
+ } else {
88
+ ret[key] = value;
89
+ }
90
+ }
91
+ return ret;
92
+ }
93
+ const result = {
94
+ ...options
95
+ };
96
+ for (const [key, value] of Object.entries(map)){
97
+ if (result[key] !== undefined) {
98
+ result[value] = result[key];
99
+ delete result[key];
87
100
  }
88
101
  }
89
- return ret;
102
+ return result;
90
103
  }
91
104
  async function getApkInfo(fn) {
92
105
  const appInfoParser = new _appinfoparser.default(fn);
@@ -0,0 +1,15 @@
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>;
@@ -0,0 +1,262 @@
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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update-cli",
3
- "version": "2.15.0",
3
+ "version": "2.15.1",
4
4
  "description": "command line tool for react-native-update (remote updates for react native)",
5
5
  "main": "lib/exports.js",
6
6
  "types": "lib/exports.d.ts",
@@ -91,8 +91,8 @@
91
91
  },
92
92
  "devDependencies": {
93
93
  "@biomejs/biome": "^2.4.12",
94
- "@swc/cli": "0.8.1",
95
- "@swc/core": "^1.15.26",
94
+ "@swc/cli": "^0.8.1",
95
+ "@swc/core": "^1.15.41",
96
96
  "@types/bun": "^1.3.12",
97
97
  "@types/filesize-parser": "^1.5.3",
98
98
  "@types/fs-extra": "^11.0.4",