Skip to content

Commit

Permalink
Merge pull request #25 from jaspervhaastert/remove-init-from-public-api
Browse files Browse the repository at this point in the history
[feat]Remove init from public api
  • Loading branch information
manyuanrong authored May 19, 2020
2 parents 6e5c9f8 + e3b26fa commit 16a3191
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ deno run --allow-net --allow-write --allow-read --allow-plugin --unstable xxx.ts
## Examples

```ts
import { init, MongoClient } from "https://deno.land/x/[email protected]/mod.ts";

// Initialize the plugin
await init();
import { MongoClient } from "https://deno.land/x/[email protected]/mod.ts";

const client = new MongoClient();
client.connectWithUri("mongodb://localhost:27017");
Expand Down
4 changes: 4 additions & 0 deletions mod.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { init } from "./ts/util.ts";

export * from "./ts/client.ts";
export * from "./ts/collection.ts";
export * from "./ts/database.ts";
Expand All @@ -7,3 +9,5 @@ export * from "./ts/util.ts";
export const VERSION = "v0.6.0";
export const RELEASE_URL =
`https://github.com/manyuanrong/deno_mongo/releases/download/${VERSION}`;

await init(RELEASE_URL);
3 changes: 2 additions & 1 deletion test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { cargoBuild } from "./build.ts";
import { init, MongoClient } from "./mod.ts";
import { init } from "./ts/util.ts";
import { MongoClient } from "./ts/client.ts";
import { assert, assertEquals, exists } from "./test.deps.ts";
import { ObjectId } from "./ts/types.ts";

Expand Down
3 changes: 1 addition & 2 deletions ts/util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { prepare } from "../deps.ts";
import { RELEASE_URL } from "../mod.ts";
import { CommandType } from "./types.ts";

// @ts-ignore
Expand Down Expand Up @@ -29,7 +28,7 @@ interface Command {
command_id?: number;
}

export async function init(releaseUrl = RELEASE_URL) {
export async function init(releaseUrl: string) {
const options = {
name: PLUGIN_NAME,
urls: {
Expand Down

0 comments on commit 16a3191

Please sign in to comment.