Skip to content

feat: export upload utils #1252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Distribution
dist/
bin/
upload/*
!upload/package.json

# NodeJS
node_modules/
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

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

### Added

- 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)).

### Fixed

- Fix APM network logging on Android ([#1253](https://github.com/Instabug/Instabug-React-Native/pull/1253)).
Expand Down
88 changes: 0 additions & 88 deletions cli/UploadSoFiles.ts

This file was deleted.

89 changes: 0 additions & 89 deletions cli/UploadSourcemaps.ts

This file was deleted.

38 changes: 38 additions & 0 deletions cli/commands/UploadSoFiles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { Command, Option } from 'commander';
import { uploadSoFiles, UploadSoFilesOptions } from '../upload/uploadSoFiles';

/**
* This script uploads .so files to the specified endpoint used in NDK crash reporting.
* Usage: node upload-so-files.js --arch <arch> --file <path> --api_key <key> --token <token> --name <name>
*/

export const UploadSoFilesCommand = new Command();

UploadSoFilesCommand.name('upload-so-files')
.addOption(
new Option('-arch, --arch <value>', 'arch')
.choices(['x86', 'x86_64', 'arm64-v8a', 'armeabi-v7a'])
.makeOptionMandatory(),
)
.addOption(
new Option(
'-f, --file <path>',
'The path of the symbol files in Zip format',
).makeOptionMandatory(),
)
.addOption(new Option('--api_key <value>', 'Your App key').makeOptionMandatory())
.addOption(
new Option('-t, --token <value>', 'Your App Token')
.env('INSTABUG_APP_TOKEN')
.makeOptionMandatory(),
)
.addOption(
new Option('-n, --name <value>', 'The app version name')
.env('INSTABUG_APP_VERSION_NAME')
.makeOptionMandatory(),
)
.action(function (this: Command) {
const options = this.opts<UploadSoFilesOptions>();
uploadSoFiles(options);
})
.showHelpAfterError();
40 changes: 40 additions & 0 deletions cli/commands/UploadSourcemaps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { Command, Option } from 'commander';
import { uploadSourcemaps, UploadSourcemapsOptions } from '../upload/uploadSourcemaps';

export const uploadSourcemapsCommand = new Command();

uploadSourcemapsCommand
.name('upload-sourcemaps')
.addOption(
new Option('-p, --platform <value>', 'Platform')
.choices(['ios', 'android'])
.makeOptionMandatory(),
)
.addOption(
new Option('-f, --file <path>', 'The path of the source map file').makeOptionMandatory(),
)
.addOption(
new Option('-t, --token <value>', 'Your App Token')
.env('INSTABUG_APP_TOKEN')
.makeOptionMandatory(),
)
.addOption(
new Option('-n, --name <value>', 'The app version name')
.env('INSTABUG_APP_VERSION_NAME')
.makeOptionMandatory(),
)
.addOption(
new Option('-c, --code <value>', 'The app version code')
.env('INSTABUG_APP_VERSION_CODE')
.makeOptionMandatory(),
)
.addOption(
new Option('-l, --label <value>', "The CodePush label if it's a CodePush release").env(
'INSTABUG_APP_VERSION_LABEL',
),
)
.action(function (this: Command) {
const options = this.opts<UploadSourcemapsOptions>();
uploadSourcemaps(options);
})
.showHelpAfterError();
4 changes: 2 additions & 2 deletions cli/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env node
import { Command } from 'commander';

import { uploadSourcemapsCommand } from './UploadSourcemaps';
import { UploadSoFilesCommand } from './UploadSoFiles';
import { uploadSourcemapsCommand } from './commands/UploadSourcemaps';
import { UploadSoFilesCommand } from './commands/UploadSoFiles';

const program = new Command();

Expand Down
2 changes: 2 additions & 0 deletions cli/upload/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './uploadSourcemaps';
export * from './uploadSoFiles';
Loading