Skip to content

Commit a9b5a0f

Browse files
authored
Add in product changelog (#7)
1 parent b9743c9 commit a9b5a0f

File tree

5 files changed

+415
-0
lines changed

5 files changed

+415
-0
lines changed

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"onCommand:gitpod.syncProvider.remove",
3737
"onCommand:gitpod.exportLogs",
3838
"onCommand:gitpod.api.autoTunnel",
39+
"onCommand:gitpod.showReleaseNotes",
3940
"onAuthenticationRequest:gitpod",
4041
"onUri"
4142
],
@@ -92,6 +93,11 @@
9293
"command": "gitpod.exportLogs",
9394
"category": "Gitpod",
9495
"title": "Export all logs"
96+
},
97+
{
98+
"command": "gitpod.showReleaseNotes",
99+
"category": "Gitpod",
100+
"title": "Show Release Notes"
95101
}
96102
]
97103
},
@@ -109,6 +115,7 @@
109115
"@types/analytics-node": "^3.1.9",
110116
"@types/crypto-js": "4.1.1",
111117
"@types/google-protobuf": "^3.7.4",
118+
"@types/js-yaml": "^4.0.5",
112119
"@types/node": "16.x",
113120
"@types/node-fetch": "^2.5.12",
114121
"@types/semver": "^7.3.10",
@@ -135,6 +142,7 @@
135142
"@gitpod/local-app-api-grpcweb": "main",
136143
"@improbable-eng/grpc-web-node-http-transport": "^0.14.0",
137144
"analytics-node": "^6.0.0",
145+
"js-yaml": "^4.1.0",
138146
"node-fetch": "2.6.7",
139147
"pkce-challenge": "^3.0.0",
140148
"semver": "^7.3.7",

src/common/cache.ts

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 ? ((+ new Date()) / 1000 + expiration) : undefined;
26+
obj[key] = { value, expiration: exp };
27+
return this.context.globalState.update(CACHE_KEY, obj);
28+
}
29+
30+
get(key: string) {
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 = (+ new Date()) / 1000;
40+
return now > data.expiration ? undefined : data.value;
41+
}
42+
43+
async handy<T>(key: string, cb: () => Thenable<{ value: T; ttl?: number }>) {
44+
let d = this.get(key);
45+
if (d === undefined) {
46+
const tmp = await cb();
47+
await this.set(key, tmp.value, tmp.ttl);
48+
d = tmp.value;
49+
}
50+
return d as T;
51+
}
52+
}

src/extension.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { enableSettingsSync, updateSyncContext } from './settingsSync';
1212
import { GitpodServer } from './gitpodServer';
1313
import TelemetryReporter from './telemetryReporter';
1414
import { exportLogs } from './exportLogs';
15+
import { registerReleaseNotesView } from './releaseNotes';
1516

1617
const EXTENSION_ID = 'gitpod.gitpod-desktop';
1718
const FIRST_INSTALL_KEY = 'gitpod-desktop.firstInstall';
@@ -89,6 +90,8 @@ export async function activate(context: vscode.ExtensionContext) {
8990
await context.globalState.update(FIRST_INSTALL_KEY, true);
9091
telemetry.sendTelemetryEvent('gitpod_desktop_installation', { kind: 'install' });
9192
}
93+
94+
registerReleaseNotesView(context);
9295
}
9396

9497
export async function deactivate() {

0 commit comments

Comments
 (0)