Skip to content

Commit

Permalink
Upgraded next-sanity to version 5. (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
wrux authored Jun 23, 2023
1 parent 7b98f65 commit 7a4e022
Show file tree
Hide file tree
Showing 74 changed files with 1,959 additions and 9,275 deletions.
8 changes: 7 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{
"extends": "next/core-web-vitals"
"extends": "next",
"plugins": ["simple-import-sort"],
"rules": {
"simple-import-sort/imports": "warn",
"simple-import-sort/exports": "warn",
"react-hooks/exhaustive-deps": "error"
}
}
13 changes: 6 additions & 7 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
version: 2
updates:

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: "weekly"
interval: 'weekly'

# Maintain dependencies for npm
- package-ecosystem: "npm"
directory: "/"
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: "weekly"
interval: 'weekly'
4 changes: 2 additions & 2 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: ESLint

on:
push:
branches: [ "main" ]
branches: ['main']
pull_request:
branches: [ "main" ]
branches: ['main']
schedule:
- cron: '18 2 * * 0'

Expand Down
10 changes: 10 additions & 0 deletions app/(cms)/studio/[[...index]]/Studio.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use client';

import { NextStudio } from 'next-sanity/studio';

import config from '../../../../sanity.config';

export function Studio() {
// Supports the same props as `import {Studio} from 'sanity'`, `config` is required
return <NextStudio config={config} />;
}
File renamed without changes.
8 changes: 8 additions & 0 deletions app/(cms)/studio/[[...index]]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Studio } from './Studio';

// Set the right `viewport`, `robots` and `referer` meta tags
export { metadata } from 'next-sanity/studio/metadata';

export default function StudioPage() {
return <Studio />;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { client, getDocumentSlugs } from 'lib/sanityClient';
import { groq } from 'next-sanity';
import { ListPosts, Section } from 'components';
import countryCodeEmoji from 'country-code-emoji';
import { imageFragment } from 'lib/fragments';
import { FadeIn } from 'components/animations';
import { groq } from 'next-sanity';

import { ListPosts, Section } from '~/components';
import { FadeIn } from '~/components/animations';
import { imageFragment } from '~/lib/fragments';
import { client, getDocumentSlugs } from '~/sanity/lib/client';

export const revalidate = 300;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import Link from 'next/link';
import { groq } from 'next-sanity';
import { client } from 'lib/sanityClient';
import { Section } from 'components';
import { FadeIn } from 'components/animations';

import { Section } from '~/components';
import { FadeIn } from '~/components/animations';
import { client } from '~/sanity/lib/client';

export const revalidate = 300;

Expand Down
14 changes: 14 additions & 0 deletions app/(content)/(pages)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { SiteHeader } from '~/components';

export default function ContentLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<>
<SiteHeader />
{children}
</>
);
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { groq } from 'next-sanity';
import { BlogPosting } from 'schema-dts';
import { JsonLd } from 'react-schemaorg';
import { BlogPosting } from 'schema-dts';

import {
CountryList,
CoverImage,
Date,
PortableText,
Section,
} from 'components';
import { imageFragment } from 'lib/fragments';
import { client, getDocumentSlugs } from 'lib/sanityClient';
} from '~/components';
import { imageFragment } from '~/lib/fragments';
import { client, getDocumentSlugs } from '~/sanity/lib/client';

export const revalidate = 300;

Expand Down
14 changes: 14 additions & 0 deletions app/(content)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { SiteFooter } from '~/components';

export default function ContentLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<>
{children}
<SiteFooter />
</>
);
}
12 changes: 6 additions & 6 deletions app/page.tsx → app/(content)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { groq } from 'next-sanity';
import { client } from 'lib/sanityClient';
import { Intro, ListPosts } from 'components';
import BaseLayout from './countries/layout';
import { imageFragment } from 'lib/fragments';

import { Intro, ListPosts } from '~/components';
import { imageFragment } from '~/lib/fragments';
import { client } from '~/sanity/lib/client';

export const revalidate = 300;

Expand All @@ -12,10 +12,10 @@ export default async function Homepage() {
const posts = await client.fetch<Array<Article>>(postQuery);

return (
<BaseLayout hideSiteHeader>
<>
<Intro />
<ListPosts posts={posts} />
</BaseLayout>
</>
);
}

Expand Down
28 changes: 0 additions & 28 deletions app/countries/[slug]/head.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions app/countries/layout.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions app/head.tsx

This file was deleted.

13 changes: 10 additions & 3 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import '~/styles/main.css';

import { Inter } from 'next/font/google';
import Script from 'next/script';
import '@fontsource/inter/variable.css';
import 'styles/main.css';

const sans = Inter({
variable: '--font-sans',
subsets: ['latin'],
weight: ['400', '500', '700', '800'],
});

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<html lang="en-GB" className={`${sans.variable}`} suppressHydrationWarning>
<body>{children}</body>
<Script
src="/stats/js/script.js"
Expand Down
29 changes: 0 additions & 29 deletions app/post/[slug]/head.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions app/post/[slug]/layout.tsx

This file was deleted.

8 changes: 0 additions & 8 deletions app/studio/[[...index]]/page.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion next.config.js → next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ const nextConfig = {
},
};

module.exports = nextConfig;
export default nextConfig;
Loading

1 comment on commit 7a4e022

@vercel
Copy link

@vercel vercel bot commented on 7a4e022 Jun 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.