Conversation
Replace semantic-release with release-it and update the release workflow. Removed legacy semantic-release configs (.release-it.json and release.config.cjs) and embed a release-it configuration in package.json; updated the npm "release" script to run release-it and adjusted devDependencies accordingly. Updated .github/workflows/release.yml to add workflow_dispatch inputs (increment, dry-run), configure Node registry, persist credentials, set git author identity, install dependencies, and run yarn release with CI flags and forwarded args (including NODE_AUTH_TOKEN and NPM_CONFIG_PROVENANCE). Regenerated yarn.lock to reflect dependency changes.
There was a problem hiding this comment.
Pull request overview
This PR updates the project’s release automation and TypeScript compatibility by migrating from semantic-release to release-it, adjusting error classes to avoid relying on the ES2022 Error constructor signature, and bumping related dependencies/versions.
Changes:
- Replace
semantic-releasesetup withrelease-itand consolidate release configuration intopackage.json. - Update
SensitiveInfoErrorandHookErrorto assigncausewithout usingError(message, { cause })(TS lib compatibility). - Upgrade
nitrogen/react-native-nitro-modulesand refresh the lockfile; bump version to6.1.1with a changelog entry.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
package.json |
Switch release scripts/deps to release-it and add embedded release-it config; bump version + dependency updates. |
.github/workflows/release.yml |
Enhance manual release workflow with increment + dry-run inputs and updated env handling. |
src/errors.ts |
Adjust typed error base class to assign cause manually for older TS lib compatibility. |
src/hooks/types.ts |
Adjust hook error wrapper to assign cause manually for older TS lib compatibility. |
CHANGELOG.md |
Add 6.1.1 entry for the TypeScript cause compatibility fix. |
example/package.json |
Bump react-native-nitro-modules to 0.35.6. |
yarn.lock |
Lockfile updates reflecting release/dependency changes and upgrades. |
release.config.cjs |
Remove old semantic-release configuration. |
.release-it.json |
Remove standalone release-it config now embedded in package.json. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Assign `cause` directly instead of passing it to `super()` so this | ||
| // compiles cleanly under TS configs whose `lib` predates ES2022 (where | ||
| // the second `Error` constructor argument was introduced). | ||
| if (options && 'cause' in options) { | ||
| ;(this as { cause?: unknown }).cause = options.cause |
There was a problem hiding this comment.
Assigning cause via direct property assignment makes it enumerable, which differs from the native ES2022 Error constructor behavior (where cause is non-enumerable). Consider using Object.defineProperty(this, 'cause', { value: options.cause, configurable: true }) (and keep it non-enumerable) to better match standard error semantics while retaining TS compatibility.
| // Assign `cause` directly instead of passing it to `super()` so this | |
| // compiles cleanly under TS configs whose `lib` predates ES2022 (where | |
| // the second `Error` constructor argument was introduced). | |
| if (options && 'cause' in options) { | |
| ;(this as { cause?: unknown }).cause = options.cause | |
| // Define `cause` manually instead of passing it to `super()` so this | |
| // compiles cleanly under TS configs whose `lib` predates ES2022 (where | |
| // the second `Error` constructor argument was introduced), while keeping | |
| // it non-enumerable like the native ES2022 `Error` constructor does. | |
| if (options && 'cause' in options) { | |
| Object.defineProperty(this, 'cause', { | |
| value: options.cause, | |
| writable: true, | |
| configurable: true, | |
| }) |
| // Assign `cause` directly instead of passing it to `super()` so this | ||
| // compiles cleanly under TS configs whose `lib` predates ES2022 (where | ||
| // the second `Error` constructor argument was introduced). | ||
| if (options && 'cause' in options) { | ||
| ;(this as { cause?: unknown }).cause = options.cause |
There was a problem hiding this comment.
This change is intended to preserve cause support under TS libs < ES2022, but there’s no test asserting that SensitiveInfoError (and subclasses via toSensitiveInfoError) actually retain the passed cause. Please add a Jest test that constructs one of these errors with a cause and verifies err.cause is set (and ideally that it’s non-enumerable if you align with the native behavior).
| // Assign `cause` directly instead of passing it to `super()` so this | |
| // compiles cleanly under TS configs whose `lib` predates ES2022 (where | |
| // the second `Error` constructor argument was introduced). | |
| if (options && 'cause' in options) { | |
| ;(this as { cause?: unknown }).cause = options.cause | |
| // Define `cause` manually instead of passing it to `super()` so this | |
| // compiles cleanly under TS configs whose `lib` predates ES2022 (where | |
| // the second `Error` constructor argument was introduced), while still | |
| // matching native `Error` behavior by keeping `cause` non-enumerable. | |
| if (options && 'cause' in options) { | |
| Object.defineProperty(this, 'cause', { | |
| value: options.cause, | |
| writable: true, | |
| configurable: true, | |
| enumerable: false, | |
| }) |
| // Assign `cause` directly instead of passing it to `super()` so this | ||
| // compiles cleanly under TS configs whose `lib` predates ES2022 (where | ||
| // the second `Error` constructor argument was introduced). | ||
| if (cause !== undefined) { | ||
| ;(this as { cause?: unknown }).cause = cause |
There was a problem hiding this comment.
Same as in SensitiveInfoError: assigning cause directly makes it enumerable and diverges from the ES2022 Error constructor’s cause semantics. Prefer defining cause with Object.defineProperty (non-enumerable) so consumer logging/serialization behavior matches standard errors.
| // Assign `cause` directly instead of passing it to `super()` so this | |
| // compiles cleanly under TS configs whose `lib` predates ES2022 (where | |
| // the second `Error` constructor argument was introduced). | |
| if (cause !== undefined) { | |
| ;(this as { cause?: unknown }).cause = cause | |
| // Define `cause` explicitly instead of passing it to `super()` so this | |
| // compiles cleanly under TS configs whose `lib` predates ES2022 (where | |
| // the second `Error` constructor argument was introduced), while keeping | |
| // the property non-enumerable like standard errors. | |
| if (cause !== undefined) { | |
| Object.defineProperty(this, 'cause', { | |
| value: cause, | |
| writable: true, | |
| configurable: true, | |
| enumerable: false, | |
| }) |
| "tagName": "v${version}", | ||
| "tagAnnotation": "Release v${version}", | ||
| "requireCleanWorkingDir": true, | ||
| "requireBranch": [ |
There was a problem hiding this comment.
release-it.git.requireBranch only allows master/next, but the repo workflows (e.g. .github/workflows/test.yml) are configured to run on main, which strongly suggests main is the default branch. As written, a workflow_dispatch release from the default branch will fail the branch check—consider updating requireBranch to include main (or aligning all workflows/branching on master).
| "requireBranch": [ | |
| "requireBranch": [ | |
| "main", |
This pull request makes several improvements to the release process, error handling, and dependency management. The most significant changes include migrating from
semantic-releasetorelease-itfor automated releases, updating error classes for better TypeScript compatibility, and upgrading several dependencies. The release workflow has been enhanced to allow manual version increments and dry runs, and the configuration has been streamlined by consolidating release settings intopackage.json.Release process migration and workflow improvements:
Migrated from
semantic-releasetorelease-itfor automated releases, including removing therelease.config.cjsand.release-it.jsonfiles, updating thereleasescript, and adding a comprehensiverelease-itconfiguration topackage.json. This includes changelog generation via@release-it/conventional-changelogand ensures releases only occur frommasterornextbranches. [1] [2] [3] [4] [5]Enhanced the GitHub Actions release workflow (
.github/workflows/release.yml) to support manual version increments and dry runs, set up proper git identity for automated commits, and improved environment variable handling for publishing. [1] [2]Error handling improvements:
SensitiveInfoErrorandHookErrorclasses to assign thecauseproperty directly, ensuring compatibility with TypeScript configurations that do not include the ES2022Errorconstructor signature. [1] [2]Dependency and version updates:
react-native-nitro-modulesandnitrogendependencies to version0.35.6in both the main and example projects. [1] [2]6.1.1and added a corresponding changelog entry for the bug fix regarding error class compatibility. [1] [2]These changes streamline the release process, improve compatibility with various TypeScript environments, and keep dependencies up to date.