You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Contributing.md
+38-6Lines changed: 38 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,45 @@
1
-
# Development environment
1
+
# Contributing
2
2
3
-
We require `node` and `pnpm` to exist. If you're a nix user, we have a flake.nix present that installs the same version of the development tools we use for everyone.
3
+
## Development environment
4
4
5
-
# Building TypeScript
5
+
We require `node` and `pnpm` to exist. If you're a nix user, we have a `flake.nix` present that installs the same version of the development tools we use for everyone.
6
+
7
+
## Building TypeScript
6
8
7
9
- You can run `pnpm build` to build all the projects in the repo
8
10
- You can run `pnpm watch` to start the TypeScript watcher process for all the projects in the repo which will recompile files as you change them
9
11
10
-
# Prereleasing
12
+
## Running Cypress tests
13
+
14
+
For running the Cypress tests, you need an API key for communicating with a Gadget app this repo uses for testing. You can ask a Gadget staff member for an existing key, or fork the test app and use your own API key for [this app](https://app.gadget.dev/auth/fork?domain=js-clients-test--development.gadget.app).
15
+
16
+
To open Cypress and execute tests interactively, run:
17
+
18
+
```react
19
+
pnpm -F=react run cypress:open
20
+
```
21
+
22
+
To run Cypress on the command line, run:
23
+
24
+
```react
25
+
pnpm -F=react run cypress:run
26
+
```
27
+
28
+
## Regenerating GraphQL queries
29
+
30
+
Most of the GraphQL queries this library makes are assembled dynamically at runtime based on the user's application and the metadata that comes from their API client. For queries we issue against our static part of the GraphQL schema that each application shares though (under `gadgetMeta { ... }`), we have an automatic type-safe GraphQL query generator in place using `graphql-codegen`.
31
+
32
+
You can author queries using the `graphql` helper, and then generate types for their return values with
33
+
34
+
```
35
+
pnpm -F=react gql-gen
36
+
```
37
+
38
+
Note that it uses the real Gadget app's GraphQL schema to generate types. The URL for the schema is defined in the `packages/react/codegen.ts` file. You may need to add `NODE_TLS_REJECT_UNAUTHORIZED=0` environment variable before running the command if you're having issues with the SSL certificate and you're using a self-signed certificate.
39
+
40
+
See the [`graphql-codegen`](https://the-guild.dev/graphql/codegen/docs/guides/react-vue#writing-graphql-queries) docs for more info.
41
+
42
+
## Prereleasing
11
43
12
44
It can be annoying to work with these packages via `pnpm link` sometimes, so we also support building and releasing the package to a git SHA which can then be installed conventionally in another repo. To push a prerelease, run `pnpm --filter=@gadgetinc/api-client-core prerelease`. This will:
13
45
@@ -16,7 +48,7 @@ It can be annoying to work with these packages via `pnpm link` sometimes, so we
16
48
- push that to the remote git repo
17
49
- and log out a version you can then refer to from other repos
18
50
19
-
# Checking test bundle sizes
51
+
##Checking test bundle sizes
20
52
21
53
We have a small project setup for evaluating what the bundled size of these dependencies might be together. Run:
22
54
@@ -28,7 +60,7 @@ to build the test bundles.
28
60
29
61
You can then view the built test bundle size reports at `packages/test-bundles/dist/<bundle>-stats.html` or import the `<bundle>-webpack-stats.json` file into your favourite bundle size analysis tool.
30
62
31
-
# Releasing
63
+
##Releasing
32
64
33
65
Releasing is done automatically via [our release workflow](.github/workflows/release.yml). Any commits to the main branch that changes one of our `packages/**/package.json` versions will automatically be published.
0 commit comments