Skip to content

Commit

Permalink
🔧 chore: update dependencies and refactor queries
Browse files Browse the repository at this point in the history
Refactors Sanity queries into centralized location and updates multiple
dependencies including next-sanity, eslint-config-next, and Cypress
  • Loading branch information
w3bdesign committed Dec 6, 2024
2 parents 9361977 + a3b86a1 commit 9d578c8
Show file tree
Hide file tree
Showing 8 changed files with 287 additions and 330 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2.1
orbs:
cypress: cypress-io/[email protected]
codecov: codecov/[email protected]
node: circleci/node@6.3.0
node: circleci/node@7.0.0
executors:
with-chrome-and-firefox:
docker:
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@
"cookie": ">=1.0.2",
"jest": "^29.7.0",
"motion": "^11.13.1",
"next": "15.0.3",
"next-sanity": "^9.8.20",
"next": "15.0.4",
"next-sanity": "^9.8.24",
"path-to-regexp": "^8.2.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-error-boundary": "^4.1.2",
"react-hook-form": "^7.53.2",
"react-icons": "^5.4.0",
"react-use": "^17.5.1",
"sanity": "^3.65.1",
"sanity": "^3.66.0",
"sitemap": "^8.0.0",
"ts-node": "^10.9.2",
"zod": "^3.23.8"
Expand All @@ -48,20 +48,20 @@
"@ladle/react": "^4.1.2",
"@playwright/test": "^1.49.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.0.1",
"@testing-library/react": "^16.1.0",
"@testing-library/user-event": "^14.5.2",
"@types/node": "^22.10.1",
"@types/react": "^18.3.12",
"@types/react": "^18.3.13",
"@types/react-dom": "^18.3.1",
"axe-core": "^4.10.2",
"cypress": "13.16.0",
"cypress": "13.16.1",
"cypress-axe": "^1.5.0",
"eslint": "9.16.0",
"eslint-config-next": "15.0.3",
"eslint-config-next": "15.0.4",
"jest-environment-jsdom": "^29.7.0",
"jsdom-testing-mocks": "^1.13.1",
"postcss": "^8.4.49",
"prettier": "3.4.1",
"prettier": "3.4.2",
"tailwindcss": "^3.4.16",
"ts-jest": "^29.2.5",
"typescript": "^5.7.2",
Expand Down
532 changes: 250 additions & 282 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

15 changes: 1 addition & 14 deletions src/app/RootLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
import { groq } from "next-sanity";
import { client } from "@/lib/sanity/client";
import Header from "@/components/Layout/Header.component";
import ErrorBoundary from "@/components/ErrorBoundary/ErrorBoundary";

const navigationQuery = groq`
*[_type == "navigation"][0] {
title,
links[] {
title,
name,
hash,
href,
externalLink
}
}
`;
import { navigationQuery } from "@/lib/sanity/queries";

export default async function RootLayout({
children,
Expand Down
11 changes: 1 addition & 10 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { groq } from "next-sanity";
import dynamic from "next/dynamic";
import RootLayout from "@/app/RootLayout";
import { client } from "@/lib/sanity/client";
import { pageContentQuery } from "@/lib/sanity/queries";

const DynamicHero = dynamic(() => import("@/components/Index/Hero.component"), {
loading: () => <div>Loading hero...</div>,
Expand All @@ -15,15 +15,6 @@ const DynamicIndexContent = dynamic(
);

export default async function HomePage() {
const pageContentQuery = groq`
*[_type == 'page' && title match 'Hjem'][0]{
"id": _id,
title,
hero,
content
}
`;

const pageContent = await client.fetch(pageContentQuery);

return (
Expand Down
13 changes: 1 addition & 12 deletions src/app/prosjekter/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import PageHeader from "@/components/UI/PageHeader.component";
import ProsjektCard from "@/components/Prosjekter/ProsjektCard.component";

import { client } from "@/lib/sanity/client";
import { projectsQuery } from "@/lib/sanity/queries";

import type { Project } from "@/types/sanity.types";
import type { Metadata } from "next/types";
Expand All @@ -12,18 +13,6 @@ export const metadata: Metadata = {
description: "Daniel Fjeldstad | Frontend Web Utvikler | Portefølje",
};

const projectsQuery = `*[_type == "project"] | order(featured desc, featureOrder asc, _createdAt desc) {
id,
name,
description,
subdescription,
projectimage,
urlwww,
urlgithub,
featured,
featureOrder
}`;

export default async function Prosjekter() {
const posts: Project[] = await client.fetch(projectsQuery);

Expand Down
22 changes: 22 additions & 0 deletions src/lib/sanity/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,25 @@ export const cvQuery = groq`
}
}
`;

export const pageContentQuery = groq`
*[_type == 'page' && title match 'Hjem'][0]{
"id": _id,
title,
hero,
content
}
`;

export const navigationQuery = groq`
*[_type == "navigation"][0] {
title,
links[] {
title,
name,
hash,
href,
externalLink
}
}
`;
6 changes: 3 additions & 3 deletions studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-icons": "^5.4.0",
"sanity": "^3.65.1",
"sanity": "^3.66.0",
"styled-components": "^6.1.13"
},
"devDependencies": {
"@sanity/eslint-config-studio": "^4.0.0",
"@types/react": "^18.3.12",
"@types/react": "^18.3.13",
"eslint": "^9.16.0",
"prettier": "^3.4.1",
"prettier": "^3.4.2",
"typescript": "^5.7.2"
},
"prettier": {
Expand Down

0 comments on commit 9d578c8

Please sign in to comment.