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

Manually packaging node modules instead of automatic collection #970

Open
itsdouges opened this issue Apr 22, 2024 · 0 comments
Open

Manually packaging node modules instead of automatic collection #970

itsdouges opened this issue Apr 22, 2024 · 0 comments

Comments

@itsdouges
Copy link

itsdouges commented Apr 22, 2024

Hello! With the closure of #421 and related issues it doesn't look like Microsoft is keen to support alternate package managers.

As an alternate path forward, we could update vsce pack to be able to package any node_modules folder that is present in the publishing folder. I had quite a hard / frustrating time using pnpm and collecting the relevant monorepo wide dependencies to build a vsce package. I ended up using, amusingly, electron-builder to collect the relevant dependencies (including symlinked ones) and have them ready for packaging. It works, albeit quite insane.

Next problem: Currently vsce pack ignores node_modules. To make it work I've applied this patch which enables node modules to be packaged if present:

diff --git a/out/package.js b/out/package.js
index 0a464f49ad8ff2b481180c65a7eba6376bb3f945..bc6b6f0557d2668e59c5532f46e2ef9b573fe801 100644
--- a/out/package.js
+++ b/out/package.js
@@ -1145,7 +1145,7 @@ const defaultIgnore = [
 const notIgnored = ['!package.json', '!README.md'];
 async function collectAllFiles(cwd, dependencies, dependencyEntryPoints) {
     const deps = await (0, npm_1.getDependencies)(cwd, dependencies, dependencyEntryPoints);
-    const promises = deps.map(dep => (0, util_1.promisify)(glob_1.default)('**', { cwd: dep, nodir: true, dot: true, ignore: 'node_modules/**' }).then(files => files.map(f => path.relative(cwd, path.join(dep, f))).map(f => f.replace(/\\/g, '/'))));
+    const promises = deps.map(dep => (0, util_1.promisify)(glob_1.default)('**', { cwd: dep, nodir: true, dot: true }).then(files => files.map(f => path.relative(cwd, path.join(dep, f))).map(f => f.replace(/\\/g, '/'))));
     return Promise.all(promises).then(util.flatten);
 }
 function getDependenciesOption(options) {

Ideally this could be added as a feature and then guided for the "alternate" package manager path. With links off for how folks can collect their node modules (pnpm publish being another example).

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

No branches or pull requests

1 participant