Put this repo as environment variable:
export SCAFFOLDS_REPO="hasura/scaffolds"
Also put the branch as env variable (default master):
export SCAFFOLDS_REPO_BRANCH="typescript"
Your action template should have three variables in the top level scope:
-
FILE_EXTENSION: Extension of the file of your language.
-
routeTemplate
: This is a function that takes in two arguments: 1)mutationSdl
andtypesSdl
. You can parse thisSDL
into a document using theparse
function fromgraphql
. Based on these two documents, you should generate code for a route that will be appended to the route file specified in theconfig.yaml
of your project. -
handlerTemplate
: This is a function that takes in two arguments: 1)mutationSdl
andtypesSdl
. You can parse thisSDL
into a document using theparse
function fromgraphql
. Based on these two documents you should generate code for a function that accepts action payload, does some logic and returns a response. This function will be created in a file and be put up as `.<FILE_EXTENSION>.
git clone git@github.com:hasura/actions-scaffolder
npm ci
npm run dev
Use the CLI with the environment variable SCAFFOLD_ORIGIN=http://localhost:8080
(wherever the scaffolder server is running).