Skip to content

Commit

Permalink
✨ 新增(docs):添加文档
Browse files Browse the repository at this point in the history
✨ 新增(docs-publish.yml):添加GitHub Actions工作流程,自动部署文档
  🔧 更新(.gitignore):忽略.next和node_modules文件夹
  • Loading branch information
Sitoi committed Feb 20, 2024
1 parent 5996905 commit 06cd1b0
Show file tree
Hide file tree
Showing 103 changed files with 9,642 additions and 1 deletion.
32 changes: 32 additions & 0 deletions .github/workflows/docs-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Deploy

on:
push:
paths:
- 'docs/**'
defaults:
run:
shell: bash
working-directory: ./docs

jobs:
github_pages_deploy:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1
- uses: actions/checkout@v3
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Install dependencies
run: |
npm install
npm run export
- name: Deploy with gh-pages
run: |
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
npm run deploy -- -u "github-actions-bot <support+actions@github.com>"
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,7 @@ dmypy.json
# Pyre type checker
.pyre/
.idea
config.json
config.json

.next
node_modules
6 changes: 6 additions & 0 deletions docs/components/counters.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.counter {
border: 1px solid #ccc;
border-radius: 5px;
padding: 2px 6px;
margin: 12px 0 0;
}
24 changes: 24 additions & 0 deletions docs/components/counters.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Example from https://beta.reactjs.org/learn

import { useState } from 'react'
import styles from './counters.module.css'

function MyButton() {
const [count, setCount] = useState(0)

function handleClick() {
setCount(count + 1)
}

return (
<div>
<button onClick={handleClick} className={styles.counter}>
Clicked {count} times
</button>
</div>
)
}

export default function MyApp() {
return <MyButton />
}
5 changes: 5 additions & 0 deletions docs/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
25 changes: 25 additions & 0 deletions docs/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/** @type {import('next').NextConfig} */
const withNextra = require('nextra')({
theme: 'nextra-theme-docs',
themeConfig: './theme.config.tsx',
})

const isProduction = process.env.NODE_ENV === 'production'
const assetPrefix = isProduction ? '/dailycheckin' : ''

const nextConfig = {
images: {
unoptimized: true,
},
reactStrictMode: true,
swcMinify: true,
trailingSlash: true,
assetPrefix,
basePath: assetPrefix,
output: 'export',
}

module.exports = {
...withNextra(),
...nextConfig,
}
Loading

0 comments on commit 06cd1b0

Please sign in to comment.