Skip to content

chore(ember): Update & cleanup Ember SDK #6003

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 14 commits into from
Oct 24, 2022
Merged

chore(ember): Update & cleanup Ember SDK #6003

merged 14 commits into from
Oct 24, 2022

Conversation

mydea
Copy link
Member

@mydea mydea commented Oct 20, 2022

This PR updates ember-cli (and all other dev dependencies) to the latest versions, updating to newer format of things etc. along the way.

While doing this, I also cleaned up some workflow-specific things. Notably:

lint / test

  • lint now also actually checks if all types are OK (this was not really checked before)
  • test now only runs against the pinned version of ember-source (as of now, 4.8.0). Previously, we had some code to run ember-try against the current release, but allowed it to fail (probably to avoid noise). IMHO it makes more sense to simply only run against the known stuff, and then run the full compatibility checks on CI only.

Compatibility

Speaking of compatibility, I have aligned the actually tested versions with the stated compatibility from the readme (ember 4+). Previously, we tested against 3.24 (and also the pinned version was 3.x). Note that realistically, nothing should actually change in support etc. with this PR.

Also, instead of running against beta on CI (but allowing to fail), I updated CI to instead only run against:

  • release (current version)
  • 4.0
  • embroider optimized (alternate build tool)

This should give a good coverage and safety that nothing important is breaking. Things like classic etc. are not that relevant, and it is highly unlikely (bordering on impossible) to have any impact on sentry code.

Tests

I made some minor adjustments to tests / the dummy app. Mainly, in newer versions the built-in components (<LinkTo> etc) are glimmer components instead of ember components, which are, as of now, not instrumented. Leading to failing tests.

Updates to actual package code

Some very minor adjustments are included here (necessitated by other updates), which should all be fully backwards compatible:

  • Some tiny TS adjustments
  • Import from modules (e.g. @ember/instrumentation) instead of using Ember.x
  • Bump ember-cli-typescript dependency from 4.x to 5.x. The only breaking change there has been dropping support for older node versions, which we do not support here anyhow.

A note on updating types

Please note that sadly, we cannot update the @types/ember dependencies at all, as the newer types rely on TS features that we currently do not support, leading to failing builds. So we need to keep them as-is for now.

@mydea mydea added the Package: ember Issues related to the Sentry Ember SDK label Oct 20, 2022
@mydea mydea self-assigned this Oct 20, 2022
Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome cleanup, looks good to me!

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, LGTM!

@@ -355,6 +354,26 @@ function _instrumentInitialLoad(config: EmberSentryConfig) {
performance.clearMeasures(measureName);
}

function _hasPerformanceSupport() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AbhiPrasad I ended up extracting this out like this. How do you normally handle it when checking something where TS "thinks" it cannot be undefined, but it can on some browsers? It didn't feel quite right to just cast const performance = window.performance as { ... }, as then you also need to do e.g. performance.clearMarks!() everywhere etc, which is also a bit weird 😅

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don’t do this very well, I would just best effort it tbh.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 21, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.41 KB (0%)
@sentry/browser - ES5 CDN Bundle (minified) 60.09 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.04 KB (+0.02% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 53.44 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 19.79 KB (0%)
@sentry/browser - Webpack (minified) 64.93 KB (0%)
@sentry/react - Webpack (gzipped + minified) 19.81 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 45.79 KB (+0.57% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.17 KB (+1.22% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 24.53 KB (+1.02% 🔺)

@mydea mydea changed the title Update & cleanup Ember SDK chore(ember): Update & cleanup Ember SDK Oct 24, 2022
mydea added 14 commits October 24, 2022 09:41
Where possible, import the module directly.
In newer versions, built-in components are Glimmer components, which are not (yet) instrumented. So these will not show up in transaction spans.
This is the same as the default config that is set anyhow, so no need to repeat this for test env.
1. When running "normal" tests, only run for pinned version of ember.
2. When running on CI, test pinned version, 4.0, release & embroider.
3. Run `yarn test:all` to test all CI versions locally
We use this custom component instead of the built-in `<LinkTo>`, as that is an ember component in older versions, and a glimmer component in newer versions.

Since glimmer components are, as of now, not instrumented, this leads to different test results.
The new/current types use newer TS features that we currently do not support :(
This did not play nicely with E2E tests, so disabling this for now...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants