Skip to content

Commit b933620

Browse files
a7medevmzelzoghbi
authored andcommitted
feat: export upload utils (#1252)
1 parent 77ca0d4 commit b933620

13 files changed

+313
-193
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Distribution
22
dist/
33
bin/
4+
upload/*
5+
!upload/package.json
46

57
# NodeJS
68
node_modules/

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased](https://github.com/Instabug/Instabug-React-Native/compare/v13.2.0...dev)
44

5+
### Added
6+
7+
- Export `uploadSourcemaps` and `uploadSoFiles` utilities in the `instabug-reactnative/upload` sub-package for usage in custom Node.js upload scripts ([#1252](https://github.com/Instabug/Instabug-React-Native/pull/1252)).
8+
59
### Fixed
610

711
- Fix APM network logging on Android ([#1253](https://github.com/Instabug/Instabug-React-Native/pull/1253)).

cli/UploadSoFiles.ts

-88
This file was deleted.

cli/UploadSourcemaps.ts

-89
This file was deleted.

cli/commands/UploadSoFiles.ts

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { Command, Option } from 'commander';
2+
import { uploadSoFiles, UploadSoFilesOptions } from '../upload/uploadSoFiles';
3+
4+
/**
5+
* This script uploads .so files to the specified endpoint used in NDK crash reporting.
6+
* Usage: node upload-so-files.js --arch <arch> --file <path> --api_key <key> --token <token> --name <name>
7+
*/
8+
9+
export const UploadSoFilesCommand = new Command();
10+
11+
UploadSoFilesCommand.name('upload-so-files')
12+
.addOption(
13+
new Option('-arch, --arch <value>', 'arch')
14+
.choices(['x86', 'x86_64', 'arm64-v8a', 'armeabi-v7a'])
15+
.makeOptionMandatory(),
16+
)
17+
.addOption(
18+
new Option(
19+
'-f, --file <path>',
20+
'The path of the symbol files in Zip format',
21+
).makeOptionMandatory(),
22+
)
23+
.addOption(new Option('--api_key <value>', 'Your App key').makeOptionMandatory())
24+
.addOption(
25+
new Option('-t, --token <value>', 'Your App Token')
26+
.env('INSTABUG_APP_TOKEN')
27+
.makeOptionMandatory(),
28+
)
29+
.addOption(
30+
new Option('-n, --name <value>', 'The app version name')
31+
.env('INSTABUG_APP_VERSION_NAME')
32+
.makeOptionMandatory(),
33+
)
34+
.action(function (this: Command) {
35+
const options = this.opts<UploadSoFilesOptions>();
36+
uploadSoFiles(options);
37+
})
38+
.showHelpAfterError();

cli/commands/UploadSourcemaps.ts

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { Command, Option } from 'commander';
2+
import { uploadSourcemaps, UploadSourcemapsOptions } from '../upload/uploadSourcemaps';
3+
4+
export const uploadSourcemapsCommand = new Command();
5+
6+
uploadSourcemapsCommand
7+
.name('upload-sourcemaps')
8+
.addOption(
9+
new Option('-p, --platform <value>', 'Platform')
10+
.choices(['ios', 'android'])
11+
.makeOptionMandatory(),
12+
)
13+
.addOption(
14+
new Option('-f, --file <path>', 'The path of the source map file').makeOptionMandatory(),
15+
)
16+
.addOption(
17+
new Option('-t, --token <value>', 'Your App Token')
18+
.env('INSTABUG_APP_TOKEN')
19+
.makeOptionMandatory(),
20+
)
21+
.addOption(
22+
new Option('-n, --name <value>', 'The app version name')
23+
.env('INSTABUG_APP_VERSION_NAME')
24+
.makeOptionMandatory(),
25+
)
26+
.addOption(
27+
new Option('-c, --code <value>', 'The app version code')
28+
.env('INSTABUG_APP_VERSION_CODE')
29+
.makeOptionMandatory(),
30+
)
31+
.addOption(
32+
new Option('-l, --label <value>', "The CodePush label if it's a CodePush release").env(
33+
'INSTABUG_APP_VERSION_LABEL',
34+
),
35+
)
36+
.action(function (this: Command) {
37+
const options = this.opts<UploadSourcemapsOptions>();
38+
uploadSourcemaps(options);
39+
})
40+
.showHelpAfterError();

cli/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env node
22
import { Command } from 'commander';
33

4-
import { uploadSourcemapsCommand } from './UploadSourcemaps';
5-
import { UploadSoFilesCommand } from './UploadSoFiles';
4+
import { uploadSourcemapsCommand } from './commands/UploadSourcemaps';
5+
import { UploadSoFilesCommand } from './commands/UploadSoFiles';
66

77
const program = new Command();
88

cli/upload/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './uploadSourcemaps';
2+
export * from './uploadSoFiles';

0 commit comments

Comments
 (0)