Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 0 additions & 3 deletions .eslintrc.json

This file was deleted.

67 changes: 48 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,59 @@ name: CI & CD
on:
push:
branches:
- main
- '*'
jobs:
Build-and-Deploy:
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }}

- uses: pnpm/action-setup@v2
- name: Deploy to Vercel
id: vercel-deployment
uses: amondnet/vercel-action@v25
if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }}
with:
version: 8
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm

- name: Install
run: pnpm i --frozen-lockfile
- name: Build
run: pnpm build
vercel-token: ${{ secrets.VERCEL_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
working-directory: ./
vercel-args: ${{ github.ref == 'refs/heads/main' && ' --prod' || '' }}

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
- name: Lark notification
uses: foxundermoon/feishu-action@v2
with:
publish_dir: ./out
personal_token: ${{ secrets.GITHUB_TOKEN }}
force_orphan: true
url: ${{ secrets.LARK_CHATBOT_HOOK_URL }}
msg_type: post
content: |
post:
en_us:
title: "Vercel Preview Environment"
content:
- - tag: text
text: "Git Repository: "
- tag: a
text: ${{ github.server_url }}/${{ github.repository }}
href: ${{ github.server_url }}/${{ github.repository }}
- - tag: text
text: "Code Branch: "
- tag: a
text: ${{ github.ref }}
href: ${{ github.server_url }}/${{ github.repository }}/tree/${{ github.ref_name }}
- - tag: text
text: "Commit Author: "
- tag: a
text: ${{ github.actor }}
href: ${{ github.server_url }}/${{ github.actor }}
- - tag: text
text: "Preview Link: "
- tag: a
text: ${{ steps.vercel-deployment.outputs.preview-url }}
href: ${{ steps.vercel-deployment.outputs.preview-url }}
4 changes: 0 additions & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
#!/bin/sh

. "$(dirname "$0")/_/husky.sh"

npm test
4 changes: 0 additions & 4 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
#!/bin/sh

. "$(dirname "$0")/_/husky.sh"

npm run build
2 changes: 1 addition & 1 deletion components/PageContent/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MDXProvider } from '@mdx-js/react';
import type { PropsWithChildren } from 'react';
import { Container, Card } from 'react-bootstrap';
import { Card, Container } from 'react-bootstrap';

import styles from '../../styles/Home.module.scss';
import pageContentStyles from './PageContent.module.scss';
Expand Down
2 changes: 1 addition & 1 deletion components/PageHead.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { PropsWithChildren } from 'react';
import Head from 'next/head';
import type { PropsWithChildren } from 'react';

export type PageHeadProps = PropsWithChildren<{
title?: string;
Expand Down
76 changes: 76 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// @ts-check
import { fixupConfigRules, fixupPluginRules } from '@eslint/compat';
import { FlatCompat } from '@eslint/eslintrc';
import eslint from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier';
import reactPlugin from 'eslint-plugin-react';
import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort';
import globals from 'globals';
import tsEslint from 'typescript-eslint';
import { fileURLToPath } from 'url';

const tsconfigRootDir = fileURLToPath(new URL('.', import.meta.url)),
flatCompat = new FlatCompat();

export default tsEslint.config(
// register all of the plugins up-front
{
plugins: {
'@typescript-eslint': tsEslint.plugin,
react: fixupPluginRules(reactPlugin),
'simple-import-sort': simpleImportSortPlugin,
},
},
{
// config with just ignores is the replacement for `.eslintignore`
ignores: ['**/node_modules/**', '**/public/**', '**/.next/**'],
},

// extends ...
eslint.configs.recommended,
...tsEslint.configs.recommended,
...fixupConfigRules(flatCompat.extends('plugin:@next/next/core-web-vitals')),

// base config
{
languageOptions: {
globals: { ...globals.es2020, ...globals.browser, ...globals.node },
parserOptions: {
projectService: true,
tsconfigRootDir,
warnOnUnsupportedTypeScriptVersion: false,
},
},
rules: {
'no-empty-pattern': 'warn',
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': 'error',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-unsafe-declaration-merging': 'warn',
'react/jsx-no-target-blank': 'warn',
'react/jsx-sort-props': [
'error',
{
reservedFirst: true,
callbacksLast: true,
noSortAlphabetically: true,
},
],
'@next/next/no-sync-scripts': 'warn',
},
},
{
files: ['**/*.js'],
extends: [tsEslint.configs.disableTypeChecked],
rules: {
// turn off other type-aware rules
'@typescript-eslint/internal/no-poorly-typed-ts-props': 'off',

// turn off rules that don't apply to JS code
'@typescript-eslint/explicit-function-return-type': 'off',
},
},
eslintConfigPrettier,
);
2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.
1 change: 0 additions & 1 deletion next.config.mjs → next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const withMDX = setMDX({
disable: process.env.NODE_ENV === 'development',
});

/** @type {import('next').NextConfig} */
export default withPWA(
withMDX({
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'md', 'mdx'],
Expand Down
68 changes: 44 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,66 @@
{
"name": "@open-source-bazaar/web-site",
"version": "0.0.2",
"version": "1.0.0",
"description": "Open Source Bazaar web-site",
"private": true,
"scripts": {
"prepare": "husky install",
"prepare": "husky",
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"test": "npm run lint && lint-staged"
"lint": "next lint && tsc --noEmit",
"test": "lint-staged && npm run lint"
},
"dependencies": {
"@mdx-js/loader": "^3.0.0",
"@mdx-js/react": "^3.0.0",
"@next/mdx": "^14.0.3",
"idea-react": "^1.0.0-rc.30",
"next": "^14.0.3",
"@mdx-js/loader": "^3.1.0",
"@mdx-js/react": "^3.1.0",
"@next/mdx": "^15.1.6",
"idea-react": "^2.0.0-rc.8",
"next": "^15.1.6",
"next-pwa": "^5.6.0",
"react": "^18.2.0",
"react-bootstrap": "^2.9.1",
"react-dom": "^18.2.0",
"react": "^18.3.1",
"react-bootstrap": "^2.10.9",
"react-dom": "^18.3.1",
"react-typed-component": "^1.0.6"
},
"devDependencies": {
"@types/node": "^18.18.9",
"@types/react": "^18.2.37",
"eslint": "^8.53.0",
"eslint-config-next": "^14.0.3",
"husky": "^8.0.3",
"lint-staged": "^15.1.0",
"prettier": "^3.1.0",
"sass": "^1.69.5",
"typescript": "~5.2.2"
"@eslint/compat": "^1.2.6",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.19.0",
"@softonus/prettier-plugin-duplicate-remover": "^1.1.2",
"@types/eslint-config-prettier": "^6.11.3",
"@types/eslint__eslintrc": "^2.1.2",
"@types/next-pwa": "^5.6.9",
"@types/node": "^22.13.1",
"@types/react": "^18.3.18",
"@types/react-dom": "^18",
"eslint": "^9.19.0",
"eslint-config-next": "^15.1.6",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-simple-import-sort": "^12.1.1",
"globals": "^15.14.0",
"husky": "^9.1.7",
"lint-staged": "^15.4.3",
"prettier": "^3.4.2",
"prettier-plugin-css-order": "^2.1.2",
"sass": "^1.84.0",
"typescript": "~5.7.3",
"typescript-eslint": "^8.23.0"
},
"resolutions": {
"next": "$next"
},
"prettier": {
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "avoid"
"arrowParens": "avoid",
"plugins": [
"prettier-plugin-css-order",
"@softonus/prettier-plugin-duplicate-remover"
]
},
"lint-staged": {
"*.{html,md,scss,json,yml,js,mjs,ts,tsx}": "prettier --write",
"*.{js,mjs,ts,tsx}": "eslint --fix"
"*.{html,md,scss,json,yml,js,mjs,ts,tsx}": "prettier --write"
}
}
30 changes: 8 additions & 22 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,16 @@
import '../styles/globals.css';

import type { AppProps } from 'next/app';
import Head from 'next/head';
import { useRouter } from 'next/router';
import { Container, Nav, Navbar } from 'react-bootstrap';

import '../styles/globals.css';

const topNavBarMenu = [
{
href: '/about',
name: '关于',
},
{
href: '/history',
name: '历史',
},
{
href: '/code-of-conduct',
name: '行为规范',
},
{
href: '/join-us',
name: '参与',
},
{
href: '/open-collaborator-award',
name: '开放协作人奖',
},
{ href: '/about', name: '关于' },
{ href: '/history', name: '历史' },
{ href: '/code-of-conduct', name: '行为规范' },
{ href: '/join-us', name: '参与' },
{ href: '/open-collaborator-award', name: '开放协作人奖' },
{
href: 'https://github.com/Open-Source-Bazaar/Git-Hackathon-scaffold',
name: '黑客马拉松',
Expand All @@ -35,6 +20,7 @@ const topNavBarMenu = [
export default function MyApp({ Component, pageProps }: AppProps) {
const { pathname } = useRouter();
const thisFullYear = new Date().getFullYear();

return (
<>
<Head>
Expand Down
6 changes: 3 additions & 3 deletions pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Html, Head, Main, NextScript } from 'next/document';
import { Head, Html, Main, NextScript } from 'next/document';

export default function Document() {
return (
<Html>
<Head>
<link
rel="stylesheet"
href="https://unpkg.com/bootstrap@5.3.2/dist/css/bootstrap.min.css"
href="https://unpkg.com/bootstrap@5.3.3/dist/css/bootstrap.min.css"
/>
<link
rel="stylesheet"
href="https://unpkg.com/bootstrap-icons@1.11.1/font/bootstrap-icons.css"
href="https://unpkg.com/bootstrap-icons@1.11.3/font/bootstrap-icons.css"
/>
</Head>
<body>
Expand Down
Loading