Skip to content

Commit ef03d89

Browse files
committed
fix: images and frontmatter in mdx and scss upgrade
1 parent 98244e8 commit ef03d89

29 files changed

+329
-84
lines changed

.github/workflows/test.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Deploy to Test (https://code-star.github.io/codestar-website-next/)
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
15+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
16+
concurrency:
17+
group: "pages"
18+
cancel-in-progress: false
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
24+
strategy:
25+
matrix:
26+
node-version: [20.x]
27+
28+
steps:
29+
- name: Checkout 🛎️
30+
uses: actions/checkout@v3
31+
- name: Use Node.js ${{ matrix.node-version }}
32+
uses: actions/setup-node@v3
33+
with:
34+
node-version: ${{ matrix.node-version }}
35+
- name: Install and Build components 🔧
36+
# .nojekyll: do not ignore _ dirs
37+
run: |
38+
touch .env
39+
echo TWITTER_ACCESS_TOKEN=${{ secrets.TWITTER_ACCESS_TOKEN }} >> .env
40+
echo TWITTER_USER_NAME=${{ secrets.TWITTER_USER_NAME }} >> .env
41+
echo YOUTUBE_API_KEY=${{ secrets.YOUTUBE_API_KEY }} >> .env
42+
echo YOUTUBE_PLAYLIST_ID=${{ secrets.YOUTUBE_PLAYLIST_ID }} >> .env
43+
echo MASTODON_ACCESS_TOKEN=${{ secrets.MASTODON_ACCESS_TOKEN }} >> .env
44+
echo MASTODON_ID=${{ secrets.MASTODON_ID }} >> .env
45+
npm ci
46+
echo "{ \"basePath\": \"/codestar-website-next\" }" > config.json
47+
npx next build && npx next export
48+
touch out/.nojekyll
49+
# CI: false # true -> fails on warning
50+
- name: Setup Pages
51+
uses: actions/configure-pages@v5
52+
- name: Upload artifact
53+
uses: actions/upload-pages-artifact@v3
54+
with:
55+
path: "out"
56+
- name: Deploy to GitHub Pages 🚀
57+
id: deployment
58+
uses: actions/deploy-pages@v4

mdx-components.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
import type { MDXComponents } from "mdx/types";
2+
import Image, { ImageProps } from 'next/image'
23

34
export function useMDXComponents(components: MDXComponents): MDXComponents {
45
return {
6+
img: (props: ImageProps) => (
7+
// eslint-disable-next-line jsx-a11y/alt-text
8+
<Image
9+
sizes="100vw"
10+
style={{ width: '100%', height: 'auto' }}
11+
{...props}
12+
/>
13+
),
514
...components,
615
};
716
}

mdx.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export interface ArticleMetadata {
2+
title?: string;
3+
author?: string;
4+
publishedAt?: string;
5+
}
6+
7+
declare module "*.mdx" {
8+
let MDXComponent: (props) => JSX.Element;
9+
export default MDXComponent;
10+
11+
export const metadata: ArticleMetadata;
12+
}

next.config.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
import type { NextConfig } from "next";
22
import createMDX from "@next/mdx";
3+
import remarkFrontmatter from "remark-frontmatter";
4+
import remarkMdxFrontmatter from "remark-mdx-frontmatter";
35

46
const nextConfig: NextConfig = {
57
pageExtensions: ["js", "jsx", "md", "mdx", "ts", "tsx"],
68
reactStrictMode: true,
9+
experimental: {
10+
mdxRs: false,
11+
},
712
};
813

914
const withMDX = createMDX({
10-
// Add markdown plugins here, as desired
15+
extension: /\.mdx?$/,
16+
options: {
17+
// turbopack does not yet support these plugins, see https://nextjs.org/docs/app/building-your-application/configuring/mdx#using-plugins-with-turbopack
18+
remarkPlugins: [
19+
remarkFrontmatter,
20+
[remarkMdxFrontmatter, { name: "metadata" }],
21+
],
22+
},
1123
});
1224

1325
export default withMDX(nextConfig);

package-lock.json

Lines changed: 124 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"version": "1.0.0",
44
"private": true,
55
"scripts": {
6-
"dev": "next dev --turbopack",
6+
"devTurbo": "next dev --turbopack",
7+
"dev": "next dev",
78
"build": "next build",
89
"start": "next start",
910
"lint": "next lint"
@@ -16,7 +17,9 @@
1617
"html-to-text": "^9.0.5",
1718
"next": "15.1.7",
1819
"react": "^19.0.0",
19-
"react-dom": "^19.0.0"
20+
"react-dom": "^19.0.0",
21+
"remark-frontmatter": "^5.0.0",
22+
"remark-mdx-frontmatter": "^5.0.0"
2023
},
2124
"devDependencies": {
2225
"@eslint/eslintrc": "^3",

public/articles/mfe/hyperlinks-and-monolith.svg

Lines changed: 1 addition & 0 deletions
Loading

public/articles/mfe/module-federation.svg

Lines changed: 1 addition & 0 deletions
Loading

public/articles/mfe/page.svg

Lines changed: 1 addition & 0 deletions
Loading

public/articles/mfe/web-components.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)