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.
- package/README.md +18 -0
- package/README.zh-CN.md +18 -0
- package/cli.json +0 -14
- package/lib/bin-cresc.d.ts +1 -0
- package/lib/bin-cresc.js +7 -0
- package/lib/bin.js +2 -2
- package/lib/bundle-runner.d.ts +19 -5
- package/lib/bundle-runner.js +164 -27
- package/lib/bundle.js +9 -12
- package/lib/diff.js +4 -0
- package/lib/install.js +30 -3
- package/lib/locales/en.d.ts +2 -0
- package/lib/locales/en.js +2 -0
- package/lib/locales/zh.d.ts +2 -0
- package/lib/locales/zh.js +2 -0
- package/lib/package.js +5 -1
- package/lib/provider.js +1 -2
- package/lib/types.d.ts +0 -1
- package/lib/utils/app-info-parser/aab.js +4 -4
- package/lib/utils/app-info-parser/xml-parser/manifest.js +3 -1
- package/lib/utils/constants.d.ts +1 -1
- package/lib/utils/constants.js +2 -1
- package/lib/utils/zip-entries.js +4 -0
- package/lib/versions.d.ts +2 -0
- package/lib/versions.js +12 -3
- package/package.json +5 -5
- package/src/bin-cresc.ts +8 -0
- package/src/bin.ts +2 -2
- package/src/bundle-runner.ts +267 -44
- package/src/bundle.ts +4 -20
- package/src/diff.ts +6 -1
- package/src/install.ts +32 -3
- package/src/locales/en.ts +3 -0
- package/src/locales/zh.ts +3 -0
- package/src/package.ts +3 -3
- package/src/provider.ts +0 -1
- package/src/types.ts +0 -1
- package/src/utils/app-info-parser/aab.ts +4 -4
- package/src/utils/app-info-parser/xml-parser/manifest.ts +6 -3
- package/src/utils/constants.ts +5 -1
- package/src/utils/zip-entries.ts +4 -0
- package/src/versions.ts +10 -6
- package/lib/utils/sentry-release.d.ts +0 -15
- package/lib/utils/sentry-release.js +0 -262
- package/src/utils/sentry-release.ts +0 -381
package/lib/utils/constants.d.ts
CHANGED
package/lib/utils/constants.js
CHANGED
|
@@ -43,7 +43,8 @@ function _interop_require_default(obj) {
|
|
|
43
43
|
default: obj
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
var _process_argv_;
|
|
47
|
+
const scriptName = process.env.RNU_BRAND === 'cresc' || _path.default.basename((_process_argv_ = process.argv[1]) != null ? _process_argv_ : '') === 'cresc' ? 'cresc' : 'pushy';
|
|
47
48
|
const IS_CRESC = scriptName === 'cresc';
|
|
48
49
|
const ppkBundleFileNames = [
|
|
49
50
|
'index.bundlejs',
|
package/lib/utils/zip-entries.js
CHANGED
|
@@ -181,6 +181,7 @@ async function enumZipEntries(zipFn, callback, nestedPath = '') {
|
|
|
181
181
|
zipfile.openReadStream(entry, async (err, readStream)=>{
|
|
182
182
|
if (err) return rej(err);
|
|
183
183
|
const writeStream = _fsextra.createWriteStream(tempZipPath);
|
|
184
|
+
readStream.on('error', rej);
|
|
184
185
|
readStream.pipe(writeStream);
|
|
185
186
|
writeStream.on('finish', ()=>res(void 0));
|
|
186
187
|
writeStream.on('error', rej);
|
|
@@ -197,6 +198,9 @@ async function enumZipEntries(zipFn, callback, nestedPath = '') {
|
|
|
197
198
|
console.error((0, _i18n.t)('processingError', {
|
|
198
199
|
error
|
|
199
200
|
}));
|
|
201
|
+
zipfile.close();
|
|
202
|
+
reject(error);
|
|
203
|
+
return;
|
|
200
204
|
}
|
|
201
205
|
zipfile.readEntry();
|
|
202
206
|
});
|
package/lib/versions.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ interface VersionCommandOptions {
|
|
|
19
19
|
warnDepsChanges?: boolean;
|
|
20
20
|
'no-interactive'?: boolean | string;
|
|
21
21
|
}
|
|
22
|
+
type Deps = Record<string, string>;
|
|
23
|
+
export declare function normalizeDeps(input: unknown): Deps | undefined;
|
|
22
24
|
export declare function fetchVersions(appId: string, offset?: number, limit?: number): Promise<Version[]>;
|
|
23
25
|
export declare const bindVersionToPackages: ({ appId, versionId, pkgs, rollout, dryRun, }: {
|
|
24
26
|
appId: string;
|
package/lib/versions.js
CHANGED
|
@@ -15,6 +15,9 @@ _export(exports, {
|
|
|
15
15
|
get fetchVersions () {
|
|
16
16
|
return fetchVersions;
|
|
17
17
|
},
|
|
18
|
+
get normalizeDeps () {
|
|
19
|
+
return normalizeDeps;
|
|
20
|
+
},
|
|
18
21
|
get versionCommands () {
|
|
19
22
|
return versionCommands;
|
|
20
23
|
}
|
|
@@ -295,7 +298,7 @@ async function chooseVersion(appId) {
|
|
|
295
298
|
default:
|
|
296
299
|
{
|
|
297
300
|
const versionId = Number.parseInt(cmd, 10);
|
|
298
|
-
const v = data.find((version)=>version.id === String(versionId));
|
|
301
|
+
const v = data.find((version)=>String(version.id) === String(versionId));
|
|
299
302
|
if (v) {
|
|
300
303
|
return v;
|
|
301
304
|
}
|
|
@@ -309,6 +312,7 @@ const bindVersionToPackages = async ({ appId, versionId, pkgs, rollout, dryRun }
|
|
|
309
312
|
}
|
|
310
313
|
if (rollout !== undefined) {
|
|
311
314
|
console.log(`${(0, _i18n.t)('rolloutConfigSet', {
|
|
315
|
+
version: versionId,
|
|
312
316
|
versions: pkgs.map((pkg)=>pkg.name).join(', '),
|
|
313
317
|
rollout: rollout
|
|
314
318
|
})}`);
|
|
@@ -441,6 +445,10 @@ const versionCommands = {
|
|
|
441
445
|
appId
|
|
442
446
|
}));
|
|
443
447
|
}
|
|
448
|
+
const pkgMap = new Map(allPkgs.map((pkg)=>[
|
|
449
|
+
String(pkg.id),
|
|
450
|
+
pkg
|
|
451
|
+
]));
|
|
444
452
|
let pkgsToBind = [];
|
|
445
453
|
if (minPkgVersion) {
|
|
446
454
|
minPkgVersion = String(minPkgVersion).trim();
|
|
@@ -490,7 +498,7 @@ const versionCommands = {
|
|
|
490
498
|
if (!pkgId) {
|
|
491
499
|
throw new Error((0, _i18n.t)('packageIdRequired'));
|
|
492
500
|
}
|
|
493
|
-
const pkg =
|
|
501
|
+
const pkg = pkgMap.get(String(pkgId));
|
|
494
502
|
if (pkg) {
|
|
495
503
|
pkgsToBind = [
|
|
496
504
|
pkg
|
|
@@ -511,7 +519,8 @@ const versionCommands = {
|
|
|
511
519
|
}
|
|
512
520
|
await bindVersionToPackages({
|
|
513
521
|
appId: String(appId),
|
|
514
|
-
|
|
522
|
+
// keep null as-is: `--versionId null` means unbinding the version
|
|
523
|
+
versionId: versionId != null ? versionId : null,
|
|
515
524
|
pkgs: pkgsToBind,
|
|
516
525
|
rollout,
|
|
517
526
|
dryRun: options.dryRun
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-update-cli",
|
|
3
|
-
"version": "2.15.
|
|
3
|
+
"version": "2.15.3",
|
|
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",
|
|
7
7
|
"bin": {
|
|
8
8
|
"pushy": "lib/bin.js",
|
|
9
|
-
"cresc": "lib/bin.js"
|
|
9
|
+
"cresc": "lib/bin-cresc.js"
|
|
10
10
|
},
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"cli.json"
|
|
33
33
|
],
|
|
34
34
|
"scripts": {
|
|
35
|
-
"build": "rm -rf lib && swc src -d lib --strip-leading-paths && bun run typecheck:build && chmod +x lib/bin.js",
|
|
35
|
+
"build": "rm -rf lib && swc src -d lib --strip-leading-paths && bun run typecheck:build && chmod +x lib/bin.js lib/bin-cresc.js",
|
|
36
36
|
"prepublishOnly": "bun run build",
|
|
37
37
|
"typecheck": "tsc --noEmit",
|
|
38
38
|
"typecheck:build": "tsc -p tsconfig.build.json",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"compare-versions": "^6.1.1",
|
|
68
68
|
"filesize-parser": "^1.5.1",
|
|
69
69
|
"form-data": "^4.0.5",
|
|
70
|
-
"fs-extra": "
|
|
70
|
+
"fs-extra": "^11.3.5",
|
|
71
71
|
"global-dirs": "^4.0.0",
|
|
72
72
|
"gradle-to-js": "^2.0.1",
|
|
73
73
|
"i18next": "^26.0.4",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"@xmldom/xmldom": "0.8.13"
|
|
88
88
|
},
|
|
89
89
|
"engines": {
|
|
90
|
-
"node": ">=
|
|
90
|
+
"node": ">= 18.17.0"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@biomejs/biome": "^2.4.12",
|
package/src/bin-cresc.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Dedicated entry for the `cresc` bin so brand detection does not depend on
|
|
4
|
+
// process.argv[1], which on Windows npm shims always points to the js file
|
|
5
|
+
// instead of the invoked command name.
|
|
6
|
+
process.env.RNU_BRAND = 'cresc';
|
|
7
|
+
|
|
8
|
+
require('./bin');
|
package/src/bin.ts
CHANGED
package/src/bundle-runner.ts
CHANGED
|
@@ -9,10 +9,6 @@ import {
|
|
|
9
9
|
spawnJavaScript,
|
|
10
10
|
spawnJavaScriptSync,
|
|
11
11
|
} from './utils/runtime';
|
|
12
|
-
import {
|
|
13
|
-
resolveSentryReleaseAndDist,
|
|
14
|
-
type SentryReleaseOptions,
|
|
15
|
-
} from './utils/sentry-release';
|
|
16
12
|
|
|
17
13
|
const g2js = require('gradle-to-js/lib/parser');
|
|
18
14
|
const properties = require('properties');
|
|
@@ -68,14 +64,31 @@ type BuildSentrySourcemapsUploadArgsOptions = {
|
|
|
68
64
|
sentryCliPath: string;
|
|
69
65
|
bundlePath: string;
|
|
70
66
|
sourcemapPath: string;
|
|
71
|
-
release
|
|
67
|
+
release?: string;
|
|
72
68
|
dist?: string;
|
|
73
69
|
stripPrefix?: string;
|
|
70
|
+
debugIdReference?: boolean;
|
|
74
71
|
useStandaloneSourcemapsCommand?: boolean;
|
|
75
72
|
};
|
|
76
73
|
|
|
77
74
|
const ANDROID_SENTRY_BUNDLE_NAME = 'index.android.bundle';
|
|
78
75
|
|
|
76
|
+
export interface SentryUploadOptions {
|
|
77
|
+
sentryRelease?: string;
|
|
78
|
+
sentryDist?: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
type SentryUploadMode =
|
|
82
|
+
| {
|
|
83
|
+
type: 'debug-id';
|
|
84
|
+
debugId: string;
|
|
85
|
+
}
|
|
86
|
+
| {
|
|
87
|
+
type: 'release';
|
|
88
|
+
release: string;
|
|
89
|
+
dist?: string;
|
|
90
|
+
};
|
|
91
|
+
|
|
79
92
|
export function hasProjectDependency(
|
|
80
93
|
dependencyName: string,
|
|
81
94
|
projectRoot = process.cwd(),
|
|
@@ -397,6 +410,11 @@ function assertSuccessfulSyncProcess(
|
|
|
397
410
|
}
|
|
398
411
|
}
|
|
399
412
|
|
|
413
|
+
function normalizeString(value: string | undefined): string | undefined {
|
|
414
|
+
const normalized = value?.trim();
|
|
415
|
+
return normalized ? normalized : undefined;
|
|
416
|
+
}
|
|
417
|
+
|
|
400
418
|
export function resolveHermesCommand(projectRoot = process.cwd()): string {
|
|
401
419
|
const osBin = getHermesOSBin();
|
|
402
420
|
if (!osBin) {
|
|
@@ -578,11 +596,11 @@ export async function copyDebugidForSentry(
|
|
|
578
596
|
fs.removeSync(path.join(outputFolder, `${bundleName}.txt.map`));
|
|
579
597
|
}
|
|
580
598
|
|
|
581
|
-
export function prepareSentryUploadArtifacts(
|
|
599
|
+
export async function prepareSentryUploadArtifacts(
|
|
582
600
|
bundleName: string,
|
|
583
601
|
outputFolder: string,
|
|
584
602
|
platform: string,
|
|
585
|
-
): SentryUploadArtifacts {
|
|
603
|
+
): Promise<SentryUploadArtifacts> {
|
|
586
604
|
const bundlePath = path.join(outputFolder, bundleName);
|
|
587
605
|
const sourcemapPath = path.join(outputFolder, `${bundleName}.map`);
|
|
588
606
|
|
|
@@ -598,13 +616,13 @@ export function prepareSentryUploadArtifacts(
|
|
|
598
616
|
outputFolder,
|
|
599
617
|
`${ANDROID_SENTRY_BUNDLE_NAME}.map`,
|
|
600
618
|
);
|
|
601
|
-
fs.
|
|
619
|
+
await fs.promises.copyFile(bundlePath, androidBundlePath);
|
|
602
620
|
|
|
603
621
|
const sourcemap = JSON.parse(
|
|
604
|
-
fs.
|
|
622
|
+
await fs.promises.readFile(sourcemapPath, 'utf8'),
|
|
605
623
|
) as Record<string, unknown>;
|
|
606
624
|
sourcemap.file = ANDROID_SENTRY_BUNDLE_NAME;
|
|
607
|
-
fs.
|
|
625
|
+
await fs.promises.writeFile(androidSourcemapPath, JSON.stringify(sourcemap));
|
|
608
626
|
|
|
609
627
|
return {
|
|
610
628
|
bundlePath: androidBundlePath,
|
|
@@ -612,6 +630,75 @@ export function prepareSentryUploadArtifacts(
|
|
|
612
630
|
};
|
|
613
631
|
}
|
|
614
632
|
|
|
633
|
+
export async function readSourcemapDebugId(
|
|
634
|
+
sourcemapPath: string,
|
|
635
|
+
): Promise<string | undefined> {
|
|
636
|
+
try {
|
|
637
|
+
const sourcemap = JSON.parse(
|
|
638
|
+
await fs.promises.readFile(sourcemapPath, 'utf8'),
|
|
639
|
+
) as Record<string, unknown>;
|
|
640
|
+
const debugId = sourcemap.debugId ?? sourcemap.debug_id;
|
|
641
|
+
return typeof debugId === 'string' ? normalizeString(debugId) : undefined;
|
|
642
|
+
} catch {
|
|
643
|
+
return undefined;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
function resolveSentryReleaseFromValues(
|
|
648
|
+
releaseValue: string | undefined,
|
|
649
|
+
distValue: string | undefined,
|
|
650
|
+
): { release: string; dist?: string } | undefined {
|
|
651
|
+
const release = normalizeString(releaseValue);
|
|
652
|
+
if (!release) {
|
|
653
|
+
return undefined;
|
|
654
|
+
}
|
|
655
|
+
return {
|
|
656
|
+
release,
|
|
657
|
+
dist: normalizeString(distValue),
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
export async function resolveSentryUploadMode(
|
|
662
|
+
sourcemapPath: string,
|
|
663
|
+
options: SentryUploadOptions = {},
|
|
664
|
+
): Promise<SentryUploadMode> {
|
|
665
|
+
const optionRelease = resolveSentryReleaseFromValues(
|
|
666
|
+
options.sentryRelease,
|
|
667
|
+
options.sentryDist,
|
|
668
|
+
);
|
|
669
|
+
if (optionRelease) {
|
|
670
|
+
return {
|
|
671
|
+
type: 'release',
|
|
672
|
+
...optionRelease,
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
const debugId = await readSourcemapDebugId(sourcemapPath);
|
|
677
|
+
if (debugId) {
|
|
678
|
+
return {
|
|
679
|
+
type: 'debug-id',
|
|
680
|
+
debugId,
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
const environmentRelease = resolveSentryReleaseFromValues(
|
|
685
|
+
process.env.SENTRY_RELEASE,
|
|
686
|
+
process.env.SENTRY_DIST,
|
|
687
|
+
);
|
|
688
|
+
if (environmentRelease) {
|
|
689
|
+
return {
|
|
690
|
+
type: 'release',
|
|
691
|
+
...environmentRelease,
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
throw new Error(
|
|
696
|
+
'[pushy/sentry] Generated source map does not contain a Debug ID. ' +
|
|
697
|
+
'Add @sentry/react-native/metro to metro.config.js so the OTA bundle can be matched by Debug ID, ' +
|
|
698
|
+
'or set --sentry-release/--sentry-dist (or SENTRY_RELEASE/SENTRY_DIST) for legacy release matching.',
|
|
699
|
+
);
|
|
700
|
+
}
|
|
701
|
+
|
|
615
702
|
export function buildSentrySourcemapsUploadArgs({
|
|
616
703
|
sentryCliPath,
|
|
617
704
|
bundlePath,
|
|
@@ -619,10 +706,32 @@ export function buildSentrySourcemapsUploadArgs({
|
|
|
619
706
|
release,
|
|
620
707
|
dist,
|
|
621
708
|
stripPrefix = process.cwd(),
|
|
709
|
+
debugIdReference = false,
|
|
622
710
|
useStandaloneSourcemapsCommand = true,
|
|
623
711
|
}: BuildSentrySourcemapsUploadArgsOptions): string[] {
|
|
624
712
|
const uploadArgs = ['--strip-prefix', stripPrefix, bundlePath, sourcemapPath];
|
|
625
713
|
|
|
714
|
+
if (debugIdReference) {
|
|
715
|
+
if (!useStandaloneSourcemapsCommand) {
|
|
716
|
+
throw new Error(
|
|
717
|
+
'[pushy/sentry] Debug ID upload requires sentry-cli sourcemaps upload.',
|
|
718
|
+
);
|
|
719
|
+
}
|
|
720
|
+
return [
|
|
721
|
+
sentryCliPath,
|
|
722
|
+
'sourcemaps',
|
|
723
|
+
'upload',
|
|
724
|
+
'--debug-id-reference',
|
|
725
|
+
...uploadArgs,
|
|
726
|
+
];
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
if (!release) {
|
|
730
|
+
throw new Error(
|
|
731
|
+
'[pushy/sentry] Legacy Sentry sourcemap upload requires a release.',
|
|
732
|
+
);
|
|
733
|
+
}
|
|
734
|
+
|
|
626
735
|
if (!useStandaloneSourcemapsCommand) {
|
|
627
736
|
return [
|
|
628
737
|
sentryCliPath,
|
|
@@ -656,13 +765,70 @@ function supportsStandaloneSentrySourcemapsUpload(sentryCliPath: string) {
|
|
|
656
765
|
return !result.error && result.status === 0;
|
|
657
766
|
}
|
|
658
767
|
|
|
768
|
+
function supportsSentryDebugIdReference(sentryCliPath: string) {
|
|
769
|
+
const result = spawnJavaScriptSync(
|
|
770
|
+
[sentryCliPath, 'sourcemaps', 'upload', '--help'],
|
|
771
|
+
{
|
|
772
|
+
encoding: 'utf8',
|
|
773
|
+
},
|
|
774
|
+
);
|
|
775
|
+
return (
|
|
776
|
+
!result.error &&
|
|
777
|
+
result.status === 0 &&
|
|
778
|
+
typeof result.stdout === 'string' &&
|
|
779
|
+
result.stdout.includes('--debug-id-reference')
|
|
780
|
+
);
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
function runSentryCli(args: string[]): SyncProcessResult {
|
|
784
|
+
return spawnJavaScriptSync(args, {
|
|
785
|
+
stdio: 'inherit',
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
function uploadSourcemapsWithRelease({
|
|
790
|
+
sentryCliPath,
|
|
791
|
+
bundlePath,
|
|
792
|
+
sourcemapPath,
|
|
793
|
+
release,
|
|
794
|
+
dist,
|
|
795
|
+
useStandaloneSourcemapsCommand,
|
|
796
|
+
}: {
|
|
797
|
+
sentryCliPath: string;
|
|
798
|
+
bundlePath: string;
|
|
799
|
+
sourcemapPath: string;
|
|
800
|
+
release: string;
|
|
801
|
+
dist?: string;
|
|
802
|
+
useStandaloneSourcemapsCommand: boolean;
|
|
803
|
+
}): void {
|
|
804
|
+
assertSuccessfulSyncProcess(
|
|
805
|
+
runSentryCli([sentryCliPath, 'releases', 'set-commits', release, '--auto']),
|
|
806
|
+
sentryCliPath,
|
|
807
|
+
);
|
|
808
|
+
console.log(t('sentryReleaseCreated', { version: release }));
|
|
809
|
+
|
|
810
|
+
console.log(t('uploadingSourcemap'));
|
|
811
|
+
assertSuccessfulSyncProcess(
|
|
812
|
+
runSentryCli(
|
|
813
|
+
buildSentrySourcemapsUploadArgs({
|
|
814
|
+
sentryCliPath,
|
|
815
|
+
bundlePath,
|
|
816
|
+
sourcemapPath,
|
|
817
|
+
release,
|
|
818
|
+
dist,
|
|
819
|
+
useStandaloneSourcemapsCommand,
|
|
820
|
+
}),
|
|
821
|
+
),
|
|
822
|
+
sentryCliPath,
|
|
823
|
+
);
|
|
824
|
+
}
|
|
825
|
+
|
|
659
826
|
export async function uploadSourcemapForSentry(
|
|
660
827
|
bundleName: string,
|
|
661
828
|
outputFolder: string,
|
|
662
829
|
sourcemapOutput: string,
|
|
663
|
-
version: string,
|
|
664
830
|
platform = '',
|
|
665
|
-
sentryOptions:
|
|
831
|
+
sentryOptions: SentryUploadOptions = {},
|
|
666
832
|
): Promise<void> {
|
|
667
833
|
if (!sourcemapOutput) {
|
|
668
834
|
return;
|
|
@@ -682,44 +848,101 @@ export async function uploadSourcemapForSentry(
|
|
|
682
848
|
return;
|
|
683
849
|
}
|
|
684
850
|
|
|
685
|
-
const {
|
|
686
|
-
platform,
|
|
687
|
-
version,
|
|
688
|
-
sentryOptions,
|
|
689
|
-
);
|
|
690
|
-
const { bundlePath, sourcemapPath } = prepareSentryUploadArtifacts(
|
|
851
|
+
const { bundlePath, sourcemapPath } = await prepareSentryUploadArtifacts(
|
|
691
852
|
bundleName,
|
|
692
853
|
outputFolder,
|
|
693
854
|
platform,
|
|
694
855
|
);
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
[sentryCliPath, 'releases', 'set-commits', release, '--auto'],
|
|
699
|
-
{
|
|
700
|
-
stdio: 'inherit',
|
|
701
|
-
},
|
|
702
|
-
),
|
|
703
|
-
sentryCliPath,
|
|
856
|
+
const uploadMode = await resolveSentryUploadMode(
|
|
857
|
+
sourcemapPath,
|
|
858
|
+
sentryOptions,
|
|
704
859
|
);
|
|
705
|
-
|
|
860
|
+
const useStandaloneSourcemapsCommand =
|
|
861
|
+
supportsStandaloneSentrySourcemapsUpload(sentryCliPath);
|
|
862
|
+
|
|
863
|
+
if (uploadMode.type === 'release') {
|
|
864
|
+
uploadSourcemapsWithRelease({
|
|
865
|
+
sentryCliPath,
|
|
866
|
+
bundlePath,
|
|
867
|
+
sourcemapPath,
|
|
868
|
+
release: uploadMode.release,
|
|
869
|
+
dist: uploadMode.dist,
|
|
870
|
+
useStandaloneSourcemapsCommand,
|
|
871
|
+
});
|
|
872
|
+
return;
|
|
873
|
+
}
|
|
706
874
|
|
|
707
875
|
console.log(t('uploadingSourcemap'));
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
876
|
+
if (
|
|
877
|
+
!useStandaloneSourcemapsCommand ||
|
|
878
|
+
!supportsSentryDebugIdReference(sentryCliPath)
|
|
879
|
+
) {
|
|
880
|
+
const explicitRelease =
|
|
881
|
+
resolveSentryReleaseFromValues(
|
|
882
|
+
sentryOptions.sentryRelease,
|
|
883
|
+
sentryOptions.sentryDist,
|
|
884
|
+
) ??
|
|
885
|
+
resolveSentryReleaseFromValues(
|
|
886
|
+
process.env.SENTRY_RELEASE,
|
|
887
|
+
process.env.SENTRY_DIST,
|
|
888
|
+
);
|
|
889
|
+
if (!explicitRelease) {
|
|
890
|
+
throw new Error(
|
|
891
|
+
'[pushy/sentry] sentry-cli does not support Debug ID source map upload. ' +
|
|
892
|
+
'Upgrade @sentry/cli, or set --sentry-release/--sentry-dist for legacy release matching.',
|
|
893
|
+
);
|
|
894
|
+
}
|
|
895
|
+
uploadSourcemapsWithRelease({
|
|
896
|
+
sentryCliPath,
|
|
897
|
+
bundlePath,
|
|
898
|
+
sourcemapPath,
|
|
899
|
+
release: explicitRelease.release,
|
|
900
|
+
dist: explicitRelease.dist,
|
|
901
|
+
useStandaloneSourcemapsCommand,
|
|
902
|
+
});
|
|
903
|
+
return;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
console.log(
|
|
907
|
+
`[pushy/sentry] Using source map Debug ID: ${uploadMode.debugId}`,
|
|
908
|
+
);
|
|
909
|
+
const debugIdResult = runSentryCli(
|
|
910
|
+
buildSentrySourcemapsUploadArgs({
|
|
911
|
+
sentryCliPath,
|
|
912
|
+
bundlePath,
|
|
913
|
+
sourcemapPath,
|
|
914
|
+
debugIdReference: true,
|
|
915
|
+
useStandaloneSourcemapsCommand,
|
|
916
|
+
}),
|
|
917
|
+
);
|
|
918
|
+
|
|
919
|
+
if (debugIdResult.status === 0 && !debugIdResult.error) {
|
|
920
|
+
return;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
const explicitRelease =
|
|
924
|
+
resolveSentryReleaseFromValues(
|
|
925
|
+
sentryOptions.sentryRelease,
|
|
926
|
+
sentryOptions.sentryDist,
|
|
927
|
+
) ??
|
|
928
|
+
resolveSentryReleaseFromValues(
|
|
929
|
+
process.env.SENTRY_RELEASE,
|
|
930
|
+
process.env.SENTRY_DIST,
|
|
931
|
+
);
|
|
932
|
+
if (!explicitRelease) {
|
|
933
|
+
assertSuccessfulSyncProcess(debugIdResult, sentryCliPath);
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
console.warn(
|
|
938
|
+
'[pushy/sentry] Debug ID source map upload failed; falling back to explicit release/dist upload.',
|
|
724
939
|
);
|
|
940
|
+
uploadSourcemapsWithRelease({
|
|
941
|
+
sentryCliPath,
|
|
942
|
+
bundlePath,
|
|
943
|
+
sourcemapPath,
|
|
944
|
+
release: explicitRelease.release,
|
|
945
|
+
dist: explicitRelease.dist,
|
|
946
|
+
useStandaloneSourcemapsCommand,
|
|
947
|
+
});
|
|
725
948
|
}
|
package/src/bundle.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { packBundle } from './bundle-pack';
|
|
|
4
4
|
import {
|
|
5
5
|
copyDebugidForSentry,
|
|
6
6
|
runReactNativeBundleCommand,
|
|
7
|
+
type SentryUploadOptions,
|
|
7
8
|
uploadSourcemapForSentry,
|
|
8
9
|
} from './bundle-runner';
|
|
9
10
|
import type { Platform } from './types';
|
|
@@ -18,7 +19,6 @@ import {
|
|
|
18
19
|
getOptionalStringOption,
|
|
19
20
|
getStringOption,
|
|
20
21
|
} from './utils/options';
|
|
21
|
-
import type { SentryReleaseOptions } from './utils/sentry-release';
|
|
22
22
|
import { versionCommands } from './versions';
|
|
23
23
|
|
|
24
24
|
type NormalizedBundleOptions = {
|
|
@@ -44,7 +44,6 @@ type NormalizedBundleOptions = {
|
|
|
44
44
|
dryRun: boolean;
|
|
45
45
|
sentryRelease?: string;
|
|
46
46
|
sentryDist?: string;
|
|
47
|
-
sentryFlavor?: string;
|
|
48
47
|
};
|
|
49
48
|
|
|
50
49
|
type PublishBundlePayload = {
|
|
@@ -130,11 +129,6 @@ function normalizeBundleOptions(
|
|
|
130
129
|
'sentry-dist',
|
|
131
130
|
'sentryDist',
|
|
132
131
|
),
|
|
133
|
-
sentryFlavor: getAliasedOptionalStringOption(
|
|
134
|
-
translatedOptions,
|
|
135
|
-
'sentry-flavor',
|
|
136
|
-
'sentryFlavor',
|
|
137
|
-
),
|
|
138
132
|
};
|
|
139
133
|
}
|
|
140
134
|
|
|
@@ -143,9 +137,8 @@ async function uploadSentryArtifactsIfNeeded(
|
|
|
143
137
|
bundleName: string,
|
|
144
138
|
intermediaDir: string,
|
|
145
139
|
sourcemapOutput: string,
|
|
146
|
-
versionName: string,
|
|
147
140
|
platform: Platform,
|
|
148
|
-
sentryOptions:
|
|
141
|
+
sentryOptions: SentryUploadOptions,
|
|
149
142
|
): Promise<void> {
|
|
150
143
|
if (!shouldUpload) {
|
|
151
144
|
return;
|
|
@@ -156,7 +149,6 @@ async function uploadSentryArtifactsIfNeeded(
|
|
|
156
149
|
bundleName,
|
|
157
150
|
intermediaDir,
|
|
158
151
|
sourcemapOutput,
|
|
159
|
-
versionName,
|
|
160
152
|
platform,
|
|
161
153
|
sentryOptions,
|
|
162
154
|
);
|
|
@@ -233,7 +225,7 @@ export const bundleCommands = {
|
|
|
233
225
|
await packBundle(path.resolve(normalized.intermediaDir), realOutput);
|
|
234
226
|
|
|
235
227
|
if (normalized.name) {
|
|
236
|
-
|
|
228
|
+
await publishBundleVersion(realOutput, platform, {
|
|
237
229
|
name: normalized.name,
|
|
238
230
|
description: normalized.description,
|
|
239
231
|
metaInfo: normalized.metaInfo,
|
|
@@ -250,12 +242,10 @@ export const bundleCommands = {
|
|
|
250
242
|
normalized.bundleName,
|
|
251
243
|
normalized.intermediaDir,
|
|
252
244
|
sourcemapOutput,
|
|
253
|
-
versionName,
|
|
254
245
|
platform,
|
|
255
246
|
{
|
|
256
247
|
sentryRelease: normalized.sentryRelease,
|
|
257
248
|
sentryDist: normalized.sentryDist,
|
|
258
|
-
sentryFlavor: normalized.sentryFlavor,
|
|
259
249
|
},
|
|
260
250
|
);
|
|
261
251
|
return;
|
|
@@ -264,22 +254,16 @@ export const bundleCommands = {
|
|
|
264
254
|
if (!getBooleanOption(options, 'no-interactive', false)) {
|
|
265
255
|
const v = await question(t('uploadBundlePrompt'));
|
|
266
256
|
if (v.toLowerCase() === 'y') {
|
|
267
|
-
|
|
268
|
-
realOutput,
|
|
269
|
-
platform,
|
|
270
|
-
{},
|
|
271
|
-
);
|
|
257
|
+
await publishBundleVersion(realOutput, platform, {});
|
|
272
258
|
await uploadSentryArtifactsIfNeeded(
|
|
273
259
|
bundleParams.sentry,
|
|
274
260
|
normalized.bundleName,
|
|
275
261
|
normalized.intermediaDir,
|
|
276
262
|
sourcemapOutput,
|
|
277
|
-
versionName,
|
|
278
263
|
platform,
|
|
279
264
|
{
|
|
280
265
|
sentryRelease: normalized.sentryRelease,
|
|
281
266
|
sentryDist: normalized.sentryDist,
|
|
282
|
-
sentryFlavor: normalized.sentryFlavor,
|
|
283
267
|
},
|
|
284
268
|
);
|
|
285
269
|
}
|
package/src/diff.ts
CHANGED
|
@@ -41,7 +41,10 @@ type DiffCommandConfig = {
|
|
|
41
41
|
export { enumZipEntries, readEntry };
|
|
42
42
|
|
|
43
43
|
const loadModule = <T>(pkgName: string): T | undefined => {
|
|
44
|
-
const
|
|
44
|
+
const nodePathDirs = (process.env.NODE_PATH || '')
|
|
45
|
+
.split(path.delimiter)
|
|
46
|
+
.filter(Boolean);
|
|
47
|
+
const resolvePaths = ['.', ...nodePathDirs, npm.packages, yarn.packages];
|
|
45
48
|
|
|
46
49
|
try {
|
|
47
50
|
const resolved = require.resolve(pkgName, { paths: resolvePaths });
|
|
@@ -179,6 +182,7 @@ async function diffFromPPK(
|
|
|
179
182
|
entry.fileName,
|
|
180
183
|
zipOptionsForPayloadEntry(entry.fileName, entryPrefix),
|
|
181
184
|
);
|
|
185
|
+
readStream.on('error', reject);
|
|
182
186
|
readStream.on('end', () => {
|
|
183
187
|
//console.log('add finished');
|
|
184
188
|
resolve(void 0);
|
|
@@ -315,6 +319,7 @@ async function diffFromPackage(
|
|
|
315
319
|
entry.fileName,
|
|
316
320
|
zipOptionsForPayloadEntry(entry.fileName, entryPrefix),
|
|
317
321
|
);
|
|
322
|
+
readStream.on('error', reject);
|
|
318
323
|
readStream.on('end', () => {
|
|
319
324
|
//console.log('add finished');
|
|
320
325
|
resolve(void 0);
|