Skip to content

Commit 7db68c9

Browse files
committed
chore(nx): fix nx release command
1 parent a058876 commit 7db68c9

File tree

4 files changed

+100
-64
lines changed

4 files changed

+100
-64
lines changed

bun.lock

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
},
7979
"packages/react-native-bluetooth-state-manager": {
8080
"name": "react-native-bluetooth-state-manager",
81-
"version": "2.0.1",
81+
"version": "2.0.2",
8282
"devDependencies": {
8383
"@types/react": "^18.3.4",
8484
"nitro-codegen": "0.25.2",
@@ -102,6 +102,9 @@
102102
"@swc/core",
103103
"react-native-bluetooth-state-manager",
104104
],
105+
"patchedDependencies": {
106+
107+
},
105108
"overrides": {
106109
"react": "18.3.1",
107110
"react-native": "0.77.0",

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,8 @@
4545
"react-native-svg": "~15.8.0",
4646
"react-native-svg-transformer": "~1.5.0",
4747
"react-native-web": "~0.19.13"
48+
},
49+
"patchedDependencies": {
50+
4851
}
4952
}

packages/react-native-bluetooth-state-manager/README.md

Lines changed: 80 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
The only purpose of this library is to manage the Bluetooth state. Not more, not less.
66

7-
If you need further functionality like connecting and communicating to a device, please look at [react-native-ble-plx](https://github.com/Polidea/react-native-ble-plx).
7+
If you need further functionality like connecting and communicating with a device, please look at [react-native-ble-plx](https://github.com/Polidea/react-native-ble-plx).
88

9-
## Table Of Content
9+
## Table Of Contents
1010

1111
- [Installation](#installation)
1212
- [Setup](#setup)
@@ -15,6 +15,8 @@ If you need further functionality like connecting and communicating to a device,
1515

1616
## Installation
1717

18+
Requires react-native `>=0.75`. See also the requirements of [react-native-nitro-modules](https://nitro.margelo.com/docs/minimum-requirements).
19+
1820
```shell
1921
bun add react-native-nitro-modules react-native-bluetooth-state-manager
2022
cd ios && bunx pod-install
@@ -25,30 +27,44 @@ cd ios && bunx pod-install
2527
## Setup
2628

2729
```tsx
28-
import { BluetoothStateManager } from 'react-native-bluetooth-state-manager'
30+
import { BluetoothStateManager } from "react-native-bluetooth-state-manager";
2931
```
3032

3133
**iOS**
3234

33-
You must provide a short description why you need access to bluetooth in your app. Otherwise your app will crash when requesting for bluetooth:
35+
You must provide a short description of why you need access to Bluetooth in your app. Otherwise, your app will crash when requesting Bluetooth access:
3436

3537
```
3638
This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSBluetoothAlwaysUsageDescription key with a string value explaining to the user how the app uses this data.
3739
```
3840

3941
See: https://developer.apple.com/documentation/bundleresources/information_property_list/nsbluetoothalwaysusagedescription
4042

43+
For expo add the following to your `app.json`/`app.config.js`/`app.config.ts`:
44+
45+
```json
46+
{
47+
"ios": {
48+
"infoPlist": {
49+
"NSBluetoothAlwaysUsageDescription": "Your reason to use bluetooth"
50+
}
51+
}
52+
}
53+
```
54+
55+
**Important**: The first attempt to check the Bluetooth state will prompt the user for permission to access Bluetooth.
56+
4157
**Android**
4258

43-
To use `requestToEnable()` and `requestToDisable()` on android, you have to add `BLUETOOTH_CONNECT` permission to your `AndroidManifest.xml`:
59+
To use `requestToEnable()` and `requestToDisable()` on Android, you have to add the `BLUETOOTH_CONNECT` permission to your `AndroidManifest.xml`:
4460

4561
```diff
4662
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
4763
+ <uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
4864
</manifest>
4965
```
5066

51-
`BLUETOOTH_CONNECT` is a runtime permission, that means you must ask the user at runtime for permission. For that, we recommend [react-native-permissions](https://github.com/zoontek/react-native-permissions/tree/master).
67+
`BLUETOOTH_CONNECT` is a runtime permission, which means you must ask the user at runtime for permission. For that, we recommend [react-native-permissions](https://github.com/zoontek/react-native-permissions/tree/master).
5268

5369
## Usage
5470

@@ -57,70 +73,71 @@ import {
5773
useBluetoothState,
5874
BluetoothStateManager,
5975
BluetoothState,
60-
} from 'react-native-bluetooth-state-manager'
76+
} from "react-native-bluetooth-state-manager";
6177

6278
// Get bluetooth state
6379

6480
// hook
65-
const bluetootState = useBluetoothState()
81+
const bluetoothState = useBluetoothState();
6682
// synchronous
67-
const bluetootState = BluetoothStateManager.getStateSync()
83+
const bluetoothState = BluetoothStateManager.getStateSync();
6884
// asynchronous
69-
const bluetootState = await BluetoothStateManager.getState()
85+
const bluetoothState = await BluetoothStateManager.getState();
7086
// Event listener
71-
const [bluetootState, setBluetoothState] = useState<BluetoothState>()
87+
const [bluetoothState, setBluetoothState] = useState<BluetoothState>();
7288
useEffect(() => {
7389
const remove = BluetoothStateManager.addListener((state) => {
74-
setBluetoothState(state)
75-
})
76-
return remove
77-
}, [])
90+
setBluetoothState(state);
91+
});
92+
return remove;
93+
}, []);
7894

7995
// Open settings page
80-
await BluetoothStateManager.openSettings()
96+
await BluetoothStateManager.openSettings();
8197

8298
// Android only
8399

84100
// Ask user to enable bluetooth
85-
await BluetoothStateManager.requestToEnable()
101+
await BluetoothStateManager.requestToEnable();
86102

87103
// Ask user to disable bluetooth
88-
await BluetoothStateManager.requestToDisable()
104+
await BluetoothStateManager.requestToDisable();
89105
```
90106

91107
## API
92108

93109
An example is under `example/App.tsx`
94110

95-
| Method | Return Type | OS | Description |
96-
| ------------------------------------------------------- | ------------------------- | ------------ | ---------------------------------------------------------------- |
97-
| [useBluetoothState()](#usebluetoothstate) | `BluetoothState` | Android, iOS | Hook that returns the current state of the bluetooth service. |
98-
| [getState()](#getstate) | `Promise<BluetoothState>` | Android, iOS | Returns the current state of the bluetooth service. |
99-
| [getStateSync()](#getstatesync) | `BluetoothState` | Android, iOS | Returns the current state synchronous of the bluetooth service. |
100-
| [addListener(listener, emitCurrentState)](#addlistener) | `Subscription` | Android, iOS | Listen for bluetooth state changes. |
101-
| [openSettings()](#opensettings) | `Promise<null>` | Android, iOS | Opens the bluetooth settings. Please see below for more details. |
102-
| [requestToEnable()](#requesttoenable) | `Promise<void>` | Android | Show a dialog that allows the user to turn on Bluetooth. |
103-
| [requestToDisable()](#requesttodisable) | `Promise<void>` | Android | Show a dialog that allows the user to turn off Bluetooth. |
111+
| Method | Return Type | OS | Description |
112+
| ---------------------------------------------------------------- | ------------------------- | ------------ | ---------------------------------------------------------------- |
113+
| [useBluetoothState(enabled: boolean = true)](#usebluetoothstate) | `BluetoothState` | Android, iOS | Hook that returns the current state of the bluetooth service. |
114+
| [getState()](#getstate) | `Promise<BluetoothState>` | Android, iOS | Returns the current state of the bluetooth service. |
115+
| [getStateSync()](#getstatesync) | `BluetoothState` | Android, iOS | Returns the current state synchronous of the bluetooth service. |
116+
| [addListener(listener, emitCurrentState)](#addlistener) | `Subscription` | Android, iOS | Listen for bluetooth state changes. |
117+
| [openSettings()](#opensettings) | `Promise<null>` | Android, iOS | Opens the bluetooth settings. Please see below for more details. |
118+
| [requestToEnable()](#requesttoenable) | `Promise<void>` | Android | Show a dialog that allows the user to turn on Bluetooth. |
119+
| [requestToDisable()](#requesttodisable) | `Promise<void>` | Android | Show a dialog that allows the user to turn off Bluetooth. |
104120

105121
---
106122

107-
### useBluetoothState()
123+
### useBluetoothState(enabled: boolean = true)
108124

109125
Hook that returns the current state of the bluetooth service.
110126

111127
```tsx
112-
import { useBluetoothState } from 'react-native-bluetooth-state-manager'
128+
import { useBluetoothState } from "react-native-bluetooth-state-manager";
113129

114-
const bluetoothState = useBluetoothState()
130+
const enabled = true; // default true
131+
const bluetoothState = useBluetoothState(enabled);
115132
switch (bluetoothState) {
116-
case 'Unknown':
117-
case 'Resetting':
118-
case 'Unsupported':
119-
case 'Unauthorized':
120-
case 'PoweredOff':
121-
case 'PoweredOn':
133+
case "Unknown":
134+
case "Resetting":
135+
case "Unsupported":
136+
case "Unauthorized":
137+
case "PoweredOff":
138+
case "PoweredOn":
122139
default:
123-
break
140+
break;
124141
}
125142
```
126143

@@ -129,17 +146,17 @@ switch (bluetoothState) {
129146
Returns the current state of the bluetooth service.
130147

131148
```tsx
132-
import { BluetoothStateManager } from 'react-native-bluetooth-state-manager'
133-
const bluetoothState = await BluetoothStateManager.getState()
149+
import { BluetoothStateManager } from "react-native-bluetooth-state-manager";
150+
const bluetoothState = await BluetoothStateManager.getState();
134151
switch (bluetoothState) {
135-
case 'Unknown':
136-
case 'Resetting':
137-
case 'Unsupported':
138-
case 'Unauthorized':
139-
case 'PoweredOff':
140-
case 'PoweredOn':
152+
case "Unknown":
153+
case "Resetting":
154+
case "Unsupported":
155+
case "Unauthorized":
156+
case "PoweredOff":
157+
case "PoweredOn":
141158
default:
142-
break
159+
break;
143160
}
144161
```
145162

@@ -148,17 +165,17 @@ switch (bluetoothState) {
148165
Returns the current state synchronous of the bluetooth service.
149166

150167
```tsx
151-
import { BluetoothStateManager } from 'react-native-bluetooth-state-manager'
152-
const bluetoothState = BluetoothStateManager.getStateSync()
168+
import { BluetoothStateManager } from "react-native-bluetooth-state-manager";
169+
const bluetoothState = BluetoothStateManager.getStateSync();
153170
switch (bluetoothState) {
154-
case 'Unknown':
155-
case 'Resetting':
156-
case 'Unsupported':
157-
case 'Unauthorized':
158-
case 'PoweredOff':
159-
case 'PoweredOn':
171+
case "Unknown":
172+
case "Resetting":
173+
case "Unsupported":
174+
case "Unauthorized":
175+
case "PoweredOff":
176+
case "PoweredOn":
160177
default:
161-
break
178+
break;
162179
}
163180
```
164181

@@ -167,10 +184,10 @@ switch (bluetoothState) {
167184
Listen for bluetooth state changes.
168185

169186
```tsx
170-
import { BluetoothStateManager } from 'react-native-bluetooth-state-manager'
187+
import { BluetoothStateManager } from "react-native-bluetooth-state-manager";
171188
BluetoothStateManager.addListener((bluetoothState) => {
172189
// do something...
173-
}, true /*=emitCurrentState*/)
190+
}, true /*=emitCurrentState*/);
174191
```
175192

176193
### openSettings()
@@ -190,18 +207,18 @@ Tested:
190207
Opens the settings page of the app. Please see [here](https://developer.apple.com/documentation/uikit/uiapplicationopensettingsurlstring).
191208

192209
```tsx
193-
BluetoothStateManager.openSettings()
210+
BluetoothStateManager.openSettings();
194211
```
195212

196213
### requestToEnable()
197214

198215
Show a dialog that allows the user to turn on Bluetooth. More here: [Android documentation](https://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html#ACTION_REQUEST_ENABLE).
199216

200-
- This function is **only** on **android** available.
217+
- This function is **only** available on **Android**.
201218

202219
```tsx
203220
try {
204-
await BluetoothStateManager.requestToEnable()
221+
await BluetoothStateManager.requestToEnable();
205222
} catch (error) {
206223
// Failed
207224
}
@@ -211,19 +228,19 @@ try {
211228

212229
Show a dialog that allows the user to turn off Bluetooth.
213230

214-
- This function is **only** on **android** available.
231+
- This function is **only** available on **Android**.
215232

216233
```tsx
217234
try {
218-
await BluetoothStateManager.requestToDisable()
235+
await BluetoothStateManager.requestToDisable();
219236
} catch (error) {
220237
// Failed
221238
}
222239
```
223240

224241
## Why?
225242

226-
##### Why not just using [react-native-ble-plx](https://github.com/Polidea/react-native-ble-plx)?
243+
##### Why not just use [react-native-ble-plx](https://github.com/Polidea/react-native-ble-plx)?
227244

228245
Because it's too bloated for my needs.
229246

patches/[email protected]

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/src/plugins/js/lock-file/lock-file.js b/src/plugins/js/lock-file/lock-file.js
2+
index 3a4dd9f7f20910cd24692d8a6be81ee9abe0fa42..6b9f88de6757247598b1d6ecbe6eff5a5a74ded7 100644
3+
--- a/src/plugins/js/lock-file/lock-file.js
4+
+++ b/src/plugins/js/lock-file/lock-file.js
5+
@@ -133,7 +133,7 @@ function getLockFileName(packageManager) {
6+
return NPM_LOCK_FILE;
7+
}
8+
if (packageManager === 'bun') {
9+
- return BUN_LOCK_FILE;
10+
+ return (0, node_fs_1.existsSync)(BUN_TEXT_LOCK_PATH) ? BUN_TEXT_LOCK_FILE : BUN_LOCK_FILE;
11+
}
12+
throw new Error(`Unknown package manager: ${packageManager}`);
13+
}

0 commit comments

Comments
 (0)