Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 37 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@ name: Release

on:
workflow_dispatch:
inputs:
increment:
description: 'Version increment (leave empty to derive from conventional commits)'
required: false
default: ''
type: choice
options:
- ''
- patch
- minor
- major
- prerelease
dry-run:
description: 'Dry run (no publish, no push)'
required: false
default: false
type: boolean

permissions:
contents: read
Expand All @@ -24,25 +41,35 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: true

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'yarn'
registry-url: 'https://registry.npmjs.org'

- name: Install npm dependencies (yarn)
run: yarn install --frozen-lockfile
- name: Configure git identity
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"

- name: Build lib
run: yarn build
- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
GIT_AUTHOR_NAME: ${{ github.actor }}
GIT_AUTHOR_EMAIL: '${{ github.actor }}@users.noreply.github.com'
GIT_COMMITTER_NAME: ${{ github.actor }}
GIT_COMMITTER_EMAIL: '${{ github.actor }}@users.noreply.github.com'
run: yarn release
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: 'true'
run: |
ARGS="--ci"
if [ -n "${{ inputs.increment }}" ]; then
ARGS="$ARGS --increment=${{ inputs.increment }}"
fi
if [ "${{ inputs.dry-run }}" = "true" ]; then
ARGS="$ARGS --dry-run"
fi
yarn release $ARGS
24 changes: 0 additions & 24 deletions .release-it.json

This file was deleted.

5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [6.1.1](https://github.com/mcodex/react-native-sensitive-info/compare/v6.1.0...v6.1.1) (2026-04-29)

### Bug Fixes

* update error classes to handle cause assignment for TypeScript compatibility ([003b00e](https://github.com/mcodex/react-native-sensitive-info/commit/003b00e2bf96af28685afdf2da57d067a87339c1))
## [6.1.0](https://github.com/mcodex/react-native-sensitive-info/compare/v6.0.0-rc.12...v6.1.0) (2026-04-28)

### Features
Expand Down
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"react": "19.2.3",
"react-native": "0.85.2",
"react-native-nitro-modules": "0.35.5",
"react-native-nitro-modules": "0.35.6",
"react-native-safe-area-context": "^5.7.0"
},
"devDependencies": {
Expand Down
82 changes: 73 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-sensitive-info",
"version": "6.1.0",
"version": "6.1.1",
"description": "🔐 React Native secure storage, rebuilt with Nitro Modules ⚡️ Biometric-ready, StrongBox-aware, and metadata-rich for modern mobile apps",
"main": "./lib/commonjs/index.js",
"module": "./lib/module/index.js",
Expand Down Expand Up @@ -50,8 +50,7 @@
"scripts": {
"typecheck": "tsc --noEmit",
"clean": "git clean -dfX",
"release": "semantic-release",
"release:it": "release-it --config .release-it.json",
"release": "release-it",
"build": "npm run typecheck && bob build",
"codegen": "nitrogen --logLevel=\"debug\" && npm run build && node post-script.js",
"lint": "biome check --write .",
Expand Down Expand Up @@ -109,26 +108,23 @@
},
"devDependencies": {
"@biomejs/biome": "^2.4.13",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@release-it/conventional-changelog": "^11.0.0",
"@testing-library/dom": "^10.4.1",
"@testing-library/react": "^16.3.2",
"@types/jest": "^30.0.0",
"@types/react": "19.2.x",
"babel-plugin-react-compiler": "^1.0.0",
"conventional-changelog-cli": "^5.0.0",
"conventional-changelog-conventionalcommits": "^9.3.1",
"jest": "^30.3.0",
"jest-environment-jsdom": "^30.3.0",
"jiti": "^2.6.1",
"nitrogen": "0.35.5",
"nitrogen": "0.35.6",
"react": "19.2.3",
"react-dom": "19.2.3",
"react-native": "0.85.2",
"react-native-builder-bob": "^0.41.0",
"react-native-nitro-modules": "0.35.5",
"react-native-nitro-modules": "0.35.6",
"release-it": "^20.0.1",
"semantic-release": "^25.0.3",
"ts-jest": "^29.4.9",
"ts-node": "^10.9.2",
"typescript": "^6.0.3"
Expand Down Expand Up @@ -164,5 +160,73 @@
]
]
},
"release-it": {
"git": {
"commitMessage": "chore(release): v${version}",
"tagName": "v${version}",
"tagAnnotation": "Release v${version}",
"requireCleanWorkingDir": true,
"requireBranch": [
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

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).

Suggested change
"requireBranch": [
"requireBranch": [
"main",

Copilot uses AI. Check for mistakes.
"master",
"next"
],
"requireUpstream": false,
"push": true,
"pushArgs": [
"--follow-tags"
]
},
"npm": {
"publish": true,
"verifyAccess": true,
"tokenRef": "NPM_TOKEN"
},
"github": {
"release": true,
"releaseName": "v${version}",
"tokenRef": "GITHUB_TOKEN"
},
"hooks": {
"before:init": [
"npm run typecheck",
"npm run build"
]
},
"plugins": {
"@release-it/conventional-changelog": {
"preset": {
"name": "conventionalcommits",
"types": [
{
"type": "feat",
"section": "✨ Features"
},
{
"type": "fix",
"section": "🐛 Bug Fixes"
},
{
"type": "perf",
"section": "💨 Performance Improvements"
},
{
"type": "refactor",
"section": "🔄 Code Refactors"
},
{
"type": "docs",
"section": "📚 Documentation"
},
{
"type": "chore",
"section": "🛠️ Other changes"
}
]
},
"infile": "CHANGELOG.md",
"header": "# Changelog"
}
}
},
"packageManager": "yarn@4.10.3"
}
60 changes: 0 additions & 60 deletions release.config.cjs

This file was deleted.

8 changes: 7 additions & 1 deletion src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,15 @@ export class SensitiveInfoError extends Error {
message: string,
options?: { cause?: unknown }
) {
super(message, options)
super(message)
this.name = 'SensitiveInfoError'
this.code = code
// 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
Comment on lines +78 to +82
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
// 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,
})

Copilot uses AI. Check for mistakes.
Comment on lines +78 to +82
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

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).

Suggested change
// 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,
})

Copilot uses AI. Check for mistakes.
}
}
}

Expand Down
8 changes: 7 additions & 1 deletion src/hooks/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,16 @@ export class HookError extends Error {
message: string,
{ cause, operation, hint }: HookErrorOptions = {}
) {
super(message, { cause })
super(message)
this.name = 'HookError'
this.operation = operation
this.hint = hint
// 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
Comment on lines +45 to +49
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
// 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,
})

Copilot uses AI. Check for mistakes.
}
}
}

Expand Down
Loading
Loading