UNPKG

chimp

Version:

Your development companion for doing quality, faster.

64 lines (37 loc) 1.54 kB
## Setup `npm install` ## Development Start the backend in dev (watch) mode: `npm start` To run tests: `npm test` To run tests in watch mode: `npm run test:watch` To run type check: `npm run type-check` To run lint: `npm run lint` ## Type Generation / Workflow Your schema files have to be in a structure of `./src/modules/MODULE_NAME/graphql/MODULE_NAME.graphql`, for example `./src/modules/Lists/graphql/Lists.graphql`. Anytime you modify one of your graphql files remember to run `npm run chimp`. It will create Mutations/Queries/Type resolvers, tests for them, types and perform all the necessary connection between the main schema, contexts, etc. Remember to start with a clean, committed state. It's difficult to compare and verify the generation results if you've had changes in the code already, so that's blocked by default. The tooling will only allow you to run the generation if there are no changes, or if .graphql files are the only one changed. Let's assume we've created a new module named Users: `mkdir -p src/modules/Users/graphql` And now create a simple schema file for it `src/modules/Users/graphql/Users.graphql`: ```graphql type User { id: ID! name: String } extend type Query { UserById(id: ID!): User! } extend type Mutation { UserAdd(name: String!): User! } ``` > Please note, we extend Queries and Mutations, as those are defined somewhere else - that helps IDEs to understand that we don't have conflicting types defined in our project Let's run the generation now: `npm run chimp`