Skip to content

Commit ecab6bf

Browse files
committed
fixes #625
1 parent b45bf93 commit ecab6bf

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

src/main.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ module.exports = function (argv: string[]): void {
141141
'Personal Access Token (defaults to VSCE_PAT environment variable)',
142142
process.env['VSCE_PAT']
143143
)
144-
.option('-t, --target <target>', 'Target architecture')
144+
.option('-t, --target <targets...>', 'Target architectures')
145145
.option('-m, --message <commit message>', 'Commit message used when calling `npm version`.')
146146
.option('--no-git-tag-version', 'Do not create a version commit and tag when calling `npm version`.')
147147
.option('-i, --packagePath <paths...>', 'Publish the provided VSIX packages.')
@@ -181,7 +181,7 @@ module.exports = function (argv: string[]): void {
181181
publish({
182182
pat,
183183
version,
184-
target,
184+
targets: target,
185185
commitMessage: message,
186186
gitTagVersion,
187187
packagePath,

src/publish.ts

+20-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const tmpName = denodeify<string>(tmp.tmpName);
1313
export interface IPublishOptions {
1414
readonly packagePath?: string[];
1515
readonly version?: string;
16-
readonly target?: string;
16+
readonly targets?: string[];
1717
readonly commitMessage?: string;
1818
readonly gitTagVersion?: boolean;
1919
readonly cwd?: string;
@@ -32,7 +32,7 @@ export async function publish(options: IPublishOptions = {}): Promise<any> {
3232
if (options.packagePath) {
3333
if (options.version) {
3434
throw new Error(`Both options not supported simultaneously: 'packagePath' and 'version'.`);
35-
} else if (options.target) {
35+
} else if (options.targets) {
3636
throw new Error(`Both options not supported simultaneously: 'packagePath' and 'target'.`);
3737
}
3838

@@ -51,13 +51,27 @@ export async function publish(options: IPublishOptions = {}): Promise<any> {
5151
} else {
5252
await versionBump(options.cwd, options.version, options.commitMessage, options.gitTagVersion);
5353

54-
const packagePath = await tmpName();
55-
const packageResult = await pack({ ...options, packagePath });
56-
await _publish(packagePath, packageResult.manifest, options);
54+
if (options.targets) {
55+
for (const target of options.targets) {
56+
const packagePath = await tmpName();
57+
const packageResult = await pack({ ...options, target, packagePath });
58+
await _publish(packagePath, packageResult.manifest, { ...options, target });
59+
}
60+
} else {
61+
const packagePath = await tmpName();
62+
const packageResult = await pack({ ...options, packagePath });
63+
await _publish(packagePath, packageResult.manifest, options);
64+
}
5765
}
5866
}
5967

60-
async function _publish(packagePath: string, manifest: Manifest, options: IPublishOptions) {
68+
export interface IInternalPublishOptions {
69+
readonly target?: string;
70+
readonly pat?: string;
71+
readonly noVerify?: boolean;
72+
}
73+
74+
async function _publish(packagePath: string, manifest: Manifest, options: IInternalPublishOptions) {
6175
if (!options.noVerify && manifest.enableProposedApi) {
6276
throw new Error("Extensions using proposed API (enableProposedApi: true) can't be published to the Marketplace");
6377
}

0 commit comments

Comments
 (0)