Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove contentlayer #68

Merged
merged 21 commits into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7eb25cc
feat: enable partial prerendering
jahirfiquitiva Jan 11, 2024
f6a11e7
chore: attempt disabling revalidate
jahirfiquitiva Jan 11, 2024
fe3a4d0
chore: revert last commit
jahirfiquitiva Jan 11, 2024
6f583ed
chore: add back previously used property
jahirfiquitiva Jan 11, 2024
a074428
chore: update dependencies
jahirfiquitiva Jan 11, 2024
1a1426a
chore: update dependencies
jahirfiquitiva Jan 12, 2024
8d003a6
chore: update dependencies
jahirfiquitiva Jan 14, 2024
3c66a53
feat: enable avif and webp for images
jahirfiquitiva Jan 14, 2024
ec330b7
feat: initial progress on removing contentlayer again
jahirfiquitiva Jan 14, 2024
8f2df97
feat: improve images component by generating placeholder blurDataURL …
jahirfiquitiva Jan 14, 2024
2fc58f9
fix: issue with uses hero image
jahirfiquitiva Jan 14, 2024
1f1fcb8
fix: accessing blog posts from sitemap and feed
jahirfiquitiva Jan 14, 2024
86467c4
fix: imports and build issues
jahirfiquitiva Jan 14, 2024
609513c
chore: remove contentlayer related config
jahirfiquitiva Jan 14, 2024
a587ba5
fix: incorrect type
jahirfiquitiva Jan 14, 2024
3ab799c
chore: remove unused code and fix incorrect dimensions for images
jahirfiquitiva Jan 14, 2024
4951c20
chore: disable lightning css
jahirfiquitiva Jan 14, 2024
11de0dd
feat: disable ppr
jahirfiquitiva Jan 14, 2024
138b5e1
feat: implement force static
jahirfiquitiva Jan 14, 2024
8fdb462
Revert "feat: implement force static"
jahirfiquitiva Jan 14, 2024
b538f8e
feat: add more json-ld structured data
jahirfiquitiva Jan 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .yarn/install-state.gz
Binary file not shown.
65 changes: 0 additions & 65 deletions config/contentlayer/blogs.ts

This file was deleted.

104 changes: 0 additions & 104 deletions config/contentlayer/rehype/image-metadata.ts

This file was deleted.

6 changes: 2 additions & 4 deletions config/contentlayer/mdx.ts → config/mdx/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MDXOptions } from 'contentlayer/core';
import type { SerializeOptions } from 'next-mdx-remote/dist/types';
import { rehypeAccessibleEmojis } from 'rehype-accessible-emojis';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
import rehypeSlug from 'rehype-slug';
Expand All @@ -7,13 +7,11 @@ import remarkSqueezeParagraphs from 'remark-squeeze-paragraphs';
import remarkUnwrapImages from 'remark-unwrap-images';

import { prettyCode } from './rehype/code';
import imageMetadata from './rehype/image-metadata';
import { toc } from './rehype/toc';

