mirror of https://git.tuxpa.in/a/code-server.git
Fixes for CI
This commit is contained in:
parent
55a7e8b56f
commit
0aa98279d6
|
@ -48,7 +48,7 @@ export interface Args extends VsArgs {
|
||||||
readonly "reuse-window"?: boolean
|
readonly "reuse-window"?: boolean
|
||||||
readonly "new-window"?: boolean
|
readonly "new-window"?: boolean
|
||||||
|
|
||||||
readonly "expose"?: OptionalString
|
readonly expose?: OptionalString
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Option<T> {
|
interface Option<T> {
|
||||||
|
@ -131,8 +131,9 @@ const options: Options<Required<Args>> = {
|
||||||
force: { type: "boolean", description: "Avoid prompts when installing VS Code extensions." },
|
force: { type: "boolean", description: "Avoid prompts when installing VS Code extensions." },
|
||||||
"install-extension": {
|
"install-extension": {
|
||||||
type: "string[]",
|
type: "string[]",
|
||||||
description: "Install or update a VS Code extension by id or vsix. The identifier of an extension is `${publisher}.${name}`.\n" +
|
description:
|
||||||
"To install a specific version provide `@${version}`. For example: 'vscode.csharp@1.2.3'.",
|
"Install or update a VS Code extension by id or vsix. The identifier of an extension is `${publisher}.${name}`.\n" +
|
||||||
|
"To install a specific version provide `@${version}`. For example: 'vscode.csharp@1.2.3'.",
|
||||||
},
|
},
|
||||||
"enable-proposed-api": {
|
"enable-proposed-api": {
|
||||||
type: "string[]",
|
type: "string[]",
|
||||||
|
@ -158,13 +159,13 @@ const options: Options<Required<Args>> = {
|
||||||
log: { type: LogLevel },
|
log: { type: LogLevel },
|
||||||
verbose: { type: "boolean", short: "vvv", description: "Enable verbose logging." },
|
verbose: { type: "boolean", short: "vvv", description: "Enable verbose logging." },
|
||||||
|
|
||||||
"expose": {
|
expose: {
|
||||||
type: OptionalString,
|
type: OptionalString,
|
||||||
description: `
|
description: `
|
||||||
Securely expose code-server via Coder Cloud with the passed name. You'll get a URL like
|
Securely expose code-server via Coder Cloud with the passed name. You'll get a URL like
|
||||||
https://myname.coder-cloud.com at which you can easily access your code-server instance.
|
https://myname.coder-cloud.com at which you can easily access your code-server instance.
|
||||||
Authorization is done via GitHub. Only the first code-server spawned with the current
|
Authorization is done via GitHub. Only the first code-server spawned with the current
|
||||||
configuration will be accessible.`
|
configuration will be accessible.`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,18 +178,23 @@ export const optionDescriptions = (): string[] => {
|
||||||
}),
|
}),
|
||||||
{ short: 0, long: 0 },
|
{ short: 0, long: 0 },
|
||||||
)
|
)
|
||||||
return entries.map(
|
return entries.map(([k, v]) => {
|
||||||
([k, v]) => {
|
const help = `${" ".repeat(widths.short - (v.short ? v.short.length : 0))}${v.short ? `-${v.short}` : " "} --${k} `
|
||||||
let help = `${" ".repeat(widths.short - (v.short ? v.short.length : 0))}${v.short ? `-${v.short}` : " "} --${k} `
|
return (
|
||||||
return help + v.description?.trim().split(/\n/).map((line, i) => {
|
help +
|
||||||
line = line.trim()
|
v.description
|
||||||
if (i == 0) {
|
?.trim()
|
||||||
return " ".repeat(widths.long - k.length) + line
|
.split(/\n/)
|
||||||
}
|
.map((line, i) => {
|
||||||
return " ".repeat(widths.long + widths.short + 6) + line
|
line = line.trim()
|
||||||
}).join("\n")
|
if (i === 0) {
|
||||||
},
|
return " ".repeat(widths.long - k.length) + line
|
||||||
)
|
}
|
||||||
|
return " ".repeat(widths.long + widths.short + 6) + line
|
||||||
|
})
|
||||||
|
.join("\n")
|
||||||
|
)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const parse = (
|
export const parse = (
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { spawn } from "child_process"
|
|
||||||
import path from "path"
|
|
||||||
import { logger } from "@coder/logger"
|
import { logger } from "@coder/logger"
|
||||||
import split2 from "split2"
|
import { spawn } from "child_process"
|
||||||
import delay from "delay"
|
import delay from "delay"
|
||||||
import fs from "fs"
|
import fs from "fs"
|
||||||
|
import path from "path"
|
||||||
|
import split2 from "split2"
|
||||||
import { promisify } from "util"
|
import { promisify } from "util"
|
||||||
import xdgBasedir from "xdg-basedir"
|
import xdgBasedir from "xdg-basedir"
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ export async function coderCloudExpose(serverName: string): Promise<void> {
|
||||||
stdio: ["inherit", "inherit", "pipe"],
|
stdio: ["inherit", "inherit", "pipe"],
|
||||||
})
|
})
|
||||||
|
|
||||||
agent.stderr.pipe(split2()).on("data", line => {
|
agent.stderr.pipe(split2()).on("data", (line) => {
|
||||||
line = line.replace(/^[0-9-]+ [0-9:]+ [^ ]+\t/, "")
|
line = line.replace(/^[0-9-]+ [0-9:]+ [^ ]+\t/, "")
|
||||||
logger.info(line)
|
logger.info(line)
|
||||||
})
|
})
|
||||||
|
@ -22,7 +22,7 @@ export async function coderCloudExpose(serverName: string): Promise<void> {
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
agent.on("error", rej)
|
agent.on("error", rej)
|
||||||
|
|
||||||
agent.on("close", code => {
|
agent.on("close", (code) => {
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
rej({
|
rej({
|
||||||
message: `coder cloud agent exited with ${code}`,
|
message: `coder cloud agent exited with ${code}`,
|
||||||
|
@ -54,7 +54,7 @@ export function coderCloudProxy(addr: string) {
|
||||||
stdio: ["inherit", "inherit", "pipe"],
|
stdio: ["inherit", "inherit", "pipe"],
|
||||||
})
|
})
|
||||||
|
|
||||||
agent.stderr.pipe(split2()).on("data", line => {
|
agent.stderr.pipe(split2()).on("data", (line) => {
|
||||||
line = line.replace(/^[0-9-]+ [0-9:]+ [^ ]+\t/, "")
|
line = line.replace(/^[0-9-]+ [0-9:]+ [^ ]+\t/, "")
|
||||||
logger.info(line)
|
logger.info(line)
|
||||||
})
|
})
|
||||||
|
@ -62,7 +62,7 @@ export function coderCloudProxy(addr: string) {
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
agent.on("error", rej)
|
agent.on("error", rej)
|
||||||
|
|
||||||
agent.on("close", code => {
|
agent.on("close", (code) => {
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
rej({
|
rej({
|
||||||
message: `coder cloud agent exited with ${code}`,
|
message: `coder cloud agent exited with ${code}`,
|
||||||
|
@ -77,7 +77,7 @@ export function coderCloudProxy(addr: string) {
|
||||||
const proxy = async () => {
|
const proxy = async () => {
|
||||||
try {
|
try {
|
||||||
await _proxy()
|
await _proxy()
|
||||||
} catch(err) {
|
} catch (err) {
|
||||||
logger.error(err.message)
|
logger.error(err.message)
|
||||||
}
|
}
|
||||||
setTimeout(proxy, 3000)
|
setTimeout(proxy, 3000)
|
||||||
|
|
Loading…
Reference in New Issue