Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
91fc766
fix: add missing git templates
comatory Mar 2, 2026
0c923ea
feat: format script for JS/TS-based packages
comatory Mar 3, 2026
a94f5be
feat: make task for formatting everything
comatory Mar 3, 2026
4f4bd3e
fix: do not format migrations
comatory Mar 3, 2026
dfc9d44
feat: add code formatting scripts for Go-based packages
comatory Mar 3, 2026
be30482
fix: add missing workspace entries
comatory Mar 3, 2026
12ef8b8
fix: review fixes
comatory Mar 3, 2026
4db4574
fix: ignore composition coverage reports
comatory Mar 3, 2026
53a4d16
fix: format composition files
comatory Mar 3, 2026
f92f4fd
fix: formatting for controlplane
comatory Mar 3, 2026
2b53c21
fix: formatting
comatory Mar 3, 2026
2c3973b
fix: only run write with prettier
comatory Mar 3, 2026
ab25dc3
fix: formatting controlplane ts configs
comatory Mar 3, 2026
601c313
Merge branch 'main' into ondrej/formatter
comatory Mar 4, 2026
fd71045
Merge branch 'main' into ondrej/formatter
comatory Mar 4, 2026
eab1e5b
fix: lint issues
comatory Mar 4, 2026
34e4182
fix: use gofmt without find
comatory Mar 4, 2026
11c8af3
fix: do not format changelogs
comatory Mar 4, 2026
8e4db96
fix: add prettierignore for all packages
comatory Mar 4, 2026
d03b03e
fix: remove unneeded types/prettier package
comatory Mar 4, 2026
72c3966
chore: revert controlplane changes
comatory Mar 4, 2026
5668d3c
Revert "fix: formatting controlplane ts configs"
comatory Mar 4, 2026
98492f4
Revert "fix: formatting for controlplane"
comatory Mar 4, 2026
95a9d63
Revert "fix: format composition files"
comatory Mar 4, 2026
c9e9dd3
Revert "chore: revert controlplane changes"
comatory Mar 4, 2026
f883f7b
fix: formatting
comatory Mar 4, 2026
1114f30
fix: formatting
comatory Mar 4, 2026
280f57c
Merge branch 'main' into ondrej/formatter
comatory Mar 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node_modules
.husky
.husky/_
.idea
.vscode
.zed
Expand Down
2 changes: 2 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
pnpm exec commitlint --edit "$1"
2 changes: 2 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
pnpm exec lint-staged
6 changes: 1 addition & 5 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,5 @@ logs
.idea

CHANGELOG.md
CHANGELOG
.husky


controlplane/migrations
Comment thread
comatory marked this conversation as resolved.

