Skip to content

Commit 729682b

Browse files
committed
Add in product changelog
1 parent 8649946 commit 729682b

File tree

9 files changed

+442
-3
lines changed

9 files changed

+442
-3
lines changed

extensions/gitpod-shared/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"prepare": "node scripts/inflate.js"
1313
},
1414
"devDependencies": {
15+
"@types/js-yaml": "^4.0.5",
1516
"@types/node": "16.x",
1617
"@types/uuid": "^8.3.1",
1718
"@types/ws": "^7.2.6"
@@ -20,8 +21,9 @@
2021
"@gitpod/gitpod-protocol": "main",
2122
"@gitpod/supervisor-api-grpc": "main",
2223
"bufferutil": "^4.0.1",
23-
"utf-8-validate": "^5.0.2",
24+
"js-yaml": "^4.1.0",
2425
"reconnecting-websocket": "^4.4.0",
26+
"utf-8-validate": "^5.0.2",
2527
"uuid": "^8.3.1",
2628
"vscode-nls": "^5.0.0",
2729
"ws": "^7.4.6",

extensions/gitpod-shared/scripts/inflate.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const nls = {
1212
'openSettings': 'Gitpod: Open Settings',
1313
'openContext': 'Gitpod: Open Context',
1414
'openDocumentation': 'Gitpod: Documentation',
15+
'showReleaseNotes': 'Gitpod: Show Release Notes',
1516
'openDiscord': 'Gitpod: Open Community Chat',
1617
'openTwitter': 'Gitpod: Follow us on Twitter',
1718
'reportIssue': 'Gitpod: Report Issue',
@@ -72,6 +73,11 @@ const commands = [
7273
'title': '%reportIssue%',
7374
'enablement': 'gitpod.inWorkspace == true'
7475
},
76+
{
77+
'command': 'gitpod.showReleaseNotes',
78+
'title': '%showReleaseNotes%',
79+
'enablement': 'gitpod.inWorkspace == true'
80+
},
7581
{
7682
'command': 'gitpod.upgradeSubscription',
7783
'title': '%upgradeSubscription%',
@@ -160,6 +166,11 @@ const remoteMenus = [
160166
'group': 'remote_00_gitpod_navigation@90',
161167
'when': 'gitpod.inWorkspace == true'
162168
},
169+
{
170+
'command': 'gitpod.showReleaseNotes',
171+
'group': 'remote_00_gitpod_navigation@70',
172+
'when': 'gitpod.inWorkspace == true'
173+
},
163174
{
164175
'command': 'gitpod.upgradeSubscription',
165176
'group': 'remote_00_gitpod_navigation@100',
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Gitpod. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import * as vscode from 'vscode';
7+
8+
const CACHE_KEY = 'gitpod.cache';
9+
10+
interface CacheObject {
11+
value: any;
12+
expiration?: number;
13+
}
14+
15+
interface CacheMap { [key: string]: CacheObject }
16+
17+
export class CacheHelper {
18+
constructor(private readonly context: vscode.ExtensionContext) { }
19+
20+
set(key: string, value: any, expiration?: number) {
21+
let obj = this.context.globalState.get<CacheMap>(CACHE_KEY);
22+
if (!obj) {
23+
obj = {};
24+
}
25+
const exp = expiration ? (Date.now() / 1000 + expiration) : undefined;
26+
obj[key] = { value, expiration: exp };
27+
return this.context.globalState.update(CACHE_KEY, obj);
28+
}
29+
30+
get<T>(key: string): T | undefined {
31+
const value = this.context.globalState.get<CacheMap>(CACHE_KEY);
32+
if (!value || !value[key]) {
33+
return undefined;
34+
}
35+
const data = value[key];
36+
if (!data.expiration) {
37+
return data.value;
38+
}
39+
const now = Date.now() / 1000;
40+
return now > data.expiration ? undefined : data.value;
41+
}
42+
43+
async getOrRefresh<T>(key: string, refreshCallback: () => Thenable<{ value: T; ttl?: number }>): Promise<T> {
44+
let value = this.get<T>(key);
45+
if (value === undefined) {
46+
const result = await refreshCallback();
47+
await this.set(key, result.value, result.ttl);
48+
value = result.value;
49+
}
50+
return value;
51+
}
52+
}

extensions/gitpod-shared/src/extension.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as vscode from 'vscode';
66
import { registerActiveLanguageAnalytics, registerUsageAnalytics } from './analytics';
77
import { createGitpodExtensionContext, GitpodExtensionContext, registerDefaultLayout, registerNotifications, registerWorkspaceCommands, registerWorkspaceSharing, registerWorkspaceTimeout } from './features';
88

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

0 commit comments

Comments
 (0)