Skip to content

chore: update dependencies #141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -241,29 +241,29 @@
"@types/vscode": "^1.73.0",
"@types/which": "^2.0.1",
"@types/ws": "^8.5.3",
"@typescript-eslint/eslint-plugin": "^5.47.1",
"@typescript-eslint/parser": "^4.14.1",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"@vscode/test-electron": "^1.6.2",
"@vscode/vsce": "^2.16.0",
"@vscode/vsce": "^2.21.1",
"bufferutil": "^4.0.7",
"coder": "https://github.com/coder/coder#main",
"dayjs": "^1.11.7",
"eslint": "^7.19.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.24.2",
"eslint": "^8.50.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-md": "^1.0.19",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-prettier": "^5.0.0",
"glob": "^7.1.6",
"nyc": "^15.1.0",
"prettier": "^2.2.1",
"ts-loader": "^8.0.14",
"tsc-watch": "^4.5.0",
"typescript": "^4.1.3",
"prettier": "^3.0.3",
"ts-loader": "^9.4.4",
"tsc-watch": "^6.0.4",
"typescript": "^5.2.2",
"utf-8-validate": "^5.0.10",
"vitest": "^0.28.3",
"vitest": "^0.34.6",
"vscode-test": "^1.5.0",
"webpack": "^5.19.0",
"webpack-cli": "^5.0.1"
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"@types/node-forge": "^1.3.4",
Expand All @@ -278,12 +278,17 @@
"ndjson": "^2.0.0",
"node-forge": "^1.3.1",
"pretty-bytes": "^6.0.0",
"semver": "^7.3.8",
"semver": "^7.5.4",
"tar-fs": "^2.1.1",
"ua-parser-js": "^1.0.35",
"which": "^2.0.2",
"ws": "^8.11.0",
"yaml": "^1.10.0",
"zod": "^3.21.4"
"zod": "^3.22.3"
},
"resolutions": {
"semver": "7.5.4",
"trim": "0.0.3",
"word-wrap": "1.2.5"
}
}
5 changes: 4 additions & 1 deletion src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import { Storage } from "./storage"
import { OpenableTreeItem } from "./workspacesProvider"

export class Commands {
public constructor(private readonly vscodeProposed: typeof vscode, private readonly storage: Storage) {}
public constructor(
private readonly vscodeProposed: typeof vscode,
private readonly storage: Storage,
) {}

public async login(...args: string[]): Promise<void> {
let url: string | undefined = args.length >= 1 ? args[0] : undefined
Expand Down
9 changes: 6 additions & 3 deletions src/error.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axios from "axios"
import { isAxiosError } from "axios"
import * as forge from "node-forge"
import * as tls from "tls"
import * as vscode from "vscode"
Expand Down Expand Up @@ -34,14 +34,17 @@ export class CertificateError extends Error {
public static InsecureMessage =
'The Coder extension will no longer verify TLS on HTTPS requests. You can change this at any time with the "coder.insecure" property in your VS Code settings.'

private constructor(message: string, public readonly x509Err?: X509_ERR) {
private constructor(
message: string,
public readonly x509Err?: X509_ERR,
) {
super("Secure connection to your Coder deployment failed: " + message)
}

// maybeWrap returns a CertificateError if the code is a certificate error
// otherwise it returns the original error.
static async maybeWrap<T>(err: T, address: string, logger: Logger): Promise<CertificateError | T> {
if (axios.isAxiosError(err)) {
if (isAxiosError(err)) {
switch (err.code) {
case X509_ERR_CODE.UNABLE_TO_VERIFY_LEAF_SIGNATURE:
// "Unable to verify" can mean different things so we will attempt to
Expand Down
35 changes: 19 additions & 16 deletions src/remote.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axios from "axios"
import { isAxiosError } from "axios"
import {
getBuildInfo,
getTemplate,
Expand Down Expand Up @@ -80,7 +80,7 @@ export class Remote {
try {
this.storage.workspace = await getWorkspaceByOwnerAndName(parts[0], parts[1])
} catch (error) {
if (!axios.isAxiosError(error)) {
if (!isAxiosError(error)) {
throw error
}
switch (error.response?.status) {
Expand Down Expand Up @@ -461,7 +461,7 @@ export class Remote {
const deploymentConfig = await getDeploymentSSHConfig()
deploymentSSHConfig = deploymentConfig.ssh_config_options
} catch (error) {
if (!axios.isAxiosError(error)) {
if (!isAxiosError(error)) {
throw error
}
switch (error.response?.status) {
Expand All @@ -483,21 +483,24 @@ export class Remote {
// Now override with the user's config.
const userConfigSSH = vscode.workspace.getConfiguration("coder").get<string[]>("sshConfig") || []
// Parse the user's config into a Record<string, string>.
const userConfig = userConfigSSH.reduce((acc, line) => {
let i = line.indexOf("=")
if (i === -1) {
i = line.indexOf(" ")
const userConfig = userConfigSSH.reduce(
(acc, line) => {
let i = line.indexOf("=")
if (i === -1) {
// This line is malformed. The setting is incorrect, and does not match
// the pattern regex in the settings schema.
return acc
i = line.indexOf(" ")
if (i === -1) {
// This line is malformed. The setting is incorrect, and does not match
// the pattern regex in the settings schema.
return acc
}
}
}
const key = line.slice(0, i)
const value = line.slice(i + 1)
acc[key] = value
return acc
}, {} as Record<string, string>)
const key = line.slice(0, i)
const value = line.slice(i + 1)
acc[key] = value
return acc
},
{} as Record<string, string>,
)
const sshConfigOverrides = mergeSSHConfigValues(deploymentSSHConfig, userConfig)

let sshConfigFile = vscode.workspace.getConfiguration().get<string>("remote.SSH.configFile")
Expand Down
6 changes: 3 additions & 3 deletions src/workspaceAction.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axios from "axios"
import { isAxiosError } from "axios"
import { getWorkspaces } from "coder/site/src/api/api"
import { Workspace, WorkspacesResponse, WorkspaceBuild } from "coder/site/src/api/typesGenerated"
import { formatDistanceToNowStrict } from "date-fns"
Expand Down Expand Up @@ -48,7 +48,7 @@ export class WorkspaceAction {
ownedWorkspacesResponse = await getWorkspaces({ q: "owner:me" })
} catch (error) {
let status
if (axios.isAxiosError(error)) {
if (isAxiosError(error)) {
status = error.response?.status
}
if (status !== 401) {
Expand Down Expand Up @@ -116,7 +116,7 @@ export class WorkspaceAction {
errorCount++

let status
if (axios.isAxiosError(error)) {
if (isAxiosError(error)) {
status = error.response?.status
}
if (status !== 401) {
Expand Down
5 changes: 4 additions & 1 deletion src/workspacesProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ export class WorkspaceProvider implements vscode.TreeDataProvider<vscode.TreeIte
private workspaces: WorkspaceTreeItem[] = []
private agentWatchers: Record<WorkspaceAgent["id"], { dispose: () => void; metadata?: AgentMetadataEvent[] }> = {}

constructor(private readonly getWorkspacesQuery: WorkspaceQuery, private readonly storage: Storage) {
constructor(
private readonly getWorkspacesQuery: WorkspaceQuery,
private readonly storage: Storage,
) {
this.fetchAndRefresh()
}

Expand Down
Loading