chore: bump prettier from 2.8.1 to 3.0.0 in /site (#8477)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Cian Johnston <cian@coder.com>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
This commit is contained in:
dependabot[bot]
2023-07-13 14:44:12 +03:00
committed by GitHub
co-authored by Cian Johnston Muhammad Atif Ali
parent 3727e02bbf
commit 24ec05b5c5
13 changed files with 97 additions and 85 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<!--
▄█▀ ▀█▄
+13 -10
View File
@@ -23,16 +23,19 @@ jest.mock("contexts/useProxyLatency", () => ({
if (!proxies) {
return {} as Record<string, ProxyLatencyReport>
}
return proxies.reduce((acc, proxy) => {
acc[proxy.id] = {
accurate: true,
// Return a constant latency of 8ms.
// If you make this random it could break stories.
latencyMS: 8,
at: new Date(),
}
return acc
}, {} as Record<string, ProxyLatencyReport>)
return proxies.reduce(
(acc, proxy) => {
acc[proxy.id] = {
accurate: true,
// Return a constant latency of 8ms.
// If you make this random it could break stories.
latencyMS: 8,
at: new Date(),
}
return acc
},
{} as Record<string, ProxyLatencyReport>,
)
}, [proxies])
return { proxyLatencies, refetch: jest.fn() }
+1 -1
View File
@@ -149,7 +149,7 @@
"jest-websocket-mock": "2.4.0",
"jest_workaround": "0.1.14",
"msw": "1.2.2",
"prettier": "2.8.1",
"prettier": "3.0.0",
"resize-observer": "1.0.4",
"storybook": "7.0.26",
"storybook-addon-react-router-v6": "1.0.2",
+2 -2
View File
@@ -481,8 +481,8 @@ export function waitForBuild(build: TypesGen.WorkspaceBuild) {
let latestJobInfo: TypesGen.ProvisionerJob | undefined = undefined
while (
!["succeeded", "canceled"].some((status) =>
latestJobInfo?.status.includes(status),
!["succeeded", "canceled"].some(
(status) => latestJobInfo?.status.includes(status),
)
) {
const { job } = await getWorkspaceBuildByNumber(
+1 -1
View File
@@ -31,4 +31,4 @@ export const getDefaultFilterProps = <TFilterProps>({
values,
},
menus,
} as TFilterProps)
}) as TFilterProps
+7 -4
View File
@@ -262,10 +262,13 @@ const selectByLatency = (
return undefined
}
const proxyMap = proxies.reduce((acc, proxy) => {
acc[proxy.id] = proxy
return acc
}, {} as Record<string, Region>)
const proxyMap = proxies.reduce(
(acc, proxy) => {
acc[proxy.id] = proxy
return acc
},
{} as Record<string, Region>,
)
const best = Object.keys(latencies)
.map((proxyId) => {
+37 -34
View File
@@ -87,43 +87,46 @@ export const useProxyLatency = (
// proxyMap is a map of the proxy path_app_url to the proxy object.
// This is for the observer to know which requests are important to
// record.
const proxyChecks = proxies.reduce((acc, proxy) => {
// Only run the latency check on healthy proxies.
if (!proxy.healthy) {
return acc
}
// Do not run latency checks if a cached check exists below the latestFetchRequest Date.
// This prevents fetching latencies too often.
// 1. Fetch the latest stored latency for the given proxy.
// 2. If the latest latency is after the latestFetchRequest, then skip the latency check.
if (storedLatencies && storedLatencies[proxy.id]) {
const fetchRequestDate = new Date(latestFetchRequest)
const latest = storedLatencies[proxy.id].reduce((prev, next) =>
prev.at > next.at ? prev : next,
)
if (latest && latest.at > fetchRequestDate) {
// dispatch the cached latency. This latency already went through the
// guard logic below, so we can just dispatch it again directly.
dispatchProxyLatencies({
proxyID: proxy.id,
cached: true,
report: latest,
})
const proxyChecks = proxies.reduce(
(acc, proxy) => {
// Only run the latency check on healthy proxies.
if (!proxy.healthy) {
return acc
}
}
// Add a random query param to the url to make sure we don't get a cached response.
// This is important in case there is some caching layer between us and the proxy.
const url = new URL(
`/latency-check?cache_bust=${generateRandomString(6)}`,
proxy.path_app_url,
)
acc[url.toString()] = proxy
return acc
}, {} as Record<string, Region>)
// Do not run latency checks if a cached check exists below the latestFetchRequest Date.
// This prevents fetching latencies too often.
// 1. Fetch the latest stored latency for the given proxy.
// 2. If the latest latency is after the latestFetchRequest, then skip the latency check.
if (storedLatencies && storedLatencies[proxy.id]) {
const fetchRequestDate = new Date(latestFetchRequest)
const latest = storedLatencies[proxy.id].reduce((prev, next) =>
prev.at > next.at ? prev : next,
)
if (latest && latest.at > fetchRequestDate) {
// dispatch the cached latency. This latency already went through the
// guard logic below, so we can just dispatch it again directly.
dispatchProxyLatencies({
proxyID: proxy.id,
cached: true,
report: latest,
})
return acc
}
}
// Add a random query param to the url to make sure we don't get a cached response.
// This is important in case there is some caching layer between us and the proxy.
const url = new URL(
`/latency-check?cache_bust=${generateRandomString(6)}`,
proxy.path_app_url,
)
acc[url.toString()] = proxy
return acc
},
{} as Record<string, Region>,
)
// dispatchProxyLatenciesGuarded will assign the latency to the proxy
// via the reducer. But it will only do so if the performance entry is
@@ -20,7 +20,7 @@ const templatePermissions = (templateId: string) =>
},
action: "update",
},
} as const)
}) as const
const fetchTemplateSettings = async (orgId: string, name: string) => {
const template = await getTemplateByName(orgId, name)
+27 -24
View File
@@ -149,31 +149,34 @@ export const MockWorkspaceProxies: TypesGen.WorkspaceProxy[] = [
]
export const MockProxyLatencies: Record<string, ProxyLatencyReport> = {
...MockWorkspaceProxies.reduce((acc, proxy) => {
if (!proxy.healthy) {
...MockWorkspaceProxies.reduce(
(acc, proxy) => {
if (!proxy.healthy) {
return acc
}
acc[proxy.id] = {
// Make one of them inaccurate.
accurate: proxy.id !== "26e84c16-db24-4636-a62d-aa1a4232b858",
// This is a deterministic way to generate a latency to for each proxy.
// It will be the same for each run as long as the IDs don't change.
latencyMS:
(Number(
Array.from(proxy.id).reduce(
// Multiply each char code by some large prime number to increase the
// size of the number and allow use to get some decimal points.
(acc, char) => acc + char.charCodeAt(0) * 37,
0,
),
) /
// Cap at 250ms
100) %
250,
at: new Date(),
}
return acc
}
acc[proxy.id] = {
// Make one of them inaccurate.
accurate: proxy.id !== "26e84c16-db24-4636-a62d-aa1a4232b858",
// This is a deterministic way to generate a latency to for each proxy.
// It will be the same for each run as long as the IDs don't change.
latencyMS:
(Number(
Array.from(proxy.id).reduce(
// Multiply each char code by some large prime number to increase the
// size of the number and allow use to get some decimal points.
(acc, char) => acc + char.charCodeAt(0) * 37,
0,
),
) /
// Cap at 250ms
100) %
250,
at: new Date(),
}
return acc
}, {} as Record<string, ProxyLatencyReport>),
},
{} as Record<string, ProxyLatencyReport>,
),
}
export const MockBuildInfo: TypesGen.BuildInfoResponse = {
@@ -138,7 +138,7 @@ const permissionsToCheck = (
},
action: "read",
},
} as const)
}) as const
export const workspaceMachine = createMachine(
{
@@ -39,7 +39,7 @@ const permissionsToCheck = (workspace: TypesGen.Workspace) =>
},
action: "update",
},
} as const)
}) as const
export type WorkspaceScheduleEvent =
| {
+1 -1
View File
@@ -1,7 +1,7 @@
{{/* This template is used by application handlers to render friendly error
pages when there is a proxy error (for example, when the target app isn't
running). */}}
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
+4 -4
View File
@@ -9435,10 +9435,10 @@ prelude-ls@^1.2.1:
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==
prettier@2.8.1:
version "2.8.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.1.tgz#4e1fd11c34e2421bc1da9aea9bd8127cd0a35efc"
integrity sha512-lqGoSJBQNJidqCHE80vqZJHWHRFoNYsSpP9AjFhlhi9ODCJA541svILes/+/1GM3VaL/abZi7cpFzOpdR9UPKg==
prettier@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.0.tgz#e7b19f691245a21d618c68bc54dc06122f6105ae"
integrity sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==
prettier@^2.8.0, prettier@^2.8.7:
version "2.8.8"