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

Add decap #1652

Merged
merged 24 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ build

# OSX
.DS_Store

# IDE
.idea

Expand All @@ -27,6 +28,7 @@ build
.next
.loos
out
certificates

# Storybook build
storybook-static
Expand All @@ -41,7 +43,13 @@ cypress/downloads
tsconfig.tsbuildinfo

# Prisma

generated

# DecapCMS
out/

# Content Collections
.content-collections

# Next TLS --experimental-https
certificates
4 changes: 4 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ module.exports = {
alias: {
...config.resolve.alias,
src: path.resolve(__dirname, '../src'),
// 'contentlayer/generated': path.resolve(
// __dirname,
// '../.contentlayer/generated',
// ),
},
fallback: {
...(config.resolve || {}).fallback,
Expand Down
29 changes: 29 additions & 0 deletions content-collections.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { defineCollection, defineConfig } from '@content-collections/core';
import { compileMarkdown } from '@content-collections/markdown';

const posts = defineCollection({
name: 'posts',
directory: 'content/posts',
include: '**/*.md',
schema: (z) => ({
title: z.string(),
date: z.string(),
author: z.string(),
profileSocialUrl: z.string().optional(),
profilePictureUrl: z.string().optional(),
}),
transform: async (document, context) => {
// @ts-expect-error -- TODO: fix this
const html = await compileMarkdown(context, document);
return {
...document,
slug: document._meta.fileName.split('.')[0],
url: `/posts/${document._meta.fileName.split('.')[0]}`,
html,
};
},
});

export default defineConfig({
collections: [posts],
});
11 changes: 10 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
**/
const moduleExports = {
reactStrictMode: true,
images: {
remotePatterns: [
{ hostname: 'avatars.githubusercontent.com' },
{ hostname: 'rca-media2.rca.ac.uk' },
],
},
transpilePackages: [
'@react-leaflet/core',
'react-leaflet',
Expand Down Expand Up @@ -51,5 +57,8 @@ const moduleExports = {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { withPlausibleProxy } = require('next-plausible');

// eslint-disable-next-line @typescript-eslint/no-var-requires
const { withContentCollections } = require('@content-collections/next');

// eslint-disable-next-line functional/immutable-data
module.exports = withPlausibleProxy()(moduleExports);
module.exports = withContentCollections(withPlausibleProxy()(moduleExports));
26 changes: 15 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"leaflet.markercluster": "^1.5.3",
"lodash": "^4.17.21",
"monaco-editor": "^0.52.0",
"next": "^14.2.13",
"next": "^14.2.15",
"next-plausible": "^3.12.2",
"ngeohash": "^0.6.3",
"prop-types": "^15.8.1",
Expand All @@ -98,14 +98,18 @@
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-typescript": "^7.24.7",
"@content-collections/core": "^0.7.2",
"@content-collections/markdown": "^0.1.2",
"@content-collections/mdx": "^0.1.6",
"@content-collections/next": "^0.2.3",
"@emotion/babel-preset-css-prop": "^11.12.0",
"@faker-js/faker": "^7.6.0",
"@graphql-codegen/cli": "^5.0.2",
"@graphql-codegen/cli": "^5.0.3",
"@graphql-codegen/import-types-preset": "^3.0.0",
"@graphql-codegen/typescript": "^4.0.9",
"@graphql-codegen/typescript-operations": "^4.2.3",
"@graphql-codegen/typescript": "^4.1.0",
"@graphql-codegen/typescript-operations": "^4.3.0",
"@graphql-codegen/typescript-react-apollo": "^4.3.2",
"@graphql-codegen/typescript-resolvers": "^4.2.1",
"@graphql-codegen/typescript-resolvers": "^4.3.0",
"@graphql-eslint/eslint-plugin": "^3.20.1",
"@jest/globals": "^29.7.0",
"@mapbox/geojson-area": "^0.2.2",
Expand All @@ -127,12 +131,12 @@
"@types/jest": "^29.5.13",
"@types/leaflet": "^1.9.12",
"@types/leaflet.markercluster": "^1.5.4",
"@types/lodash": "^4.17.9",
"@types/lodash": "^4.17.10",
"@types/mapbox": "^1.6.45",
"@types/mapbox__geojson-area": "^0.2.6",
"@types/ngeohash": "^0.6.4",
"@types/ngeohash": "^0.6.8",
"@types/node": "20.14.8",
"@types/react": "^18.3.8",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.0",
"@types/styled-system": "^5.1.22",
"@typescript-eslint/eslint-plugin": "^5.59.1",
Expand Down Expand Up @@ -164,20 +168,20 @@
"postcss-loader": "^7.3.3",
"prettier": "^3.3.3",
"prisma": "^5.19.1",
"protomaps-leaflet": "3.1.2",
"protomaps-leaflet": "4.0.1",
"require-from-string": "^2.0.2",
"start-server-and-test": "^2.0.8",
"storybook": "7.6.17",
"storybook-addon-apollo-client": "^5.0.0",
"style-loader": "^3.3.4",
"supabase": "^1.192.5",
"supabase": "^1.203.0",
"topojson-server": "^3.0.1",
"topojson-simplify": "^3.0.3",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "^5.6.2",
"wait-on": "^7.2.0",
"webpack": "^5.94.0"
"webpack": "^5.95.0"
},
"packageManager": "pnpm@8.6.3",
"pnpm": {
Expand Down
Loading
Loading