Skip to content

Commit

Permalink
Update package (#69)
Browse files Browse the repository at this point in the history
* chore(packages): update to latest non-breaking versions

* chore(packages): update to latest non-breaking versions

* chore(packages): update to latest breaking versions

* typecheck(web): remoe unnecessary `ts-expect-error` comment

* test(web/snapshot): restore puppeteer
  • Loading branch information
GervinFung authored Sep 29, 2024
1 parent 623ba3f commit e1b8a3d
Show file tree
Hide file tree
Showing 9 changed files with 1,191 additions and 1,436 deletions.
6 changes: 2 additions & 4 deletions apps/web/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ import tseslint from 'typescript-eslint';
const allowedFor = ['SyntaxHighlighter', 'Image'];

export default tseslint.config(
// @ts-expect-error: type mismatch between eslint and eslint-compat
includeIgnoreFile(`${process.cwd()}/.gitignore`),
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.strict,
...tseslint.configs.stylistic,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
node,
{
...next,
Expand Down
44 changes: 22 additions & 22 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,58 +14,58 @@
},
"dependencies": {
"@chakra-ui/react": "^2.8.2",
"@emotion/react": "^11.13.0",
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@poolofdeath20/util": "^0.8.0",
"@supabase/supabase-js": "^2.45.0",
"@poolofdeath20/util": "^0.8.2",
"@supabase/supabase-js": "^2.45.4",
"@tanstack/react-query": "^4.36.1",
"@trpc/client": "^10.45.2",
"@trpc/next": "^10.45.2",
"@trpc/react-query": "^10.45.2",
"@trpc/server": "^10.45.2",
"axios": "^1.7.2",
"axios": "^1.7.7",
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"file-saver": "^2.0.5",
"fuse.js": "^7.0.0",
"hex-rgb": "^5.0.0",
"iwanthue": "^2.0.0",
"jszip": "^3.10.1",
"next": "^14.2.5",
"next-seo": "^6.5.0",
"next": "^14.2.13",
"next-seo": "^6.6.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-icons": "^5.2.1",
"react-select": "^5.8.0",
"react-icons": "^5.3.0",
"react-select": "^5.8.1",
"react-syntax-highlighter": "^15.5.0",
"react-toastify": "^10.0.5",
"superjson": "^2.2.1",
"valibot": "^0.37.0"
"valibot": "^0.42.1"
},
"devDependencies": {
"@ducanh2912/next-pwa": "^10.2.8",
"@poolofdeath20/eslint-config": "^0.4.0",
"@ducanh2912/next-pwa": "^10.2.9",
"@poolofdeath20/eslint-config": "^0.4.1",
"@poolofdeath20/tsconfig": "^0.1.1",
"@types/cors": "^2.8.17",
"@types/file-saver": "^2.0.7",
"@types/jest-image-snapshot": "^6.4.0",
"@types/react": "^18.3.3",
"@types/react": "^18.3.10",
"@types/react-dom": "^18.3.0",
"@types/react-syntax-highlighter": "^15.5.13",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@typescript-eslint/eslint-plugin": "^8.7.0",
"@typescript-eslint/parser": "^8.7.0",
"ci-info": "^4.0.0",
"eslint": "^9.9.1",
"eslint": "^9.11.1",
"gen-env-type-def": "^0.0.4",
"jest-image-snapshot": "^6.4.0",
"knip": "^5.27.0",
"knip": "^5.30.6",
"next-sitemap": "^4.2.3",
"prettier": "^3.3.3",
"puppeteer": "^22.14.0",
"sql-formatter": "15.3.2",
"supabase": "^1.187.10",
"typescript": "^5.5.4",
"vite-node": "^2.0.4",
"vitest": "^2.0.4"
"puppeteer": "^22.15.0",
"sql-formatter": "15.4.2",
"supabase": "^1.200.3",
"typescript": "^5.6.2",
"vite-node": "^2.1.1",
"vitest": "^2.1.1"
}
}
24 changes: 1 addition & 23 deletions apps/web/pages/templates/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,29 +62,7 @@ const useCopyToClipboard = (timeout?: number) => {
return {
copied,
copy: (text: string) => {
if (navigator?.clipboard.writeText) {
void navigator.clipboard.writeText(text);
} else {
const element = document.createElement('textarea');

element.value = text;

element.setAttribute('readonly', '');

element.style.position = 'absolute';

element.style.left = '-9999px';

document.body.appendChild(element);

element.select();

document.execCommand('copy');

document.body.removeChild(element);
}

setCopied(true);
void navigator.clipboard.writeText(text);
},
};
};
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/api/database/persistence/template-batch/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Persistence } from '..';

