From 9ce457837e5b82f07d4f50b9c15b6ab52c08a2b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nacho=20Cord=C3=B3n?= Date: Wed, 25 Oct 2023 23:54:41 +0100 Subject: [PATCH] Bumps version --- .changeset/nervous-rabbits-greet.md | 6 ++++++ .changeset/pre.json | 6 +++++- packages/language-server/CHANGELOG.md | 6 ++++++ packages/language-server/README.md | 22 +++++++++++----------- packages/language-server/package.json | 10 ++++++---- packages/vscode-extension/CHANGELOG.md | 8 ++++++++ packages/vscode-extension/package.json | 6 +++--- packages/vscode-extension/src/extension.ts | 4 +--- 8 files changed, 46 insertions(+), 22 deletions(-) create mode 100644 .changeset/nervous-rabbits-greet.md diff --git a/.changeset/nervous-rabbits-greet.md b/.changeset/nervous-rabbits-greet.md new file mode 100644 index 000000000..b016abcda --- /dev/null +++ b/.changeset/nervous-rabbits-greet.md @@ -0,0 +1,6 @@ +--- +'neo4j-cypher-vscode-extension': patch +'@neo4j-cypher/language-server': patch +--- + +Makes language server executable with npx diff --git a/.changeset/pre.json b/.changeset/pre.json index c57ba0f93..244848f72 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -11,5 +11,9 @@ "antlr4": "4.13.1", "antlr4-c3": "3.0.1" }, - "changesets": ["brown-ravens-obey", "fuzzy-rice-train"] + "changesets": [ + "brown-ravens-obey", + "fuzzy-rice-train", + "nervous-rabbits-greet" + ] } diff --git a/packages/language-server/CHANGELOG.md b/packages/language-server/CHANGELOG.md index 8ce43a2fe..681a4f888 100644 --- a/packages/language-server/CHANGELOG.md +++ b/packages/language-server/CHANGELOG.md @@ -1,5 +1,11 @@ # @neo4j-cypher/language-server +## 2.0.0-next.1 + +### Patch Changes + +- Makes language server executable with npx + ## 2.0.0-next.0 ### Major Changes diff --git a/packages/language-server/README.md b/packages/language-server/README.md index 98b2800cb..54627a7c9 100644 --- a/packages/language-server/README.md +++ b/packages/language-server/README.md @@ -6,13 +6,9 @@ A language server wrapper for the `@neo4j-cypher/language-support` package. We will provide a quick way to install the serer via npm soon™️. For now you can build it yourself, see instructions below. -### Bundling and usage from typescript +### Usage from typescript -To package the language server into a single javascript bundle, go to the root of the project and -do `npm run build`. -After that a file `./packages/language-server/dist/cypher-language-server.js` will be generated. - -You can run the language server with `node ./cypher-language-server.js --stdio`. +You can run the language server with `npx @neo4j-cypher/language-server.js --stdio`. Below you can find a few examples in Typescript on how to send messages to that server. @@ -21,8 +17,9 @@ Below you can find a few examples in Typescript on how to send messages to that ```typescript import * as child_process from 'child_process'; -let lspProcess = child_process.fork('cypher-language-server.js', [ - '--node-ipc', +let lspProcess = child_process.spawn('npx', [ + '@neo4j-cypher/language-server', + '--ipc', ]); let messageId = 1; @@ -99,7 +96,10 @@ const server = net.createServer((socket: net.Socket) => { }); server.listen(3000, () => { - child_process.spawn('node', ['cypher-language-server.js', '--socket=3000']); + child_process.spawn('npx', [ + '@neo4j-cypher/language-server', + '--socket=3000', + ]); }); ``` @@ -109,8 +109,8 @@ server.listen(3000, () => { import * as child_process from 'child_process'; import * as rpc from 'vscode-jsonrpc/node'; -let lspProcess = child_process.spawn('node', [ - 'cypher-language-server.js', +let lspProcess = child_process.spawn('npx', [ + '@neo4j-cypher/language-server', '--stdio', ]); let messageId = 1; diff --git a/packages/language-server/package.json b/packages/language-server/package.json index 52f3c3b3d..4a3e5f7ca 100644 --- a/packages/language-server/package.json +++ b/packages/language-server/package.json @@ -16,8 +16,8 @@ "cypher", "language server" ], - "version": "2.0.0-next.0", - "main": "./dist/cypher-language-server.js", + "version": "2.0.0-next.1", + "main": "./dist/server.js", "types": "src/server.ts", "repository": { "type": "git", @@ -30,6 +30,7 @@ "engines": { "node": ">=18.18.2" }, + "bin": "./dist/cypher-ls-node.js", "dependencies": { "@neo4j-cypher/language-support": "2.0.0-next.0", "neo4j-driver": "^5.3.0", @@ -37,8 +38,9 @@ "vscode-languageserver-textdocument": "^1.0.8" }, "scripts": { - "build": "tsc -b && npm run bundle", - "bundle": "esbuild ./src/server.ts --bundle --format=cjs --platform=node --outfile=dist/cypher-language-server.js", + "build": "tsc -b && npm run bundle && npm run make-executable", + "bundle": "esbuild ./src/server.ts --bundle --format=cjs --platform=node --outfile=dist/cypher-ls.js --minify", + "make-executable": "cd dist && echo '#!/usr/bin/env node' > cypher-language-server.js && cat cypher-ls.js >> cypher-language-server.js", "clean": "rm -rf dist", "watch": "tsc -b -w" }, diff --git a/packages/vscode-extension/CHANGELOG.md b/packages/vscode-extension/CHANGELOG.md index 45fa79722..7b4f910ba 100644 --- a/packages/vscode-extension/CHANGELOG.md +++ b/packages/vscode-extension/CHANGELOG.md @@ -1,5 +1,13 @@ # @neo4j-cypher/vscode-extension +## 2.0.0-next.1 + +### Patch Changes + +- Makes language server executable with npx +- Updated dependencies + - @neo4j-cypher/language-server@2.0.0-next.1 + ## 2.0.0-next.0 ### Major Changes diff --git a/packages/vscode-extension/package.json b/packages/vscode-extension/package.json index b702ddd3e..8f4a3ce11 100644 --- a/packages/vscode-extension/package.json +++ b/packages/vscode-extension/package.json @@ -4,7 +4,7 @@ "description": "Enables support for Neo4j and its query language Cypher", "author": "Neo4j Inc.", "license": "Apache-2.0", - "version": "2.0.0-next.0", + "version": "2.0.0-next.1", "publisher": "Neo4j Inc.", "activationEvents": [ "onLanguage:cypher" @@ -83,14 +83,14 @@ }, "scripts": { "vscode:prepublish": "npm run build", - "bundle-language-server": "cd ../language-server && npm run bundle -- --minify && cp dist/cypher-language-server.js ../vscode-extension/dist/", + "bundle-language-server": "cd ../language-server && npm run bundle && cp dist/cypher-ls.js ../vscode-extension/dist/", "bundle-extension": "esbuild ./src/extension.ts --bundle --external:vscode --format=cjs --platform=node --minify --outfile=dist/extension.js", "build": "tsc -b && npm run bundle-extension && npm run bundle-language-server", "clean": "rm -rf dist", "test:e2e": "npm run build && rm -rf .vscode-test/user-data && node ./dist/e2e_tests/main.js" }, "dependencies": { - "@neo4j-cypher/language-server": "2.0.0-next.0", + "@neo4j-cypher/language-server": "2.0.0-next.1", "vscode-languageclient": "^8.1.0" }, "devDependencies": { diff --git a/packages/vscode-extension/src/extension.ts b/packages/vscode-extension/src/extension.ts index 97a467ff2..f6100e15c 100644 --- a/packages/vscode-extension/src/extension.ts +++ b/packages/vscode-extension/src/extension.ts @@ -11,9 +11,7 @@ let client: LanguageClient; export function activate(context: ExtensionContext) { // The server is implemented in node - const runServer = context.asAbsolutePath( - path.join('dist', 'cypher-language-server.js'), - ); + const runServer = context.asAbsolutePath(path.join('dist', 'cypher-ls.js')); const debugServer = context.asAbsolutePath( path.join('..', 'language-server', 'dist', 'server.js'), );