Skip to content

Commit b45e51c

Browse files
authored
Merge pull request #17 from code-star/feature/upgrade_next
Feature/upgrade next
2 parents 8aa7d75 + 4756464 commit b45e51c

File tree

64 files changed

+10422
-4415
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+10422
-4415
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

.gitignore

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
# dependencies
44
/node_modules
55
/.pnp
6-
.pnp.js
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
712

813
# testing
914
/coverage
@@ -25,8 +30,8 @@ yarn-debug.log*
2530
yarn-error.log*
2631
.pnpm-debug.log*
2732

28-
# local env files
29-
.env*.local
33+
# env files (can opt-in for committing if needed)
34+
.env*
3035

3136
# vercel
3237
.vercel

eslint.config.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { dirname } from "path";
2+
import { fileURLToPath } from "url";
3+
import { FlatCompat } from "@eslint/eslintrc";
4+
5+
const __filename = fileURLToPath(import.meta.url);
6+
const __dirname = dirname(__filename);
7+
8+
const compat = new FlatCompat({
9+
baseDirectory: __dirname,
10+
});
11+
12+
const eslintConfig = [
13+
...compat.extends("next/core-web-vitals", "next/typescript"),
14+
];
15+
16+
export default eslintConfig;

mdx-components.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type { MDXComponents } from "mdx/types";
2+
import Image, { ImageProps } from 'next/image'
3+
4+
export function useMDXComponents(components: MDXComponents): MDXComponents {
5+
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+
),
14+
...components,
15+
};
16+
}

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: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import type { NextConfig } from "next";
2+
import createMDX from "@next/mdx";
3+
import remarkFrontmatter from "remark-frontmatter";
4+
import remarkMdxFrontmatter from "remark-mdx-frontmatter";
5+
6+
const nextConfig: NextConfig = {
7+
pageExtensions: ["js", "jsx", "md", "mdx", "ts", "tsx"],
8+
reactStrictMode: true,
9+
experimental: {
10+
mdxRs: false,
11+
},
12+
};
13+
14+
const withMDX = createMDX({
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+
},
23+
});
24+
25+
export default withMDX(nextConfig);

0 commit comments

Comments
 (0)