Skip to main content

Build timeline

npm run init does the following:

  1. Platform generates GraphQL artifacts based off of what's defined in the Platform code.
  • (Common is copied to Platform, in case files have changed.)
  • It generates /portal/generate/resolvers.ts which includes strong typing for the full GraphQL schema.
  1. Common generates GraphQL React hooks/types and is copied to all projects.
  • From any GraphQL queries defined in Common's UI/React files, the codegen generates GraphQL React hooks/types in /generated/graphql.tsx.
  • Common is copied to all projects.
  1. Next.js projects generate GraphQL React hooks/types.
  • From any GraphQL queries defined in each project, the codegen generates GraphQL react hooks/types in /{project}/src/generated/graphql.tsx.
  1. Dependencies generated -- Next.js projects can start.

Scripts

Document all scripts

All Node scripts for / should be comprehensively documented here -- no exceptions!

Most common

Developing

  • init: See "Build timeline" above.
  • upgrade: Helpful if you've just pulled down new commits. This installs all packages (install:all), runs init, and migrates the database (Docker must be running).
  • lint:all: Manually run ESLint across all projects. Useful as a preliminary check to fail faster, compared to waiting for the CI.

Helpers

  • ci:all: Runs npm ci in root and all projects.
  • install:all: Runs npm install in root and all projects.
  • tsc:all: Typechecking across all projects. Useful as a preliminary check to fail faster, compared to waiting for the CI.
  • gql:coverage: Generates GraphQL and uses GraphQL Inspector to print out the usage of various GraphQL objects, types, and fields. Unused fields are highlighted in red and are candidates for removal.

The underlying commands are:

  • _gql:codegen:resolvers: Generate GraphQL artifacts (Platform TypeScript bindings) based off of what's defined in the schema (*.graphql) code.
  • _gql:codegen: Runs TypeScript GraphQL codegen for projects (not Common) using the root schema.graphql that already exists.
  • _gql:coverage: Prints out usage of various GraphQL objects, types, and fields.