composition/tests/unstaged-tests
23 changes: 15 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ use (

We use [conventionalcommits](https://www.conventionalcommits.org/en/v1.0.0-beta.2/#why-use-conventional-commits) for changelog generation and more structured commit messages.

In order to enforce this standard we use a linter on pre-commit hook. This functionality is provided by [husky](https://typicode.github.io/husky/#/).
In some setup, you have to tell husky where to find your package manager or binaries. Here is the file `.huskyrc` you have to put in your user home directory.
If you want to enforce this standard, you can set up a pre-commit hook. This functionality is provided by [husky](https://typicode.github.io/husky/#/). Run `pnpm husky` to install pre-commit hooks which format code and check commit message format.
Comment thread
comatory marked this conversation as resolved.
In some setup, you have to tell husky where to find your package manager or binaries. Here is the file `husky.sh` which you should put in your home's configuration directory (`~/.config/husky/husky.sh`).

```bash
export NVM_DIR=/home/starptech/.nvm
Expand Down Expand Up @@ -170,29 +170,36 @@ We manage multiple compose files:
We use Codecov for code coverage. Code coverage is used for both PRs and also our default branch main.

#### Workaround for uploading to main

Codecov relies on commit hashes to map code to Codecov reports, however unfortunately we use "Squash Merge", which means that the HEAD of any merged PR is never present on main post-merge, leading to no code coverage uploaded for main (which is used as a base for comparisons).

In order to circumvent this we do the following steps:
* Upload Codecov reports from PR runs to GitHub as artifacts for the PR's HEAD commit
* Upon merge we find the PR and it's HEAD commit using the GitHub rest API
* We find the github artifact from this commit hash
* We then upload it again, but this time it acts as if it was uploaded from main

- Upload Codecov reports from PR runs to GitHub as artifacts for the PR's HEAD commit
- Upon merge we find the PR and it's HEAD commit using the GitHub rest API
- We find the github artifact from this commit hash
Comment thread
comatory marked this conversation as resolved.
- We then upload it again, but this time it acts as if it was uploaded from main

#### Adding new projects

When you add a new project (i.e. a subfolder in the cosmo repository root), if you wish to add code coverage for it you can follow these steps:

* Add a flag in the codecov.yaml for your project with the folder name, this is important so coverage does not get overwritten (for example if a router pr gets merged, cli coverage won't be set to empty for that commit)
- Add a flag in the codecov.yaml for your project with the folder name, this is important so coverage does not get overwritten (for example if a router pr gets merged, cli coverage won't be set to empty for that commit)

```yaml
flags:
router:
paths:
- router
carryforward: true
```
* You should be running tests in ci for your project via a GH Workflow, You need to add the GH Workflow name to `codecov-post-merge.yaml`, the line you are looking for will look something like this

- You should be running tests in ci for your project via a GH Workflow, You need to add the GH Workflow name to `codecov-post-merge.yaml`, the line you are looking for will look something like this

```yaml
workflow-paths: .github/workflows/cli-ci.yaml,.github/workflows/router-ci.yaml,
```

Ensure you add the full relative path from the cosmo repository root and it is comma-separated, e.g.: for graphqlmetrics `,.github/workflows/graphqlmetrics-ci.yaml`

**Clean up a compose stack before starting another one!**
Expand Down
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,24 @@ infra-debug-down-v:
infra-debug-up:
docker compose -f docker-compose.yml --profile debug up --remove-orphans --detach

format-all:
pnpm -r --parallel format

format:
@package="$(word 2,$(MAKECMDGOALS))"; \
if [ -z "$$package" ]; then \
echo "Usage: make format <package>"; \
exit 1; \
fi; \
pnpm --filter "./$$package" --fail-if-no-match run format

ifneq ($(filter format,$(MAKECMDGOALS)),)
FORMAT_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
.PHONY: $(FORMAT_ARGS)
$(FORMAT_ARGS):
@:
Comment thread
comatory marked this conversation as resolved.
endif
Comment thread
comatory marked this conversation as resolved.

seed:
pnpm -r run --filter './controlplane' seed

Expand Down
5 changes: 3 additions & 2 deletions admission-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
],
"scripts": {
"dev": "tsx watch src/index.ts",
"build": "rm -rf dist && tsc"
"build": "rm -rf dist && tsc",
"format": "prettier -w -c ."
},
"dependencies": {
"@hono/node-server": "1.13.7",
Expand All @@ -19,4 +20,4 @@
"tsx": "^4.16.0",
"typescript": "^5.3.2"
}
}
}
3 changes: 3 additions & 0 deletions aws-lambda-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"aws-lambda",
"serverless"
],
"scripts": {
"format": "go fmt ./..."
},
"author": {
"name": "WunderGraph Maintainers",
"email": "info@wundergraph.com"
Expand Down
1 change: 1 addition & 0 deletions cdn-server/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CHANGELOG.md
4 changes: 2 additions & 2 deletions cdn-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"build": "rm -rf dist && tsc",
"start": "tsx src/index.ts",
"lint": "eslint --cache && prettier -c src",
"format:fix": "prettier --write -c src",
"format": "prettier -w -c .",
"postversion": "name=$(jq -r .name package.json); version=$(jq -r .version package.json); gh workflow run image-release.yml -F name=$name -F workingDirectory=cdn-server -F tag=$version -F dockerContext=."
},
"dependencies": {
Expand All @@ -36,4 +36,4 @@
"tsx": "^4.16.0",
"typescript": "5.5.2"
}
}
}
1 change: 1 addition & 0 deletions cli/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CHANGELOG.md
5 changes: 3 additions & 2 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"test": "pnpm lint && vitest run test/",
"coverage": "vitest run test/ --coverage",
"lint": "eslint --cache --ext .ts,.mjs,.cjs . && prettier -c src",
"lint:fix": "eslint --cache --fix --ext .ts,.mjs,.cjs . && prettier --write -c src",
"lint:fix": "eslint --cache --fix --ext .ts,.mjs,.cjs . && pnpm format",
"format": "prettier -w -c .",
"e2e": "bun test e2e/"
},
"keywords": [
Expand Down Expand Up @@ -109,4 +110,4 @@
"vitest": "3.2.4"
},
"gitHead": "c37aed755e1b19ed91d30f9b5f7041e15c56901a"
}
}
1 change: 1 addition & 0 deletions client-tests/apollo-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "Apollo Client tests for GraphQL",
"main": "index.js",
"scripts": {
"format": "prettier -w .",
Comment thread
comatory marked this conversation as resolved.
"test": "vitest run",
"test:watch": "vitest watch",
"test:coverage": "vitest run --coverage"
Expand Down
3 changes: 3 additions & 0 deletions composition/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tests/unstaged-tests
coverage/
CHANGELOG.md
31 changes: 18 additions & 13 deletions composition/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![npm version](https://badge.fury.io/js/%40wundergraph%2Fcomposition.svg)](https://badge.fury.io/js/%40wundergraph%2Fcomposition)

The WunderGraph composition library facilitates the federation of multiple subgraph schemas into a
The WunderGraph composition library facilitates the federation of multiple subgraph schemas into a
single federated GraphQL schema.

### Prerequisites
Expand Down Expand Up @@ -53,29 +53,31 @@ const subgraphB: Subgraph = {

### FederationResult

The `federateSubgraphs` function returns `FederationResult`, which is a union of `FederationResultSuccess` and
The `federateSubgraphs` function returns `FederationResult`, which is a union of `FederationResultSuccess` and
`FederationResultFailure`. Both types in the union always define the following mutual properties:

| property | Description | type |
|----------|----------------------------------------|----------------|
| -------- | -------------------------------------- | -------------- |
| success | assertion of composition success | boolean |
| warnings | array of composition warnings (if any) | Array<Warning> |

#### FederationResultSuccess

If federation was successful, the return type is `FederationResultSuccess`.

| property | Description | type |
|----------------------|-------------------------------------------------------------|-----------------------|
| federatedGraphAST | an AST object representation of the federated graph sdl | graphql.DocumentNode |
| federatedGraphSchema | a schema object representation of the federated graph sdl | graphql.GraphQLSchema |
| success | assertion that composition was successful | true |
| warnings | array of composition warnings (if any) | Array<Warning> |
| property | Description | type |
| -------------------- | --------------------------------------------------------- | --------------------- |
| federatedGraphAST | an AST object representation of the federated graph sdl | graphql.DocumentNode |
| federatedGraphSchema | a schema object representation of the federated graph sdl | graphql.GraphQLSchema |
| success | assertion that composition was successful | true |
| warnings | array of composition warnings (if any) | Array<Warning> |

#### FederationResultFailure

If federation was unsuccessful, the return type is `FederationResultFailure`.

| property | Description | type |
|----------|---------------------------------------------|----------------|
| -------- | ------------------------------------------- | -------------- |
| errors | array of composition errors | Array<Error> |
| success | assertion that composition was unsuccessful | false |
| warnings | array of composition warnings (if any) | Array<Warning> |
Expand Down Expand Up @@ -112,9 +114,10 @@ for (const warning of result.warnings) {
### Errors

Errors can happen in three main stages:

1. While validating the subgraph metadata, e.g., validating that each `Subgraph` object has a unique name.
2. During the normalization process, which prepares the subgraph for federation.
(if this stage fails, federation will not be attempted)
(if this stage fails, federation will not be attempted)
3. During the federation process itself.

All errors will be appended to the `FederationResultFailure.errors` array.
Expand All @@ -127,7 +130,7 @@ This is easily achieved by passing string representation of the subgraph SDL to
An example is shown below:

```typescript
import { Subgraph } from '@wundergraph/composition'
import { Subgraph } from '@wundergraph/composition';
import { parse } from 'graphql';

const subgraphA: Subgraph = {
Expand All @@ -148,13 +151,15 @@ const subgraphA: Subgraph = {
### Subgraph Properties

| property | Description | type |
|-------------|-------------------------------------------|----------------------|
| ----------- | ----------------------------------------- | -------------------- |
| name | unique name of the subgraph | string |
| url | unique endpoint for the subgraph | string |
| definitions | an AST representation of the subgraph SDL | graphql.DocumentNode |

### Contributing

When adding or changing error, please ensure GraphQL types begin with a capital letter for clarity:

- Enum
- Input Object
- Interface
Expand Down
5 changes: 3 additions & 2 deletions composition/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
"test": "vitest run",
"test:core": "vitest run --exclude ./tests/unstaged-tests",
"test:coverage": "vitest run --coverage",
"lint": "prettier --check src tests",
"lint:fix": "prettier --write src tests",
"lint": "prettier --check .",
"lint:fix": "pnpm format",
"format": "prettier -w -c .",
"postversion": "node ./scripts/get-composition-version.mjs"
},
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion composition/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"declaration": true,
"outDir": "./dist",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"moduleResolution": "NodeNext"
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
Expand Down
2 changes: 1 addition & 1 deletion composition/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export default defineConfig({
// Ensure always the CJS version is used otherwise we might conflict with multiple versions of graphql
alias: [{ find: /^graphql$/, replacement: 'graphql/index.js' }],
},
});
});
3 changes: 3 additions & 0 deletions controlplane/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
migrations/
src/templates/emails/
CHANGELOG.md
2 changes: 1 addition & 1 deletion controlplane/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ A user session "cookie" is valid for 1 day. The refresh token has the same lifes
That implies that the user can interact with the app for 1 day until the refresh token is expired. The user can renew the session by calling the session endpoint `/v1/auth/session`.
The session endpoint will refresh the access and refresh token and update the session cookie. The user can interact with the app for another day.

__Summary: If the frontend ensure that the session endpoint `/v1/auth/session` is called on focus and load. The user might never be logged out again.__
**Summary: If the frontend ensure that the session endpoint `/v1/auth/session` is called on focus and load. The user might never be logged out again.**
4 changes: 3 additions & 1 deletion controlplane/emails/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"type": "module",
"scripts": {
"dev": "email dev --dir src --port 3400",
"build": "email export --dir src --outDir ../src/templates/emails --pretty && pnpm run --filter ../ lint:fix"
"build": "email export --dir src --outDir ../src/templates/emails --pretty && pnpm run --filter ../ lint:fix",
"format": "prettier -w .",
"lint:fix": "eslint --cache --fix --ext .ts,.mjs,.cjs . && pnpm format"
},
"author": {
"name": "WunderGraph Maintainers",
Expand Down
9 changes: 2 additions & 7 deletions controlplane/emails/src/components/cosmo-logo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,8 @@ export function CosmoLogo() {
href="https://wundergraph.com/"
className="flex items-center space-x-2 font-bold text-slate-800 no-underline w-full"
>
<Img
alt="WunderGraph"
src="https://wundergraph.com/images/logos/wundergraph-light.png"
width="45"
height="45"
/>
<Img alt="WunderGraph" src="https://wundergraph.com/images/logos/wundergraph-light.png" width="45" height="45" />
WunderGraph
</Link>
);
}
}
2 changes: 1 addition & 1 deletion controlplane/emails/src/components/main-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ export function MainContainer({ children }: React.PropsWithChildren) {
{children}
</Container>
);
}
}
10 changes: 5 additions & 5 deletions controlplane/emails/src/components/tailwind-config.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Tailwind, } from '@react-email/components';
import { Tailwind } from '@react-email/components';

export function TailwindConfig({ children }: React.PropsWithChildren) {
return (
Expand All @@ -9,12 +9,12 @@ export function TailwindConfig({ children }: React.PropsWithChildren) {
extend: {
colors: {
brand: '#ea4899',
}
}
}
},
},
},
}}
>
{children}
</Tailwind>
);
}
}
Loading
Loading