Skip to content

Commit

Permalink
feat: store package version for future updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Howard committed Dec 29, 2018
1 parent 5550141 commit 6c91211
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import {
commands,
Disposable,
ExtensionContext,
extensions,
window,
workspace
} from 'vscode';

import { init as initCommands } from './commands';
import { DEBUG } from './constants';
import { DEBUG, EXTENSION_ID } from './constants';
import * as gists from './gists';
import { insights } from './insights';
import { init as initListeners } from './listeners';
Expand All @@ -33,6 +34,9 @@ export function activate(context: ExtensionContext): void {
profiles.configure({ state: context.globalState });

const config = workspace.getConfiguration('gist');
const extension = extensions.getExtension(EXTENSION_ID) as Extension;
const previousVersion = context.globalState.get('version');
const currentVersion = extension.packageJSON.version;

disposables.commands = initCommands(config, {
gists,
Expand Down Expand Up @@ -69,6 +73,11 @@ export function activate(context: ExtensionContext): void {
insights.exception('migrations', { message: err.message });
}

if (previousVersion !== currentVersion) {
// TODO: show what's new
context.globalState.update('version', currentVersion);
}

insights.track('activated', undefined, {
migrationCount: results.migrated.length
});
Expand Down

0 comments on commit 6c91211

Please sign in to comment.