Skip to content

Commit 0a9711c

Browse files
author
John McCambridge
committed
Remove compareVersions call, simplify version checking
1 parent ed4190e commit 0a9711c

1 file changed

Lines changed: 5 additions & 14 deletions

File tree

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";
@@ -140,25 +140,16 @@ if (isCli) {
140140
}
141141
}
142142

143-
let newestVersion = "";
144-
if (process.env.VERSION) {
143+
if (isCli) {
145144
let currentVersion = process.env.VERSION;
146145
const recentRelease = await getRecentRelease();
147146

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

0 commit comments

Comments
 (0)