diff --git a/packages/browser/package.json b/packages/browser/package.json index b9c19352..8edd439c 100644 --- a/packages/browser/package.json +++ b/packages/browser/package.json @@ -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" ], diff --git a/packages/react/package.json b/packages/react/package.json index 27c7519e..7c77b668 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -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" ], diff --git a/packages/server/README.md b/packages/server/README.md index 2a685e15..a33a9a2f 100644 --- a/packages/server/README.md +++ b/packages/server/README.md @@ -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'); @@ -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