import { Defined, Optional, isFalse } from '@poolofdeath20/util';
import { Defined, Optional } from '@poolofdeath20/util';

import { isMoreThanOrEqualOneWeek, isTimeEqual } from '../../../logic/util';
import DatabaseOperation from '../util';
Expand Down Expand Up @@ -122,7 +122,7 @@ class TemplateBatchPersistence {
readonly findLatestCommittedTime = async () => {
return this.shouldUpdate().then((result) => {
return result.flatMap(async (shouldUpdate) => {
if (isFalse(shouldUpdate)) {
if (!shouldUpdate) {
return this.findLatestTimeCommitted();
}

Expand Down
4 changes: 1 addition & 3 deletions apps/web/src/api/database/persistence/template/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import type { Persistence } from '..';
import type { DeepReadonly } from '@poolofdeath20/util';

import { isFalse } from '@poolofdeath20/util';

import DatabaseOperation from '../util';

type Templates = DeepReadonly<
Expand Down Expand Up @@ -118,7 +116,7 @@ class TemplatePersistence {
.shouldUpdate()
.then((result) => {
return result.flatMap(async (shouldUpdate) => {
if (isFalse(shouldUpdate)) {
if (!shouldUpdate) {
return this.findMany();
}

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/api/routes/internal/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const result = <T>(operation: () => Promise<AsyncResult<T>>) => {
console.error(result.reason());
}

return result.toJson();
return await result.toJson();
} catch (error) {
return {
hadSucceed: false,
Expand Down
16 changes: 11 additions & 5 deletions apps/web/src/api/scrapper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,16 @@ class Scrapper {
};

readonly latestTimeCommitted = async () => {
return axios
.get('https://api.github.com/repos/github/gitignore/branches/main')
.then(singleFlowParser(schemas.latestTimeCommitted))
.then(AsyncOperation.succeed)
.catch(AsyncOperation.failed);
return (
axios
.get(
'https://api.github.com/repos/github/gitignore/branches/main'
)
.then(singleFlowParser(schemas.latestTimeCommitted))
.then(AsyncOperation.succeed)
// eslint-disable-next-line @typescript-eslint/use-unknown-in-catch-callback-variable
.catch(AsyncOperation.failed)
);
};

readonly templates = async () => {
Expand Down Expand Up @@ -102,6 +107,7 @@ class Scrapper {
);
})
.then(AsyncOperation.succeed)
// eslint-disable-next-line @typescript-eslint/use-unknown-in-catch-callback-variable
.catch(AsyncOperation.failed);

return result.map((list) => {
Expand Down
16 changes: 6 additions & 10 deletions apps/web/src/web/components/docs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const docs = {

const Item = (
props: DeepReadonly<{
mb?: false;
title: string;
items: Array<string>;
match: {
Expand All @@ -39,7 +38,7 @@ const Item = (
}>
) => {
return (
<Box mb={props.mb ? 0 : 8}>
<Box mb={8}>
<Text as="b" color="GrayText">
{props.title}
</Text>
Expand Down Expand Up @@ -86,19 +85,16 @@ const Item = (

const Documentation = (
props: PropsWithChildren &
DeepReadonly<
| undefined
| {
title: string;
}
>
DeepReadonly<{
title: string;
}>
) => {
const router = useRouter();

const [_, __, title, item] = router.asPath.split('/');

return (
<Layout title={!props ? 'Docs' : `Docs - ${props.title}`}>
<Layout title={`Docs - ${props.title}`}>
<Container display="grid" maxWidth="100%" placeItems="center">
<Box
boxSizing="border-box"
Expand Down Expand Up @@ -130,7 +126,7 @@ const Documentation = (
/>
</Box>
<Divider orientation="vertical" />
<Box textAlign="justify">{props?.children}</Box>
<Box textAlign="justify">{props.children}</Box>
</Box>
</Container>
</Layout>
Expand Down
Loading

0 comments on commit e1b8a3d

Please sign in to comment.