From 8244e6632958f0418acf3a8783f34cbb4ebc98db Mon Sep 17 00:00:00 2001 From: Devon Campbell Date: Tue, 6 Feb 2024 12:06:54 -0500 Subject: [PATCH] Surface Deno prerequisites (#851) --- docs/index.rst | 22 ++++++++++++++++++++++ docs/interfaces.rst | 21 +++++++++++++++++++++ docs/queries.rst | 21 +++++++++++++++++++++ docs/querybuilder.rst | 21 +++++++++++++++++++++ 4 files changed, 85 insertions(+) diff --git a/docs/index.rst b/docs/index.rst index 6ef9668a6..0a1e692b2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -71,6 +71,28 @@ generators from npm using your package manager of choice. $ bun add edgedb # database driver $ bun add --dev @edgedb/generate # generators +.. note:: Deno users + + Create these two files in your project root: + + .. code-block:: json + :caption: importMap.json + + { + "imports": { + "edgedb": "https://deno.land/x/edgedb/mod.ts", + "edgedb/": "https://deno.land/x/edgedb/" + } + } + + .. code-block:: json + :caption: deno.js + + { + "importMap": "./importMap.json" + } + + .. _edgedb-js-quickstart: Quickstart diff --git a/docs/interfaces.rst b/docs/interfaces.rst index f565161e2..9a868e06e 100644 --- a/docs/interfaces.rst +++ b/docs/interfaces.rst @@ -68,6 +68,27 @@ The following command will run the ``interfaces`` generator. $ bunx @edgedb/generate queries +.. note:: Deno users + + Create these two files in your project root: + + .. code-block:: json + :caption: importMap.json + + { + "imports": { + "edgedb": "https://deno.land/x/edgedb/mod.ts", + "edgedb/": "https://deno.land/x/edgedb/" + } + } + + .. code-block:: json + :caption: deno.js + + { + "importMap": "./importMap.json" + } + This will introspect your schema and generate TypeScript interfaces that correspond to each object type. By default, these interfaces will be written to a single file called ``interfaces.ts`` into the ``dbschema`` directory in your project root. The file will contain the following contents (roughly): .. code-block:: typescript diff --git a/docs/queries.rst b/docs/queries.rst index 72660fb52..2a6a99771 100644 --- a/docs/queries.rst +++ b/docs/queries.rst @@ -67,6 +67,27 @@ The following command will run the ``queries`` generator. $ bunx @edgedb/generate queries +.. note:: Deno users + + Create these two files in your project root: + + .. code-block:: json + :caption: importMap.json + + { + "imports": { + "edgedb": "https://deno.land/x/edgedb/mod.ts", + "edgedb/": "https://deno.land/x/edgedb/" + } + } + + .. code-block:: json + :caption: deno.js + + { + "importMap": "./importMap.json" + } + The generator will detect the project root by looking for an ``edgedb.toml``, then scan the directory for ``*.edgeql`` files. In this case, there's only one: ``queries/getUser.edgeql``. diff --git a/docs/querybuilder.rst b/docs/querybuilder.rst index d3250816d..af7f868ba 100644 --- a/docs/querybuilder.rst +++ b/docs/querybuilder.rst @@ -110,6 +110,27 @@ The following command will run the ``edgeql-js`` query builder generator. $ bunx @edgedb/generate edgeql-js +.. note:: Deno users + + Create these two files in your project root: + + .. code-block:: json + :caption: importMap.json + + { + "imports": { + "edgedb": "https://deno.land/x/edgedb/mod.ts", + "edgedb/": "https://deno.land/x/edgedb/" + } + } + + .. code-block:: json + :caption: deno.js + + { + "importMap": "./importMap.json" + } + The generation command is configurable in a number of ways. ``--output-dir ``