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
5b9d341c1c
commit
dd14b71121
3 changed files with 965 additions and 1 deletions
|
@ -1,6 +1,14 @@
|
||||||
import {IThemeCustomSettings} from '../../extensions/interfaces/itheme-custom-properties';
|
import {IThemeCustomSettings} from '../../extensions/interfaces/itheme-custom-properties';
|
||||||
import {IDefaults} from '../../extensions/interfaces/idefaults';
|
import {IDefaults} from '../../extensions/interfaces/idefaults';
|
||||||
|
|
||||||
|
export interface IPost {
|
||||||
|
title: String;
|
||||||
|
version: String;
|
||||||
|
fixed: String[];
|
||||||
|
new: String[];
|
||||||
|
breaking: String[];
|
||||||
|
}
|
||||||
|
|
||||||
export interface SettingsChangedMessage {
|
export interface SettingsChangedMessage {
|
||||||
type: 'settingsChanged';
|
type: 'settingsChanged';
|
||||||
config: IThemeCustomSettings;
|
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