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

All monaco-vscode packages are peerDependencies #809

Merged
merged 6 commits into from
Dec 18, 2024
Merged

All monaco-vscode packages are peerDependencies #809

merged 6 commits into from
Dec 18, 2024

Conversation

kaisalmen
Copy link
Collaborator

This fixes #789 and is related to CodinGame/monaco-vscode-api#544

@kaisalmen
Copy link
Collaborator Author

kaisalmen commented Dec 18, 2024

@CGNonofr the approach works with npm, pnpm and yarn. I just tested it with the next-14 release.

@cdietrich
Copy link
Contributor

is there a list of dependencies we need now to prodivde?

@kaisalmen
Copy link
Collaborator Author

@cdietrich no, there should be no change on your end needed, but if you have an incompatible monaco-vscode package it will now flag this during install. Depending on the default setting of the package manager the install will fail immediately (npm) or a warning is written (pnpm).

@kaisalmen
Copy link
Collaborator Author

@CGNonofr if you agree with this I will perform the final release of the packages (finally 😆) later today or tomorrow.

@cdietrich
Copy link
Contributor

hmmm
i had to add more in order for it to work

   "dependencies": {
+    "@codingame/monaco-vscode-api": "~11.1.2",
+    "@codingame/monaco-vscode-configuration-service-override": "~11.1.2",
+    "@codingame/monaco-vscode-editor-api": "~11.1.2",
+    "@codingame/monaco-vscode-extensions-service-override": "~11.1.2",
     "@codingame/monaco-vscode-keybindings-service-override": "~11.1.2",
+    "@codingame/monaco-vscode-languages-service-override": "~11.1.2",
+    "@codingame/monaco-vscode-localization-service-override": "~11.1.2",
+    "@codingame/monaco-vscode-log-service-override": "~11.1.2",
+    "@codingame/monaco-vscode-model-service-override": "~11.1.2",
-    "monaco-editor-wrapper": "6.0.0-next.11",
-    "monaco-languageclient": "9.0.0-next.11",
-    "vscode-ws-jsonrpc": "^3.3.2"
+    "monaco-editor-wrapper": "6.0.0-next.14",
+    "monaco-languageclient": "9.0.0-next.14",
+    "vscode-ws-jsonrpc": "3.4.0-next.14"
   },

@kaisalmen
Copy link
Collaborator Author

Copy link
Collaborator

@CGNonofr CGNonofr left a comment

Choose a reason for hiding this comment

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

👍

@kaisalmen
Copy link
Collaborator Author

kaisalmen commented Dec 18, 2024

i had to add more in order for it to work

@cdietrich which package manager?

@kaisalmen kaisalmen merged commit 9c35a27 into main Dec 18, 2024
1 check passed
@kaisalmen kaisalmen deleted the issue-789 branch December 18, 2024 17:29
@cdietrich
Copy link
Contributor

cdietrich commented Dec 18, 2024

we are using yarn.

with

  "dependencies": {
    "@codingame/monaco-vscode-keybindings-service-override": "~11.1.2",
    "monaco-editor-wrapper": "6.0.0-next.14",
    "monaco-languageclient": "9.0.0-next.14",
    "vscode-ws-jsonrpc": "3.4.0-next.14"
  },

yarn will complain about missing peers

but at runtime it will fail with e.g.

✘ [ERROR] Could not resolve "@codingame/monaco-vscode-languages-service-override"

    ../../node_modules/monaco-languageclient/lib/vscode/services.js:8:40:
      8 │ import getLanguagesServiceOverride from '@codingame/monaco-vscode-languages-service-override';
➤ YN0002: │ @xxx@workspace:docs/enduser doesn't provide @codingame/monaco-vscode-api (p45429), requested by monaco-languageclient.
➤ YN0002: │ @xxx@workspace:docs/enduser doesn't provide @codingame/monaco-vscode-configuration-service-override (pb2fb6), requested by monaco-languageclient.
➤ YN0002: │ @xxx@workspace:docs/enduser doesn't provide @codingame/monaco-vscode-editor-api (p399eb), requested by monaco-languageclient.
➤ YN0002: │ @xxx@workspace:docs/enduser doesn't provide @codingame/monaco-vscode-extensions-service-override (p96a48), requested by monaco-languageclient.
➤ YN0002: │ @xxx@workspace:docs/enduser doesn't provide @codingame/monaco-vscode-languages-service-override (p95f6a), requested by monaco-languageclient.
➤ YN0002: │ @xxx@workspace:docs/enduser doesn't provide @codingame/monaco-vscode-localization-service-override (pb558e), requested by monaco-languageclient.
➤ YN0002: │ @xxx@workspace:docs/enduser doesn't provide @codingame/monaco-vscode-log-service-override (p3731b), requested by monaco-languageclient.
➤ YN0002: │ @xxx@workspace:docs/enduser doesn't provide @codingame/monaco-vscode-model-service-override (p03ea4), requested by monaco-languageclient.

@cdietrich
Copy link
Contributor

so i added all of these

@kaisalmen
Copy link
Collaborator Author

@cdietrich yes, yarn needs more (it used to be like that before) it does not automatically install required peers (npm and pnpm do). Had to do the same: https://github.com/TypeFox/monaco-languageclient/blob/main/verify/yarn/package.json

Even with latest yarn there is not argument available that allows to install peer dependencies directly. Don't ask me why.🤷‍♂️

@kaisalmen
Copy link
Collaborator Author

@CGNonofr figuring this out was time-consuming (more than I expected). I don't know how many times I installed packages today.

@kaisalmen
Copy link
Collaborator Author

kaisalmen commented Dec 18, 2024

@kaisalmen
Copy link
Collaborator Author

kaisalmen commented Dec 19, 2024

@CGNonofr one very important thing to note here. The peerDependencies work nicely with released packages available via npm. The enforcement does not work inside a npm workspace. I had a wrong devDependency defined in monaco-editor-wrapper and it did not lead to errors (see 12bcdf9). Fortunately it was only a devDependency and therefore did not require to updated the released version. Btw, that's also the reason why I released multiple next releases yesterday, because only then I was able to tell if an approach I tried had worked for real.

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.

Better peer dependency enforcement needed
3 participants