Skip to content

Commit 38fdcdb

Browse files
authored
add turbo, update dev:graphiql command (#3933)
* upd * upd * upd
1 parent 29521e7 commit 38fdcdb

File tree

9 files changed

+219
-258
lines changed

9 files changed

+219
-258
lines changed

.changeset/empty-dingos-suffer.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'graphql-language-service-server': patch
3+
---
4+
5+
remove unnecessary string conversion in `logger.info(String(error))`

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ module.exports = {
384384
'@typescript-eslint/non-nullable-type-assertion-style': 'error',
385385
'@typescript-eslint/consistent-type-assertions': 'error',
386386
'@typescript-eslint/no-duplicate-type-constituents': 'error',
387+
'@typescript-eslint/no-unnecessary-type-conversion': 'error',
387388
// TODO: Fix all errors for the following rules included in recommended config
388389
'@typescript-eslint/no-deprecated': 'off',
389390
'@typescript-eslint/no-unsafe-function-type': 'off',

DEVELOPMENT.md

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### Getting Started
1+
# Getting Started
22

33
Please note that we require a signed GraphQL Specification Membership agreement
44
before landing a contribution. This is checked automatically when you open a PR.
@@ -9,8 +9,9 @@ prompted by the EasyCLA bot. For more details, please see the
99
0. First, you will need the latest `git`, `yarn` 1.16, & `node` 12 or greater.
1010
macOS, Windows and Linux should all be supported as build environments.
1111

12-
_**Note:** None of the commands below will work with `npm`. Please use `yarn` in
13-
this repo._
12+
> [!WARNING]
13+
>
14+
> None of the commands below will work with `npm`. Please use `yarn` in this repo.
1415
1516
1. Fork this repo by using the "Fork" button in the upper-right
1617

@@ -29,35 +30,35 @@ this repo._
2930
4. Build all interdependencies so the project you are working on can resolve
3031
other packages
3132

32-
First you'll need
33+
First, you'll need:
3334

3435
```sh
3536
yarn build
3637
```
3738

38-
— or —
39+
or
3940

4041
```sh
4142
yarn build:watch
4243
```
4344

44-
If you are focused on GraphiQL development, you can run
45+
If you are focused on GraphiQL development, you can run:
4546

4647
```sh
47-
yarn dev-graphiql
48+
yarn dev:graphiql
4849
```
4950

5051
5. Get coding! If you've added code, add tests. If you've changed APIs, update
5152
any relevant documentation or tests. Ensure your work is committed within a
5253
feature branch.
5354

54-
6. Ensure all tests pass, and build everything
55+
6. Ensure all tests pass and build everything
5556

5657
```sh
5758
yarn test
5859
```
5960

60-
### Fix CI issues with linting
61+
## Fix CI issues with linting
6162

6263
If you have `prettier` or `eslint --fix`-able issues you see in CI, use —
6364

@@ -67,7 +68,7 @@ If you see `typescript` build issues, do a `yarn build` locally, and make sure
6768
the whole project references tree builds. Changing interfaces can end up
6869
breaking their implementations.
6970

70-
### Run tests for GraphiQL:
71+
## Run tests for GraphiQL:
7172

7273
- `yarn test graphiql` will run all tests for graphiql. You can also run tests
7374
from a workspace, but most tooling is at the root.
@@ -80,28 +81,30 @@ breaking their implementations.
8081
If you want these commands to watch for changes to dependent packages in the
8182
repo, then run `yarn build --watch` alongside either of these.
8283

83-
### Developing for GraphiQL
84+
## Developing for GraphiQL
8485

8586
If you want to develop just for graphiql, you won't need to execute commands
8687
from the package subdirectory at `packages/graphiql`.
8788

8889
First, you'll need to `yarn build` all the packages from the root.
8990

90-
Then, you can run these commands:
91+
Then, you can run `yarn dev:graphiql` command, which will launch `vite` dev server for GraphiQL.
9192

92-
- `yarn dev-graphiql` — which will launch `webpack` dev server for graphiql
93-
from the root
93+
```text
94+
VITE v6.3.4 ready in 1015 ms
9495
95-
> The GraphiQL UI is available at http://localhost:8080/dev.html
96+
➜ Local: http://localhost:5173/
97+
➜ Network: use --host to expose
98+
```
9699

97-
### Developing Monaco GraphQL
100+
## Developing Monaco GraphQL
98101

99102
1. First run `yarn`.
100-
2. run `yarn tsc --watch` to watch `monaco-graphql` and
103+
2. Run `yarn tsc --watch` to watch `monaco-graphql` and
101104
`graphql-language-service` in one screen session/terminal tab/etc
102-
3. in another session, run `yarn start-monaco` from anywhere in the repository
105+
3. In another session, run `yarn start-monaco` from anywhere in the repository
103106
aside from an individual workspace.
104-
4. alternatively to the webpack example, or in addition, you can run monaco or
107+
4. Alternatively to the webpack example, or in addition, you can run monaco or
105108
next.js examples, though these examples are simpler. They also require their
106109
own `yarn` or `npm install` as they are excluded from the `workspaces`
107110
resolved on global `yarn install`

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
},
1515
"packageManager": "[email protected]",
1616
"scripts": {
17+
"dev:graphiql": "turbo run dev --filter=graphiql...",
1718
"build": "yarn build-clean && yarn tsc && yarn build:nontsc",
1819
"build-bundles": "yarn prebuild-bundles && yarn wsrun:noexamples --stages build-bundles",
1920
"build-bundles-clean": "rimraf '{packages,examples}/**/{bundle,cdn,webpack}'",
@@ -28,7 +29,6 @@
2829
"watch-vscode-exec": "yarn workspace vscode-graphql-execution compile",
2930
"check": "yarn tsc --noEmit",
3031
"cypress-open": "yarn workspace graphiql cypress-open",
31-
"dev-graphiql": "yarn workspace graphiql dev",
3232
"e2e": "yarn workspace graphiql e2e",
3333
"eslint": "NODE_OPTIONS=--max-old-space-size=4096 ESLINT_USE_FLAT_CONFIG=false eslint --max-warnings=0 --ignore-path .gitignore --cache .",
3434
"format": "yarn eslint --fix && yarn pretty",
@@ -86,8 +86,8 @@
8686
"@types/jest": "^29.5.2",
8787
"@types/node": "^16.18.4",
8888
"@types/ws": "8.2.2",
89-
"@typescript-eslint/eslint-plugin": "^8.31.0",
90-
"@typescript-eslint/parser": "^8.31.0",
89+
"@typescript-eslint/eslint-plugin": "^8.32.0",
90+
"@typescript-eslint/parser": "^8.32.0",
9191
"babel-jest": "^29.4.3",
9292
"babel-plugin-transform-import-meta": "^2.2.1",
9393
"concurrently": "^7.0.0",
@@ -119,7 +119,8 @@
119119
"typescript": "^4.6.3",
120120
"vitest": "^2.1.9",
121121
"wgutils": "^1.2.5",
122-
"wsrun": "^5.2.4"
122+
"wsrun": "^5.2.4",
123+
"turbo": "^2.5.2"
123124
},
124125
"resolutions": {
125126
"@babel/traverse": "^7.23.2",

packages/graphiql-react/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,6 @@ elements background.
130130
If you want to develop with `@graphiql/react` locally - in particular when
131131
working on the `graphiql` package - all you need to do is run `yarn dev` in the
132132
package folder in a separate terminal. This will build the package using Vite.
133-
When using it in combination with `yarn dev-graphiql` (running in the repo
133+
When using it in combination with `yarn dev:graphiql` (running in the repo
134134
root) this will give you auto-reloading when working on `graphiql` and
135135
`@graphiql/react` simultaneously.

packages/graphql-language-service-server/src/parsers/astro.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const astroParser: SourceParser = async (text, uri, logger) => {
5050
`Could not parse the astro file at ${uri} to extract the graphql tags:`,
5151
);
5252
for (const error of parseAstroResult.errors) {
53-
logger.info(String(error));
53+
logger.info(error);
5454
}
5555
return null;
5656
}

packages/graphql-language-service/src/interface/__tests__/getAutocompleteSuggestions.test.ts

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,29 +105,32 @@ describe('getAutocompleteSuggestions', () => {
105105
.map(suggestion => {
106106
// TODO: A PR where we do `const { type, ..rest} = suggestion; return rest;`
107107
// and validate the entire completion object - kinds, documentation, etc
108-
const response = { label: suggestion.label } as CompletionItem;
108+
const response: CompletionItem = { label: suggestion.label };
109109
if (suggestion.detail) {
110-
response.detail = String(suggestion.detail);
110+
response.detail = suggestion.detail;
111111
}
112-
if (suggestion.insertText && !options?.ignoreInsert) {
113-
response.insertText = suggestion.insertText;
114-
}
115-
if (suggestion.insertTextFormat && !options?.ignoreInsert) {
116-
response.insertTextFormat = suggestion.insertTextFormat;
117-
}
118-
if (suggestion.command && !options?.ignoreInsert) {
119-
response.command = suggestion.command;
112+
if (!options?.ignoreInsert) {
113+
if (suggestion.insertText) {
114+
response.insertText = suggestion.insertText;
115+
}
116+
if (suggestion.insertTextFormat) {
117+
response.insertTextFormat = suggestion.insertTextFormat;
118+
}
119+
if (suggestion.command) {
120+
response.command = suggestion.command;
121+
}
122+
if (suggestion.labelDetails) {
123+
response.labelDetails = suggestion.labelDetails;
124+
}
120125
}
121126
if (suggestion.documentation?.length) {
122127
response.documentation = suggestion.documentation;
123128
}
124-
if (suggestion.labelDetails && !options?.ignoreInsert) {
125-
response.labelDetails = suggestion.labelDetails;
126-
}
127129

128130
return response;
129131
});
130132
}
133+
131134
describe('with Operation types', () => {
132135
const expectedDirectiveSuggestions = [
133136
{ label: 'include', documentation: GraphQLIncludeDirective.description },

turbo.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "https://turbo.build/schema.json",
3+
"globalDependencies": ["yarn.lock", "resources/patches/*"],
4+
"tasks": {
5+
"build": {
6+
"dependsOn": [
7+
// Run `build` in workspaces I depend on first
8+
"^build"
9+
],
10+
// Cache all files emitted to the packages's directories
11+
"outputs": ["dist/**"]
12+
},
13+
"dev": {
14+
"dependsOn": [
15+
// Run `build` in workspaces I depend on first
16+
"^build"
17+
],
18+
"cache": false
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)