Skip to content

Commit

Permalink
Merge pull request #15 from RS-Imagine/TestForDeploy
Browse files Browse the repository at this point in the history
deploy for testdeploy
  • Loading branch information
RS-Imagine authored Dec 12, 2024
2 parents 4618d29 + 921bf81 commit a6fce6e
Show file tree
Hide file tree
Showing 354 changed files with 16,331 additions and 6,367 deletions.
4 changes: 2 additions & 2 deletions .env.local → .env.example
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables
NEXT_PUBLIC_VERSION=4.6.1


# 可在此添加环境变量,去掉最左边的(# )注释即可
# Notion页面ID,必须
# NOTION_PAGE_ID=097e5f674880459d8e1b4407758dc4fb

# 非必须
# NEXT_PUBLIC_VERSION=
# NEXT_PUBLIC_PSEUDO_STATIC=
# NEXT_PUBLIC_REVALIDATE_SECOND=
# NEXT_PUBLIC_THEME=matery
Expand Down Expand Up @@ -174,3 +173,4 @@ NEXT_PUBLIC_VERSION=4.6.1
# ENABLE_CACHE=
# VERCEL_ENV=
# NEXT_PUBLIC_VERSION=
# NEXT_BUILD_STANDALONE=
46 changes: 42 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,30 @@ module.exports = {
es2021: true,
node: true
},
extends: ['plugin:react/recommended', 'plugin:@next/next/recommended', 'standard', 'prettier'],
extends: [
'plugin:react/jsx-runtime',
'plugin:react/recommended',
'plugin:@next/next/recommended',
'next',
'prettier',
'plugin:@typescript-eslint/recommended', // 添加 TypeScript 推荐规则
'plugin:@typescript-eslint/recommended-requiring-type-checking' // 添加需要类型检查的规则
],
parser: '@typescript-eslint/parser', // 使用 TypeScript 解析器
parserOptions: {
ecmaFeatures: {
jsx: true
},
ecmaVersion: 12,
sourceType: 'module'
sourceType: 'module',
project: './tsconfig.eslint.json' // 指向新的 ESLint 配置文件
},
plugins: ['react', 'react-hooks', 'prettier'],
plugins: [
'react',
'react-hooks',
'prettier',
'@typescript-eslint' // 添加 TypeScript 插件
],
settings: {
react: {
version: 'detect'
Expand All @@ -23,8 +38,31 @@ module.exports = {
'react/no-unknown-property': 'off', // <style jsx>
'react/prop-types': 'off',
'space-before-function-paren': 0,
'react-hooks/rules-of-hooks': 'error' // Checks rules of Hooks
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], // 确保未使用的变量报错
'@typescript-eslint/explicit-function-return-type': 'off' // 关闭强制函数返回类型声明
},
overrides: [
{
files: ['.eslintrc.js'],
parser: null // 避免对 `.eslintrc.js` 文件使用 TypeScript 解析器
},
{
files: ['**/*.js'], // Match all .js files 对js的代码规范检查不那么严格
rules: {
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-unsafe-return': 'off'
}
}
],
globals: {
React: true
}
Expand Down
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# These are supported funding model platforms
ko_fi: tangly1024
36 changes: 36 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
> 尽量按此模板PR内容,或粘贴相关的ISSUE链接。
## 已知问题

1. (示例)版本号管理不规范
- 版本号直接写在环境变量中,容易出错
- 多处维护版本号,可能不一致

## 解决方案

1. (示例)将版本号管理从 `.env.local` 迁移到 `package.json`
- 统一从 `package.json` 读取版本号
- 使用 IIFE 优雅处理版本号获取逻辑
- 保持向后兼容,支持环境变量覆盖

## 改动收益

1. (示例)更规范的版本管理
- 统一从 `package.json` 读取
- 保持与 npm 生态一致
- 减少人为错误

## 具体改动

1. (示例)`blog.config.js`
- 移除原有的静态版本号配置
- 在文件末尾添加动态版本号获取逻辑
- 保持向后兼容,优先使用环境变量
- 添加错误处理和默认值

## 测试确认

- [x] 本地开发环境测试通过
- [x] 生产环境构建测试通过
- [x] 版本号正确显示
- [x] 环境变量配置正常工作
10 changes: 5 additions & 5 deletions .github/workflows/docker-ghcr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
Expand All @@ -47,14 +47,14 @@ jobs:
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pushUrl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jobs:
runs-on: ubuntu-latest # 运行环境为最新版的Ubuntu
steps:
- name: 'Checkout codes' # 步骤一,获取仓库代码
uses: actions/checkout@v2
uses: actions/checkout@v4
# - name: 'Run baiduPush' # 步骤二,执行sh命令文件
# run: npm install && npm run baiduPush # 运行目录是仓库根目录
- name: Set up Python 3.8
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: 3.8

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
# Step 1: run a standard checkout action
- name: Checkout target repo
uses: actions/checkout@v3
uses: actions/checkout@v4

# Step 2: run the sync action
- name: Sync upstream changes
Expand Down
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ yarn-debug.log*
yarn-error.log*

# local env files
# .env.local # 版本号放在此环境变量中
.env.local
.env.development.local
.env.test.local
.env.production.local
Expand All @@ -45,4 +45,9 @@ yarn-error.log*
# sitemap
/public/robots.txt
/public/sitemap.xml
/public/rss/*
/public/rss/*
/sitemap.xml

# yarn
package-lock.json
# yarn.lock
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- [Setup](#setup)
- [Creating new themes](#creating-new-themes)
- [Adding localizations](#adding-localizations)
- [Environment Variables](#environment-variables)

Thanks for considering to contribute!

Expand Down Expand Up @@ -42,6 +43,19 @@ localization! Follow these steps to add a new localization:
3. Add your language config to [lang.js][lang.js].
4. [Create a PR][pr] with your localization updates.

## Environment Variables

NotionNext uses environment variables for configuration. To set up your development environment:

1. Copy `.env.example` to `.env.local`
2. Fill in the required values in `.env.local`
3. Never commit `.env.local` to version control

The configuration priority is:
1. Notion Config Table (highest)
2. Environment Variables
3. blog.config.js (lowest)

[fork]: https://github.com/tangly1024/NotionNext/fork
[pr]: https://github.com/tangly1024/NotionNext/compare
[next.js]: https://github.com/vercel/next.js
Expand Down
33 changes: 27 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,42 @@
ARG NOTION_PAGE_ID
# Install dependencies only when needed
FROM node:18-alpine3.18 AS deps
ARG NEXT_PUBLIC_THEME

FROM node:18-alpine3.18 AS base

# 1. Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json ./
RUN yarn install --frozen-lockfile

# Rebuild the source code only when needed
FROM node:18-alpine3.18 AS builder
# 2. Rebuild the source code only when needed
FROM base AS builder
ARG NOTION_PAGE_ID
ENV NEXT_BUILD_STANDALONE=true

WORKDIR /app

COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN yarn build

ENV NODE_ENV production
# 3. Production image, copy all the files and run next
FROM base AS runner
ENV NODE_ENV=production

WORKDIR /app

COPY --from=builder /app/public ./public

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static

# 个人仓库把将配置好的.env.local文件放到项目根目录,可自动使用环境变量
# COPY --from=builder /app/.env.local ./

EXPOSE 3000

Expand All @@ -24,4 +45,4 @@ EXPOSE 3000
# Uncomment the following line in case you want to disable telemetry.
# ENV NEXT_TELEMETRY_DISABLED 1

CMD ["yarn", "start"]
CMD ["node", "server.js"]
59 changes: 32 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ I have modified the
here is the website->[ImagineBlog](https://forimagine.eu.org 'ImagineBlog')


# 帮助教程

访问帮助:[NotionNext帮助手册](https://docs.tangly1024.com/)

> 本项目教程为免费、公开资源,仅限个人学习使用。严禁任何个人或组织将本教程用于商业用途,包括但不限于直接售卖、间接收费、或其他变相盈利行为。转载、复制或介绍本教程内容时,须保留作者信息并明确注明来源。
> 本项目仅提供由作者团队授权的付费咨询服务,请注意辨别,谨防诈骗行为。任何未经授权的收费服务均可能存在法律风险。
Notion是一个能让效率暴涨的生产力引擎,可以帮你书写文档、管理笔记,搭建知识库,甚至可以为你规划项目、时间管理、组织团队、提高生产力、还有当前最强大的AI技术加持。

> 如果希望进一步探索Notion的功能,欢迎购买《[Notion笔记从入门到精通进阶课程](https://docs.tangly1024.com/article/notion-tutorial)
# NotionNext

<p>
Expand All @@ -26,38 +37,25 @@ here is the website->[ImagineBlog](https://forimagine.eu.org 'ImagineBlog')
</p>


[中文文档](./README.md) | README in English
中文文档 | [README in English](./README_EN.md)

<hr/>

A static blog system built with NextJS and Notion API, deployed on Vercel. Designed for Notion and all creators.

支持多种部署方案

## Preview

Live Demo:[https://preview.tangly1024.com/](https://preview.tangly1024.com/) ,Project supports switching between multiple themes. Can't find a theme you like? How about [contributing](/CONTRIBUTING.md) one?~

| Next | Medium | Hexo | Fukasawa |
|--|--|--|--|
| <img src='./docs/theme-next.png' width='300'/> [NEXT](https://preview.tangly1024.com/?theme=next) | <img src='./docs/theme-medium.png' width='300'/> [MEDIUM](https://preview.tangly1024.com/?theme=medium) | <img src='./docs/theme-hexo.png' width='300'/> [HEXO](https://preview.tangly1024.com/?theme=hexo) | <img src='./docs/theme-fukasawa.png' width='300'/> [FUKASAWA](https://preview.tangly1024.com/?theme=fukasawa) |

## Get Start!
在线演示:[https://preview.tangly1024.com/](https://preview.tangly1024.com/) ,点击左下角挂件可以切换主题,没找到喜欢的主题?[贡献](/CONTRIBUTING.md)一个吧~

It only takes a few minutes to set up your personal site:
| Next | Medium | Hexo | Fukasawa |
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| <img src='./docs/theme-next.png' width='300'/> [预览NEXT](https://preview.tangly1024.com/?theme=next) | <img src='./docs/theme-medium.png' width='300'/> [预览MEDIUM](https://preview.tangly1024.com/?theme=medium) | <img src='./docs/theme-hexo.png' width='300'/> [预览HEXO](https://preview.tangly1024.com/?theme=hexo) | <img src='./docs/theme-fukasawa.png' width='300'/> [预览FUKASAWA](https://preview.tangly1024.com/?theme=fukasawa) |

- [Quick Deployment Tutorial - Multiple Options Available](https://tangly1024.com/article/notion-next)
## 致谢

- [Customization Guide - How to Configure Feature Plugins](https://tangly1024.com/article/notion-next-guide)

- [Development Guide - How to Conduct Local Development](https://tangly1024.com/article/how-to-develop-with-notion-next)

- [Update Guide - How to Get the Latest Upgrade Patch](https://tangly1024.com/article/how-to-update-notionnext)

- [Version History - Check Feature Highlights for Each Version](https://tangly1024.com/article/notion-next-changelogs)

## Acknowledgements

Special thanks to Craig Hart for initiating the Nobelium project.
感谢Craig Hart发起的Nobelium项目

<table><tr align="left">
<td align="center"><a href="https://github.com/craigary" title="Craig Hart"><img src="https://avatars.githubusercontent.com/u/10571717" width="64px;"alt="Craig Hart"/></a><br/><a href="https://github.com/craigary" title="Craig Hart">Craig Hart</a></td>
Expand Down Expand Up @@ -183,15 +181,22 @@ Special thanks to Craig Hart for initiating the Nobelium project.
</table>


## Technologies Used
## 引用技术

- **Technical Framework**: [Next.js](https://nextjs.org)
- **Styles**: [Tailwind CSS](https://www.tailwindcss.cn/)
- **Rendering Tool**: [React-notion-x](https://github.com/NotionX/react-notion-x)
- **COMMENT**: [Twikoo](https://github.com/imaegoo/twikoo), [Giscus](https://giscus.app/zh-CN), [Gitalk](https://gitalk.github.io), [Cusdis](https://cusdis.com), [Utterances](https://utteranc.es)
- **ICON**: [Fontawesome](https://fontawesome.com/v6/icons/)
- **框架**: [Next.js](https://nextjs.org)
- **样式**: [Tailwind CSS](https://www.tailwindcss.cn/)
- **渲染**: [React-notion-x](https://github.com/NotionX/react-notion-x)
- **评论**: [Twikoo](https://github.com/imaegoo/twikoo), [Giscus](https://giscus.app/zh-CN), [Gitalk](https://gitalk.github.io), [Cusdis](https://cusdis.com), [Utterances](https://utteranc.es)
- **图标**: [Fontawesome](https://fontawesome.com/v6/icons/)

## 🔗 友情链接

- [Elog](https://github.com/LetTTGACO/elog) Markdown 批量导出工具、开放式跨平台博客解决方案,随意组合写作平台(语雀/Notion/FlowUs/飞书)和博客平台(Hexo/Vitepress/Halo/Confluence/WordPress等)

## License

The MIT License.

## Star History

[![Star History Chart](https://api.star-history.com/svg?repos=tangly1024/NotionNext&type=Date)](https://star-history.com/#tangly1024/NotionNext&Date)
Loading

0 comments on commit a6fce6e

Please sign in to comment.