Skip to the content
Documentation

exp:expgraphqlstarter

No ratings yet

Available since Exponential 6.0.15 (in development, not in a release yet).

Summary

Generate a starter front end (Next.js, Nuxt, Astro, plain HTML or Expo) that reads the site through the GraphQL API, with queries from the live schema; a dry run unless --apply

Usage

./console exp:expgraphqlstarter [options]
php bin/php/expgraphqlstarter.php [options]
./console exp:graphql:starter [options]

Aliases

exp:graphql:starter

Help

The output of ./console help exp:expgraphqlstarter (the script run with --help), without the standard options:

Usage: bin/php/expgraphqlstarter.php [OPTION]...
Generate a starter front end for the GraphQL API
Writes a project into a new directory: the kit's files (shipped in share/graphql/starters/) with the
end point filled in, and queries generated from the schema of the siteaccess: the menu, a page by its
URL alias, and one query per content class with every field of the class, as a module of the kit and
as .graphql files for exp:graphql:persist. Every generated query is checked against the schema and its
limits first. Nothing is installed or deployed: run npm in the directory. Lists the files and writes
nothing without --apply.

  html   Plain HTML and JavaScript, no build step
  next   Next.js (App Router)
  nuxt   Nuxt 3
  astro  Astro, a static build
  expo   React Native with Expo

./console exp:graphql:starter --kit=next --to=../shop-front
./console exp:graphql:starter --kit=astro --to=../site-static --endpoint=https://www.example.com/api/graphql --apply
./console exp:graphql:starter --list

Exit code: 0 done (or shown); 1 a generated query does not fit the schema or its limits, or a file
could not be written; 3 the library is missing; 2 wrong options (an unknown kit, a directory that is
not empty).


Options:
  --kit=VALUE       the kit: html, next, nuxt, astro or expo
  --to=VALUE        the directory to write the project to (new or empty)
  --endpoint=VALUE  the address of the end point (default: site.ini [SiteSettings] SiteURL and /api/graphql)
  --list            list the kits
  --apply           write; without it nothing is changed

Options

Option Value Description
--kit required the kit: html, next, nuxt, astro or expo
--to required the directory to write the project to (new or empty)
--endpoint required the address of the end point (default: site.ini [SiteSettings] SiteURL and /api/graphql)
--list - list the kits
--apply - write; without it nothing is changed

Standard options

Every script also takes the standard options of the script framework: --help, --quiet, --siteaccess, --debug, --colors, --no-colors, --logfiles, --no-logfiles, --verbose and --allow-root-user.

Source

bin/php/expgraphqlstarter.php, kernel/private/classes/commands/expgraphqlstarter.php

See also

Generated example: exp:expgraphqlstarter

Added to the reference for Exponential 6.0.15.

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.