Skip to content

Commit

Permalink
fix: package should not check for publisher
Browse files Browse the repository at this point in the history
Closes: #328
  • Loading branch information
joaomoreno committed Nov 5, 2021
1 parent 7182692 commit a38657e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import mime from 'mime';
import * as semver from 'semver';
import urljoin from 'url-join';
import {
validatePublisher,
validateExtensionName,
validateVersion,
validateEngineCompatibility,
Expand Down Expand Up @@ -1089,7 +1088,6 @@ export class ValidationProcessor extends BaseProcessor {
}

export function validateManifest(manifest: Manifest): Manifest {
validatePublisher(manifest.publisher);
validateExtensionName(manifest.name);

if (!manifest.version) {
Expand Down
3 changes: 3 additions & 0 deletions src/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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");
}
Expand Down
6 changes: 3 additions & 3 deletions src/test/package.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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' } });
});
Expand All @@ -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', () => {
Expand Down

0 comments on commit a38657e

Please sign in to comment.