Skip to content

feat: convert to v2 addon format#59

Open
aklkv wants to merge 4 commits into
MindscapeHQ:mainfrom
aklkv:feat/v2-format
Open

feat: convert to v2 addon format#59
aklkv wants to merge 4 commits into
MindscapeHQ:mainfrom
aklkv:feat/v2-format

Conversation

@aklkv
Copy link
Copy Markdown

@aklkv aklkv commented Apr 27, 2026

Fixes: #57

Migrates ember-cli-raygun from a v1 (ember-cli) addon to a v2 addon, modernises tooling, and replaces the auto-running instance initializer with an explicit setupRaygun bootstrap that the host app calls.

Highlights

  • v2 addon format: published source lives in src/, built with Rollup (addon-main.cjs + rollup.config.mjs). Compatible with Embroider/Vite hosts.
  • Explicit bootstrap: consumers wire the addon via setupRaygun(appInstance, config) in their app/instance-initializers/raygun.js (or App.instanceInitializer({...}) in app/app.js). No more magic.
  • TypeScript everywhere: addon source, demo app, and tests are all .ts / .gts.
  • Modern tooling: pnpm workspace, Vite + @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 under demo-app/ (was tests/dummy/) showing the loader, user identity form, error scenarios, and a live "what was sent to Raygun" panel via an onBeforeSend hook.

Breaking changes (for consumers)

Before (v1) After (v2)
ember install ember-cli-raygun pnpm add ember-cli-raygun (or npm/yarn). No blueprint.
Loader injected by contentFor('head') Paste the raygun4js <script> snippet into your index.html yourself (v2 addons can't inject into the host's <head>). See README.
Auto-wired via instance-initializers/raygun.js in the app Call setupRaygun(appInstance, config) yourself from an instance initializer or App.instanceInitializer({...}).
Config read from ENV.raygun in config/environment.js Pass the same shape to setupRaygun directly.
enablePulse hardcoded on Configurable via enablePulse (defaults to true).
ENV.raygun.options was a no-op Forwarded to rg4js('options', ...).
Page-view tracking always on, fired on every routeDidChange Toggleable via trackPageViews (defaults to true).

The README has a full upgrade guide and a side-by-side migration table.

Service surface (unchanged shape)

import type { RaygunService } from 'ember-cli-raygun';

raygun.send(error);
raygun.setUser({ identifier, email, fullName });
raygun.trackEvent({ type: 'customTiming', name: 'X', duration: 1200 });

Every method gracefully no-ops + console.warns when window.rg4js isn't loaded (e.g. CSP/network blocked the CDN).

Tests

pnpm test28/28 passing across:

  • tests/acceptance/error-maker-test.ts (8) — demo render, onBeforeSend registration, manual report, form wiring, LinkTo navigation.
  • tests/unit/services/raygun-test.ts (9) — every setter/getter round-trips through rg4js, and the rg4js-missing fallback warns instead of throwing.
  • tests/unit/setup-test.ts (10) — early-exit when disabled, full configuration, enablePulse default/explicit, options forwarding, missing-service warning, unhandledrejectionraygun.send, appInstance.onerror chaining, routeDidChange → pageView, trackPageViews: false.

Plus pnpm lint (ESLint, prettier, ember-template-lint, ember-tsc, publint) is green.

Out of scope / follow-ups

  • Verify the enablePulse command name against the latest raygun4js docs (modern docs prefer enableRealUserMonitoring / options.disablePulse).
  • Page-view tracking still uses route names (transition.to.name); revisit using router.currentURL.

aklkv added 4 commits April 26, 2026 17:17
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v2 format

1 participant