parent
855deca147
commit
f26f398300
2 changed files with 58 additions and 3 deletions
|
@ -124,15 +124,24 @@ export class TagsProcessor extends BaseProcessor {
|
|||
const keywords = this.manifest.keywords || [];
|
||||
const trimmedKeywords = keywords.slice(0, 5);
|
||||
|
||||
let promise = Promise.resolve(null);
|
||||
let promise = Promise.resolve(trimmedKeywords);
|
||||
|
||||
if (keywords.length > 5) {
|
||||
console.warn(`The keyword list is limited to 5 keywords; only the following keywords will be in your extension: [${ trimmedKeywords.join(', ') }].`);
|
||||
promise = util.read('Do you want to continue? [y/N] ')
|
||||
.then(answer => /^y$/i.test(answer) ? Promise.resolve(null) : Promise.reject('Aborted'));
|
||||
.then(answer => /^y$/i.test(answer) ? Promise.resolve(trimmedKeywords) : Promise.reject('Aborted'));
|
||||
}
|
||||
|
||||
return promise.then<any>(() => this.vsix.tags = trimmedKeywords.join(','));
|
||||
return promise.then<any>(keywords => {
|
||||
const contributes = this.manifest.contributes;
|
||||
const themes = contributes && contributes['themes'];
|
||||
|
||||
if (themes && themes.length > 0) {
|
||||
keywords = [...keywords, 'theme'];
|
||||
}
|
||||
|
||||
this.vsix.tags = _.unique(keywords).join(',');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -427,6 +427,52 @@ describe('toVsixManifest', () => {
|
|||
assert.deepEqual(result.PackageManifest.Metadata[0].GalleryFlags, ['Public Preview']);
|
||||
});
|
||||
});
|
||||
|
||||
it('should automatically add theme tag', () => {
|
||||
const manifest = {
|
||||
name: 'test',
|
||||
publisher: 'mocha',
|
||||
version: '0.0.1',
|
||||
engines: Object.create(null),
|
||||
contributes: {
|
||||
themes: [{ label: 'monokai', uiTheme: 'vs', path: 'monokai.tmTheme' }]
|
||||
}
|
||||
};
|
||||
|
||||
return _toVsixManifest(manifest, [])
|
||||
.then(parseXml)
|
||||
.then(result => assert.deepEqual(result.PackageManifest.Metadata[0].Tags, ['theme']));
|
||||
});
|
||||
|
||||
it('should not automatically add theme tag when themes are empty', () => {
|
||||
const manifest = {
|
||||
name: 'test',
|
||||
publisher: 'mocha',
|
||||
version: '0.0.1',
|
||||
engines: Object.create(null),
|
||||
contributes: {
|
||||
themes: []
|
||||
}
|
||||
};
|
||||
|
||||
return _toVsixManifest(manifest, [])
|
||||
.then(parseXml)
|
||||
.then(result => assert.deepEqual(result.PackageManifest.Metadata[0].Tags, ['']));
|
||||
});
|
||||
|
||||
it('should remove duplicate tags', () => {
|
||||
const manifest = {
|
||||
name: 'test',
|
||||
publisher: 'mocha',
|
||||
version: '0.0.1',
|
||||
engines: Object.create(null),
|
||||
keywords: ['theme', 'theme']
|
||||
};
|
||||
|
||||
return _toVsixManifest(manifest, [])
|
||||
.then(parseXml)
|
||||
.then(result => assert.deepEqual(result.PackageManifest.Metadata[0].Tags, ['theme']));
|
||||
});
|
||||
});
|
||||
|
||||
describe('toContentTypes', () => {
|
||||
|
|
Loading…
Add table
Reference in a new issue