question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Node.js support and restructuring to monorepo

See original GitHub issue

I am seeing increasing demand for a Node.js backend for Sprotty. I already created an example for that about a year ago:

https://github.com/spoenemann/theia-sprotty-nodejs-example/blob/master/diagram-view/src/node/diagram-server-impl.ts

I would like to share this to the Sprotty project as a separate package. At the same time, I propose to change this repository to a monorepo with multiple packages:

This will make it considerably easier to keep the code synchronized and to implement cross-package functionality.

I’d leave sprotty-theia and sprotty-vscode separate because their dependency tree is more complex, and I have previously seen problems when trying to include both the Theia and the VS Code integration in the same Yarn workspace. I would also keep sprotty-server separate to avoid a mixed-platform repository (TypeScript / Java).

sprotty-node should not have a dependency to sprotty to avoid using browser code in a Node.js context. For that reason, we need to extract common data structures into a new package sprotty-protocol. This is also a good opportunity to isolate and document the client / server protocol of Sprotty more clearly. For now that new repository should contain

  • SModel (schema) declarations
  • Actions (#233)

In order to keep API breakage at a minimum, we could mark the original declarations in the sprotty package as deprecated (they will still work, but should be changed to the new sprotty-protocol definitions at the earliest convenience).

What do you think?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
tortmayrcommented, Sep 24, 2021

👍 We are currently also evaluating the efforts of providing a node.js based GLSP server so this sounds like the perfect opportunity to align our efforts.

In GLSP we are already using a monorepo pattern similar to your suggestion and are quite happy with it. So I’m all for it. Keeping the core sprotty code and application specific glue code in separate repositories definitely makes sense. We also came to the same conclusion.

In order to keep API breakage at a minimum, we could mark the original declarations in the sprotty package as deprecated (they will still work, but should be changed to the new sprotty-protocol definitions at the earliest convenience).

Sounds good to me. However, I would only provide the deprecated API for limited time frame and the drop the support for it in a later release (similar to how it has been done in Theia with the @theia/languages AP). In our case I think we should drop the deprecated API once sprotty is leaving incubation.

0reactions
tortmayrcommented, Oct 26, 2021

Open discussion points from #233: From @spoenemann :

I’m currently working on extracting the action types and common datastructures of GLSP into a separate protocol package

@tortmayr Do you need any input / help on this?

Thanks, I think I don’t need any help for now. We have already contributed the initial PR for this. (see also (https://github.com/eclipse-glsp/glsp-client/tree/master/packages/protocol/src/action-protocol)) Currently we are duplicating/re implementing the types and action definitions that we need from sprotty. As soon as the new sprotty-protocol package is available we will remove the duplicate code and directly reuse the new package.

Note that I’ve already created an example of a Sprotty server in Node.js: https://github.com/litanlitudan/mlir-hlo-sprotty-vscode/tree/master/src/sprotty-node

Thanks! I already saw that, and it was very helpful as a reference!

I planned the 0.11.0 release that includes the monorepo restructuring for November 11: https://projects.eclipse.org/projects/ecd.sprotty/releases/0.11.0

Does that match your plans, or is it too early?

Great, sounds good to me and perfectly aligns with the GLSP plans

@tortmayr an important constraint on this: We should “block” all development while working on the restructuring to avoid unnecessary work for copying changes / resolving conflicts. In particular, there is a PR that needs to be reviewed and merged: #245

Agreed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Turning a Node.js Monolith into a Monorepo without ... - InfoQ
Let's discuss ways to smoothly turn a monolithic Node.js codebase into a Monorepo, while minimizing disruptions and risks.
Read more >
Migrating to a Monorepo Using NPM 7 Workspaces - Medium
Restructure our current directory. Once npm7 is installed, we will start with restructuring the repository folders to fit Monorepo's structure.
Read more >
Fullstacking: Restructuring the project - DEV Community ‍ ‍
Don't forget to sudo service mongod start . We shall add "start": "nodemon server.js" in the scripts object in this package.json
Read more >
Monorepo? Think Twice - Stuck In Queues
The issue comes when you want to containerise a JS application built in a monorepo. Let's say you're using Docker to containerise your...
Read more >
Monorepos Made Simpler with Bit - Bits and Pieces
How to leverage Bit + NPM to simplify monorepo architecture, ... Components can be installed with NPM or Yarn from Bit's Node.js registry....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found