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

authored by

Daniel and committed by
GitHub
d702223f afa458a5

+61 -29
+8 -8
.vscode/launch.json
··· 4 4 // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 5 "version": "0.2.0", 6 6 "configurations": [ 7 - { 8 - // See: https://github.com/microsoft/TypeScript/wiki/Debugging-Language-Service-in-VS-Code 9 - "type": "node", 10 - "request": "attach", 11 - "name": "Attach to VS Code TS Server via Port", 12 - "processId": "${command:PickProcess}", 13 - } 7 + { 8 + // See: https://github.com/microsoft/TypeScript/wiki/Debugging-Language-Service-in-VS-Code 9 + "type": "node", 10 + "request": "attach", 11 + "name": "Attach to VS Code TS Server via Port", 12 + "port": 9559 13 + } 14 14 ] 15 - } 15 + }
+4 -1
package.json
··· 5 5 "main": "./dist/index.js", 6 6 "module": "./dist/index.module.js", 7 7 "scripts": { 8 - "prepare": "husky install" 8 + "build": "rollup -c ./scripts/build.mjs", 9 + "prepare": "husky install", 10 + "dev": "pnpm --filter @0no-co/graphqlsp dev", 11 + "launch-debug": "./scripts/launch-debug.sh" 9 12 }, 10 13 "prettier": { 11 14 "singleQuote": true,
+2 -1
packages/example/package.json
··· 11 11 "license": "ISC", 12 12 "dependencies": { 13 13 "@urql/core": "^3.0.0", 14 - "graphql": "^16.6.0" 14 + "graphql": "^16.6.0", 15 + "@graphql-typed-document-node/core": "^3.2.0" 15 16 }, 16 17 "devDependencies": { 17 18 "typescript": "^5.0.0",
+1
packages/graphqlsp/package.json
··· 6 6 "module": "./dist/index.module.js", 7 7 "scripts": { 8 8 "build": "rollup -c ../../scripts/build.mjs", 9 + "dev": "NODE_ENV=development pnpm build --watch", 9 10 "prepublishOnly": "pnpm build" 10 11 }, 11 12 "repository": {
+11
pnpm-lock.yaml
··· 37 37 38 38 packages/example: 39 39 dependencies: 40 + '@graphql-typed-document-node/core': 41 + specifier: ^3.2.0 42 + version: 3.2.0(graphql@16.6.0) 40 43 '@urql/core': 41 44 specifier: ^3.0.0 42 45 version: 3.2.2(graphql@16.6.0) ··· 996 999 dependencies: 997 1000 graphql: 16.6.0 998 1001 tslib: 2.4.1 1002 + 1003 + /@graphql-typed-document-node/core@3.2.0(graphql@16.6.0): 1004 + resolution: {integrity: sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ==} 1005 + peerDependencies: 1006 + 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 1007 + dependencies: 1008 + graphql: 16.6.0 1009 + dev: false 999 1010 1000 1011 /@jridgewell/gen-mapping@0.1.1: 1001 1012 resolution: {integrity: sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==}
+23 -19
scripts/build.mjs
··· 1 1 import typescript from '@rollup/plugin-typescript'; 2 2 import terser from '@rollup/plugin-terser'; 3 3 4 + const isDev = process.env.NODE_ENV === 'development'; 5 + 6 + /** @type {import('rollup').RollupOptions} */ 4 7 export default { 5 8 input: './src/index.ts', 6 9 output: [ 7 10 { file: './dist/index.module.js', format: 'esm' }, 8 - { file: './dist/index.js', format: 'cjs' } 11 + { file: './dist/index.js', format: 'cjs' }, 9 12 ], 10 13 plugins: [ 11 14 typescript(), 12 - terser({ 13 - warnings: true, 14 - ecma: 2015, 15 - ie8: false, 16 - toplevel: true, 17 - compress: { 18 - keep_infinity: true, 19 - pure_getters: true, 20 - passes: 10 21 - }, 22 - mangle: { 23 - module: true, 24 - }, 25 - output: { 26 - comments: false 27 - } 28 - }) 29 - ] 15 + !isDev && 16 + terser({ 17 + warnings: true, 18 + ecma: 2015, 19 + ie8: false, 20 + toplevel: true, 21 + compress: { 22 + keep_infinity: true, 23 + pure_getters: true, 24 + passes: 10, 25 + }, 26 + mangle: { 27 + module: true, 28 + }, 29 + output: { 30 + comments: false, 31 + }, 32 + }), 33 + ], 30 34 };
+12
scripts/launch-debug.sh
··· 1 + #!/usr/bin/env sh 2 + 3 + # Check if code is in PATH 4 + 5 + if ! command -v code &> /dev/null 6 + then 7 + echo "Make sure to add VS Code to your PATH:" 8 + echo "https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line" 9 + exit 10 + fi 11 + 12 + TSS_DEBUG=9559 code --user-data-dir ~/.vscode-debug/ packages/example