handle homepage links

This commit is contained in:
Joao Moreno 2015-10-14 11:34:11 +02:00
parent 0d9d4822f5
commit 6e57d39c51
3 changed files with 31 additions and 1 deletions

View file

@ -7,6 +7,9 @@
<Tags>${ tags }</Tags>
<GalleryFlags>Public</GalleryFlags>
<% if (license) { %><License>${ license }</License><% } %>
<Properties>
<% if (links.homepage) { %><Property Id="Microsoft.VisualStudio.Services.Links.Source" Value="${ links.homepage }" /><% } %>
</Properties>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Code"/>

View file

@ -116,6 +116,10 @@ export function toVsixManifest(manifest: Manifest, files: IFile[]): Promise<stri
}
});
const links = {
homepage: manifest.homepage
};
return readFile(vsixManifestTemplatePath, 'utf8')
.then(vsixManifestTemplateStr => _.template(vsixManifestTemplateStr))
.then(vsixManifestTemplate => vsixManifestTemplate({
@ -126,7 +130,8 @@ export function toVsixManifest(manifest: Manifest, files: IFile[]): Promise<stri
description: manifest.description || '',
tags: (manifest.keywords || []).concat('vscode').join(';'),
license,
assets
assets,
links
}));
}

View file

@ -157,6 +157,28 @@ describe('toVsixManifest', () => {
assert.equal(result.PackageManifest.Metadata[0].License[0], 'extension/thelicense.md');
});
});
it('should add homepage link property', () => {
const manifest = {
name: 'test',
publisher: 'mocha',
version: '0.0.1',
description: 'test extension',
engines: Object.create(null),
homepage: 'https://homepage/test'
};
return toVsixManifest(manifest, [])
.then(xml => parseXml(xml))
.then(result => {
assert.ok(result.PackageManifest.Metadata[0].Properties);
assert.equal(result.PackageManifest.Metadata[0].Properties.length, 1);
assert.ok(result.PackageManifest.Metadata[0].Properties[0].Property, 1);
assert.equal(result.PackageManifest.Metadata[0].Properties[0].Property.length, 1);
assert.equal(result.PackageManifest.Metadata[0].Properties[0].Property[0].$.Id, 'Microsoft.VisualStudio.Services.Links.Source');
assert.equal(result.PackageManifest.Metadata[0].Properties[0].Property[0].$.Value, 'https://homepage/test');
});
});
});
describe('toContentTypes', () => {