Output commit along with the version
This commit is contained in:
parent
ce637d318d
commit
599670136d
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "code-server",
|
"name": "code-server",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"version": "3.0.1",
|
"version": "3.0.2",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "ci/clean.sh",
|
"clean": "ci/clean.sh",
|
||||||
"vscode": "ci/vscode.sh",
|
"vscode": "ci/vscode.sh",
|
||||||
|
@ -14,24 +14,27 @@ import { SshProvider } from "./ssh/server"
|
|||||||
import { generateCertificate, generatePassword, generateSshHostKey, hash, open } from "./util"
|
import { generateCertificate, generatePassword, generateSshHostKey, hash, open } from "./util"
|
||||||
import { ipcMain, wrap } from "./wrapper"
|
import { ipcMain, wrap } from "./wrapper"
|
||||||
|
|
||||||
const main = async (args: Args): Promise<void> => {
|
let pkg: { version?: string; commit?: string } = {}
|
||||||
const auth = args.auth || AuthType.Password
|
|
||||||
const originalPassword = auth === AuthType.Password && (process.env.PASSWORD || (await generatePassword()))
|
|
||||||
|
|
||||||
let commit: string | undefined
|
|
||||||
try {
|
try {
|
||||||
commit = require("../../package.json").commit
|
pkg = require("../../package.json")
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.warn(error.message)
|
logger.warn(error.message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const version = pkg.version || "development"
|
||||||
|
const commit = pkg.commit || "development"
|
||||||
|
|
||||||
|
const main = async (args: Args): Promise<void> => {
|
||||||
|
const auth = args.auth || AuthType.Password
|
||||||
|
const originalPassword = auth === AuthType.Password && (process.env.PASSWORD || (await generatePassword()))
|
||||||
|
|
||||||
// Spawn the main HTTP server.
|
// Spawn the main HTTP server.
|
||||||
const options = {
|
const options = {
|
||||||
auth,
|
auth,
|
||||||
cert: args.cert ? args.cert.value : undefined,
|
cert: args.cert ? args.cert.value : undefined,
|
||||||
certKey: args["cert-key"],
|
certKey: args["cert-key"],
|
||||||
sshHostKey: args["ssh-host-key"],
|
sshHostKey: args["ssh-host-key"],
|
||||||
commit: commit || "development",
|
commit,
|
||||||
host: args.host || (args.auth === AuthType.Password && typeof args.cert !== "undefined" ? "0.0.0.0" : "localhost"),
|
host: args.host || (args.auth === AuthType.Password && typeof args.cert !== "undefined" ? "0.0.0.0" : "localhost"),
|
||||||
password: originalPassword ? hash(originalPassword) : undefined,
|
password: originalPassword ? hash(originalPassword) : undefined,
|
||||||
port: typeof args.port !== "undefined" ? args.port : process.env.PORT ? parseInt(process.env.PORT, 10) : 8080,
|
port: typeof args.port !== "undefined" ? args.port : process.env.PORT ? parseInt(process.env.PORT, 10) : 8080,
|
||||||
@ -68,7 +71,7 @@ const main = async (args: Args): Promise<void> => {
|
|||||||
|
|
||||||
ipcMain().onDispose(() => httpServer.dispose())
|
ipcMain().onDispose(() => httpServer.dispose())
|
||||||
|
|
||||||
logger.info(`code-server ${require("../../package.json").version}`)
|
logger.info(`code-server ${version} ${commit}`)
|
||||||
|
|
||||||
let sshPort = ""
|
let sshPort = ""
|
||||||
if (!args["disable-ssh"] && options.sshHostKey) {
|
if (!args["disable-ssh"] && options.sshHostKey) {
|
||||||
@ -132,7 +135,7 @@ const tryParse = (): Args => {
|
|||||||
|
|
||||||
const args = tryParse()
|
const args = tryParse()
|
||||||
if (args.help) {
|
if (args.help) {
|
||||||
console.log("code-server", require("../../package.json").version)
|
console.log("code-server", version, commit)
|
||||||
console.log("")
|
console.log("")
|
||||||
console.log(`Usage: code-server [options] [path]`)
|
console.log(`Usage: code-server [options] [path]`)
|
||||||
console.log("")
|
console.log("")
|
||||||
@ -141,14 +144,14 @@ if (args.help) {
|
|||||||
console.log("", description)
|
console.log("", description)
|
||||||
})
|
})
|
||||||
} else if (args.version) {
|
} else if (args.version) {
|
||||||
const version = require("../../package.json").version
|
|
||||||
if (args.json) {
|
if (args.json) {
|
||||||
console.log({
|
console.log({
|
||||||
codeServer: version,
|
codeServer: version,
|
||||||
|
commit,
|
||||||
vscode: require("../../lib/vscode/package.json").version,
|
vscode: require("../../lib/vscode/package.json").version,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
console.log(version)
|
console.log(version, commit)
|
||||||
}
|
}
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
} else if (args["list-extensions"] || args["install-extension"] || args["uninstall-extension"]) {
|
} else if (args["list-extensions"] || args["install-extension"] || args["uninstall-extension"]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user