Repository navigation
Modernize tooling and validate the configuration: TypeScript, ESM, Vitest, ESLint 10, zod - #34
Merged
Merged
Conversation
- @sentry/node 8 → 11, date-fns 3 → 4, jest 29 → 30, lerna 8 → 10 - babel and eslint to latest compatible 7.x / 8.x - drop deprecated @babel/plugin-proposal-class-properties (covered by preset-env) - CI: Node 24, actions/checkout and actions/setup-node v7 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
All packages now share one version. `npm run release` bumps every workspace, commits and tags the release; CI publishes the tag with `npm publish --workspaces` after checking it matches the version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Sources are TypeScript, built with tsc into ESM + type declarations. The handwritten types.d.ts files are replaced by generated ones. - Tests run with vitest instead of jest. The config tests use real fixture projects instead of virtual jest mocks. - Formatters and plugins are resolved with createRequire() from the project's package.json and loaded via require(esm), which keeps the Logger constructor synchronous. - Replace the deprecated jest-get-type with a small local check. - Fix numbers in the configuration being turned into empty objects while parsing env() placeholders. - Make the example project runnable again. BREAKING CHANGE: The packages are ESM only and require Node.js >= 22.12. Plugins and formatters loaded via package.json must be resolvable with Node's module resolution (ESM or CJS with a default export). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace eslint-config-brainbits with a flat config based on the recommended rules of ESLint, typescript-eslint (type checked), import-x and vitest. @Stylistic keeps the existing code style (4 spaces, semicolons, single quotes, 1tbs). Errors thrown while loading formatters and plugins now keep the original error as `cause`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The merged configuration is validated when a Logger is created, after env() placeholders are resolved. All problems are reported at once with their path, unknown options are rejected. Plugins hook into the validation with a static `configSchema`: the logger loads the configured plugins first and validates their options together with its own. The Sentry plugin defines its options this way and accepts strings for booleans and numbers, so they can be set with env(). BREAKING CHANGE: Unknown options and invalid values throw an error. Only the standard log levels are allowed. Plugins that read their own options from the configuration need to provide a `configSchema`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 tasks done
- The eight syslog levels are fixed: the Logger has real methods for them and a generic `log(level, message, meta)`. The `levels` option is removed, so methods can't be missing at runtime anymore. - Messages are a string or an Error. The formatter logs the stack trace, the `context` of an error and the chain of `cause` errors. - `Meta` is an interface plugins can extend; the Sentry plugin adds `tags` and `user`. Users are typed in the config schema. - Timers take a string label and are removed when stopped. - The Sentry plugin maps the log levels to Sentry's severity levels (keeping the original as tag) and sends strings as messages instead of exceptions. - Remove CustomError, HttpError and ConnectorError: domain errors don't belong into the logger, the native `cause` replaces `origin`. BREAKING CHANGE: The `levels` option is removed, messages must be a string or an Error, and the error classes are no longer exported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`npm version --workspaces` bumped the versions but left the peer dependency of the formatter and the Sentry plugin on the core package at ^2.2.3, so the bump itself and every following `npm ci` failed with ERESOLVE. The release script now bumps the workspaces itself and sets their peer dependencies on other workspace packages to the new version before the lockfile is updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Messages are typed as string or Error, but callers without type checks still log objects and arrays. They became `[object Object]` and arrays were joined with commas. The formatter logs them like before again: the `message` and `context` of an object are used, the other properties become extras, arrays are joined with spaces. The Sentry plugin sends them as readable text and keeps objects as extra. The Sentry plugin buffered breadcrumbs itself and added all of them to Sentry again for every exception, so later events contained duplicates. Breadcrumbs are now added to Sentry directly, which keeps the last `maxBreadcrumbs` and scopes them per request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…kage.json once CommonJS modules exporting the formatter or plugin directly are loaded again, modules without a default export fail with a clear error. The package.json is read once per working directory instead of for every Logger, and is found in the root directory as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An env() without fallback no longer throws if the variable is not set or empty, the option is left out and its default applies. This way optional values like the Sentry DSN can stay unset. Empty variables use the fallback as well, they no longer result in an empty string. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eXaminator
force-pushed
the
update-all-dependencies
branch
from
October 15, 2026 12:49
11fa916 to
7d00c0b
Compare
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.
Summary
Replaces outdated tooling and converts the packages to TypeScript. Prepares the next major release (3.0.0).
@sentry/node8 → 11,date-fns3 → 4, CI on Node 24,actions/checkout/actions/setup-nodev7npm run release -- <major|minor|patch|x.y.z>bumps, commits and tags; CI checks that the tag matches the version and runsnpm publish --workspacestsc, ESM only, generated type declarations replace the handwrittentypes.d.tsLoggeris created, afterenv()placeholders are resolved. All problems are reported at once with their path, unknown options are rejectedconfigSchema; the logger loads the configured plugins first and validates their options together with its own. The Sentry plugin uses it (booleans/numbers accept strings forenv(),exceptionLevelmust be a configured level)Loggermethods plus a genericlog(level, message, meta)that rejects unknown levels; thelevelsoption is gone, so level methods can't be missing at runtime. Messages arestring | Error,Metais an interface plugins can extend (Sentry addstagsanduser), timers take a string labelCustomError,HttpErrorandConnectorErroraren't used anywhere and don't belong into a logger. The nativecausereplacesorigin; the formatter logs the stack trace, an error'scontextand the chain ofcauseerrorscritical→fataletc., the original level is kept as taglogLevel); strings are sent withcaptureMessageinstead ofcaptureException(the level is kept on the event); breadcrumbs are added to Sentry directly instead of being re-added for every exception, which caused duplicates@stylistickeeps the existing code styleeslint-config-brainbits, deprecatedjest-get-type. Install shrinks from 991 to 187 packages,npm auditreports 0 vulnerabilitiesBreaking changes
@sentry/node11 (requires Node.js >= 20.19 itself)levelsoption is removed, the eight syslog levels are fixedstring | Error. Objects and arrays from callers without type checks are still logged like before (message/context/extras, arrays joined with spaces)CustomError,HttpErrorandConnectorErrorare removedconfigSchemalog()with an unknown level throws aTypeErrorpackage.jsonare resolved with Node's module resolution from the project (createRequire) and loaded viarequire(esm), so theLoggerconstructor stays synchronousExample:
Fixes
{}while parsingenv()placeholders (e.g.sentry.maxBreadcrumbs→ unlimited breadcrumbs)cause"sentry": { "exceptionLevel": "fatal" }(no exception ever sent),"sentry": { "debug": "env(SENTRY_DEBUG, false)" }("false"is truthy) or"plugins"as string (crashed withconfig.plugins.map is not a function)examples/test-moduleis runnable againenv()without fallback no longer throws when the variable is missing or empty: the option is left out and its default applies, so optional values like the Sentry DSN can stay unset. Empty variables use the fallback as wellmodule.exports = …) are loaded; modules without default export fail with a clear errorpackage.jsonis read once per working directory instead of for everyLogger, and is found in the root directory as wellcontext.user/meta.user) are sent to Sentry againcausechain, including causes that are no errors and causes of plain objects; missing messages are logged as-againNotes
typescript-eslintdoesn't support TypeScript 7 yetnpm run release -- major. The release script also sets the peer dependencies of the formatter and the Sentry plugin on@brainbits/node-loggerto the new version (setting them before the bump is not possible,npm ciwould fail withERESOLVE)Test plan
npm ci,npm run typecheck,npm run lint,npm test(114 tests),npm run buildexamples/test-modulefails at startup with a readable error for a broken configuration, also when the invalid value comes fromenv()@sentry/node11 (init, console integration removed, user/tags/extras/breadcrumbs/exception in the event)examples/test-moduleloads formatter and Sentry plugin as ES modules viapackage.jsonand logs correctlymajorand a followingpatchbump all versions and peer dependencies,npm ci, build and tests pass, annotated tag matches the CI checkERESOLVEand log correctly; the Sentry plugin 3.0.0 together with@brainbits/node-logger@2is rejected by npm🤖 Generated with Claude Code