Skip to content

Commit

Permalink
fixes --skipDuplicate ignoring target platforms(#868) (#873)
Browse files Browse the repository at this point in the history
If there is a target present in the options, then check it along with the
version. Otherwise just check the version.
  • Loading branch information
drewbrokke authored Jul 11, 2023
1 parent 701a450 commit 8ef9b97
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,18 @@ async function _publish(packagePath: string, manifest: Manifest, options: IInter
}

if (extension && extension.versions) {
const sameVersion = extension.versions.filter(v => v.version === manifest.version);
const versionExists = extension.versions.some(v =>
(v.version === manifest.version) &&
(options.target ? v.targetPlatform === options.target : true));

if (sameVersion.length > 0) {
if (versionExists) {
if (options.skipDuplicate) {
log.done(`Version ${manifest.version} is already published. Skipping publish.`);
return;
}

if (sameVersion.some(v => v.targetPlatform === options.target)) {
} else {
throw new Error(`${description} already exists.`);
}

}

try {
Expand Down

0 comments on commit 8ef9b97

Please sign in to comment.