Skip to content
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
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Changelog

## [unreleased]
## [3.1.0] - 2025-05-12

### Added

- Add support for Linux ARM platforms [#202](https://github.com/bugsnag/bugsnag-cli/pull/202)

### Fixed

- Call the CLI directly rather than using NPX in the JS CLI wrapper [#201](https://github.com/bugsnag/bugsnag-cli/pull/201)

### Changed

Expand Down
2 changes: 1 addition & 1 deletion features/steps/steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def get_version_number(file_path)
# Change directory to the js directory
@js_dir = "#{base_dir}/js"
Dir.chdir(@js_dir)
@output = `npm pack`
@output = `npm i && npm pack`
@bugsnag_cli_package_path = "#{@js_dir}/#{@output}"
Dir.chdir(base_dir)
end
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ display_help() {
EOS
}

VERSION="3.0.1"
VERSION="3.1.0"

while [[ "$#" -gt 0 ]]; do
case "$1" in
Expand Down
4 changes: 2 additions & 2 deletions js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/cli",
"version": "3.0.1",
"version": "3.1.0",
"description": "BugSnag CLI",
"main": "dist/bugsnag-cli-wrapper.js",
"types": "dist/bugsnag-cli-wrapper.d.ts",
Expand Down Expand Up @@ -33,7 +33,7 @@
"build": "tsc",
"postinstall": "node postinstall.js",
"prepack": "npm run prepublish",
"prepublish": "cp bin/bugsnag-cli-placeholder bin/bugsnag-cli"
"prepublish": "npm run build && cp bin/bugsnag-cli-placeholder bin/bugsnag-cli"
},
"devDependencies": {
"@types/node": "^22.15.3",
Expand Down
84 changes: 9 additions & 75 deletions js/src/bugsnag-cli-wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,72 +1,6 @@
import { exec } from 'child_process'

interface BaseOptions {
apiKey?: string
dryRun?: boolean
logLevel?: string
port?: number
failOnUploadError?: boolean
verbose?: boolean
overwrite?: boolean
retries?: number
timeout?: number
}

export interface BugsnagCreateBuildOptions extends BaseOptions {
autoAssignRelease?: boolean
buildApiRootUrl?: string
builderName?: string
metadata?: object
provider?: string
releaseStage?: string
repository?: string
revision?: string
versionName?: string
androidAab?: string
appManifest?: string
versionCode?: string
bundleVersion?: string
}

interface UploadOptions extends BaseOptions {
uploadApiRootUrl?: string
projectRoot?: string
dev?: boolean
bundle?: string
versionName?: string
sourceMap?: string
codeBundleId?: string
}

export interface BugsnagUploadReactNativeOptions extends UploadOptions {
androidAppManifest?: string
androidVariant?: string
androidVersionCode?: string
iosBundleVersion?: string
iosPlist?: string
iosScheme?: string
iosXcodeProject?: string
}

export interface BugsnagUploadiOSOptions extends UploadOptions {
sourceMap?: string
bundleVersion?: string
plist?: string
scheme?: string
xcodeProject?: string
}

export interface BugsnagUploadAndroidOptions extends UploadOptions {
appManifest?: string
variant?: string
versionCode?: string
}

export interface BugsnagUploadJsOptions extends UploadOptions {
baseUrl?: string
bundleUrl?: string
projectRoot?: string
}
import { execFile } from 'child_process'
import { BugsnagCreateBuildOptions, BugsnagUploadiOSOptions, BugsnagUploadJsOptions, BugsnagUploadAndroidOptions, BugsnagUploadReactNativeOptions } from './types'
import * as path from "path"

/**
* Wrapper for Bugsnag CLI
Expand Down Expand Up @@ -98,13 +32,13 @@ class BugsnagCLI {
.filter(Boolean)
.join(' ')

const positionalArg = target ? `"${target}"` : ''
const cliCommand = `npx bugsnag-cli ${command} ${kebabCaseOptions} ${positionalArg}`.trim()

const binPath = path.resolve(__dirname, path.join('..','bin','bugsnag-cli'))
// Split CLI options to pass to execFile
const args = [...command.split(" "), ...kebabCaseOptions.split(" "), target.trim()]
// Execute the command
exec(cliCommand, (error, stdout, stderr) => {
execFile(binPath, args, (error, stdout, stderr) => {
if (error) {
const errorMessage = `Command failed: ${cliCommand}\n` +
const errorMessage = `Command failed: ${binPath}\n` +
`Error: ${error.message}\n` +
`${stdout.trim()}`
reject(errorMessage)
Expand Down Expand Up @@ -156,4 +90,4 @@ class BugsnagCLI {

}

export default BugsnagCLI
export = BugsnagCLI
67 changes: 67 additions & 0 deletions js/src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
interface BaseOptions {
apiKey?: string
dryRun?: boolean
logLevel?: string
port?: number
failOnUploadError?: boolean
verbose?: boolean
overwrite?: boolean
retries?: number
timeout?: number
}

export interface BugsnagCreateBuildOptions extends BaseOptions {
autoAssignRelease?: boolean
buildApiRootUrl?: string
builderName?: string
metadata?: object
provider?: string
releaseStage?: string
repository?: string
revision?: string
versionName?: string
androidAab?: string
appManifest?: string
versionCode?: string
bundleVersion?: string
}

interface UploadOptions extends BaseOptions {
uploadApiRootUrl?: string
projectRoot?: string
dev?: boolean
bundle?: string
versionName?: string
sourceMap?: string
codeBundleId?: string
}

export interface BugsnagUploadReactNativeOptions extends UploadOptions {
androidAppManifest?: string
androidVariant?: string
androidVersionCode?: string
iosBundleVersion?: string
iosPlist?: string
iosScheme?: string
iosXcodeProject?: string
}

export interface BugsnagUploadiOSOptions extends UploadOptions {
sourceMap?: string
bundleVersion?: string
plist?: string
scheme?: string
xcodeProject?: string
}

export interface BugsnagUploadAndroidOptions extends UploadOptions {
appManifest?: string
variant?: string
versionCode?: string
}

export interface BugsnagUploadJsOptions extends UploadOptions {
baseUrl?: string
bundleUrl?: string
projectRoot?: string
}
5 changes: 5 additions & 0 deletions js/supported-platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
ARTIFACT_NAME: 'x86_64-linux-bugsnag-cli'
BINARY_NAME: 'bugsnag-cli'

- TYPE: 'Linux'
ARCHITECTURE: 'arm64'
ARTIFACT_NAME: 'arm64-linux-bugsnag-cli'
BINARY_NAME: 'bugsnag-cli'

- TYPE: 'Linux'
ARCHITECTURE: 'i386'
ARTIFACT_NAME: 'i386-linux-bugsnag-cli'
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/bugsnag/bugsnag-cli/pkg/utils"
)

var package_version = "3.0.1"
var package_version = "3.1.0"

func main() {
commands := options.CLI{}
Expand Down
1 change: 1 addition & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ build-windows:
.PHONY: build-linux
build-linux:
[ -d bin ] || mkdir -p bin
GOOS=linux GOARCH=arm64 go build -ldflags '-s' -o bin/arm64-linux-bugsnag-cli main.go
GOOS=linux GOARCH=amd64 go build -ldflags '-s' -o bin/x86_64-linux-bugsnag-cli main.go
GOOS=linux GOARCH=386 go build -ldflags '-s' -o bin/i386-linux-bugsnag-cli main.go

Expand Down
2 changes: 1 addition & 1 deletion scripts/bump-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ fi
echo Bumping the version number to $VERSION
sed -i '' "s/package_version = \".*\"/package_version = \"$VERSION\"/" main.go
sed -i '' "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" js/package.json
sed -i '' "s/## \[Unreleased\]/## \[$VERSION\] - $(date '+%Y-%m-%d')/" CHANGELOG.md
sed -i '' "s/## \[unreleased\]/## \[$VERSION\] - $(date '+%Y-%m-%d')/" CHANGELOG.md
sed -i '' "s/VERSION=\".*\"/VERSION=\"$VERSION\"/" install.sh