From 53aa4e79cff1a748578e049f5fe4fdbb4be35576 Mon Sep 17 00:00:00 2001 From: Andrew Gammon Date: Fri, 10 Apr 2026 11:07:57 -0700 Subject: [PATCH] Add --marketplace-url global CLI flag Add a global --marketplace-url option that overrides the target marketplace endpoint for all commands (publish, unpublish, show, search, etc.). This enables publishing extensions to private or alternative marketplace instances without relying solely on the VSCE_MARKETPLACE_URL environment variable. Precedence: --marketplace-url flag > VSCE_MARKETPLACE_URL env var > default Example: vsce publish --marketplace-url https://private.example.com Assisted by GitHub Copilot using Claude Opus 4.6 --- src/main.ts | 14 +++++++++++++- src/util.ts | 6 +++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main.ts b/src/main.ts index 68d14e3a..7a315237 100644 --- a/src/main.ts +++ b/src/main.ts @@ -6,7 +6,7 @@ import { show } from './show'; import { search } from './search'; import { listPublishers, deletePublisher, loginPublisher, logoutPublisher, verifyPat } from './store'; import { getLatestVersion } from './npm'; -import { CancellationToken, log } from './util'; +import { CancellationToken, log, setMarketplaceUrl } from './util'; import * as semver from 'semver'; import { isatty } from 'tty'; @@ -64,6 +64,18 @@ module.exports = function (argv: string[]): void { program.version(pkg.version).usage(''); + program.option( + '--marketplace-url ', + 'Marketplace endpoint URL (defaults to VSCE_MARKETPLACE_URL environment variable or https://marketplace.visualstudio.com)' + ); + + program.hook('preAction', (thisCommand) => { + const opts = thisCommand.opts(); + if (opts.marketplaceUrl) { + setMarketplaceUrl(opts.marketplaceUrl); + } + }); + program .command('ls') .description('Lists all the files that will be published/packaged') diff --git a/src/util.ts b/src/util.ts index b18a4777..755aab5d 100644 --- a/src/util.ts +++ b/src/util.ts @@ -18,7 +18,11 @@ export function read(prompt: string, options: _read.Options = {}): Promise