feat: added support for ext changelogs (WIP) (#275)

* feat: added support for ext changelogs

* chore: switch repo releases url
This commit is contained in:
Alessio Occhipinti 2018-10-24 16:28:05 +02:00 committed by Mattia Astorino
parent f9d07fadba
commit 751b7635b3
3 changed files with 965 additions and 1 deletions

View file

@ -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;

View file

@ -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);
});

933
yarn.lock

File diff suppressed because it is too large Load diff