Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds scaffolding for publishing #124

Merged
merged 24 commits into from
Oct 24, 2023
Merged

Adds scaffolding for publishing #124

merged 24 commits into from
Oct 24, 2023

Conversation

ncordon
Copy link
Collaborator

@ncordon ncordon commented Oct 23, 2023

This PR brings a lot of changes to make the package ready for publishing:

  • Adds a LICENSE file to each subproject, as that will be needed.
  • Fixes the VSCode extension debugging. This has been done by:
    • Using a different language server (a non bundled one that loads the language support package code when used) for debugging and a bundled one for run.
    • Enabling source maps in the .vscode/launch file and giving them the paths of all source maps inside language support and schema-poller.
  • Enables TS incremental compilation. This enables to recompile projects very quickly after the first run with npm run build, unless you run a clean.
  • Bundles antlr4 and antlr4-c3 inside the language-support package and uses esbuild whenever possible or necessary with other packages.
  • Adds the typings for react-codemirror.
  • Configures the exports so all the projects work both with esm and commonjs.
    • I've tried publishing the language-support package locally, installing it into a separate project with npm link and using it both as commonjs and esm, it works ✅ .
  • Cleans up the libraries and aligns the projects on Typescript 4.9.5. We have 0 library vulnerabilities now, we used to have some.
  • Installs changeset and aligns all versions on a 2.0.0-next.0 release.
  • Changes the VSCode extension settings from CypherLSP.neo4j to just neo4j namespace, which looks cleaner:
    "neo4j.connect": true,
    "neo4j.password": "pass12345",
    "neo4j.user": "neo4j"

Caveats

  • I don't know why but the package-lock.json has a lot of changes. I upgraded my npm locally to 9.5.0 so maybe that is caused a lot of them.

@CLAassistant
Copy link

CLAassistant commented Oct 23, 2023

CLA assistant check
All committers have signed the CLA.

Comment on lines +19 to +25
"outFiles": [
"${workspaceRoot}/packages/vscode-extension/**/*.js",
"${workspaceRoot}/packages/language-support/**/*.cjs",
"${workspaceRoot}/packages/schema-poller/**/*.cjs"
],
"autoAttachChildProcesses": true,
"preLaunchTask": {
"type": "npm",
"script": "watch"
}
"sourceMaps": true
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the VSCode debugging

@@ -34,6 +35,6 @@
"prettier-plugin-organize-imports": "^3.2.1",
"ts-jest": "^29.1.1",
"turbo": "^1.10.15",
"typescript": "^4.8.4"
"typescript": "4.9.5"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aligns the same typescript version everywhere

@@ -0,0 +1,15 @@
{
"mode": "pre",
"tag": "next",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how it works but my intuition tells me we should be using this next tag instead of the alpha one? At least that's what they even describe in the changesets documentation

@@ -14,11 +22,11 @@
},
"scripts": {
"gen-parser": "antlr4 -Dlanguage=TypeScript -visitor src/antlr-grammar/CypherParser.g4 src/antlr-grammar/CypherLexer.g4 -o src/generated-parser/ -Xexact-output-dir",
"postinstall": "npm run gen-parser",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this as far as I know. The generated parser should be included in the package

"module": "./esm/index.js",
"version": "2.0.0-next.0",
"main": "./dist/cjs/index.cjs",
"moudle": "./dist/esm/index.mjs",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mispelt

@@ -0,0 +1,1606 @@
@[email protected] /Users/ncordon/neo4j/intellisense/cypher-lsp
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this file

@@ -1,7 +1,8 @@
{
"compilerOptions": {
"declaration": true,
"target": "ES2022",
"target": "ESNext",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Research whether we should use ESNext vs es2020 for example

Comment on lines +10 to +16
"ignore": [
"antlr4",
"antlr4-c3",
"vscode-extension",
"react-codemirror-playground",
"schema-poller"
]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we need this. In the description of ignore it says Packages that should not be released

@@ -0,0 +1,25 @@
# Node files
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we need this file either

"version": "0.0.1",
"main": "dist/cypher-language-server.js",
"version": "2.0.0-next.0",
"main": "./dist/server.js",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for VSCode debugging to work

Comment on lines -22 to -24
"type": "npm",
"script": "watch"
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure whether we need the watch but it seems broken to me locally

Comment on lines +14 to +18
const runServer = context.asAbsolutePath(
path.join('dist', 'cypher-language-server.js'),
);
const debugServer = context.asAbsolutePath(
path.join('..', 'language-server', 'dist', 'server.js'),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a different configuration for debug and for running (once the extension is compiled, the language server has to be living inside it, we cannot use a relative path). Also we want that language server to be minified.

@@ -9,7 +9,8 @@
"skipLibCheck": true,
"sourceMap": true,
"target": "ESNext",
"outDir": "dist"
"outDir": "dist",
"incremental": true
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enables incremental compilation

@@ -1,6 +1,6 @@
{
"name": "@neo4j-cypher",
"description": "Cypher Language Support",
"name": "neo4j-cypher-language-support",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name wasn't valid for the top package because of the @ 🤷‍♂️

"name": "@neo4j-cypher/vscode-extension",
"description": "Neo4j's Cypher VSCode extension",
"author": "neo4j",
"name": "neo4j-cypher-vscode-extension",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The command to publish the VSCode extension doesn't like this name either

@ncordon ncordon merged commit 19ffd9d into main Oct 24, 2023
3 checks passed
@ncordon ncordon deleted the publishing-scaffolding branch October 24, 2023 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants