add preview flag

fixes #82
This commit is contained in:
Joao Moreno 2016-03-18 11:41:42 +00:00
parent ee9bd7e823
commit 7bf31e59b7
4 changed files with 25 additions and 1 deletions

View file

@ -6,7 +6,7 @@
<Description xml:space="preserve"><%- description %></Description> <Description xml:space="preserve"><%- description %></Description>
<Tags><%- tags %></Tags> <Tags><%- tags %></Tags>
<Categories><%- categories %></Categories> <Categories><%- categories %></Categories>
<GalleryFlags>Public</GalleryFlags> <GalleryFlags><%- flags %></GalleryFlags>
<Properties> <Properties>
<% if (links.repository) { %> <% if (links.repository) { %>
<Property Id="Microsoft.VisualStudio.Services.Links.Source" Value="<%- links.repository %>" /> <Property Id="Microsoft.VisualStudio.Services.Links.Source" Value="<%- links.repository %>" />

View file

@ -17,6 +17,7 @@ export interface Manifest {
activationEvents?: string[]; activationEvents?: string[];
extensionDependencies?: string[]; extensionDependencies?: string[];
galleryBanner?: { color?: string; theme?: string; }; galleryBanner?: { color?: string; theme?: string; };
preview?: boolean;
_bundling?: { [name: string]: string; }[]; _bundling?: { [name: string]: string; }[];
_testing?: string; _testing?: string;

View file

@ -94,6 +94,12 @@ class MainProcessor extends BaseProcessor {
constructor(manifest: Manifest) { constructor(manifest: Manifest) {
super(manifest); super(manifest);
const flags = ['Public'];
if (manifest.preview) {
flags.push('Preview');
}
_.assign(this.vsix, { _.assign(this.vsix, {
id: manifest.name, id: manifest.name,
displayName: manifest.displayName || manifest.name, displayName: manifest.displayName || manifest.name,
@ -102,6 +108,7 @@ class MainProcessor extends BaseProcessor {
description: manifest.description || '', description: manifest.description || '',
tags: (manifest.keywords || []).concat('vscode').join(','), tags: (manifest.keywords || []).concat('vscode').join(','),
categories: (manifest.categories || []).join(','), categories: (manifest.categories || []).join(','),
flags: flags.join(' '),
links: { links: {
repository: getUrl(manifest.repository), repository: getUrl(manifest.repository),
bugs: getUrl(manifest.bugs), bugs: getUrl(manifest.bugs),

View file

@ -411,6 +411,22 @@ describe('toVsixManifest', () => {
assert.ok(categories.some(c => c === 'world')); assert.ok(categories.some(c => c === 'world'));
}); });
}); });
it('should respect preview flag', () => {
const manifest = {
name: 'test',
publisher: 'mocha',
version: '0.0.1',
engines: Object.create(null),
preview: true
};
return _toVsixManifest(manifest, [])
.then(xml => parseXml(xml))
.then(result => {
assert.deepEqual(result.PackageManifest.Metadata[0].GalleryFlags, ['Public Preview']);
});
});
}); });
describe('toContentTypes', () => { describe('toContentTypes', () => {