remove publisher from manifest

This commit is contained in:
Joao Moreno 2015-09-18 20:06:37 +02:00
parent 7a658f375b
commit ffb5ef5000
2 changed files with 25 additions and 15 deletions

View file

@ -10,9 +10,6 @@ export interface Manifest {
version: string;
engines: { vscode: string; [name: string]: string; };
// mandatory (vscode)
publisher: string; // TODO move out
// optional (npm)
author?: string | Person;
description?: string;

View file

@ -3,8 +3,10 @@ import * as path from 'path';
import * as _ from 'lodash';
import * as yazl from 'yazl';
import { Manifest } from './manifest';
import { getCredentials } from './login';
import { nfcall, Promise, reject, resolve, all } from 'q';
import * as glob from 'glob';
import { read } from './util';
const resourcesPath = path.join(path.dirname(__dirname), 'resources');
const vsixManifestTemplatePath = path.join(resourcesPath, 'extension.vsixmanifest');
@ -32,10 +34,6 @@ function validateManifest(manifest: Manifest): Promise<Manifest> {
return reject<Manifest>('Manifest missing field: version');
}
if (!manifest.publisher) {
return reject<Manifest>('Manifest missing field: publisher');
}
if (!manifest.engines) {
return reject<Manifest>('Manifest missing field: engines');
}
@ -50,14 +48,29 @@ function validateManifest(manifest: Manifest): Promise<Manifest> {
function toVsixManifest(manifest: Manifest): Promise<string> {
return nfcall<string>(fs.readFile, vsixManifestTemplatePath, 'utf8')
.then(vsixManifestTemplateStr => _.template(vsixManifestTemplateStr))
.then(vsixManifestTemplate => vsixManifestTemplate({
id: manifest.name,
displayName: manifest.name,
version: manifest.version,
publisher: manifest.publisher,
description: manifest.description || '',
tags: (manifest.keywords || []).concat('vscode').join(';')
}));
.then(vsixManifestTemplate => {
return getCredentials().then(credentials => {
if (credentials) {
return resolve(credentials.publisher);
}
console.log(`A publisher name is required. Run '${ path.basename(process.argv[1]) } login' to avoid setting it every time.`);
return read('Publisher name: ');
}).then(publisher => {
if (!publisher) {
return reject<string>('Packaging requires a publisher name.');
}
return vsixManifestTemplate({
id: manifest.name,
displayName: manifest.name,
version: manifest.version,
publisher,
description: manifest.description || '',
tags: (manifest.keywords || []).concat('vscode').join(';')
});
});
});
}
function collectFiles(cwd: string): Promise<string[]> {