Mirror: TypeScript LSP plugin that finds GraphQL documents in your code and provides diagnostics, auto-complete and hover-information.

Add dev watch build (#29)

* Improve DX

* Add launch script and add port to launch.json

* Fixes after switch to monorepo

Daniel d702223f afa458a5

Changed files
+61 -29
.vscode
packages
example
graphqlsp
scripts
+8 -8
.vscode/launch.json
···
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
-
{
-
// See: https://github.com/microsoft/TypeScript/wiki/Debugging-Language-Service-in-VS-Code
-
"type": "node",
-
"request": "attach",
-
"name": "Attach to VS Code TS Server via Port",
-
"processId": "${command:PickProcess}",
-
}
+
{
+
// See: https://github.com/microsoft/TypeScript/wiki/Debugging-Language-Service-in-VS-Code
+
"type": "node",
+
"request": "attach",
+
"name": "Attach to VS Code TS Server via Port",
+
"port": 9559
+
}
]
-
}
+
}
+4 -1
package.json
···
"main": "./dist/index.js",
"module": "./dist/index.module.js",
"scripts": {
-
"prepare": "husky install"
+
"build": "rollup -c ./scripts/build.mjs",
+
"prepare": "husky install",
+
"dev": "pnpm --filter @0no-co/graphqlsp dev",
+
"launch-debug": "./scripts/launch-debug.sh"
},
"prettier": {
"singleQuote": true,
+2 -1
packages/example/package.json
···
"license": "ISC",
"dependencies": {
"@urql/core": "^3.0.0",
-
"graphql": "^16.6.0"
+
"graphql": "^16.6.0",
+
"@graphql-typed-document-node/core": "^3.2.0"
},
"devDependencies": {
"typescript": "^5.0.0",
+1
packages/graphqlsp/package.json
···
"module": "./dist/index.module.js",
"scripts": {
"build": "rollup -c ../../scripts/build.mjs",
+
"dev": "NODE_ENV=development pnpm build --watch",
"prepublishOnly": "pnpm build"
},
"repository": {
+11
pnpm-lock.yaml
···
packages/example:
dependencies:
+
'@graphql-typed-document-node/core':
+
specifier: ^3.2.0
+
version: 3.2.0(graphql@16.6.0)
'@urql/core':
specifier: ^3.0.0
version: 3.2.2(graphql@16.6.0)
···
dependencies:
graphql: 16.6.0
tslib: 2.4.1
+
+
/@graphql-typed-document-node/core@3.2.0(graphql@16.6.0):
+
resolution: {integrity: sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ==}
+
peerDependencies:
+
graphql: ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0
+
dependencies:
+
graphql: 16.6.0
+
dev: false
/@jridgewell/gen-mapping@0.1.1:
resolution: {integrity: sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==}
+23 -19
scripts/build.mjs
···
import typescript from '@rollup/plugin-typescript';
import terser from '@rollup/plugin-terser';
+
const isDev = process.env.NODE_ENV === 'development';
+
+
/** @type {import('rollup').RollupOptions} */
export default {
input: './src/index.ts',
output: [
{ file: './dist/index.module.js', format: 'esm' },
-
{ file: './dist/index.js', format: 'cjs' }
+
{ file: './dist/index.js', format: 'cjs' },
],
plugins: [
typescript(),
-
terser({
-
warnings: true,
-
ecma: 2015,
-
ie8: false,
-
toplevel: true,
-
compress: {
-
keep_infinity: true,
-
pure_getters: true,
-
passes: 10
-
},
-
mangle: {
-
module: true,
-
},
-
output: {
-
comments: false
-
}
-
})
-
]
+
!isDev &&
+
terser({
+
warnings: true,
+
ecma: 2015,
+
ie8: false,
+
toplevel: true,
+
compress: {
+
keep_infinity: true,
+
pure_getters: true,
+
passes: 10,
+
},
+
mangle: {
+
module: true,
+
},
+
output: {
+
comments: false,
+
},
+
}),
+
],
};
+12
scripts/launch-debug.sh
···
+
#!/usr/bin/env sh
+
+
# Check if code is in PATH
+
+
if ! command -v code &> /dev/null
+
then
+
echo "Make sure to add VS Code to your PATH:"
+
echo "https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line"
+
exit
+
fi
+
+
TSS_DEBUG=9559 code --user-data-dir ~/.vscode-debug/ packages/example