Skip to content

Commit d4d52eb

Browse files
author
John McCambridge
committed
Remove compareVersions call, simplify version checking
1 parent 9ca7ddf commit d4d52eb

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

packages/server/src/cli.ts

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as os from "os";
88
import * as path from "path";
99
import * as WebSocket from "ws";
1010
import { buildDir, cacheHome, dataHome, isCli, serveStatic } from "./constants";
11-
import { getRecentRelease, compareVersions } from "./updater";
11+
import { getRecentRelease } from "./updater";
1212
import { setup as setupNativeModules } from "./modules";
1313
import { createApp } from "./server";
1414
import { forkModule, requireFork, requireModule } from "./vscode/bootstrapFork";
@@ -144,25 +144,16 @@ const bold = (text: string | number): string | number => {
144144
}
145145
}
146146

147-
let newestVersion = "";
148-
if (process.env.VERSION) {
147+
if (isCli) {
149148
let currentVersion = process.env.VERSION;
150149
const recentRelease = await getRecentRelease();
151150

152-
if (compareVersions(currentVersion, recentRelease)! <= 1) {
153-
newestVersion = recentRelease;
154-
} else {
155-
newestVersion = currentVersion;
151+
if (recentRelease !== currentVersion) {
152+
logger.warn(`New version (\u001B[1m${recentRelease}\u001B[0m) available https://github.com/codercom/code-server/releases/latest`);
156153
}
157154
}
158-
const isDev = process.env.NODE_ENV !== "production";
159-
if (newestVersion === process.env.VERSION || isDev) {
160-
logger.info("You are using the latest version");
161-
} else {
162-
logger.warn(`New version (\u001B[1m${newestVersion}) available https://github.com/codercom/code-server/releases`);
163-
}
164-
logger.info(`\u001B[1mcode-server ${process.env.VERSION ? `v${process.env.VERSION}` : "development"}`);
165155
// TODO: fill in appropriate doc url
156+
logger.info(`\u001B[1mcode-server ${process.env.VERSION ? `v${process.env.VERSION}` : "development"}`);
166157
logger.info("Additional documentation: http://github.com/codercom/code-server");
167158
logger.info("Initializing", field("data-dir", dataDir), field("working-dir", workingDir), field("log-dir", logDir));
168159
const sharedProcess = new SharedProcess(dataDir, builtInExtensionsDir);

0 commit comments

Comments
 (0)