Skip to content

Commit

Permalink
Migrate to Sentry JavaScript V8 (#675)
Browse files Browse the repository at this point in the history
* migrate V8 initial commit

* add polyfill, changed integrations structure

* format prettier and update prettier

* remove enable out of memory and update packages

* update jest, replace scope with scopeSync

* fix deprecated expect tests

* fix test build rule

* fix default integrations init. Fix SDK tests

* fix sdkinfo tests

* fix release tests

* fix native options, rewrite frames and webview tests

* lint

* isolate race condition

* nit build errors

* expose registerSpanErrorInstrumentation and add changelog/migration guide

* Apply suggestions from code review

Co-authored-by: Krystof Woldrich <[email protected]>

* removed testutils.ts, migration.md, altered changelog with requested changes.  removed setup from integrations. Added check for TextEncoder.

* forgot to add textEncoders.ts

* ordering issue

* add back isolationscope

* requested changes

* add missing get scope

* yarn fix

* Prepare Samples for Sentry Javascript V8 (#686)

* apply break changes to code, update yarn from v6

* port sample v6

* bump v5

* bump v4

* bump v3

* bump vue

* ios test

* expose registerSpanErrorInstrumentation and add changelog/migration guide

* Apply suggestions from code review

Co-authored-by: Krystof Woldrich <[email protected]>

* removed testutils.ts, migration.md, altered changelog with requested changes.  removed setup from integrations. Added check for TextEncoder.

* forgot to add textEncoders.ts

* ordering issue

* add back isolationscope

* requested changes

* yarn
 fix

* requested changes

---------

Co-authored-by: Krystof Woldrich <[email protected]>

* requested changes

* test download artifact v4

---------

Co-authored-by: Krystof Woldrich <[email protected]>
  • Loading branch information
lucas-zimerman and krystofwoldrich authored Jul 31, 2024
1 parent 53eb95a commit 44709b3
Show file tree
Hide file tree
Showing 79 changed files with 9,711 additions and 9,016 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module.exports = {
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/unbound-method': 'off',
},
},
{
Expand All @@ -48,6 +49,5 @@ module.exports = {
'@sentry-internal/sdk/no-optional-chaining': 'off',
'@sentry-internal/sdk/no-nullish-coalescing': 'off',
'@sentry-internal/sdk/no-class-field-initializers': 'off',
'deprecation/deprecation': 'off',
},
};
2 changes: 1 addition & 1 deletion .github/workflows/buildandtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ jobs:
run: yarn global add @ionic/cli

- name: Download Sentry Capacitor package
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: yalc-package
path: ~/.yalc # Ensure this path matches where yalc expects to find the package
Expand Down
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,34 @@

## Unreleased


### How to Upgrade to Version 1:

- Angular minimum supported version changed to version 14, upgrade to Angular 14 or higher for using the latest SDK.

- When using the package `@sentry/angular-ivy`, you will need to replace it by `@sentry/angular`.

- enableOutOfMemoryTracking was removed and replaced by enableWatchdogTerminationTracking.

- We recommend reading the
[migration guide docs](https://docs.sentry.io/platforms/javascript/migration/v7-to-v8/#migration-codemod) to find out
how to address any breaking changes in your code for your specific platform or framework.

To automate upgrading to v8 as much as possible, use our migration codemod `@sentry/migr8`:

```sh
npx @sentry/migr8@latest
```

All deprecations from the v7 cycle, with the exception of `getCurrentHub()`, have been removed and can no longer be used
in v8. If you have an advanced Sentry SDK setup, we additionally recommend reading the
[in-depth migration guide](https://github.com/getsentry/sentry-javascript/blob/develop/MIGRATION.md#upgrading-from-7x-to-8x) in our repo which highlights all changes with additional details and
information.


### Features

- Support for Angular 18 ([#675](https://github.com/getsentry/sentry-capacitor/pull/675))
- Add close function on `@sentry/capacitor` ([#664](https://github.com/getsentry/sentry-capacitor/pull/664))
- Expose `getClient` on `@sentry/capacitor` ([#664](https://github.com/getsentry/sentry-capacitor/pull/664))
- Add the following functions to `@sentry/capacitor` ([#666](https://github.com/getsentry/sentry-capacitor/pull/666))
Expand All @@ -13,6 +39,12 @@

- Accept undefined as value for tags ([#656](https://github.com/getsentry/sentry-capacitor/pull/656))

### Dependencies

- Bump JavaScript SDK from v7.114.0 to v8.9.2 ([#675](https://github.com/getsentry/sentry-capacitor/pull/675))
- [changelog](https://github.com/getsentry/sentry-javascript/blob/8.9.2/CHANGELOG.md)
- [diff](https://github.com/getsentry/sentry-javascript/compare/7.114.0...8.9.2)

## 0.18.0

### Features
Expand Down
6 changes: 4 additions & 2 deletions example/ionic-angular-v3/angular.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"defaultProject": "app",
"newProjectRoot": "projects",
"projects": {
"app": {
Expand Down Expand Up @@ -171,7 +170,10 @@
}
},
"cli": {
"defaultCollection": "@ionic/angular-toolkit"
"schematicCollections": [
"@ionic/angular-toolkit"
],
"analytics": false
},
"schematics": {
"@ionic/angular-toolkit:component": {
Expand Down
12 changes: 0 additions & 12 deletions example/ionic-angular-v3/browserslist

This file was deleted.

26 changes: 13 additions & 13 deletions example/ionic-angular-v3/package.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
{
"author": "Ionic Framework",
"dependencies": {
"@angular/common": "~13.3.0",
"@angular/core": "~13.3.0",
"@angular/forms": "~13.3.0",
"@angular/platform-browser": "~13.3.0",
"@angular/platform-browser-dynamic": "~13.3.0",
"@angular/router": "~13.3.0",
"@angular/common": "^14.3.0",
"@angular/core": "^14.3.0",
"@angular/forms": "^14.3.0",
"@angular/platform-browser": "^14.3.0",
"@angular/platform-browser-dynamic": "^14.3.0",
"@angular/router": "^14.3.0",
"@capacitor/android": "^3.9.0",
"@capacitor/core": "^3.9.0",
"@capacitor/ios": "^3.9.0",
"@ionic-native/core": "^5.0.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic/angular": "^5.0.0",
"@sentry/angular-ivy": "7.114.0",
"@ionic/angular": "6.7.5",
"@sentry/angular": "8.9.2",
"@sentry/capacitor": "file:.yalc/@sentry/capacitor",
"rxjs": "~6.5.5",
"tslib": "^2.0.0",
"zone.js": "~0.11.4"
},
"description": "An Ionic project",
"devDependencies": {
"@angular-devkit/build-angular": "~13.3.0",
"@angular/cli": "~13.3.0",
"@angular/compiler": "~13.3.0",
"@angular/compiler-cli": "~13.3.0",
"@angular/language-service": "~13.3.0",
"@angular-devkit/build-angular": "^14.2.13",
"@angular/cli": "^14.2.13",
"@angular/compiler": "^14.3.0",
"@angular/compiler-cli": "^14.3.0",
"@angular/language-service": "^14.3.0",
"@capacitor/cli": "^3.9.0",
"@ionic/angular-toolkit": "^2.3.0",
"@ionic/cli": "^6.16.3",
Expand Down
38 changes: 22 additions & 16 deletions example/ionic-angular-v3/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';

import * as Sentry from '@sentry/capacitor';
import { init as sentryAngularInit, createErrorHandler } from '@sentry/angular-ivy';
import { init as sentryAngularInit, createErrorHandler } from '@sentry/angular';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
Expand All @@ -24,7 +24,13 @@ Sentry.init(
// Whether SDK should be enabled or not
enabled: true,
// Use the tracing integration to see traces and add performance monitoring
integrations: [new Sentry.BrowserTracing()],
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration({
maskAllText: false,
blockAllMedia: true,
}),
],
// A release identifier
release: '1.0.0',
// A dist identifier
Expand All @@ -39,18 +45,18 @@ Sentry.init(
);

@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule],
providers: [
StatusBar,
SplashScreen,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
/* Provide the @sentry/angular error handler */
{
provide: ErrorHandler,
useValue: createErrorHandler(),
},
],
bootstrap: [AppComponent]
declarations: [AppComponent],
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule],
providers: [
StatusBar,
SplashScreen,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
/* Provide the @sentry/angular error handler */
{
provide: ErrorHandler,
useValue: createErrorHandler(),
},
],
bootstrap: [AppComponent]
})
export class AppModule {}
export class AppModule { }
16 changes: 6 additions & 10 deletions example/ionic-angular-v3/src/app/tab1/tab1.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { SeverityLevel } from '@sentry/types';
styleUrls: ['tab1.page.scss'],
})
export class Tab1Page {
constructor() {}
constructor() { }

public throwUnhandledException(): void {
// @ts-ignore intentionally calling to demonstrate global error handling
Expand Down Expand Up @@ -126,20 +126,16 @@ export class Tab1Page {
}

public clearUser(): void {
Sentry.configureScope(scope => {
scope.setUser(null);
});
Sentry.setUser(null);
}

public clearBreadcrumbs(): void {
Sentry.configureScope(scope => {
scope.clearBreadcrumbs();
});
Sentry.getGlobalScope().clearBreadcrumbs();
Sentry.getIsolationScope().clearBreadcrumbs();
Sentry.getCurrentScope().clearBreadcrumbs();
}

public clearTestContext(): void {
Sentry.configureScope(scope => {
scope.setContext('TEST-CONTEXT', null);
});
Sentry.setContext('TEST-CONTEXT', null);
}
}
2 changes: 1 addition & 1 deletion example/ionic-angular-v3/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"target": "es2020",
"lib": [
"es2018",
"dom"
Expand Down
Loading

0 comments on commit 44709b3

Please sign in to comment.