Skip to content

Commit

Permalink
Add bun driver and generator instructions (#762)
Browse files Browse the repository at this point in the history
  • Loading branch information
scotttrinh authored Nov 6, 2023
1 parent 5e20857 commit c84881d
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ jobs:
uses: edgedb/setup-edgedb@8bc9e10005674ec772652b86e1fdd476e6462284
with:
instance-name: test
cli-version: 3.5
server-version: ${{ matrix.edgedb-version }}

- name: Show actual EdgeDB server version
Expand Down
5 changes: 5 additions & 0 deletions docs/generation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ Run a generator with the following command.
--unstable \
https://deno.land/x/edgedb/generate.ts <generator> [options]

.. code-tab:: bash
:caption: bun

$ bunx @edgedb/generate <generator> [options]

The value of ``<generator>`` should be one of the following:

.. list-table::
Expand Down
6 changes: 6 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ generators from npm using your package manager of choice.

import * as edgedb from "http://deno.land/x/edgedb/mod.ts";

.. code-tab:: bash
:caption: bun

$ bun add edgedb # database driver
$ bun add --dev @edgedb/generate # generators

.. _edgedb-js-quickstart:

Quickstart
Expand Down
7 changes: 7 additions & 0 deletions docs/interfaces.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ Install the ``edgedb`` package.
$ npm install edgedb # npm users
$ yarn add edgedb # yarn users
$ bun add edgedb # bun users
Then install ``@edgedb/generate`` as a dev dependency.

.. code-block:: bash
$ npm install @edgedb/generate --save-dev # npm users
$ yarn add @edgedb/generate --dev # yarn users
$ bun add --dev @edgedb/generate # bun users
Generation
Expand Down Expand Up @@ -61,6 +63,11 @@ The following command will run the ``interfaces`` generator.

$ deno run --allow-all --unstable https://deno.land/x/edgedb/generate.ts interfaces

.. code-tab:: bash
:caption: Bun

$ bunx @edgedb/generate queries

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
Expand Down
7 changes: 7 additions & 0 deletions docs/queries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ Install the ``edgedb`` package.
$ npm install edgedb # npm users
$ yarn add edgedb # yarn users
$ bun add edgedb # bun users
Then install ``@edgedb/generate`` as a dev dependency.

.. code-block:: bash
$ npm install @edgedb/generate --save-dev # npm users
$ yarn add @edgedb/generate --dev # yarn users
$ bun add --dev @edgedb/generate # bun users
Generation
Expand Down Expand Up @@ -60,6 +62,11 @@ The following command will run the ``queries`` generator.

$ deno run --allow-all --unstable https://deno.land/x/edgedb/generate.ts queries

.. code-tab:: bash
:caption: Bun

$ bunx @edgedb/generate queries

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``.
Expand Down
49 changes: 47 additions & 2 deletions docs/querybuilder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,53 @@ helps you write valid queries the first time.
*Close to EdgeQL!* The goal of the query builder is to provide an API that is as
close as possible to EdgeQL itself while feeling like idiomatic TypeScript.

Configuration
-------------
Installation
------------

To get started, install the following packages.

.. note::

If you're using Deno, you can skip this step.

Install the ``edgedb`` package.

.. code-block:: bash
$ npm install edgedb # npm users
$ yarn add edgedb # yarn users
$ bun add edgedb # bun users
Then install ``@edgedb/generate`` as a dev dependency.

.. code-block:: bash
$ npm install @edgedb/generate --save-dev # npm users
$ yarn add @edgedb/generate --dev # yarn users
$ bun add --dev @edgedb/generate # bun users
Generation
----------

The following command will run the ``edgeql-js`` query builder generator.

.. tabs::

.. code-tab:: bash
:caption: Node.js

$ npx @edgedb/generate edgeql-js

.. code-tab:: bash
:caption: Deno

$ deno run --allow-all --unstable https://deno.land/x/edgedb/generate.ts edgeql-js

.. code-tab:: bash
:caption: Bun

$ bunx @edgedb/generate edgeql-js

The generation command is configurable in a number of ways.

Expand Down

0 comments on commit c84881d

Please sign in to comment.