Fauna GQL Upload

Github Twitter

๐Ÿน Getting started

Initialize Fauna GQL Upload

It is possible, as of version 2.5.0, to run an initialization command that, based on a few questions, creates the desired folders and configuration files. Simply run:

yarn fgu init

or

npx fgu init

and answer the questions that are presented. This will create the folders you need and create a config file with the correct options. If you don't want to answer the questions and you're happy with the defaults, simply add the -y flag to the command. Like so:

yarn fgu init -y

You could, of course, completely ignore the init command and create the folders and configuration files yourself. The init command could be a good way to familiarize yourself with the folder structure.

NOTE: This command creates placeholder resources. Remember to edit or delete these before uploading.

Manual setup

Installation

Fauna GQL Upload needs a local installation of faunadb. That means you need to install both fauna-gql-upload and faunadb.

With npm:

npm install --save-dev fauna-gql-upload faunadb

With yarn:

yarn add -D fauna-gql-upload faunadb

NOTE: You do not need to install faunadb as a development dependency. You could also install it normally if you use it as part of your frontend or in other backend code.

Adding npm script

You will need to add an npm script to the command.

Package.json:

...
"scripts": {
  "fauna": "fgu" // you can use 'fgu' or 'fauna-gql'
}
...

Running it:

npm run fauna

or:

yarn fauna

Files and directories

For the command to work properly, you need to have certain information in your project.

Usage

To upload your resources, simply run the previously configured command. For example, if your npm script is called fauna run the following.

with npm:

npm run fauna

with yarn:

yarn fauna