Vscode-vsce: yarn workspaces

Created on 16 Oct 2018  路  8Comments  路  Source: microsoft/vscode-vsce

Feature request: support yarn workspaces.

vsce --yarn (as of 1.52.0) does not package any of the modules from the root's node_modules/.

feature-request

Most helpful comment

We have a multiple extensions with some common packages mono-repo structure. Each extension has dependencies on few of those common packages.

Currently we are using Lerna to manage the mono-repo, using webpack compile packages for each extension, and using vsce package individual extension and publish it.

It would be great if vsce support this natively

All 8 comments

Hi @joaomoreno: any idea if this support will be added soon?

We have a multiple extensions with some common packages mono-repo structure. Each extension has dependencies on few of those common packages.

Currently we are using Lerna to manage the mono-repo, using webpack compile packages for each extension, and using vsce package individual extension and publish it.

It would be great if vsce support this natively

I've worked around this by:

  • Using nohoist to force all (transitive) deps of the VSCode ext to be present in its own node_modules directory.
  • Calculating the list of dependencies to be bundled myself.
  • Calling vsce package programmatically and injecting the previously computed list of dependencies using proxyquire

See here:

Another requirement is that it should support webpack as well as exceptions specified in the .vscodeignore file such as

node_modules/**
../../node_modules/**
!../../node_modules/vscode-jsonrpc/**
!../../node_modules/vscode-languageclient/**
!../../node_modules/vscode-languageserver-protocol/**
!../../node_modules/vscode-languageserver-types/**
!../../node_modules/vscode-nls/**

Note that if you bundle your extension, e.g using webpack you won't need the contents of the node_modules inside your vsix.

Is this still an issue? I'm using yarn workspaces and was able to successfully package a .vsix using vsce package --yarn and it collected the node_modules from the root just fine.

  • vsce 1.79.5
  • yarn 1.22.4

image

Interestingly enough, running npx [email protected] ls --yarn in the same repo also lists node_modules in the root. I also checked the outputs of npx [email protected] list --prod (as well as some earlier versions back through [email protected]), and they also include the hoisted dependencies.

It could be that I'm running vsce from the root, rather than from within a workspace folder (since I'm planning on bundling the packages anyway in the future).

You can safely ignore my last two comments. After looking at the PR code in #458 I can see that your goal was to run vsce publish from within a specific workspace folder, not the workspace root.

I just put up #480 to auto-detect --yarn, but that may need to be modified slightly if your PR goes in so that it also looks for a yarn workspace root (so you could just do vsce publish from within the workspace folder rather than vsce publish --yarn).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joaomoreno picture joaomoreno  路  4Comments

jkeech picture jkeech  路  4Comments

Jakobud picture Jakobud  路  4Comments

SamVerschueren picture SamVerschueren  路  5Comments

muuvmuuv picture muuvmuuv  路  6Comments