Skip to content

Commit 879b9c1

Browse files
authored
Merge pull request #81 from PlayerData/expo
refactor: Switching to Expo
2 parents ac5bef9 + a993a05 commit 879b9c1

File tree

106 files changed

+42945
-19659
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+42945
-19659
lines changed

.eslintrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
root: true,
3+
extends: ['universe/native', 'universe/web'],
4+
ignorePatterns: ['build'],
5+
};

.github/workflows/build_and_release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
node-version: 18
2121

2222
- name: Install dependencies
23-
run: yarn install
23+
run: npm install
2424

2525
- name: Build
26-
run: yarn build
26+
run: npm run build
2727

2828
- name: Release
2929
env:

.github/workflows/lint.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@ jobs:
1818
node-version: 18
1919

2020
- name: Install package dependencies
21-
run: yarn install
22-
21+
run: npm install
22+
2323
- name: Install example app dependencies
24-
run: yarn example install
24+
working-directory: ./example
25+
run: npm install
2526

2627
- name: Lint
27-
run: yarn lint
28-
29-
- name: Typecheck
30-
run: yarn typecheck
28+
run: npm run lint

.gitignore

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
#
33
.DS_Store
44

5-
# XDE
6-
.expo/
7-
85
# VSCode
96
.vscode/
107
jsconfig.json
@@ -31,30 +28,30 @@ project.xcworkspace
3128

3229
# Android/IJ
3330
#
34-
.idea
31+
.classpath
32+
.cxx
3533
.gradle
34+
.idea
35+
.project
36+
.settings
3637
local.properties
3738
android.iml
39+
android/app/libs
40+
android/keystores/debug.keystore
3841

3942
# Cocoapods
4043
#
4144
example/ios/Pods
4245

46+
# Ruby
47+
example/vendor/
48+
4349
# node.js
4450
#
4551
node_modules/
4652
npm-debug.log
4753
yarn-debug.log
4854
yarn-error.log
4955

50-
# BUCK
51-
buck-out/
52-
\.buckd/
53-
android/app/libs
54-
android/keystores/debug.keystore
55-
5656
# Expo
5757
.expo/*
58-
59-
# generated by bob
60-
lib/

.npmignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Exclude all top-level hidden directories by convention
2+
/.*/
3+
4+
__mocks__
5+
__tests__
6+
7+
/babel.config.js
8+
/android/src/androidTest/
9+
/android/src/test/
10+
/android/build/
11+
/example/

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 PlayerData Holdings Ltd
3+
Copyright (c) 2023 PlayerData Holdings Ltd
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

README.md

Lines changed: 52 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,34 @@
1-
# react-native-mcu-manager
1+
# @playerdata/react-native-mcu-manager
22

3-
MCUMgr DFU from React Native.
3+
React Native Wrappers for MCUMgr's Android / iOS client libraries
44

5-
## Getting started
5+
# Getting started
6+
7+
## Installation in managed Expo projects
8+
9+
For [managed](https://docs.expo.dev/archive/managed-vs-bare/) Expo projects,
10+
we hope this will Just Work :tm:.
11+
12+
The example app uses Expo Prebuild, so we've some confidence, but let us know
13+
how you get on.
14+
15+
## Installation in bare React Native projects
16+
17+
For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/) before continuing.
18+
19+
### Add the package to your npm dependencies
20+
21+
```
22+
npm install @playerdata/react-native-mcu-manager
23+
```
24+
25+
### Configure for iOS
26+
27+
Run `npx pod-install` after installing the npm package.
28+
29+
30+
### Configure for Android
631

7-
`$ npm install @playerdata/react-native-mcu-manager --save`
832
## Usage
933
```ts
1034
import McuManager, { ProgressEvent, UploadEvents } from '@playerdata/react-native-mcu-manager';
@@ -24,57 +48,52 @@ UploadEvents.addListener('uploadStateChanged', onUploadStateChanged);
2448
McuManager.updateDevice(bluetoothId, fileUri)
2549
```
2650

27-
## Contributing
51+
# Contributing
2852

29-
### Development workflow
53+
Contributions are very welcome!
3054

31-
To get started with the project, run `yarn` in the root directory to install the required dependencies for each package:
55+
There are many examples of expo modules in the expo repo packages like
56+
https://github.com/expo/expo/blob/main/packages/expo-camera/README.md
3257

33-
```sh
34-
yarn install
35-
yarn example install
36-
yarn example pods
37-
```
58+
## Development Workflow
3859

39-
While developing, you can run the [example app](/example/) to test your changes.
60+
Install dependencies:
4061

41-
To start the packager:
42-
43-
```sh
44-
yarn example start
62+
```
63+
npm install
4564
```
4665

47-
To run the example app on Android:
66+
You should use the example app to test your changes:
4867

49-
```sh
50-
yarn example android
5168
```
69+
cd example
5270
53-
To run the example app on iOS:
54-
55-
```sh
56-
yarn example ios
71+
npx expo prebuild
5772
```
5873

74+
From the top level of the repo, you can use `npm run open:(ios|android)` to open
75+
the appropriate IDE.
76+
77+
For Swift files, you'll find the source files at `Pods > Development Pods > ReactNativeMcuManager`
78+
in XCode.
79+
80+
For Kotlin, you'll find the source files at `reactnativemcumanager` under `Android` in Android Studio.
81+
5982
Make sure your code passes TypeScript and ESLint. Run the following to verify:
6083

6184
```sh
62-
yarn typecheck
63-
yarn lint
85+
npm run typecheck
86+
npm run lint
6487
```
6588

6689
To fix formatting errors, run the following:
6790

6891
```sh
69-
yarn lint --fix
92+
npm run lint --fix
7093
```
7194

72-
Remember to add tests for your change if possible. Run the unit tests by:
95+
Remember to add unit tests for your change if possible. Run the unit tests by:
7396

7497
```sh
75-
yarn test
98+
npm run test
7699
```
77-
78-
To edit the Swift files, open `example/ios/McuManagerExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-mcu-manager`.
79-
80-
To edit the Kotlin files, open `example/android` in Android studio and find the source files at `reactnativemcumanager` under `Android`.

0 commit comments

Comments
 (0)