Skip to content

Commit

Permalink
fix: validate version with prerelease at publish time
Browse files Browse the repository at this point in the history
Closes: #425
  • Loading branch information
joaomoreno committed Nov 4, 2021
1 parent 525f2fc commit 35e9716
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/publish.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as fs from 'fs';
import { promisify } from 'util';
import * as semver from 'semver';
import { ExtensionQueryFlags, PublishedExtension } from 'azure-devops-node-api/interfaces/GalleryInterfaces';
import { pack, readManifest, versionBump, prepublish } from './package';
import * as tmp from 'tmp';
Expand Down Expand Up @@ -81,6 +82,10 @@ async function _publish(packagePath: string, manifest: Manifest, options: IInter
throw new Error("Extensions using proposed API (enableProposedApi: true) can't be published to the Marketplace");
}

if (semver.prerelease(manifest.version)) {
throw new Error(`The VS Marketplace doesn't support prerelease versions: '${manifest.version}'`);
}

const pat = options.pat ?? (await getPublisher(manifest.publisher)).pat;
const api = await getGalleryAPI(pat);
const packageStream = fs.createReadStream(packagePath);
Expand Down

0 comments on commit 35e9716

Please sign in to comment.