const mdx: MDXOptions = {
const mdx: SerializeOptions['mdxOptions'] = {
remarkPlugins: [remarkGfm, remarkSqueezeParagraphs, remarkUnwrapImages],
rehypePlugins: [
imageMetadata,
rehypeSlug,
rehypeAccessibleEmojis,
// @ts-expect-error idk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ const commentsCustomColor = (theme: 'light' | 'dark') => ({

const getThemeJson = (theme: 'light' | 'dark'): JSON | string => {
try {
const json = readFileSync(
`./config/contentlayer/themes/${theme}.json`,
'utf-8',
);
const json = readFileSync(`./config/mdx/themes/${theme}.json`, 'utf-8');
const parsed = JSON.parse(json);
return {
...parsed,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion config/next/headers.js → config/next/headers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const securityHeaders = [
},
];

module.exports = [
const headers = [
{
source: '/(.*)',
headers: securityHeaders,
Expand All @@ -59,3 +59,5 @@ module.exports = [
],
},
];

export default headers;
4 changes: 3 additions & 1 deletion config/next/redirects.js → config/next/redirects.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const buildRedirect = (source, destination, permanent = false) => {
};
};

module.exports = [
const redirects = [
/* Blog posts redirections */
buildRedirect(
'/blog/md-iconography-guidelines',
Expand Down Expand Up @@ -51,3 +51,5 @@ module.exports = [
'https://umami.jahir.dev/share/uEOUfeOMI5kda1wn/jahir.dev',
),
];

export default redirects;
13 changes: 0 additions & 13 deletions contentlayer.config.ts

This file was deleted.

23 changes: 11 additions & 12 deletions next.config.js → next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/* eslint-disable @typescript-eslint/no-var-requires */
// NOTE
// Do not change this file to .mjs
// https://github.com/contentlayerdev/contentlayer/issues/313#issuecomment-1305424923
const path = require('path');
import path from 'path';
import { fileURLToPath } from 'url';

const million = require('million/compiler');
const { withContentlayer } = require('next-contentlayer');
import withPlaiceholder from '@plaiceholder/next';
import million from 'million/compiler';

const appHeaders = require('./config/next/headers');
const redirects = require('./config/next/redirects');
import appHeaders from './config/next/headers.mjs';
import redirects from './config/next/redirects.mjs';

const __dirname = path.dirname(fileURLToPath(import.meta.url));

/**
* @type {import('next').NextConfig}
Expand Down Expand Up @@ -49,6 +49,7 @@ const defaultNextConfig = {
],
dangerouslyAllowSVG: true,
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
formats: ['image/avif', 'image/webp'],
},
headers: () => appHeaders,
redirects: () => redirects,
Expand All @@ -59,7 +60,5 @@ const millionConfig = {
auto: { rsc: true },
};

module.exports = million.next(
withContentlayer(defaultNextConfig),
millionConfig,
);
const config = million.next(withPlaiceholder(defaultNextConfig), millionConfig);
export default config;
24 changes: 10 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,38 @@
"start": "next start",
"lint": "next lint",
"setup": "node ./scripts/setup.mjs",
"clean": "rimraf .next && rimraf dist && rimraf out && rimraf .contentlayer",
"clean": "rimraf .next && rimraf dist && rimraf out",
"update-deps": "npx --yes npm-check-updates -u && yarn",
"download-themes": "node ./scripts/download-themes.mjs",
"prune-code": "ts-prune -i '.next|.contentlayer|src/app'",
"prune-code": "ts-prune -i '.next|src/app'",
"postinstall": "is-ci || husky install"
},
"dependencies": {
"canvas-confetti": "^1.9.2",
"medium-zoom": "^1.1.0",
"next": "^14.0.4",
"next": "^14.0.5-canary.56",
"next-themes": "0.2.1",
"react": "^18.2.0",
"react-compare-image": "^3.4.0",
"react-dom": "^18.2.0",
"server-only": "^0.0.1",
"swr": "^2.2.4"
},
"devDependencies": {
"@commitlint/cli": "^18.4.4",
"@commitlint/config-conventional": "^18.4.4",
"@jsdevtools/rehype-toc": "^3.0.2",
"@plaiceholder/next": "^3.0.0",
"@planetscale/database": "^1.13.0",
"@types/canvas-confetti": "^1.6.4",
"@types/node": "^20.10.8",
"@types/node": "^20.11.0",
"@types/react": "^18.2.47",
"@types/react-dom": "^18.2.18",
"@types/xml": "^1.0.11",
"@typescript-eslint/eslint-plugin": "^6.18.1",
"@typescript-eslint/parser": "^6.18.1",
"autoprefixer": "^10.4.16",
"colord": "^2.9.3",
"contentlayer": "^0.3.4",
"cssnano": "^6.0.3",
"dotenv": "^16.3.1",
"eslint": "^8.56.0",
Expand All @@ -48,10 +49,10 @@
"kysely": "^0.27.2",
"kysely-planetscale": "^1.4.0",
"million": "^2.6.4",
"next-contentlayer": "^0.3.4",
"next-mdx-remote": "^4.4.1",
"plaiceholder": "^3.0.0",
"postcss": "^8.4.33",
"prettier": "^3.1.1",
"prettier": "^3.2.1",
"react-twc": "^1.2.2",
"reading-time": "^1.5.0",
"rehype-accessible-emojis": "^0.3.2",
Expand All @@ -64,7 +65,7 @@
"rimraf": "^5.0.5",
"sass": "^1.69.7",
"sharp": "^0.32.6",
"shikiji": "^0.9.18",
"shikiji": "^0.9.19",
"tailwind-merge": "^2.2.0",
"tailwindcss": "^3.4.1",
"tailwindcss-hocus": "^0.0.7",
Expand All @@ -79,10 +80,5 @@
"trailingComma": "all",
"semi": true
},
"packageManager": "[email protected]",
"overrides": {
"next-contentlayer": {
"next": "$next"
}
}
"packageManager": "[email protected]"
}
4 changes: 1 addition & 3 deletions scripts/download-themes.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ const darkThemeUrl =
'https://raw.githubusercontent.com/fabian-hiller/vscode-pace-theme/main/themes/dark.json';

const downloadThemeFile = async (light) => {
const filePath = `./config/contentlayer/themes/${
light ? 'light' : 'dark'
}.json`;
const filePath = `./config/mdx/themes/${light ? 'light' : 'dark'}.json`;
try {
if (existsSync(filePath)) return;
const response = await fetch(light ? lightThemeUrl : darkThemeUrl);
Expand Down
Loading