feat: added support for ext changelogs (WIP) (#275)
* feat: added support for ext changelogs * chore: switch repo releases url
This commit is contained in:
parent
f9d07fadba
commit
751b7635b3
3 changed files with 965 additions and 1 deletions
|
@ -1,6 +1,14 @@
|
|||
import {IThemeCustomSettings} from '../../extensions/interfaces/itheme-custom-properties';
|
||||
import {IDefaults} from '../../extensions/interfaces/idefaults';
|
||||
|
||||
export interface IPost {
|
||||
title: String;
|
||||
version: String;
|
||||
fixed: String[];
|
||||
new: String[];
|
||||
breaking: String[];
|
||||
}
|
||||
|
||||
export interface SettingsChangedMessage {
|
||||
type: 'settingsChanged';
|
||||
config: IThemeCustomSettings;
|
||||
|
|
|
@ -1 +1,24 @@
|
|||
console.log('ReleaseNotes');
|
||||
import {IPost} from '../../interfaces';
|
||||
|
||||
const getReleaseNotes = (): Promise<object[]> => {
|
||||
const uri = 'https://raw.githubusercontent.com/equinusocio/vsc-material-theme-releases/master/releases/index.json';
|
||||
return fetch(uri).then(res => res.json());
|
||||
};
|
||||
|
||||
const renderTemplate = (posts: IPost[]) => {
|
||||
return `${posts.reduce((acc, {version, title, fixed, new: newItems, breaking}) => acc.concat(`<section class="Release">
|
||||
<header class="Release__Header">
|
||||
<span class="Release__Number">${version}</span>
|
||||
<h2 class="Release__Title">${title}</h2>
|
||||
</header>
|
||||
<ul class="Release-List">
|
||||
${fixed.reduce((accc, src) => accc.concat(`<li data-type="fixed">${src}</li>`), '')}
|
||||
${newItems.reduce((accc, src) => accc.concat(`<li data-type="new">${src}</li>`), '')}
|
||||
${breaking.reduce((accc, src) => accc.concat(`<li data-type="breaking">${src}</li>`), '')}
|
||||
</ul>
|
||||
</section>`), '')}`;
|
||||
};
|
||||
|
||||
getReleaseNotes().then((res: IPost[]) => {
|
||||
document.querySelector('.Container').innerHTML = renderTemplate(res);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue