chore: drafts in-app changelog viewer.

This commit is contained in:
octod 2017-09-07 21:02:45 +02:00
parent 02d20b7cfb
commit 40fbd7bacb
4 changed files with 54 additions and 0 deletions

View file

@ -17,6 +17,10 @@
"Teal": "#80CBC4",
"Yellow": "#FFA000"
},
"changelog": {
"lastversion": "",
"stopShowingChangelog": false
},
"icons": {
"theme": {
"iconDefinitions": {

View file

@ -0,0 +1,39 @@
import * as path from 'path';
import { getDefaultValues, getPackageJSON, writeFile } from "./fs";
import { PATHS } from "../consts/paths";
function splitVersion(input: string): { major: number, minor: number, patch: number } {
let [ major, minor, patch ] = input.split('.').map(i => parseInt(i));
return { major, minor, patch };
}
export function showChangelog(): void {
}
export function shouldShowChangelog(): boolean {
let defaults = getDefaultValues();
let out: boolean;
let packageJSON = getPackageJSON();
if (defaults.changelog == undefined || (defaults.changelog !== undefined && typeof defaults.changelog.lastversion !== 'string')) {
defaults.changelog = {
lastversion: packageJSON.version,
stopShowingChangelog: false
}
out = true;
} else {
let versionCurrent = splitVersion(packageJSON.version);
let versionOld = splitVersion(defaults.changelog.lastversion);
out = versionCurrent.major !== versionOld.major || versionCurrent.minor !== versionOld.minor || versionCurrent.patch !== versionOld.patch;
defaults.changelog.lastversion = packageJSON.version;
}
writeFile(path.join(PATHS.VSIX_DIR, './extensions/defaults.json'), JSON.stringify(defaults, null, 2));
return out;
}

View file

@ -1,5 +1,6 @@
export interface IDefaults {
accents: IAccents;
changelog: IChangelog;
icons: IDefaultsThemeIcons;
themeVariants: IDefaultsThemeVariant;
themeVariantsColours: IDefaultsThemeVariantColours;
@ -11,6 +12,11 @@ export interface IAccents {
[index: string]: string;
}
export interface IChangelog {
lastversion: string;
stopShowingChangelog: boolean;
}
export interface IDefaultsThemeIcons {
theme: {
iconDefinitions: {

View file

@ -3,6 +3,7 @@ import * as vscode from 'vscode';
import { IGenericObject } from "./interfaces/igeneric-object";
import { THEME_ACCENTS_SETTER } from "./commands/accents-setter/index";
import { THEME_VARIANT } from "./commands/theme-variant/index";
import { shouldShowChangelog, showChangelog } from './helpers/changelog';
enum Commands {
ACCENTS,
@ -19,6 +20,10 @@ export function activate(context: vscode.ExtensionContext) {
vscode.workspace.getConfiguration().update('materialTheme.cache.workbench.accent', undefined, true);
}
if (shouldShowChangelog()) {
showChangelog();
}
// registering the command
let command = vscode.commands.registerCommand('material.theme.config', () => {
// the user is going to choose what aspect of theme to config