Skip to content

Commit

Permalink
Add in product changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
mustard-mh committed Jul 20, 2022
1 parent 99a52e9 commit ac98123
Show file tree
Hide file tree
Showing 9 changed files with 442 additions and 3 deletions.
4 changes: 3 additions & 1 deletion extensions/gitpod-shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"prepare": "node scripts/inflate.js"
},
"devDependencies": {
"@types/js-yaml": "^4.0.5",
"@types/node": "16.x",
"@types/uuid": "^8.3.1",
"@types/ws": "^7.2.6"
Expand All @@ -20,8 +21,9 @@
"@gitpod/gitpod-protocol": "main",
"@gitpod/supervisor-api-grpc": "main",
"bufferutil": "^4.0.1",
"utf-8-validate": "^5.0.2",
"js-yaml": "^4.1.0",
"reconnecting-websocket": "^4.4.0",
"utf-8-validate": "^5.0.2",
"uuid": "^8.3.1",
"vscode-nls": "^5.0.0",
"ws": "^7.4.6",
Expand Down
11 changes: 11 additions & 0 deletions extensions/gitpod-shared/scripts/inflate.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const nls = {
'openSettings': 'Gitpod: Open Settings',
'openContext': 'Gitpod: Open Context',
'openDocumentation': 'Gitpod: Documentation',
'showReleaseNotes': 'Gitpod: Show Release Notes',
'openDiscord': 'Gitpod: Open Community Chat',
'openTwitter': 'Gitpod: Follow us on Twitter',
'reportIssue': 'Gitpod: Report Issue',
Expand Down Expand Up @@ -72,6 +73,11 @@ const commands = [
'title': '%reportIssue%',
'enablement': 'gitpod.inWorkspace == true'
},
{
'command': 'gitpod.showReleaseNotes',
'title': '%showReleaseNotes%',
'enablement': 'gitpod.inWorkspace == true'
},
{
'command': 'gitpod.upgradeSubscription',
'title': '%upgradeSubscription%',
Expand Down Expand Up @@ -160,6 +166,11 @@ const remoteMenus = [
'group': 'remote_00_gitpod_navigation@90',
'when': 'gitpod.inWorkspace == true'
},
{
'command': 'gitpod.showReleaseNotes',
'group': 'remote_00_gitpod_navigation@70',
'when': 'gitpod.inWorkspace == true'
},
{
'command': 'gitpod.upgradeSubscription',
'group': 'remote_00_gitpod_navigation@100',
Expand Down
52 changes: 52 additions & 0 deletions extensions/gitpod-shared/src/common/cache.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Gitpod. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import * as vscode from 'vscode';

const CACHE_KEY = 'gitpod.cache';

interface CacheObject {
value: any;
expiration?: number;
}

interface CacheMap { [key: string]: CacheObject }

export class CacheHelper {
constructor(private readonly context: vscode.ExtensionContext) { }

set(key: string, value: any, expiration?: number) {
let obj = this.context.globalState.get<CacheMap>(CACHE_KEY);
if (!obj) {
obj = {};
}
const exp = expiration ? ((+ new Date()) / 1000 + expiration) : undefined;
obj[key] = { value, expiration: exp };
return this.context.globalState.update(CACHE_KEY, obj);
}

get(key: string) {
const value = this.context.globalState.get<CacheMap>(CACHE_KEY);
if (!value || !value[key]) {
return undefined;
}
const data = value[key];
if (!data.expiration) {
return data.value;
}
const now = (+ new Date()) / 1000;
return now > data.expiration ? undefined : data.value;
}

async handy<T>(key: string, cb: () => Thenable<{ value: T; ttl?: number }>) {
let d = this.get(key);
if (d === undefined) {
const tmp = await cb();
await this.set(key, tmp.value, tmp.ttl);
d = tmp.value;
}
return d as T;
}
}
1 change: 1 addition & 0 deletions extensions/gitpod-shared/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as vscode from 'vscode';
import { registerActiveLanguageAnalytics, registerUsageAnalytics } from './analytics';
import { createGitpodExtensionContext, GitpodExtensionContext, registerDefaultLayout, registerNotifications, registerWorkspaceCommands, registerWorkspaceSharing, registerWorkspaceTimeout } from './features';

export { registerReleaseNotesView } from './releaseNote';
export { GitpodExtensionContext, registerTasks, SupervisorConnection, registerIpcHookCli } from './features';
export * from './gitpod-plugin-model';

Expand Down
Loading

0 comments on commit ac98123

Please sign in to comment.