Skip to content

Commit

Permalink
Merge branch 'main' into move-to-drizzle
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheraff committed Apr 6, 2024
2 parents 9c2f4af + 07fed02 commit a617cd4
Show file tree
Hide file tree
Showing 8 changed files with 515 additions and 465 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
"@typescript-eslint/consistent-type-definitions": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-unused-vars": ["error", { "varsIgnorePattern": "^_" }],
"@typescript-eslint/restrict-template-expressions": "off", // good rule in theory, but doesn't work
"@typescript-eslint/restrict-plus-operands": "off", // good rule in theory, but doesn't work
"@typescript-eslint/use-unknown-in-catch-callback-variable": "off",
"no-empty": "off",
"react-refresh/only-export-components": ["error", { "allowConstantExport": true }],
"no-unused-labels": "off",
Expand Down
14 changes: 14 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,20 @@
"*.wasm": "${capture}.wasm.*",
"*.sql": "${capture}.sql.d.ts, ${capture}.sql.d.ts.map"
},
"workbench.editor.customLabels.patterns": {
".github/**/action.yml": "${dirname}/action.${extname}",
"**/src/index.*": "${dirname(1)}/src/index.${extname}",
"**/index.*": "${dirname}/index.${extname}",
"**/package.json": "${dirname}/package.json",
"**/tsconfig*.json": "${dirname}/${filename}.json",
"**/.eslintrc.*": "${dirname}/.eslintrc.${extname}",
"**/esbuild.ts": "${dirname}/esbuild.ts",
"**/turbo.json": "${dirname}/turbo.json",
"**/.gitignore": "${dirname}/.gitignore",
"**/.nvmrc": "${dirname}/.nvmrc",
"**/vitest.config.ts": "${dirname}/vitest.config.ts",
"**/vite.config.ts": "${dirname}/vite.config.ts"
},
"github-actions.workflows.pinned.refresh.enabled": true,
"cSpell.spellCheckOnlyWorkspaceFiles": true,
"files.associations": {
Expand Down
19 changes: 10 additions & 9 deletions client/src/components/Hero/Hero.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
animation-range-start: exit 0%;
animation-range-end: exit 80%;
animation-fill-mode: both;
animation-timing-function: ease-in;
animation-timing-function: ease-in-out;

&::before {
content: "";
Expand Down Expand Up @@ -138,17 +138,18 @@
--falloff: 5deg;
--light: 65%;
}
50% {
60% {
opacity: 0.2;
--angle: 35deg;
--falloff: 35deg;
--light: 80%;
--falloff: 25deg;
--light: 75%;
}

100% {
opacity: 0.1;
--angle: 5deg;
--falloff: 5deg;
--light: 65%;
--angle: 2deg;
--falloff: 2deg;
--light: 70%;
}
}

Expand Down Expand Up @@ -207,12 +208,12 @@
scale: 0.9;
filter: drop-shadow(0 0 5px rgb(0 0 0 / 0)) brightness(1);
}
70% {
60% {
scale: 1;
filter: drop-shadow(0 100px 10px rgb(0 0 0 / 0.8)) brightness(1.2);
}
100% {
scale: 1;
filter: drop-shadow(0 170px 15px rgb(0 0 0 / 0)) brightness(0.9);
filter: drop-shadow(0 170px 20px rgb(0 0 0 / 0)) brightness(0.9);
}
}
18 changes: 5 additions & 13 deletions client/src/db/useDbQuery.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { afterAll, beforeAll, describe, expect, test, vi } from "vitest"
import { afterAll, beforeAll, describe, expect, test, vi, beforeEach } from "vitest"
import { QueryClient, QueryObserver, type QueryCache } from "@tanstack/react-query"
import { UNIQUE_KEY, start, type DbQueryKey } from "client/db/useDbQuery"
import type { Ctx } from "client/db/DbProvider"
Expand Down Expand Up @@ -47,6 +47,10 @@ describe.sequential("'start' listening to QueryCache for live SQL queries", () =
stop()
})

beforeEach(() => {
events.length = 0
})

