feat: convert to v2 addon format#59
Open
aklkv wants to merge 4 commits into
Open
Conversation
Migrates ember-cli-raygun from a v1 (ember-cli) addon to a v2 (Embroider/Vite-compatible) addon, modernises tooling, and introduces an explicit setupRaygun bootstrap.
v2-addon convention: test the addon's exports (RaygunService, setupRaygun) directly. The demo app is for vite serve / manual exploration, not the test suite. Also fixes CI on ember-lts-5.8 / ember-lts-5.12, whose renderers don't accept template-tag SFCs as route templates.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #57
Migrates
ember-cli-raygunfrom a v1 (ember-cli) addon to a v2 addon, modernises tooling, and replaces the auto-running instance initializer with an explicitsetupRaygunbootstrap that the host app calls.Highlights
src/, built with Rollup (addon-main.cjs+rollup.config.mjs). Compatible with Embroider/Vite hosts.setupRaygun(appInstance, config)in theirapp/instance-initializers/raygun.js(orApp.instanceInitializer({...})inapp/app.js). No more magic..ts/.gts.@ember/test-helpers, ember-qunit 9, qunit-dom 3, ESLint 9 flat config, Prettier,publint, GitHub Actions (pinned to commit SHAs) replacing Travis.demo-app/(wastests/dummy/) showing the loader, user identity form, error scenarios, and a live "what was sent to Raygun" panel via anonBeforeSendhook.Breaking changes (for consumers)
ember install ember-cli-raygunpnpm add ember-cli-raygun(or npm/yarn). No blueprint.contentFor('head')<script>snippet into yourindex.htmlyourself (v2 addons can't inject into the host's<head>). See README.instance-initializers/raygun.jsin the appsetupRaygun(appInstance, config)yourself from an instance initializer orApp.instanceInitializer({...}).ENV.rayguninconfig/environment.jssetupRaygundirectly.enablePulsehardcoded onenablePulse(defaults totrue).ENV.raygun.optionswas a no-oprg4js('options', ...).routeDidChangetrackPageViews(defaults totrue).The README has a full upgrade guide and a side-by-side migration table.
Service surface (unchanged shape)
Every method gracefully no-ops +
console.warns whenwindow.rg4jsisn't loaded (e.g. CSP/network blocked the CDN).Tests
pnpm test— 28/28 passing across:tests/acceptance/error-maker-test.ts(8) — demo render,onBeforeSendregistration, manual report, form wiring,LinkTonavigation.tests/unit/services/raygun-test.ts(9) — every setter/getter round-trips throughrg4js, and the rg4js-missing fallback warns instead of throwing.tests/unit/setup-test.ts(10) — early-exit when disabled, full configuration,enablePulsedefault/explicit,optionsforwarding, missing-service warning,unhandledrejection→raygun.send,appInstance.onerrorchaining,routeDidChange→ pageView,trackPageViews: false.Plus
pnpm lint(ESLint, prettier, ember-template-lint, ember-tsc, publint) is green.Out of scope / follow-ups
enablePulsecommand name against the latest raygun4js docs (modern docs preferenableRealUserMonitoring/options.disablePulse).transition.to.name); revisit usingrouter.currentURL.