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/README.md
CHANGED
|
@@ -134,6 +134,24 @@ export PUSHY_REGISTRY=https://your-api-endpoint.com
|
|
|
134
134
|
export NO_INTERACTIVE=true
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
+
## Sentry Sourcemaps
|
|
138
|
+
|
|
139
|
+
When `ios/sentry.properties` or `android/sentry.properties` exists, `bundle` uploads sourcemaps for OTA packages. The default matching path is Sentry Debug IDs; the CLI no longer infers release/dist from the native package.
|
|
140
|
+
|
|
141
|
+
React Native projects should use `@sentry/react-native/metro` in `metro.config.js` so the generated bundle and sourcemap share the same Debug ID. For Hermes, the CLI copies the packager sourcemap Debug ID to the composed Hermes sourcemap and uploads with:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
sentry-cli sourcemaps upload --debug-id-reference
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
For older self-hosted Sentry versions or older `@sentry/cli` versions without Debug ID support, pass explicit legacy release/dist values:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
npx pushy bundle --platform android --name "4.1" --sentry-release "com.example@1.0.0+10+pushy:4.1" --sentry-dist "pushy:4.1"
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
In legacy mode, the app runtime must report exactly the same Sentry `release` and `dist` values.
|
|
154
|
+
|
|
137
155
|
## Configuration
|
|
138
156
|
|
|
139
157
|
Create `update.json` in your React Native project:
|
package/README.zh-CN.md
CHANGED
|
@@ -134,6 +134,24 @@ export PUSHY_REGISTRY=https://your-api-endpoint.com
|
|
|
134
134
|
export NO_INTERACTIVE=true
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
+
## Sentry Sourcemap
|
|
138
|
+
|
|
139
|
+
当项目存在 `ios/sentry.properties` 或 `android/sentry.properties` 时,`bundle` 会为 OTA 包上传 sourcemap。默认使用 Sentry Debug ID 匹配,不再根据原生包推导 release/dist。
|
|
140
|
+
|
|
141
|
+
React Native 项目需要在 `metro.config.js` 中接入 `@sentry/react-native/metro`,确保生成的 bundle 和 sourcemap 带有相同 Debug ID。Hermes 场景下 CLI 会把 packager sourcemap 的 Debug ID 复制到合成后的 Hermes sourcemap,并使用:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
sentry-cli sourcemaps upload --debug-id-reference
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
旧版 self-hosted Sentry 或旧版 `@sentry/cli` 不支持 Debug ID 时,可以显式指定 legacy release/dist:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
npx pushy bundle --platform android --name "4.1" --sentry-release "com.example@1.0.0+10+pushy:4.1" --sentry-dist "pushy:4.1"
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
这种 legacy 模式要求 App 运行时上报到 Sentry 的 `release` 和 `dist` 与上传参数完全一致。
|
|
154
|
+
|
|
137
155
|
## 配置文件
|
|
138
156
|
|
|
139
157
|
在 React Native 项目中创建 `update.json`:
|
package/cli.json
CHANGED
|
@@ -221,9 +221,6 @@
|
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
},
|
|
224
|
-
"build": {
|
|
225
|
-
"description": "Bundle javascript and copy assets."
|
|
226
|
-
},
|
|
227
224
|
"bundle": {
|
|
228
225
|
"description": "Bundle javascript code only and optionally publish.",
|
|
229
226
|
"options": {
|
|
@@ -313,20 +310,9 @@
|
|
|
313
310
|
"sentryDist": {
|
|
314
311
|
"hasValue": true,
|
|
315
312
|
"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"
|
|
324
313
|
}
|
|
325
314
|
}
|
|
326
315
|
},
|
|
327
|
-
"release": {
|
|
328
|
-
"description": "Push builded file to server."
|
|
329
|
-
},
|
|
330
316
|
"hdiff": {
|
|
331
317
|
"description": "Create hdiff patch",
|
|
332
318
|
"options": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/lib/bin-cresc.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
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
|
+
require('./bin');
|
package/lib/bin.js
CHANGED
package/lib/bundle-runner.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type SentryReleaseOptions } from './utils/sentry-release';
|
|
2
1
|
export interface BundleCliOptions {
|
|
3
2
|
taro?: boolean;
|
|
4
3
|
expo?: boolean;
|
|
@@ -28,17 +27,32 @@ type BuildSentrySourcemapsUploadArgsOptions = {
|
|
|
28
27
|
sentryCliPath: string;
|
|
29
28
|
bundlePath: string;
|
|
30
29
|
sourcemapPath: string;
|
|
31
|
-
release
|
|
30
|
+
release?: string;
|
|
32
31
|
dist?: string;
|
|
33
32
|
stripPrefix?: string;
|
|
33
|
+
debugIdReference?: boolean;
|
|
34
34
|
useStandaloneSourcemapsCommand?: boolean;
|
|
35
35
|
};
|
|
36
|
+
export interface SentryUploadOptions {
|
|
37
|
+
sentryRelease?: string;
|
|
38
|
+
sentryDist?: string;
|
|
39
|
+
}
|
|
40
|
+
type SentryUploadMode = {
|
|
41
|
+
type: 'debug-id';
|
|
42
|
+
debugId: string;
|
|
43
|
+
} | {
|
|
44
|
+
type: 'release';
|
|
45
|
+
release: string;
|
|
46
|
+
dist?: string;
|
|
47
|
+
};
|
|
36
48
|
export declare function hasProjectDependency(dependencyName: string, projectRoot?: string): boolean;
|
|
37
49
|
export declare function resolveExpoCli(projectRoot?: string): ResolvedExpoCli;
|
|
38
50
|
export declare function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputFolder, platform, sourcemapOutput, config, forceHermes, cli, isSentry, }: RunBundleCommandOptions): Promise<void>;
|
|
39
51
|
export declare function resolveHermesCommand(projectRoot?: string): string;
|
|
40
52
|
export declare function copyDebugidForSentry(bundleName: string, outputFolder: string, sourcemapOutput: string): Promise<void>;
|
|
41
|
-
export declare function prepareSentryUploadArtifacts(bundleName: string, outputFolder: string, platform: string): SentryUploadArtifacts
|
|
42
|
-
export declare function
|
|
43
|
-
export declare function
|
|
53
|
+
export declare function prepareSentryUploadArtifacts(bundleName: string, outputFolder: string, platform: string): Promise<SentryUploadArtifacts>;
|
|
54
|
+
export declare function readSourcemapDebugId(sourcemapPath: string): Promise<string | undefined>;
|
|
55
|
+
export declare function resolveSentryUploadMode(sourcemapPath: string, options?: SentryUploadOptions): Promise<SentryUploadMode>;
|
|
56
|
+
export declare function buildSentrySourcemapsUploadArgs({ sentryCliPath, bundlePath, sourcemapPath, release, dist, stripPrefix, debugIdReference, useStandaloneSourcemapsCommand, }: BuildSentrySourcemapsUploadArgsOptions): string[];
|
|
57
|
+
export declare function uploadSourcemapForSentry(bundleName: string, outputFolder: string, sourcemapOutput: string, platform?: string, sentryOptions?: SentryUploadOptions): Promise<void>;
|
|
44
58
|
export {};
|
package/lib/bundle-runner.js
CHANGED
|
@@ -21,12 +21,18 @@ _export(exports, {
|
|
|
21
21
|
get prepareSentryUploadArtifacts () {
|
|
22
22
|
return prepareSentryUploadArtifacts;
|
|
23
23
|
},
|
|
24
|
+
get readSourcemapDebugId () {
|
|
25
|
+
return readSourcemapDebugId;
|
|
26
|
+
},
|
|
24
27
|
get resolveExpoCli () {
|
|
25
28
|
return resolveExpoCli;
|
|
26
29
|
},
|
|
27
30
|
get resolveHermesCommand () {
|
|
28
31
|
return resolveHermesCommand;
|
|
29
32
|
},
|
|
33
|
+
get resolveSentryUploadMode () {
|
|
34
|
+
return resolveSentryUploadMode;
|
|
35
|
+
},
|
|
30
36
|
get runReactNativeBundleCommand () {
|
|
31
37
|
return runReactNativeBundleCommand;
|
|
32
38
|
},
|
|
@@ -41,7 +47,6 @@ const _os = /*#__PURE__*/ _interop_require_default(require("os"));
|
|
|
41
47
|
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
42
48
|
const _i18n = require("./utils/i18n");
|
|
43
49
|
const _runtime = require("./utils/runtime");
|
|
44
|
-
const _sentryrelease = require("./utils/sentry-release");
|
|
45
50
|
function _interop_require_default(obj) {
|
|
46
51
|
return obj && obj.__esModule ? obj : {
|
|
47
52
|
default: obj
|
|
@@ -332,6 +337,10 @@ function assertSuccessfulSyncProcess(result, command) {
|
|
|
332
337
|
throw new Error(`${command} failed with ${result.status === null ? `signal ${result.signal}` : `exit code ${result.status}`}`);
|
|
333
338
|
}
|
|
334
339
|
}
|
|
340
|
+
function normalizeString(value) {
|
|
341
|
+
const normalized = value == null ? void 0 : value.trim();
|
|
342
|
+
return normalized ? normalized : undefined;
|
|
343
|
+
}
|
|
335
344
|
function resolveHermesCommand(projectRoot = process.cwd()) {
|
|
336
345
|
const osBin = getHermesOSBin();
|
|
337
346
|
if (!osBin) {
|
|
@@ -455,7 +464,7 @@ async function copyDebugidForSentry(bundleName, outputFolder, sourcemapOutput) {
|
|
|
455
464
|
}
|
|
456
465
|
_fsextra.removeSync(_path.default.join(outputFolder, `${bundleName}.txt.map`));
|
|
457
466
|
}
|
|
458
|
-
function prepareSentryUploadArtifacts(bundleName, outputFolder, platform) {
|
|
467
|
+
async function prepareSentryUploadArtifacts(bundleName, outputFolder, platform) {
|
|
459
468
|
const bundlePath = _path.default.join(outputFolder, bundleName);
|
|
460
469
|
const sourcemapPath = _path.default.join(outputFolder, `${bundleName}.map`);
|
|
461
470
|
if (platform !== 'android' || bundleName === ANDROID_SENTRY_BUNDLE_NAME) {
|
|
@@ -466,22 +475,81 @@ function prepareSentryUploadArtifacts(bundleName, outputFolder, platform) {
|
|
|
466
475
|
}
|
|
467
476
|
const androidBundlePath = _path.default.join(outputFolder, ANDROID_SENTRY_BUNDLE_NAME);
|
|
468
477
|
const androidSourcemapPath = _path.default.join(outputFolder, `${ANDROID_SENTRY_BUNDLE_NAME}.map`);
|
|
469
|
-
_fsextra.
|
|
470
|
-
const sourcemap = JSON.parse(_fsextra.
|
|
478
|
+
await _fsextra.promises.copyFile(bundlePath, androidBundlePath);
|
|
479
|
+
const sourcemap = JSON.parse(await _fsextra.promises.readFile(sourcemapPath, 'utf8'));
|
|
471
480
|
sourcemap.file = ANDROID_SENTRY_BUNDLE_NAME;
|
|
472
|
-
_fsextra.
|
|
481
|
+
await _fsextra.promises.writeFile(androidSourcemapPath, JSON.stringify(sourcemap));
|
|
473
482
|
return {
|
|
474
483
|
bundlePath: androidBundlePath,
|
|
475
484
|
sourcemapPath: androidSourcemapPath
|
|
476
485
|
};
|
|
477
486
|
}
|
|
478
|
-
function
|
|
487
|
+
async function readSourcemapDebugId(sourcemapPath) {
|
|
488
|
+
try {
|
|
489
|
+
var _sourcemap_debugId;
|
|
490
|
+
const sourcemap = JSON.parse(await _fsextra.promises.readFile(sourcemapPath, 'utf8'));
|
|
491
|
+
const debugId = (_sourcemap_debugId = sourcemap.debugId) != null ? _sourcemap_debugId : sourcemap.debug_id;
|
|
492
|
+
return typeof debugId === 'string' ? normalizeString(debugId) : undefined;
|
|
493
|
+
} catch (unused) {
|
|
494
|
+
return undefined;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
function resolveSentryReleaseFromValues(releaseValue, distValue) {
|
|
498
|
+
const release = normalizeString(releaseValue);
|
|
499
|
+
if (!release) {
|
|
500
|
+
return undefined;
|
|
501
|
+
}
|
|
502
|
+
return {
|
|
503
|
+
release,
|
|
504
|
+
dist: normalizeString(distValue)
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
async function resolveSentryUploadMode(sourcemapPath, options = {}) {
|
|
508
|
+
const optionRelease = resolveSentryReleaseFromValues(options.sentryRelease, options.sentryDist);
|
|
509
|
+
if (optionRelease) {
|
|
510
|
+
return {
|
|
511
|
+
type: 'release',
|
|
512
|
+
...optionRelease
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
const debugId = await readSourcemapDebugId(sourcemapPath);
|
|
516
|
+
if (debugId) {
|
|
517
|
+
return {
|
|
518
|
+
type: 'debug-id',
|
|
519
|
+
debugId
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
const environmentRelease = resolveSentryReleaseFromValues(process.env.SENTRY_RELEASE, process.env.SENTRY_DIST);
|
|
523
|
+
if (environmentRelease) {
|
|
524
|
+
return {
|
|
525
|
+
type: 'release',
|
|
526
|
+
...environmentRelease
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
throw new Error('[pushy/sentry] Generated source map does not contain a Debug ID. ' + 'Add @sentry/react-native/metro to metro.config.js so the OTA bundle can be matched by Debug ID, ' + 'or set --sentry-release/--sentry-dist (or SENTRY_RELEASE/SENTRY_DIST) for legacy release matching.');
|
|
530
|
+
}
|
|
531
|
+
function buildSentrySourcemapsUploadArgs({ sentryCliPath, bundlePath, sourcemapPath, release, dist, stripPrefix = process.cwd(), debugIdReference = false, useStandaloneSourcemapsCommand = true }) {
|
|
479
532
|
const uploadArgs = [
|
|
480
533
|
'--strip-prefix',
|
|
481
534
|
stripPrefix,
|
|
482
535
|
bundlePath,
|
|
483
536
|
sourcemapPath
|
|
484
537
|
];
|
|
538
|
+
if (debugIdReference) {
|
|
539
|
+
if (!useStandaloneSourcemapsCommand) {
|
|
540
|
+
throw new Error('[pushy/sentry] Debug ID upload requires sentry-cli sourcemaps upload.');
|
|
541
|
+
}
|
|
542
|
+
return [
|
|
543
|
+
sentryCliPath,
|
|
544
|
+
'sourcemaps',
|
|
545
|
+
'upload',
|
|
546
|
+
'--debug-id-reference',
|
|
547
|
+
...uploadArgs
|
|
548
|
+
];
|
|
549
|
+
}
|
|
550
|
+
if (!release) {
|
|
551
|
+
throw new Error('[pushy/sentry] Legacy Sentry sourcemap upload requires a release.');
|
|
552
|
+
}
|
|
485
553
|
if (!useStandaloneSourcemapsCommand) {
|
|
486
554
|
return [
|
|
487
555
|
sentryCliPath,
|
|
@@ -520,7 +588,45 @@ function supportsStandaloneSentrySourcemapsUpload(sentryCliPath) {
|
|
|
520
588
|
});
|
|
521
589
|
return !result.error && result.status === 0;
|
|
522
590
|
}
|
|
523
|
-
|
|
591
|
+
function supportsSentryDebugIdReference(sentryCliPath) {
|
|
592
|
+
const result = (0, _runtime.spawnJavaScriptSync)([
|
|
593
|
+
sentryCliPath,
|
|
594
|
+
'sourcemaps',
|
|
595
|
+
'upload',
|
|
596
|
+
'--help'
|
|
597
|
+
], {
|
|
598
|
+
encoding: 'utf8'
|
|
599
|
+
});
|
|
600
|
+
return !result.error && result.status === 0 && typeof result.stdout === 'string' && result.stdout.includes('--debug-id-reference');
|
|
601
|
+
}
|
|
602
|
+
function runSentryCli(args) {
|
|
603
|
+
return (0, _runtime.spawnJavaScriptSync)(args, {
|
|
604
|
+
stdio: 'inherit'
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
function uploadSourcemapsWithRelease({ sentryCliPath, bundlePath, sourcemapPath, release, dist, useStandaloneSourcemapsCommand }) {
|
|
608
|
+
assertSuccessfulSyncProcess(runSentryCli([
|
|
609
|
+
sentryCliPath,
|
|
610
|
+
'releases',
|
|
611
|
+
'set-commits',
|
|
612
|
+
release,
|
|
613
|
+
'--auto'
|
|
614
|
+
]), sentryCliPath);
|
|
615
|
+
console.log((0, _i18n.t)('sentryReleaseCreated', {
|
|
616
|
+
version: release
|
|
617
|
+
}));
|
|
618
|
+
console.log((0, _i18n.t)('uploadingSourcemap'));
|
|
619
|
+
assertSuccessfulSyncProcess(runSentryCli(buildSentrySourcemapsUploadArgs({
|
|
620
|
+
sentryCliPath,
|
|
621
|
+
bundlePath,
|
|
622
|
+
sourcemapPath,
|
|
623
|
+
release,
|
|
624
|
+
dist,
|
|
625
|
+
useStandaloneSourcemapsCommand
|
|
626
|
+
})), sentryCliPath);
|
|
627
|
+
}
|
|
628
|
+
async function uploadSourcemapForSentry(bundleName, outputFolder, sourcemapOutput, platform = '', sentryOptions = {}) {
|
|
629
|
+
var _resolveSentryReleaseFromValues;
|
|
524
630
|
if (!sourcemapOutput) {
|
|
525
631
|
return;
|
|
526
632
|
}
|
|
@@ -538,29 +644,60 @@ async function uploadSourcemapForSentry(bundleName, outputFolder, sourcemapOutpu
|
|
|
538
644
|
if (!_fsextra.existsSync(sentryCliPath)) {
|
|
539
645
|
return;
|
|
540
646
|
}
|
|
541
|
-
const {
|
|
542
|
-
const
|
|
543
|
-
|
|
647
|
+
const { bundlePath, sourcemapPath } = await prepareSentryUploadArtifacts(bundleName, outputFolder, platform);
|
|
648
|
+
const uploadMode = await resolveSentryUploadMode(sourcemapPath, sentryOptions);
|
|
649
|
+
const useStandaloneSourcemapsCommand = supportsStandaloneSentrySourcemapsUpload(sentryCliPath);
|
|
650
|
+
if (uploadMode.type === 'release') {
|
|
651
|
+
uploadSourcemapsWithRelease({
|
|
652
|
+
sentryCliPath,
|
|
653
|
+
bundlePath,
|
|
654
|
+
sourcemapPath,
|
|
655
|
+
release: uploadMode.release,
|
|
656
|
+
dist: uploadMode.dist,
|
|
657
|
+
useStandaloneSourcemapsCommand
|
|
658
|
+
});
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
console.log((0, _i18n.t)('uploadingSourcemap'));
|
|
662
|
+
if (!useStandaloneSourcemapsCommand || !supportsSentryDebugIdReference(sentryCliPath)) {
|
|
663
|
+
var _resolveSentryReleaseFromValues1;
|
|
664
|
+
const explicitRelease = (_resolveSentryReleaseFromValues1 = resolveSentryReleaseFromValues(sentryOptions.sentryRelease, sentryOptions.sentryDist)) != null ? _resolveSentryReleaseFromValues1 : resolveSentryReleaseFromValues(process.env.SENTRY_RELEASE, process.env.SENTRY_DIST);
|
|
665
|
+
if (!explicitRelease) {
|
|
666
|
+
throw new Error('[pushy/sentry] sentry-cli does not support Debug ID source map upload. ' + 'Upgrade @sentry/cli, or set --sentry-release/--sentry-dist for legacy release matching.');
|
|
667
|
+
}
|
|
668
|
+
uploadSourcemapsWithRelease({
|
|
669
|
+
sentryCliPath,
|
|
670
|
+
bundlePath,
|
|
671
|
+
sourcemapPath,
|
|
672
|
+
release: explicitRelease.release,
|
|
673
|
+
dist: explicitRelease.dist,
|
|
674
|
+
useStandaloneSourcemapsCommand
|
|
675
|
+
});
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
console.log(`[pushy/sentry] Using source map Debug ID: ${uploadMode.debugId}`);
|
|
679
|
+
const debugIdResult = runSentryCli(buildSentrySourcemapsUploadArgs({
|
|
544
680
|
sentryCliPath,
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
], {
|
|
550
|
-
stdio: 'inherit'
|
|
551
|
-
}), sentryCliPath);
|
|
552
|
-
console.log((0, _i18n.t)('sentryReleaseCreated', {
|
|
553
|
-
version: release
|
|
681
|
+
bundlePath,
|
|
682
|
+
sourcemapPath,
|
|
683
|
+
debugIdReference: true,
|
|
684
|
+
useStandaloneSourcemapsCommand
|
|
554
685
|
}));
|
|
555
|
-
|
|
556
|
-
|
|
686
|
+
if (debugIdResult.status === 0 && !debugIdResult.error) {
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
const explicitRelease = (_resolveSentryReleaseFromValues = resolveSentryReleaseFromValues(sentryOptions.sentryRelease, sentryOptions.sentryDist)) != null ? _resolveSentryReleaseFromValues : resolveSentryReleaseFromValues(process.env.SENTRY_RELEASE, process.env.SENTRY_DIST);
|
|
690
|
+
if (!explicitRelease) {
|
|
691
|
+
assertSuccessfulSyncProcess(debugIdResult, sentryCliPath);
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
console.warn('[pushy/sentry] Debug ID source map upload failed; falling back to explicit release/dist upload.');
|
|
695
|
+
uploadSourcemapsWithRelease({
|
|
557
696
|
sentryCliPath,
|
|
558
697
|
bundlePath,
|
|
559
698
|
sourcemapPath,
|
|
560
|
-
release,
|
|
561
|
-
dist,
|
|
562
|
-
useStandaloneSourcemapsCommand
|
|
563
|
-
})
|
|
564
|
-
stdio: 'inherit'
|
|
565
|
-
}), sentryCliPath);
|
|
699
|
+
release: explicitRelease.release,
|
|
700
|
+
dist: explicitRelease.dist,
|
|
701
|
+
useStandaloneSourcemapsCommand
|
|
702
|
+
});
|
|
566
703
|
}
|
package/lib/bundle.js
CHANGED
|
@@ -52,16 +52,15 @@ function normalizeBundleOptions(translatedOptions, platform) {
|
|
|
52
52
|
rollout: (0, _options.getOptionalStringOption)(translatedOptions, 'rollout'),
|
|
53
53
|
dryRun: (0, _options.getBooleanOption)(translatedOptions, 'dryRun', false),
|
|
54
54
|
sentryRelease: getAliasedOptionalStringOption(translatedOptions, 'sentry-release', 'sentryRelease'),
|
|
55
|
-
sentryDist: getAliasedOptionalStringOption(translatedOptions, 'sentry-dist', 'sentryDist')
|
|
56
|
-
sentryFlavor: getAliasedOptionalStringOption(translatedOptions, 'sentry-flavor', 'sentryFlavor')
|
|
55
|
+
sentryDist: getAliasedOptionalStringOption(translatedOptions, 'sentry-dist', 'sentryDist')
|
|
57
56
|
};
|
|
58
57
|
}
|
|
59
|
-
async function uploadSentryArtifactsIfNeeded(shouldUpload, bundleName, intermediaDir, sourcemapOutput,
|
|
58
|
+
async function uploadSentryArtifactsIfNeeded(shouldUpload, bundleName, intermediaDir, sourcemapOutput, platform, sentryOptions) {
|
|
60
59
|
if (!shouldUpload) {
|
|
61
60
|
return;
|
|
62
61
|
}
|
|
63
62
|
await (0, _bundlerunner.copyDebugidForSentry)(bundleName, intermediaDir, sourcemapOutput);
|
|
64
|
-
await (0, _bundlerunner.uploadSourcemapForSentry)(bundleName, intermediaDir, sourcemapOutput,
|
|
63
|
+
await (0, _bundlerunner.uploadSourcemapForSentry)(bundleName, intermediaDir, sourcemapOutput, platform, sentryOptions);
|
|
65
64
|
}
|
|
66
65
|
async function publishBundleVersion(outputPath, platform, payload) {
|
|
67
66
|
return _versions.versionCommands.publish({
|
|
@@ -109,7 +108,7 @@ const bundleCommands = {
|
|
|
109
108
|
});
|
|
110
109
|
await (0, _bundlepack.packBundle)(_path.default.resolve(normalized.intermediaDir), realOutput);
|
|
111
110
|
if (normalized.name) {
|
|
112
|
-
|
|
111
|
+
await publishBundleVersion(realOutput, platform, {
|
|
113
112
|
name: normalized.name,
|
|
114
113
|
description: normalized.description,
|
|
115
114
|
metaInfo: normalized.metaInfo,
|
|
@@ -121,21 +120,19 @@ const bundleCommands = {
|
|
|
121
120
|
rollout: normalized.rollout,
|
|
122
121
|
dryRun: normalized.dryRun
|
|
123
122
|
});
|
|
124
|
-
await uploadSentryArtifactsIfNeeded(bundleParams.sentry, normalized.bundleName, normalized.intermediaDir, sourcemapOutput,
|
|
123
|
+
await uploadSentryArtifactsIfNeeded(bundleParams.sentry, normalized.bundleName, normalized.intermediaDir, sourcemapOutput, platform, {
|
|
125
124
|
sentryRelease: normalized.sentryRelease,
|
|
126
|
-
sentryDist: normalized.sentryDist
|
|
127
|
-
sentryFlavor: normalized.sentryFlavor
|
|
125
|
+
sentryDist: normalized.sentryDist
|
|
128
126
|
});
|
|
129
127
|
return;
|
|
130
128
|
}
|
|
131
129
|
if (!(0, _options.getBooleanOption)(options, 'no-interactive', false)) {
|
|
132
130
|
const v = await (0, _utils.question)((0, _i18n.t)('uploadBundlePrompt'));
|
|
133
131
|
if (v.toLowerCase() === 'y') {
|
|
134
|
-
|
|
135
|
-
await uploadSentryArtifactsIfNeeded(bundleParams.sentry, normalized.bundleName, normalized.intermediaDir, sourcemapOutput,
|
|
132
|
+
await publishBundleVersion(realOutput, platform, {});
|
|
133
|
+
await uploadSentryArtifactsIfNeeded(bundleParams.sentry, normalized.bundleName, normalized.intermediaDir, sourcemapOutput, platform, {
|
|
136
134
|
sentryRelease: normalized.sentryRelease,
|
|
137
|
-
sentryDist: normalized.sentryDist
|
|
138
|
-
sentryFlavor: normalized.sentryFlavor
|
|
135
|
+
sentryDist: normalized.sentryDist
|
|
139
136
|
});
|
|
140
137
|
}
|
|
141
138
|
}
|
package/lib/diff.js
CHANGED
|
@@ -75,8 +75,10 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
75
75
|
return newObj;
|
|
76
76
|
}
|
|
77
77
|
const loadModule = (pkgName)=>{
|
|
78
|
+
const nodePathDirs = (process.env.NODE_PATH || '').split(_path.default.delimiter).filter(Boolean);
|
|
78
79
|
const resolvePaths = [
|
|
79
80
|
'.',
|
|
81
|
+
...nodePathDirs,
|
|
80
82
|
_globaldirs.npm.packages,
|
|
81
83
|
_globaldirs.yarn.packages
|
|
82
84
|
];
|
|
@@ -179,6 +181,7 @@ async function diffFromPPK(origin, next, output, diffFn) {
|
|
|
179
181
|
return reject(new Error(`Unable to read zip entry: ${entry.fileName}`));
|
|
180
182
|
}
|
|
181
183
|
zipfile.addReadStream(readStream, entry.fileName, (0, _zipoptions.zipOptionsForPayloadEntry)(entry.fileName, entryPrefix));
|
|
184
|
+
readStream.on('error', reject);
|
|
182
185
|
readStream.on('end', ()=>{
|
|
183
186
|
//console.log('add finished');
|
|
184
187
|
resolve(void 0);
|
|
@@ -279,6 +282,7 @@ async function diffFromPackage(origin, next, output, diffFn, originBundleName, t
|
|
|
279
282
|
return reject(new Error(`Unable to read zip entry: ${entry.fileName}`));
|
|
280
283
|
}
|
|
281
284
|
zipfile.addReadStream(readStream, entry.fileName, (0, _zipoptions.zipOptionsForPayloadEntry)(entry.fileName, entryPrefix));
|
|
285
|
+
readStream.on('error', reject);
|
|
282
286
|
readStream.on('end', ()=>{
|
|
283
287
|
//console.log('add finished');
|
|
284
288
|
resolve(void 0);
|
package/lib/install.js
CHANGED
|
@@ -10,23 +10,50 @@ Object.defineProperty(exports, "installCommands", {
|
|
|
10
10
|
});
|
|
11
11
|
const _child_process = require("child_process");
|
|
12
12
|
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
13
|
+
const _constants = require("./utils/constants");
|
|
14
|
+
const _i18n = require("./utils/i18n");
|
|
13
15
|
const _runtime = require("./utils/runtime");
|
|
14
16
|
function _interop_require_default(obj) {
|
|
15
17
|
return obj && obj.__esModule ? obj : {
|
|
16
18
|
default: obj
|
|
17
19
|
};
|
|
18
20
|
}
|
|
21
|
+
// package names / version specs only — rejects shell metacharacters since
|
|
22
|
+
// Windows needs shell: true to run package manager .cmd shims
|
|
23
|
+
const SAFE_PACKAGE_ARG = /^[@a-z0-9^~._/-]+$/i;
|
|
19
24
|
const installCommands = {
|
|
20
25
|
install: async ({ args })=>{
|
|
21
26
|
if (args.length === 0) {
|
|
22
|
-
|
|
27
|
+
throw new Error((0, _i18n.t)('installPackageRequired', {
|
|
28
|
+
scriptName: _constants.scriptName
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
for (const arg of args){
|
|
32
|
+
if (!SAFE_PACKAGE_ARG.test(arg)) {
|
|
33
|
+
throw new Error((0, _i18n.t)('installPackageRequired', {
|
|
34
|
+
scriptName: _constants.scriptName
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
23
37
|
}
|
|
24
38
|
const cliDir = _path.default.resolve(__dirname, '..');
|
|
25
39
|
const installCommand = (0, _runtime.getInstallCommand)(args, cliDir);
|
|
26
|
-
(0, _child_process.spawnSync)(installCommand.command, installCommand.args, {
|
|
40
|
+
const result = (0, _child_process.spawnSync)(installCommand.command, installCommand.args, {
|
|
27
41
|
cwd: cliDir,
|
|
28
42
|
stdio: 'inherit',
|
|
29
|
-
|
|
43
|
+
// package manager executables are .cmd shims on Windows
|
|
44
|
+
shell: process.platform === 'win32'
|
|
30
45
|
});
|
|
46
|
+
if (result.error) {
|
|
47
|
+
throw new Error((0, _i18n.t)('installFailed', {
|
|
48
|
+
packages: args.join(' '),
|
|
49
|
+
error: result.error.message
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
if (result.status !== 0) {
|
|
53
|
+
throw new Error((0, _i18n.t)('installFailed', {
|
|
54
|
+
packages: args.join(' '),
|
|
55
|
+
error: `${installCommand.command} exited with code ${result.status}`
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
31
58
|
}
|
|
32
59
|
};
|
package/lib/locales/en.d.ts
CHANGED
|
@@ -136,6 +136,8 @@ declare const _default: {
|
|
|
136
136
|
diffPackageGenerated: string;
|
|
137
137
|
nodeHdiffpatchRequired: string;
|
|
138
138
|
apkExtracted: string;
|
|
139
|
+
installPackageRequired: string;
|
|
140
|
+
installFailed: string;
|
|
139
141
|
proxyNetworkError: string;
|
|
140
142
|
proxyNetworkErrorTips: string;
|
|
141
143
|
};
|
package/lib/locales/en.js
CHANGED
|
@@ -152,6 +152,8 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
|
|
152
152
|
diffPackageGenerated: '{{- output}} generated.',
|
|
153
153
|
nodeHdiffpatchRequired: 'This function needs "node-hdiffpatch". Please run "{{scriptName}} install node-hdiffpatch" to install',
|
|
154
154
|
apkExtracted: 'APK extracted to {{output}}',
|
|
155
|
+
installPackageRequired: 'Please specify the package to install, e.g. "{{scriptName}} install node-hdiffpatch"',
|
|
156
|
+
installFailed: 'Failed to install {{packages}}: {{error}}',
|
|
155
157
|
proxyNetworkError: 'Network error — likely caused by a proxy/VPN. Please try disabling your proxy and retry.',
|
|
156
158
|
proxyNetworkErrorTips: 'Common fixes:\n1. Disable system proxy or VPN\n2. Check HTTP_PROXY / HTTPS_PROXY environment variables\n3. Check proxy settings in .npmrc'
|
|
157
159
|
};
|
package/lib/locales/zh.d.ts
CHANGED
|
@@ -135,6 +135,8 @@ declare const _default: {
|
|
|
135
135
|
diffPackageGenerated: string;
|
|
136
136
|
nodeHdiffpatchRequired: string;
|
|
137
137
|
apkExtracted: string;
|
|
138
|
+
installPackageRequired: string;
|
|
139
|
+
installFailed: string;
|
|
138
140
|
proxyNetworkError: string;
|
|
139
141
|
proxyNetworkErrorTips: string;
|
|
140
142
|
};
|
package/lib/locales/zh.js
CHANGED
|
@@ -151,6 +151,8 @@ const _default = {
|
|
|
151
151
|
diffPackageGenerated: '{{- output}} 已生成。',
|
|
152
152
|
nodeHdiffpatchRequired: '此功能需要 "node-hdiffpatch"。请运行 "{{scriptName}} install node-hdiffpatch" 来安装',
|
|
153
153
|
apkExtracted: 'APK 已提取到 {{output}}',
|
|
154
|
+
installPackageRequired: '请指定要安装的包,例如 "{{scriptName}} install node-hdiffpatch"',
|
|
155
|
+
installFailed: '安装 {{packages}} 失败: {{error}}',
|
|
154
156
|
proxyNetworkError: '网络连接异常,可能是代理/VPN 导致。请尝试关闭代理后重试。',
|
|
155
157
|
proxyNetworkErrorTips: '常见解决方法:\n1. 关闭系统代理或 VPN\n2. 检查 HTTP_PROXY / HTTPS_PROXY 环境变量\n3. 检查 .npmrc 中的 proxy 配置'
|
|
156
158
|
};
|
package/lib/package.js
CHANGED
|
@@ -341,8 +341,12 @@ const packageCommands = {
|
|
|
341
341
|
appId
|
|
342
342
|
}));
|
|
343
343
|
}
|
|
344
|
+
const allPkgsMap = new Map(allPkgs.map((pkg)=>[
|
|
345
|
+
pkg.name,
|
|
346
|
+
pkg
|
|
347
|
+
]));
|
|
344
348
|
packageIds = packageVersions.map((packageVersion)=>{
|
|
345
|
-
const selectedPackage =
|
|
349
|
+
const selectedPackage = allPkgsMap.get(packageVersion);
|
|
346
350
|
if (!selectedPackage) {
|
|
347
351
|
throw new Error((0, _i18n.t)('packageNotFound', {
|
|
348
352
|
packageVersion
|
package/lib/provider.js
CHANGED
|
@@ -107,8 +107,7 @@ class CLIProviderImpl {
|
|
|
107
107
|
rncli: options.rncli || false,
|
|
108
108
|
hermes: options.hermes || false,
|
|
109
109
|
sentryRelease: options.sentryRelease,
|
|
110
|
-
sentryDist: options.sentryDist
|
|
111
|
-
sentryFlavor: options.sentryFlavor
|
|
110
|
+
sentryDist: options.sentryDist
|
|
112
111
|
});
|
|
113
112
|
const { bundleCommands } = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./bundle")));
|
|
114
113
|
await bundleCommands.bundle(context);
|
package/lib/types.d.ts
CHANGED
|
@@ -101,8 +101,8 @@ class AabParser extends _zip.Zip {
|
|
|
101
101
|
});
|
|
102
102
|
});
|
|
103
103
|
// Create a temp file for the .apks output
|
|
104
|
-
const tempDir = _os.default.tmpdir();
|
|
105
|
-
const tempApksPath = _path.default.join(tempDir,
|
|
104
|
+
const tempDir = await _fsextra.mkdtemp(_path.default.join(_os.default.tmpdir(), 'bundletool-'));
|
|
105
|
+
const tempApksPath = _path.default.join(tempDir, 'output.apks');
|
|
106
106
|
const needsNpxDownload = async ()=>{
|
|
107
107
|
try {
|
|
108
108
|
await runCommand('npx', [
|
|
@@ -191,8 +191,8 @@ class AabParser extends _zip.Zip {
|
|
|
191
191
|
});
|
|
192
192
|
} finally{
|
|
193
193
|
// Cleanup
|
|
194
|
-
if (await _fsextra.pathExists(
|
|
195
|
-
await _fsextra.remove(
|
|
194
|
+
if (await _fsextra.pathExists(tempDir)) {
|
|
195
|
+
await _fsextra.remove(tempDir);
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
}
|
|
@@ -15,7 +15,9 @@ const CATEGORY_LAUNCHER = 'android.intent.category.LAUNCHER';
|
|
|
15
15
|
class ManifestParser {
|
|
16
16
|
collapseAttributes(element) {
|
|
17
17
|
const collapsed = Object.create(null);
|
|
18
|
-
|
|
18
|
+
const attributes = element.attributes;
|
|
19
|
+
for(let i = 0, len = attributes.length; i < len; i++){
|
|
20
|
+
const attr = attributes[i];
|
|
19
21
|
collapsed[attr.name] = attr.typedValue.value;
|
|
20
22
|
}
|
|
21
23
|
return collapsed;
|