test("Mount 1st query", async () => {
const observer = new QueryObserver(client, {
queryKey: [
Expand All @@ -63,7 +67,6 @@ describe.sequential("'start' listening to QueryCache for live SQL queries", () =
expect(events).toMatchInlineSnapshot(`
[
"first > added",
"first > observerOptionsUpdated",
"first > observerResultsUpdated",
"first > observerAdded",
"first > observerResultsUpdated",
Expand All @@ -83,7 +86,6 @@ describe.sequential("'start' listening to QueryCache for live SQL queries", () =
"first > updated::success",
]
`)
events.length = 0
})

test("Mount 2nd query with a matching key (same DB, same SQL)", async () => {
Expand All @@ -102,7 +104,6 @@ describe.sequential("'start' listening to QueryCache for live SQL queries", () =
expect(events).toMatchInlineSnapshot(`
[
"second > added",
"second > observerOptionsUpdated",
"second > observerResultsUpdated",
"second > observerAdded",
"second > observerResultsUpdated",
Expand All @@ -119,7 +120,6 @@ describe.sequential("'start' listening to QueryCache for live SQL queries", () =
"second > updated::success",
]
`)
events.length = 0
})

test("Simulate a 'live query' triggering an update on a table used by those 2 queries", async () => {
Expand All @@ -141,7 +141,6 @@ describe.sequential("'start' listening to QueryCache for live SQL queries", () =
"second > updated::success",
]
`)
events.length = 0
})

test("Simulate a 'live query' triggering an update on a table used by only 1 query", async () => {
Expand All @@ -158,7 +157,6 @@ describe.sequential("'start' listening to QueryCache for live SQL queries", () =
"first > updated::success",
]
`)
events.length = 0
})

test("Unmount 2nd query", async () => {
Expand All @@ -171,7 +169,6 @@ describe.sequential("'start' listening to QueryCache for live SQL queries", () =
"second > observerRemoved",
]
`)
events.length = 0
})

test("Unmount 1st query", async () => {
Expand All @@ -184,7 +181,6 @@ describe.sequential("'start' listening to QueryCache for live SQL queries", () =
"first > observerRemoved",
]
`)
events.length = 0

await new Promise(nextTick)
expect(onRange).toHaveBeenCalledTimes(1)
Expand All @@ -206,7 +202,6 @@ describe.sequential("'start' listening to QueryCache for live SQL queries", () =
expect(events).toMatchInlineSnapshot(`
[
"third > added",
"third > observerOptionsUpdated",
"third > observerResultsUpdated",
"third > observerAdded",
"third > observerResultsUpdated",
Expand Down Expand Up @@ -234,7 +229,6 @@ describe.sequential("'start' listening to QueryCache for live SQL queries", () =
"third > observerRemoved",
]
`)
events.length = 0

expect(onRange).toHaveBeenCalledTimes(1)
})
Expand All @@ -252,7 +246,6 @@ describe.sequential("'start' listening to QueryCache for live SQL queries", () =
"third > updated::invalidate",
]
`)
events.length = 0

expect(onRange).toHaveBeenCalledTimes(1)
})
Expand All @@ -273,7 +266,6 @@ describe.sequential("'start' listening to QueryCache for live SQL queries", () =
expect(events).toMatchInlineSnapshot(`
[
"fourth > added",
"fourth > observerOptionsUpdated",
"fourth > observerResultsUpdated",
"fourth > observerAdded",
"fourth > observerResultsUpdated",
Expand Down
44 changes: 22 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,56 +37,56 @@
"dependencies": {
"@fastify/cookie": "^9.3.1",
"@fastify/session": "^10.7.0",
"@fastify/static": "7.0.1",
"@tanstack/react-query": "^5.25.0",
"@tanstack/react-query-devtools": "^5.25.0",
"@fastify/static": "7.0.3",
"@tanstack/react-query": "^5.29.0",
"@tanstack/react-query-devtools": "^5.29.0",
"@vlcn.io/crsqlite": "0.16.3",
"@vlcn.io/crsqlite-wasm": "0.16.0",
"@vlcn.io/rx-tbl": "0.15.0",
"@vlcn.io/ws-common": "0.2.0",
"better-sqlite3": "^9.4.3",
"better-sqlite3": "^9.4.5",
"clsx": "^2.1.0",
"dotenv": "^16.4.5",
"drizzle-orm": "^0.30.6",
"drizzle-orm-crsqlite-wasm": "file:../../drizzle-orm-crsqlite-wasm",
"fastify": "^4.26.2",
"grant": "^5.4.22",
"pino-pretty": "10.3.1",
"pino-pretty": "11.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"valibot": "0.30.0",
"web-push": "^3.6.7"
},
"devDependencies": {
"@fastify/http-proxy": "^9.4.0",
"@fastify/http-proxy": "^9.5.0",
"@total-typescript/ts-reset": "0.5.1",
"@types/better-sqlite3": "^7.6.9",
"@types/node": "20.11.25",
"@types/react": "18.2.64",
"@types/react-dom": "18.2.21",
"@types/node": "20.12.5",
"@types/react": "18.2.74",
"@types/react-dom": "18.2.24",
"@types/web-push": "^3.6.3",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"@typescript-eslint/eslint-plugin": "^7.5.0",
"@typescript-eslint/parser": "^7.5.0",
"@vitejs/plugin-react-swc": "3.6.0",
"@vitest/web-worker": "^1.3.1",
"@vitest/web-worker": "^1.4.0",
"chalk": "^5.3.0",
"chokidar": "3.6.0",
"cspell": "^8.6.0",
"cspell": "^8.6.1",
"drizzle-kit": "^0.20.14",
"esbuild": "0.20.1",
"esbuild": "0.20.2",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-react-refresh": "^0.4.5",
"json-schema-to-ts": "3.0.0",
"knip": "^5.0.3",
"eslint-plugin-react-refresh": "^0.4.6",
"json-schema-to-ts": "3.0.1",
"knip": "^5.8.0",
"prettier": "^3.2.5",
"rollup-plugin-visualizer": "5.12.0",
"tsx": "4.7.1",
"turbo": "1.12.5",
"tsx": "4.7.2",
"turbo": "1.13.2",
"typed-css-modules": "^0.9.1",
"typescript": "^5.4.2",
"vite": "5.1.5",
"vitest": "^1.3.1",
"typescript": "^5.4.4",
"vite": "5.2.8",
"vitest": "^1.4.0",
"vitest-github-actions-reporter": "^0.11.1"
},
"engines": {
Expand Down
Loading

0 comments on commit a617cd4

Please sign in to comment.