Build timeline
npm run init does the following:
- 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.tswhich includes strong typing for the full GraphQL schema.
- 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.
- 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.
- 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), runsinit, 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
NPM related
ci:all: Runsnpm ciin root and all projects.install:all: Runsnpm installin root and all projects.
TypeScript related
tsc:all: Typechecking across all projects. Useful as a preliminary check to fail faster, compared to waiting for the CI.
GraphQL codegen related
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 rootschema.graphqlthat already exists._gql:coverage: Prints out usage of various GraphQL objects, types, and fields.