Skip to content

Commit

Permalink
release vscode-graphql@4.0.3 from the monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
acao committed Apr 11, 2022
1 parent 931b8b4 commit 7ac4987
Show file tree
Hide file tree
Showing 15 changed files with 350 additions and 215 deletions.
9 changes: 9 additions & 0 deletions .changeset/old-mugs-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'graphql-language-service': patch
'graphql-language-service-server': patch
'vscode-graphql': patch
---
- fix esbuild bundling issues with vscode-graphql [#2269](https://github.com/graphql/graphiql/issues/2269) by fixing esbuild version
- remove `graphql-language-service` dependency on `graphql-config`, which is only for types
- remove direct `vscode-graphql` dependency on `graphql-config`, which previously existed for op exec client
- resolve `graphql-config` to `4.3.0` in `graphql-language-server`
5 changes: 3 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
"tasks": [
{
"label": "watch-vscode",
"type": "shell",
"command": "source ~/.zshrc; yarn run watch-vscode",
"type": "npm",
"script": "watch-vscode",
"problemMatcher": ["$tsc-watch"],
"isBackground": true,
"presentation": {
"reveal": "always"
Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@
"build:clean": "yarn tsc --clean",
"build:watch": "yarn tsc --watch",
"watch": "yarn build:watch",
"watch-vscode:prebuild": "yarn build && yarn workspace vscode-graphql run build-bundles",
"watch-vscode:bundle": "chokidar 'packages/*/dist/**/*.{js,ts}' -c 'yarn workspace vscode-graphql run build-bundles'",
"watch-vscode": "yarn watch-vscode:prebuild && concurrently 'yarn tsc --watch' 'yarn watch-vscode:bundle'",
"watch-vscode": "concurrently --raw 'yarn tsc --watch' 'yarn workspace vscode-graphql run compile --watch'",
"check": "yarn tsc --dry",
"cypress-open": "yarn workspace graphiql cypress-open",
"dev-graphiql": "yarn workspace graphiql dev",
Expand Down
31 changes: 27 additions & 4 deletions packages/graphql-language-service-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,39 @@ The custom graphql language configurations are:
- `customDirectives` - `['@myExampleDirective']`
- `customValidationRules` - returns rules array with parameter `ValidationContext` from `graphql/validation`

### Using the command-line interface
### LSP Workspace Configuration

When running `server`, your LSP-compatible client can [provide additional workspace configuration](https://npmjs.com/graphql-language-service-server#workspace-configuration).

For example, `coc.nvim` allows for providing custom `settings`

```json
"languageserver": {
"graphql": {
"command": "graphql-lsp",
"args": ["server", "-m", "stream"],
// customize filetypes to your needs
"filetypes": ["typescript", "typescriptreact", "graphql"],
"settings": {
"graphql-config.load.legacy": true
}
}
}
```

`graphql-lsp server --schema=localhost:3000`
this would allow for legacy `graphql-config` file formats like `.graphqlconfig`, useful on projects maintaining compatibility with the intellij plugin

The node executable contains several commands: `server` and the command-line language service methods (`validate`, `autocomplete`, `outline`).
### Using the command-line interface

```
graphql-lsp server --schema=localhost:3000
```

The node executable contains several commands: `server` and the command-line language service methods (`validate`, `autocomplete`, `outline`).

GraphQL Language Service Command-Line Interface.
### CLI Options

```
Usage: graphql-lsp <command> <file>
[-h | --help][-c | --configdir] {configDir}
Expand Down
2 changes: 2 additions & 0 deletions packages/graphql-language-service-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ module.exports = {

we also load `require('dotenv').config()`, so you can use process.env variables from local `.env` files!

<span id="workspace-configuration" />

### Workspace Configuration

The LSP Server reads config by sending `workspace/configuration` method when it initializes.
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-language-service-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@babel/types": "^7.17.0",
"@babel/parser": "^7.17.3",
"dotenv": "8.2.0",
"graphql-config": "^4.1.0",
"graphql-config": "^4.3.0",
"graphql-language-service": "^5.0.1",
"mkdirp": "^1.0.4",
"node-fetch": "^2.6.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-language-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"graphql": "^15.5.0 || ^16.0.0"
},
"dependencies": {
"graphql-config": "^4.1.0",
"vscode-languageserver-types": "^3.15.1",
"nullthrows": "^1.0.0"
},
Expand All @@ -41,6 +40,7 @@
"@types/json-schema": "7.0.9",
"benchmark": "^2.1.4",
"graphql": "16.0.0-experimental-stream-defer.5",
"graphql-config": "^4.3.0",
"lodash": "^4.17.15",
"platform": "^1.3.5",
"ts-node": "^8.10.2",
Expand Down
3 changes: 1 addition & 2 deletions packages/vscode-graphql/.vscodeignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
.vscode/**
.vscode-test/**
out/test/**
out/**/*.map
src/**
.gitignore
node_modules
tsconfig.json
vsc-extension-quickstart.md
tslint.json
node_modules
.github
renovate.json
30 changes: 30 additions & 0 deletions packages/vscode-graphql/esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const { build } = require('esbuild');
const [, , arg] = process.argv;

const logger = console.log;

build({
entryPoints: ['src/extension.ts', 'src/server/index.ts'],
bundle: true,
minify: arg === '--minify',
platform: 'node',
outdir: 'out/',
external: ['vscode'],
format: 'cjs',
sourcemap: true,
watch: arg === '--watch',
})
.then(({ errors, warnings }) => {
if (warnings.length) {
logger.warn(...warnings);
}
if (errors.length) {
logger.error(...errors);
}
logger.log('successfully bundled vscode-graphql 🚀');
process.exit();
})
.catch(err => {
logger.error(err);
process.exit(1);
});
35 changes: 4 additions & 31 deletions packages/vscode-graphql/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vscode-graphql",
"version": "0.4.0",
"version": "0.4.3",
"preview": true,
"private": true,
"license": "MIT",
Expand Down Expand Up @@ -152,20 +152,6 @@
"default": false,
"description": "Enable debug logs"
},
"vscode-graphql.trace.server": {
"type": [
"string"
],
"default": "off",
"description": "Enable tracing for language server"
},
"vscode-graphql.showExecCodelens": {
"type": [
"boolean"
],
"description": "Show codelens to execute operations inline",
"default": true
},
"vscode-graphql.cacheSchemaFileForLookup": {
"type": [
"boolean"
Expand Down Expand Up @@ -216,28 +202,19 @@
}
},
"commands": [
{
"command": "vscode-graphql.isDebugging",
"title": "VSCode GraphQL: Is Debugging?"
},
{
"command": "vscode-graphql.restart",
"title": "VSCode GraphQL: Manual Restart"
},
{
"command": "vscode-graphql.showOutputChannel",
"title": "VSCode GraphQL: Show output channel"
},
{
"command": "vscode-graphql.contentProvider",
"title": "VSCode GraphQL: Execute GraphQL Operations"
}
]
},
"scripts": {
"vscode:prepublish": "npm run compile -- --minify",
"compile": "npm run compile:server && esbuild ./dist/extension.js --bundle --outfile=out/extension.js --external:vscode --format=cjs --platform=node",
"compile:server": "esbuild ./dist/server/index.js --bundle --outfile=out/server/server.js --external:vscode --format=cjs --platform=node",
"compile": "node esbuild",
"build-bundles": "npm run compile -- --sourcemap",
"vsce:package": "vsce package --yarn",
"env:source": "export $(cat .envrc | xargs)",
Expand All @@ -248,17 +225,13 @@
"devDependencies": {
"@types/capitalize": "2.0.0",
"@types/vscode": "1.62.0",
"esbuild": "0.13.15",
"esbuild": "0.12.15",
"ovsx": "0.3.0",
"vsce-yarn-patch": "^1.66.2"
"vsce": "^2.7.0"
},
"dependencies": {
"graphql": "16.0.0-experimental-stream-defer.5",
"graphql-config": "^4.1.0",
"graphql-language-service-server": "^2.7.18",
"vscode-languageclient": "5.2.1"
},
"resolutions": {
"graphql-config": "4.1.0"
}
}
2 changes: 1 addition & 1 deletion packages/vscode-graphql/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function activate(context: ExtensionContext) {
console.log('Extension "vscode-graphql" is now active!');
}

const serverPath = path.join('out/server', 'server.js');
const serverPath = path.join('out', 'server', 'index.js');
const serverModule = context.asAbsolutePath(serverPath);

const debugOptions = {
Expand Down
1 change: 0 additions & 1 deletion packages/vscode-graphql/src/server/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'babel-polyfill';
import { startServer } from 'graphql-language-service-server';

// The npm scripts are configured to only build this once before
Expand Down
1 change: 1 addition & 0 deletions packages/vscode-graphql/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "../../resources/tsconfig.base.esm.json",
"compilerOptions": {
"target": "ES2018",
"module": "CommonJS",
"composite": true,
"rootDir": "./src",
"outDir": "./dist"
Expand Down
2 changes: 0 additions & 2 deletions packages/vscode-graphql/yarn.lock

This file was deleted.

Loading

0 comments on commit 7ac4987

Please sign in to comment.