From 3a09ec85c26750ce52444006e4b9b4f6233e6dc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nacho=20Cord=C3=B3n?= Date: Wed, 25 Oct 2023 14:20:56 +0100 Subject: [PATCH] Sets up publishing (#127) * Makes some changes to the packaging * Adds included files for the packaging * Ignores buildinfo file * Adds job to publish * Adjusts branch of the CI, cleans up * Last nits * Waiting for the tests is not working * Adds keywords --- .changeset/config.json | 9 +---- .changeset/pre.json | 2 +- ...emirror.yaml => publish-npm-packages.yaml} | 21 +++++------- .gitignore | 3 +- .npmignore | 25 -------------- package-lock.json | 1 - package.json | 1 + packages/language-server/README.md | 2 +- packages/language-server/package.json | 34 ++++++++++++++++--- packages/language-support/package.json | 28 ++++++++++++++- .../react-codemirror-playground/package.json | 11 ++++++ packages/react-codemirror/package.json | 24 ++++++++++++- packages/schema-poller/package.json | 16 +++++++-- packages/vscode-extension/package.json | 21 ++++++++---- 14 files changed, 135 insertions(+), 63 deletions(-) rename .github/workflows/{publish-cypher-codemirror.yaml => publish-npm-packages.yaml} (54%) delete mode 100644 .npmignore diff --git a/.changeset/config.json b/.changeset/config.json index 432f1d396..34dfead03 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -6,12 +6,5 @@ "linked": [], "access": "public", "baseBranch": "main", - "updateInternalDependencies": "patch", - "ignore": [ - "antlr4", - "antlr4-c3", - "vscode-extension", - "react-codemirror-playground", - "schema-poller" - ] + "updateInternalDependencies": "patch" } diff --git a/.changeset/pre.json b/.changeset/pre.json index e79c2c86a..ed431e077 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -7,7 +7,7 @@ "@neo4j-cypher/react-codemirror": "1.0.0", "@neo4j-cypher/react-codemirror-playground": "1.0.0", "@neo4j-cypher/schema-poller": "1.0.0", - "@neo4j-cypher/vscode-extension": "1.0.0", + "neo4j-cypher-vscode-extension": "1.0.0", "antlr4": "4.13.1", "antlr4-c3": "3.0.1" }, diff --git a/.github/workflows/publish-cypher-codemirror.yaml b/.github/workflows/publish-npm-packages.yaml similarity index 54% rename from .github/workflows/publish-cypher-codemirror.yaml rename to .github/workflows/publish-npm-packages.yaml index d87f07ba9..26e8bcaf1 100644 --- a/.github/workflows/publish-cypher-codemirror.yaml +++ b/.github/workflows/publish-npm-packages.yaml @@ -1,12 +1,8 @@ -name: Publish react-codemirror package to npm +name: Publish packages to npm on: - # Runs on pushes targeting the default branch - # push: - # branches: ['main'] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: + push: + branches: ['publishing'] env: NODE_OPTIONS: '--max_old_space_size=4096' @@ -32,9 +28,10 @@ jobs: - name: Build project run: npm run build - - name: Publish on updated version number - uses: JS-DevTools/npm-publish@v2 + - name: Create Release Pull Request or Publish to npm + id: changesets + uses: changesets/action@f13b1baaa620fde937751f5d2c3572b9da32af23 # v1.4.5 with: - token: ${{ secrets.NPM_TOKEN }} - package: 'packages/react-codemirror/package.json' - access: 'restricted' + publish: npm run release + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index fa65ec085..f4d396ecc 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ generated .turbo *.antlr *.jar -*.clinic \ No newline at end of file +*.clinic +*.tsbuildinfo \ No newline at end of file diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 84bac5e24..000000000 --- a/.npmignore +++ /dev/null @@ -1,25 +0,0 @@ -# Node files -node_modules -npm-debug.log - -# OSX files -Thumbs.db -.DS_Store - -# Turbo folders -.turbo/ - -# Test files -*.test.ts -*.spec.ts - -# Antlr4 generated files -*.interp -*.tokens - -# Sourcemap files -*.map -.vscode/ -.eslintrc.json -.github/ -.git/ diff --git a/package-lock.json b/package-lock.json index c00530fc8..6aa816d02 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18404,7 +18404,6 @@ "license": "Apache-2.0", "dependencies": { "@neo4j-cypher/language-support": "2.0.0-next.0", - "@neo4j-cypher/schema-poller": "2.0.0-next.0", "neo4j-driver": "^5.3.0", "vscode-languageserver": "^8.1.0", "vscode-languageserver-textdocument": "^1.0.8" diff --git a/package.json b/package.json index 07fa6322d..3f744b28c 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "scripts": { "prepare": "husky install", "build": "turbo run build", + "release": "turbo run build && npx changeset publish", "clean": "turbo run clean", "watch": "turbo run watch", "test": "turbo run test", diff --git a/packages/language-server/README.md b/packages/language-server/README.md index 91c9d6b62..203f98a7c 100644 --- a/packages/language-server/README.md +++ b/packages/language-server/README.md @@ -5,7 +5,7 @@ A language server wrapper for the `@neo4j-cypher/language-support` package. ## Bundle the server and run with node To package the language server into a single javascript bundle, go to the root of the project and -do `npm run bundle`. +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`. diff --git a/packages/language-server/package.json b/packages/language-server/package.json index 600ac6210..a0ba8a019 100644 --- a/packages/language-server/package.json +++ b/packages/language-server/package.json @@ -1,20 +1,46 @@ { "name": "@neo4j-cypher/language-server", "description": "Cypher Language Server", - "author": "Neo4j", + "author": "Neo4j Inc.", "license": "Apache-2.0", + "files": [ + "./dist/cypher-language-server.js", + "./src", + "package.json", + "README.md", + "LICENSE.md", + "CHANGELOG.md" + ], + "keywords": [ + "neo4j", + "cypher", + "language server" + ], "version": "2.0.0-next.0", - "main": "./dist/server.js", + "main": "./dist/cypher-language-server.js", "types": "src/server.ts", + "repository": { + "type": "git", + "url": "git://github.com/neo4j/cypher-language-support.git" + }, + "bin": { + "cypher-language-server": "/dist/cypher-language-server.js" + }, + "bugs": { + "url": "https://github.com/neo4j/cypher-language-support/issues" + }, + "engineStrict": true, + "engines": { + "node": ">=18.18.2" + }, "dependencies": { "@neo4j-cypher/language-support": "2.0.0-next.0", - "@neo4j-cypher/schema-poller": "2.0.0-next.0", "neo4j-driver": "^5.3.0", "vscode-languageserver": "^8.1.0", "vscode-languageserver-textdocument": "^1.0.8" }, "scripts": { - "build": "tsc -b", + "build": "tsc -b && npm run bundle", "bundle": "esbuild ./src/server.ts --bundle --format=cjs --platform=node --outfile=dist/cypher-language-server.js", "clean": "rm -rf dist", "watch": "tsc -b -w" diff --git a/packages/language-support/package.json b/packages/language-support/package.json index e56377c49..2e31ae8dd 100644 --- a/packages/language-support/package.json +++ b/packages/language-support/package.json @@ -1,8 +1,23 @@ { "name": "@neo4j-cypher/language-support", "description": "Cypher language support", - "author": "Neo4j", + "author": "Neo4j Inc.", "license": "Apache-2.0", + "files": [ + "dist", + "src", + "package.json", + "README.md", + "LICENSE.md", + "CHANGELOG.md" + ], + "keywords": [ + "neo4j", + "cypher", + "autocompletion", + "linting", + "highlighting" + ], "version": "2.0.0-next.0", "main": "./dist/cjs/index.cjs", "module": "./dist/esm/index.mjs", @@ -14,6 +29,17 @@ "default": "./dist/cjs/index.cjs" } }, + "repository": { + "type": "git", + "url": "git://github.com/neo4j/cypher-language-support.git" + }, + "bugs": { + "url": "https://github.com/neo4j/cypher-language-support/issues" + }, + "engineStrict": true, + "engines": { + "node": ">=18.18.2" + }, "dependencies": { "antlr4": "*", "antlr4-c3": "*", diff --git a/packages/react-codemirror-playground/package.json b/packages/react-codemirror-playground/package.json index ca5886c4a..445269686 100644 --- a/packages/react-codemirror-playground/package.json +++ b/packages/react-codemirror-playground/package.json @@ -8,6 +8,17 @@ "build": "tsc --noEmit && vite build", "preview": "vite preview" }, + "repository": { + "type": "git", + "url": "git://github.com/neo4j/cypher-language-support.git" + }, + "bugs": { + "url": "https://github.com/neo4j/cypher-language-support/issues" + }, + "engineStrict": true, + "engines": { + "node": ">=18.18.2" + }, "dependencies": { "@neo4j-cypher/language-support": "2.0.0-next.0", "@neo4j-cypher/react-codemirror": "2.0.0-next.0", diff --git a/packages/react-codemirror/package.json b/packages/react-codemirror/package.json index 4e01023bb..9322cf0be 100644 --- a/packages/react-codemirror/package.json +++ b/packages/react-codemirror/package.json @@ -3,8 +3,19 @@ "license": "Apache-2.0", "files": [ "dist", + "src", "package.json", - "README.md" + "README.md", + "LICENSE.md", + "CHANGELOG.md" + ], + "keywords": [ + "neo4j", + "cypher", + "react", + "editor", + "codemirror", + "codemirror 6" ], "version": "2.0.0-next.0", "main": "./dist/cjs/index.cjs", @@ -28,6 +39,17 @@ "test:e2e": "playwright test -c playwright-ct.config.ts", "test:e2e-ui": "playwright test -c playwright-ct.config.ts --ui" }, + "repository": { + "type": "git", + "url": "git://github.com/neo4j/cypher-language-support.git" + }, + "bugs": { + "url": "https://github.com/neo4j/cypher-language-support/issues" + }, + "engineStrict": true, + "engines": { + "node": ">=18.18.2" + }, "dependencies": { "@neo4j-cypher/language-support": "2.0.0-next.0", "@codemirror/autocomplete": "^6.5.1", diff --git a/packages/schema-poller/package.json b/packages/schema-poller/package.json index 506ea8fa5..635d44101 100644 --- a/packages/schema-poller/package.json +++ b/packages/schema-poller/package.json @@ -1,11 +1,12 @@ { "name": "@neo4j-cypher/schema-poller", + "private": true, "description": "", - "author": "Neo4j", + "author": "Neo4j Inc.", "license": "Apache-2.0", "version": "2.0.0-next.0", "main": "./dist/cjs/src/index.js", - "moudle": "./dist/esm/src/index.js", + "module": "./dist/esm/src/index.js", "exports": { ".": { "require": "./dist/cjs/src/index.js", @@ -13,6 +14,17 @@ "default": "./dist/cjs/src/index.js" } }, + "repository": { + "type": "git", + "url": "git://github.com/neo4j/cypher-language-support.git" + }, + "bugs": { + "url": "https://github.com/neo4j/cypher-language-support/issues" + }, + "engineStrict": true, + "engines": { + "node": ">=18.18.2" + }, "dependencies": { "@neo4j-cypher/language-support": "2.0.0-next.0", "neo4j-driver": "^5.12.0" diff --git a/packages/vscode-extension/package.json b/packages/vscode-extension/package.json index fe3ed2c6c..b702ddd3e 100644 --- a/packages/vscode-extension/package.json +++ b/packages/vscode-extension/package.json @@ -1,18 +1,27 @@ { "name": "neo4j-cypher-vscode-extension", + "private": true, "description": "Enables support for Neo4j and its query language Cypher", - "author": "Neo4j", + "author": "Neo4j Inc.", "license": "Apache-2.0", "version": "2.0.0-next.0", - "repository": "https://github.com/neo4j/cypher-language-support", - "engines": { - "vscode": "^1.75.0" - }, - "publisher": "Neo4j", + "publisher": "Neo4j Inc.", "activationEvents": [ "onLanguage:cypher" ], "main": "./dist/extension.js", + "repository": { + "type": "git", + "url": "git://github.com/neo4j/cypher-language-support.git" + }, + "bugs": { + "url": "https://github.com/neo4j/cypher-language-support/issues" + }, + "engineStrict": true, + "engines": { + "node": ">=18.18.2", + "vscode": "^1.75.0" + }, "contributes": { "languages": [ {