diff --git a/README.md b/README.md index 68d974ec..79df0d2a 100644 --- a/README.md +++ b/README.md @@ -10,38 +10,43 @@ To install dependencies, run $ npm ci ``` -## Available Scripts +## Electron -Builds the electron library in debug mode: +The electron library consists of two parts -### `nx build electron` +- `@bitdrift/core` - the native bindings that allow calling into the Rust shared code. +- `@bitdrift/electron` - the top level library providing a JS API for `@bitdrift/core`. -Buld the electron library in release mode, suitable for distribution: +The indirection allows us to have users install `@bitdrift/electron` and download the +architecture appropriate version of `@bitdrift/core`. -### `nx build electron -c release` +### Useful commands -Runs the test suite: +Builds the electron native library in debug mode: -### `nx test electron` +`nx build @bitdrift/core` -## Exploring capture-es +Build the electron native library in release mode, suitable for distribution: -After building capture-es, you can explore its exports at the Node REPL: +`nx build @bitdrift/core -c release` -```sh -$ nx build electron -$ node -> require('./dist/native.node').init("") -``` +Runs the electron native library test suite: -## Distribution +`nx test @bitdrift/core` -To distribute the electron library, run: +Runs the electron JS library test suite: -```sh -nx build electron -c release -npm pack ./dist/electron -``` +`nx test @bitdrift/electron` + +Most of the development of the electron logger tends to be done via the example app which can +be used to interact with the library. + +## React Native + +The React Native library needs to run in the context of an app, so use the `expo` example app +to build and develop the plugin. By opening the `expo` app in XCode or Android Studio, the +plugin files can be edited directly for a smoother development experience. -This produces a .tgz in the project root that can be distributed and installed with npm. +## Example Apps +To run either of the example apps, refer to the READMEs in `examples/`. diff --git a/examples/expo/README.md b/examples/expo/README.md new file mode 100644 index 00000000..ad552564 --- /dev/null +++ b/examples/expo/README.md @@ -0,0 +1,28 @@ +# Install + +From the root of the project, run: + +```bash +npm ci +``` + +Before running the example app, you need to create an .env file, so from the `expo` directory, run: + +```bash +cp .env.example .env +vim .env +``` + +And edit your env file with the proper values for the environment you're trying to test against. + +# Usage + +To run the example app, from the root of the project, run: + +```bash +nx ios expo-example # Run on iOS +nx android expo-example # Run on Android +``` + +Depending on the changes you're making locally, you may need to clean up the `ios/` and `android/` directory within `expo-example`, +as this is generated as part of the build and won't always be properly re-generated on changes. diff --git a/examples/hello-electron/README.md b/examples/hello-electron/README.md index c4c99b35..88b157db 100644 --- a/examples/hello-electron/README.md +++ b/examples/hello-electron/README.md @@ -3,10 +3,10 @@ From the root of the project, run: ```bash -npm install +npm ci ``` -Bofore running the example app, you need to create an .env file, so from the `hello-electron` directory, run: +Before running the example app, you need to create an .env file, so from the `hello-electron` directory, run: ```bash cp .env.example .env