feat(cli): forward vsce's --follow-symlinks, and document the pnpm story - #2169
Merged
Conversation
vsce collects the files to pack by walking production dependencies, and it treats a symlinked directory as a file unless --follow-symlinks says otherwise. A node_modules assembled out of symlinks - pnpm's - therefore packs the links rather than what they point at. vsce has carried the option on ls, package and publish for a while; ovsx never passed it, so there was no way to ask for it from here. Forward it, and warn that it is ignored for a prepackaged extension the way --yarn already does. Unset stays unset: vsce defaults the argument to false in collectFiles, so an invocation that does not pass the flag packs exactly what it packed before. Also write down what pnpm users are meant to do, which was the substance of issue #368 and was documented nowhere. vsce supports npm and yarn v1 only and has closed the request for more as out of scope, so the answer is either --no-dependencies for a bundled extension, which is most of them now, or --follow-symlinks when the dependency walk really is wanted. The README said nothing about any of the three flags. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Closed
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The change is small and additive, includes a targeted unit test for the new forwarding behavior, and documentation updates align with the described upstream constraints.
Pull request overview
This PR enhances the ovsx CLI publish workflow by exposing and forwarding vsce’s --follow-symlinks packaging behavior (important for symlink-heavy node_modules layouts like pnpm’s), and documents recommended approaches for non-npm/yarn setups.
Changes:
- Add
--follow-symlinkstoovsx publishand forward it into@vscode/vscepackaging options. - Extend CLI docs with a “Package managers” section explaining npm/yarn-only support upstream and recommending
--no-dependencies/--follow-symlinksas appropriate. - Add a unit test asserting
ovsxforwards packaging options (cwd,useYarn,followSymlinks,dependencies) tocreateVSIX.
File summaries
| File | Description |
|---|---|
| cli/test/unit/publish.spec.ts | Adds a unit test that mocks createVSIX and verifies packaging options are forwarded intact. |
| cli/src/publish.ts | Passes followSymlinks through to createVSIX package options. |
| cli/src/publish-options.ts | Adds followSymlinks?: boolean to publish option types with documentation. |
| cli/src/main.ts | Exposes --follow-symlinks flag in the CLI, forwards it to publish, and warns when ignored for prepackaged VSIX. |
| cli/README.md | Documents the package-manager story and recommended flags (--no-dependencies, --follow-symlinks). |
| cli/CHANGELOG.md | Notes the addition of --follow-symlinks in the CLI changelog. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #368.
Context
#368 (from 2021) asked how
ovsx publishshould handle pnpm. The answer it was waiting on has since arrived from upstream: microsoft/vscode-vsce#421 "Support pnpm" was closed as out of scope in December 2023 — "we've decided to limit the amount of supported package managers to npm and yarn v1 only." The condition set in the original discussion ("ifvsceadds a dedicated flag for pnpm, we should adaptovsxas well") therefore resolves in the negative, and@vscode/vsce@3.7.1— what we depend on today — contains no occurrence ofpnpmanywhere in its compiled output.That leaves two things worth doing on our side.
--follow-symlinksvsce collects the files to pack by walking production dependencies, and
collectFilestreats a symlinked directory as a file unlessfollowSymlinkssays otherwise. Anode_modulesassembled out of symlinks — pnpm's — therefore packs the links rather than what they point at. vsce exposes--follow-symlinksonls,packageandpublish;ovsxnever passed it, so there was no way to ask for it from here.Now forwarded, with the same "ignored for a prepackaged extension" warning
--yarnalready carries.Unset stays unset. vsce's
collectFilesdefaults the parameter tofalse, and a JS default applies to an explicitundefined, so an invocation that doesn't pass the flag packs exactly what it packed before. This is strictly additive.Documentation
The substance of #368 was really "what is a pnpm user supposed to do?" — and the answer existed but was written down nowhere. The CLI README's 121 lines mentioned neither
--yarn,--no-dependenciesnor pnpm. It now has a short Package managers subsection saying:--no-dependenciesskips the dependency walk entirely — the right answer for a bundled extension built with esbuild/webpack, which is most of them now, whatever installed the sources. It maps to vsce'sgetDependenciesOption→'none', and is what upstream recommends;--follow-symlinksfor the case where the walk really is wanted against a symlinkednode_modules.Testing
publish.spec.tsgains a test that mockscreateVSIXand asserts the packaging options arrive intact (cwd,useYarn,followSymlinks,dependencies). I checked it actually bites: reverting the one-line pass-through inpublish.tsmakes it fail.Full CLI suite green (100 tests, 10 files),
tsc --noEmitandyarn lintclean.Not done
The
--yarnflag keeps its name. #368 floated renaming it to something generic, but it maps 1:1 onto vsce'suseYarn, which selectsyarn list --jsonovernpm list --production --parseable; a generic name would describe less accurately what it does, not more.🤖 Generated with Claude Code