Skip to content

Commit

Permalink
feat: clean up the scaffold from no longer required dependencies, gen…
Browse files Browse the repository at this point in the history
…eral clean up
  • Loading branch information
lgandecki committed Aug 21, 2023
1 parent bf1829f commit d0e4862
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 33 deletions.
9 changes: 4 additions & 5 deletions scaffold/README.md
Expand Up @@ -29,11 +29,10 @@ To run lint:

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 graphql:generateAll`.
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.
It's advisable to create a new module, fill it with schema, run the generation to see what are the resulting changes.
Remember to start with a clean, commited 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.
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:
Expand All @@ -57,8 +56,8 @@ extend type Mutation {
}
```

> Please note, we extend Queries and Mutations, as those are defined something else - that helps IDEs to understand that we don't have conflicting types defined in our project
> 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 graphql:generateAll`
`npm run chimp`
15 changes: 0 additions & 15 deletions scaffold/fix-generated.js

This file was deleted.

14 changes: 1 addition & 13 deletions scaffold/package.json
Expand Up @@ -37,15 +37,6 @@
"tsconfig-paths": "3.9.0"
},
"devDependencies": {
"@graphql-codegen/add": "5.0.0",
"@graphql-codegen/cli": "5.0.0",
"@graphql-codegen/typescript": "4.0.1",
"@graphql-codegen/typescript-mongodb": "2.4.6",
"@graphql-codegen/typescript-operations": "4.0.1",
"@graphql-codegen/typescript-resolvers": "4.0.1",
"@graphql-tools/graphql-file-loader": "8.0.0",
"@graphql-tools/load": "8.0.0",
"@graphql-tools/merge": "9.0.0",
"@jest/globals": "26.1.0",
"@tsconfig/node18": "^18.2.0",
"@types/body-parser": "^1.19.2",
Expand All @@ -54,12 +45,10 @@
"@types/express": "^4.17.17",
"@types/jest": "29.4.0",
"@types/lodash": "^4.14.196",
"@types/node": "14.0.23",
"@types/shelljs": "0.8.8",
"@types/node": "18.15.3",
"@typescript-eslint/eslint-plugin": "6.2.1",
"@typescript-eslint/parser": "6.2.1",
"chimp": "latest",
"chimp-graphql-codegen-plugin": "latest",
"eslint": "8.46.0",
"eslint-config-airbnb-typescript": "17.1.0",
"eslint-config-prettier": "8.10.0",
Expand All @@ -70,7 +59,6 @@
"lint-staged": "10.2.11",
"nodemon": "^3.0.1",
"prettier": "3.0.1",
"shelljs": "0.8.5",
"testdouble": "3.18.0",
"testdouble-jest": "2.0.0",
"ts-jest": "29.1.1",
Expand Down

0 comments on commit d0e4862

Please sign in to comment.