diff --git a/src/package.ts b/src/package.ts index a479b411..a590376c 100644 --- a/src/package.ts +++ b/src/package.ts @@ -15,7 +15,6 @@ import mime from 'mime'; import * as semver from 'semver'; import urljoin from 'url-join'; import { - validatePublisher, validateExtensionName, validateVersion, validateEngineCompatibility, @@ -1089,7 +1088,6 @@ export class ValidationProcessor extends BaseProcessor { } export function validateManifest(manifest: Manifest): Manifest { - validatePublisher(manifest.publisher); validateExtensionName(manifest.name); if (!manifest.version) { diff --git a/src/publish.ts b/src/publish.ts index d3b169b1..3f11e49d 100644 --- a/src/publish.ts +++ b/src/publish.ts @@ -8,6 +8,7 @@ import { getPublisher } from './store'; import { getGalleryAPI, read, getPublishedUrl, log, getHubUrl, patchOptionsWithManifest } from './util'; import { Manifest } from './manifest'; import { readVSIXPackage } from './zip'; +import { validatePublisher } from './validation'; const tmpName = promisify(tmp.tmpName); @@ -80,6 +81,8 @@ export interface IInternalPublishOptions { } async function _publish(packagePath: string, manifest: Manifest, options: IInternalPublishOptions) { + validatePublisher(manifest.publisher); + if (!options.noVerify && manifest.enableProposedApi) { throw new Error("Extensions using proposed API (enableProposedApi: true) can't be published to the Marketplace"); } diff --git a/src/test/package.test.ts b/src/test/package.test.ts index e40398da..f4c3ec6f 100644 --- a/src/test/package.test.ts +++ b/src/test/package.test.ts @@ -22,6 +22,7 @@ import * as tmp from 'tmp'; import { spawnSync } from 'child_process'; import { XMLManifest, parseXmlManifest, parseContentTypes } from '../xml'; import { flatten } from '../util'; +import { validatePublisher } from '../validation'; // don't warn in tests console.warn = () => null; @@ -265,9 +266,6 @@ describe('readManifest', () => { describe('validateManifest', () => { it('should catch missing fields', () => { assert.ok(validateManifest({ publisher: 'demo', name: 'demo', version: '1.0.0', engines: { vscode: '0.10.1' } })); - assert.throws(() => { - validateManifest({ publisher: undefined!, name: 'demo', version: '1.0.0', engines: { vscode: '0.10.1' } }); - }); assert.throws(() => { validateManifest({ publisher: 'demo', name: null!, version: '1.0.0', engines: { vscode: '0.10.1' } }); }); @@ -283,6 +281,8 @@ describe('validateManifest', () => { assert.throws(() => { validateManifest({ publisher: 'demo', name: 'demo', version: '1.0.0', engines: { vscode: null } as any }); }); + validatePublisher('demo'); + assert.throws(() => validatePublisher(undefined!)); }); it('should prevent SVG icons', () => {