Skip to content

Commit

Permalink
feat(repo): export esm modules
Browse files Browse the repository at this point in the history
  • Loading branch information
jrea committed Apr 3, 2024
1 parent 19d150d commit 8b379a3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 8 deletions.
13 changes: 12 additions & 1 deletion packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@
"name": "@niledatabase/browser",
"version": "2.1.2-alpha.1",
"license": "MIT",
"main": "dist/index.js",
"exports": {
".": {
"require": "./dist/index.js",
"default": "./dist/browser.esm.js"
},
"./src": {
"default": "./src/index.ts"
}
},
"main": "./dist/index.js",
"module": "./dist/browser.esm.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
Expand Down
13 changes: 12 additions & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@
"name": "@niledatabase/react",
"version": "2.1.2-alpha.1",
"license": "MIT",
"main": "dist/index.js",
"exports": {
".": {
"require": "./dist/index.js",
"default": "./dist/react.esm.js"
},
"./src": {
"default": "./src/index.ts"
}
},
"main": "./dist/index.js",
"module": "./dist/react.esm.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
Expand Down
16 changes: 10 additions & 6 deletions packages/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ Consolidates the API and DB for working with Nile.
### With configuration object

```ts
import Server from '@niledatabase/server';
import Nile from '@niledatabase/server';

const nile = Server({
const nile = new Nile({
user: 'username',
password: 'password',
});

await nile.init();

await nile.api.createTenant({ name: 'name' });

await nile.db.query('select * from todo');
Expand All @@ -27,18 +29,20 @@ NILEDB_PASSWORD=password
```

```ts
import Server from '@niledatabase/server';
import Nile from '@niledatabase/server';

const nile = new Nile();

const nile = Server();
await nile.init();

await nile.api.createTenant({ name: 'name' });

await nile.db.query('select * from todo');
```

## Auto-configuration
## Initialization

In addition to `user` and `password`, a fully configured SDK must also have values for `db.host`, `databaseName`, and `databaseId`. If the values are not provided in either the `.env` file or the instance configuration, the SDK will automatically phone home to configure itself. For production, it is recommended to set those values.
In addition to `user` and `password`, a fully configured SDK must also have values for `db.host`, `databaseName`, and `databaseId`. If the values are not provided in either the `.env` file or the instance configuration, the `init()` function should be called, which will allow the SDK to automatically configure itself. For production, it is recommended to set those values.

## Configuration

Expand Down

0 comments on commit 8b379a3

Please sign in to comment.