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: 26 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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("<api key>")
```
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/`.
28 changes: 28 additions & 0 deletions examples/expo/README.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 2 additions & 2 deletions examples/hello-electron/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down