-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
544 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,68 @@ | ||
# Turborepo starter | ||
# zhi | ||
|
||
This is an official pnpm starter turborepo. | ||
🛍️ A siyuan-note theme with plugin and blog bundled | ||
|
||
## What's inside? | ||
[中文版](README_zh_CN.md) | ||
|
||
This turborepo uses [pnpm](https://pnpm.io) as a package manager. It includes the following packages/apps: | ||
[![](https://img.shields.io/badge/api-docs-green)](https://zhi.terwer.space) | ||
[![dev checks](https://img.shields.io/github/checks-status/terwer/zhi/dev?label=build)](https://github.com/terwer/zhi/tree/dev) | ||
![version](https://img.shields.io/github/release/terwer/zhi.svg?style=flat-square) | ||
![license](https://img.shields.io/badge/license-GPL-blue.svg?style=popout-square) | ||
|
||
### Apps and Packages | ||
[![](https://img.shields.io/badge/build-assets-green)](https://github.com/terwer/zhi) | ||
[![](https://img.shields.io/badge/theme-source-red)](https://github.com/terwer/zhi/tree/dev/packages/zhi-mini) | ||
[![](https://img.shields.io/badge/dynamic-blog-blue)](https://github.com/terwer/zhi/tree/dev/packages/zhi-blog) | ||
[![](https://img.shields.io/badge/static-blog-purple)](https://github.com/terwer/zhi/tree/dev/packages/zhi-blog-astro) | ||
|
||
- `docs`: a [Next.js](https://nextjs.org/) app | ||
- `web`: another [Next.js](https://nextjs.org/) app | ||
- `ui`: a stub React component library shared by both `web` and `docs` applications | ||
- `eslint-config-custom`: `eslint` configurations (includes `eslint-config-next` and `eslint-config-prettier`) | ||
- `tsconfig`: `tsconfig.json`s used throughout the monorepo | ||
> ⚠️ WARNING 1: Attention: The `zhi` theme only supports the `2.7.6+` version of [siyuan-note](https://github.com/siyuan-note/siyuan) , and the plugin system only supports `2.8.1+`. Otherwise, you need to upgrade [siyuan-note](https://github.com/siyuan-note/siyuan) to a new version. | ||
Each package/app is 100% [TypeScript](https://www.typescriptlang.org/). | ||
> ⚠️ WARNING 2: `1.0.0` is an available version in the early stage, and the function is not comprehensive yet. It is only used for testing and welcomes valuable opinions through issuing. Please refer to [core features](#core-features) for this version's characteristics. | ||
### Utilities | ||
> ⚠️ WARNING 3: The plugin system is set to `security mode` by default, and you need to click on the settings menu in the upper right corner to turn off the security mode before you can activate the plugin system. | ||
This turborepo has some additional tools already setup for you: | ||
> ⚠️ WARNING 4: Except for the theme's core plugins, all plugins are disabled by default and need to be enabled in the plugin list before the first use. | ||
- [TypeScript](https://www.typescriptlang.org/) for static type checking | ||
- [ESLint](https://eslint.org/) for code linting | ||
- [Prettier](https://prettier.io) for code formatting | ||
## Quick start | ||
|
||
### Build | ||
You can download the `zhi` theme directly in the Market of siyuan-note, and then select the `zhi` theme | ||
in `Settings` - `Appearance` - `Theme` to change the appearance of the notebook. | ||
|
||
To build all apps and packages, run the following command: | ||
Note: `zhi` theme only supports siyuan-note `2.7.6+`, or you must upgrade siyuan-note first. | ||
|
||
``` | ||
cd my-turborepo | ||
pnpm run build | ||
``` | ||
## Design Philosophy | ||
|
||
### Develop | ||
- The theme core should be kept lightweight and compact as much as possible. | ||
- Plugins should be used as much as possible to implement functions. | ||
- Plugin functions should be single-purpose to avoid brainless accumulation of functions. | ||
- Components should be kept as reusable as possible. | ||
|
||
To develop all apps and packages, run the following command: | ||
## Core Features | ||
|
||
``` | ||
cd my-turborepo | ||
pnpm run dev | ||
``` | ||
The theme is inspired by `Zhihu` but not limited to its style. The appearance optimization includes but is not limited | ||
to: | ||
|
||
### Remote Caching | ||
- Font style beautification, using `Open Sans` for English and `LXGW WenKai` for Chinese | ||
- Background color optimization, overall layout and spacing optimization | ||
- Code block beautification, similar to the Mac window style | ||
- It natively supports the plugin system and comes with many built-in plugins. The plugin system is supported by | ||
community developers. | ||
- SourceNote publishing tool plugin | ||
- Document image background automatic transparency plugin | ||
- Blog plugin | ||
- It can handle both the theme and the preview. Installing the zhi theme is equivalent to installing an additional | ||
plugin system and an online blog. | ||
- SPA blog homepage: http://127.0.0.1:6806/appearance/themes/zhi/web/blog/ <sup>simple</sup> | ||
- SSR blog homepage: http://127.0.0.1:6806/appearance/themes/zhi/server/blog/ <sup>seo friendly</sup> | ||
- Widget version of the blog management and publishing [Deprecated] | ||
homepage: http://127.0.0.1:6806/widgets/sy-post-publisher/blog/?from=siyuanNewWin | ||
|
||
Turborepo can use a technique known as [Remote Caching](https://turbo.build/repo/docs/core-concepts/remote-caching) to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines. | ||
> Note: 🌹 The plugin system is provided by enthusiastic community developers. Please understand the relevant mechanisms in | ||
> detail before using. | ||
By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can [create one](https://vercel.com/signup), then enter the following commands: | ||
## Technical Roadmap | ||
|
||
``` | ||
cd my-turborepo | ||
pnpm dlx turbo login | ||
``` | ||
[tech](tech.md) | ||
|
||
This will authenticate the Turborepo CLI with your [Vercel account](https://vercel.com/docs/concepts/personal-accounts/overview). | ||
## Acknowledgments | ||
|
||
Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your turborepo: | ||
|
||
``` | ||
pnpm dlx turbo link | ||
``` | ||
|
||
## Useful Links | ||
|
||
Learn more about the power of Turborepo: | ||
|
||
- [Tasks](https://turbo.build/repo/docs/core-concepts/monorepos/running-tasks) | ||
- [Caching](https://turbo.build/repo/docs/core-concepts/caching) | ||
- [Remote Caching](https://turbo.build/repo/docs/core-concepts/remote-caching) | ||
- [Filtering](https://turbo.build/repo/docs/core-concepts/monorepos/filtering) | ||
- [Configuration Options](https://turbo.build/repo/docs/reference/configuration) | ||
- [CLI Usage](https://turbo.build/repo/docs/reference/command-line-reference) | ||
Thanks to [zuoez02](https://github.com/zuoez02/siyuan-plugin-system) for providing the plugin system. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# zhi | ||
|
||
🛍️ 一款自带插件和博客的思源笔记主题 | ||
|
||
[English](README.md) | ||
|
||
[![](https://img.shields.io/badge/api-docs-green)](https://zhi.terwer.space) | ||
[![dev checks](https://img.shields.io/github/checks-status/terwer/zhi/dev?label=build)](https://github.com/terwer/zhi/tree/dev) | ||
![version](https://img.shields.io/github/release/terwer/zhi.svg?style=flat-square) | ||
![license](https://img.shields.io/badge/license-GPL-blue.svg?style=popout-square) | ||
|
||
[![](https://img.shields.io/badge/构建-成品-green)](https://github.com/terwer/zhi) | ||
[![](https://img.shields.io/badge/主题-源码-red)](https://github.com/terwer/zhi/tree/dev/packages/zhi-mini) | ||
[![](https://img.shields.io/badge/动态-博客-blue)](https://github.com/terwer/zhi/tree/dev/packages/zhi-blog) | ||
[![](https://img.shields.io/badge/静态-博客-purple)](https://github.com/terwer/zhi/tree/dev/packages/zhi-blog-astro) | ||
|
||
> ⚠️ 特别提醒 1: 注意:`zhi` 主题仅支持 [思源笔记](https://github.com/siyuan-note/siyuan) `2.7.6+` 以上版本,插件功能仅支持 `2.8.1+` ,否则您需要升级 [思源笔记](https://github.com/siyuan-note/siyuan) 到新版本。 | ||
> ⚠️ 特别提醒 2: `0.1.0` 为前期可用版本,功能上尚不全面,仅作为测试使用,欢迎 issue | ||
> 提出宝贵意见。此版本特性,请参照 [核心特性](#核心特性) 。 | ||
> ⚠️ 特别提醒 3: 插件系统默认为 `安全模式` ,需要点击右上角设置菜单关闭安全模式,才能开启插件系统。 | ||
> ⚠️ 特别提醒 4: 除主题核心插件外,所有插件默认禁用,需要在首次使用之前,在插件列表开启。 | ||
## 快速上手 | ||
|
||
直接在思源笔记 `集市` 下载 `zhi` 主题,然后在 <kbd>设置</kbd> - <kbd>外观</kbd> - <kbd>主题</kbd> 选择 `zhi` 主题即可 | ||
|
||
## 设计哲学 | ||
|
||
- 主题核心尽量保持足够轻量、小巧 | ||
- 尽可能的使用插件实现功能 | ||
- 插件功能单一化,杜绝功能无脑堆积 | ||
- 组件尽可能保持可重用 | ||
|
||
## 核心特性 | ||
|
||
- 主题灵感源自于知乎但不限于知乎风格,外观优化包括不限于: | ||
|
||
- 字体样式美化,英文以 `Open Sans` 为主, 中文以 `落霞孤鹜` 为主 | ||
- 背景色优化,整体布局、间距优化 | ||
- 代码块美化,类似 `Mac` 窗口风格 | ||
|
||
- 天生支持插件系统,并内置诸多使用插件,插件系统由社区开发者提供支持 | ||
|
||
- 思源笔记发布工具插件 | ||
- 文档图片背景自动透明插件 | ||
- 博客插件 | ||
|
||
- 同时搞定主题与预览,安装了 zhi 主题相当于额外安装了一个插件系统,两个在线博客 | ||
|
||
静态博客主页:http://127.0.0.1:6806/appearance/themes/zhi/web/blog/ <sup>简单</sup> | ||
动态博客主页:http://127.0.0.1:3000/appearance/themes/zhi/server/blog/ <sup>SEO 友好</sup> | ||
|
||
特别说明: | ||
|
||
1. 博客服务已经自带,开箱即用,无需任何配置。 | ||
2. 静态博客如果想自部署,可拷贝 `web/blog` 目录 ,然后用 `Nginx` 伺服即可,无需其他。 | ||
3. 动态博客如果想自部署,可拷贝 `server/blog` 目录 ,然后用 `Node` 环境启动,也可自行通过 `docker` 镜像或者下面的 `docker-compose.yml` 启动,也可源码编译,然后部署到 `Vercel` 。 | ||
|
||
挂件版博客管理与发布主页:http://127.0.0.1:6806/widgets/sy-post-publisher/blog/?from=siyuanNewWin [功能重叠][已废弃][建议使用新版博客] | ||
|
||
> 注意事项:🌹 插件系统为社区热心开发者提供,请详细了解相关机制之后再使用。 | ||
## 技术路线 | ||
|
||
[技术路线](tech_zh_CN.md) | ||
|
||
## 感谢 | ||
|
||
感谢 [zuoez02](https://github.com/zuoez02/siyuan-plugin-system) 提供的插件系统 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VITE_DEBUG_MODE=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VITE_DEBUG_MODE=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VITE_DEBUG_MODE=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
root: true, | ||
extends: ["custom"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# idea | ||
.idea | ||
|
||
# build | ||
dist | ||
lib | ||
!src/lib | ||
node_modules | ||
|
||
# api-extractor | ||
etc | ||
temp | ||
tsdoc-metadata.json | ||
|
||
# env | ||
.env.development | ||
.env.production | ||
.env.test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# ts-esbuild-lib | ||
TypeScript library using esbuild | ||
|
||
## How to use | ||
|
||
For more detail, please go to [zhi-cli](https://github.com/terwer/zhi/tree/dev/apps/zhi-cli) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "api-docs/api-extractor-base.json", | ||
|
||
"apiReport": { | ||
"enabled": true, | ||
"reportFolder": "../../reports/api/" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (c) 2023, Terwer . All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. Terwer designates this | ||
* particular file as subject to the "Classpath" exception as provided | ||
* by Terwer in the LICENSE file that accompanied this code. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com | ||
* or visit www.terwer.space if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
const sharedConfig = require("jest-config-custom/babel.config.cjs") | ||
|
||
module.exports = { | ||
...sharedConfig, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright (c) 2023, Terwer . All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. Terwer designates this | ||
* particular file as subject to the "Classpath" exception as provided | ||
* by Terwer in the LICENSE file that accompanied this code. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com | ||
* or visit www.terwer.space if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
interface ImportMeta { | ||
readonly env: ImportMetaEnv | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Copyright (c) 2023, Terwer . All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. Terwer designates this | ||
* particular file as subject to the "Classpath" exception as provided | ||
* by Terwer in the LICENSE file that accompanied this code. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com | ||
* or visit www.terwer.space if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
const path = require("path") | ||
// const minimist = require("minimist") | ||
const { dtsPlugin } = require("esbuild-plugin-d.ts") | ||
const { copy } = require("esbuild-plugin-copy") | ||
|
||
// const args = minimist(process.argv.slice(2)) | ||
// const isWatch = args.watch || args.w | ||
|
||
// for dist | ||
const baseDir = "./" | ||
const distDir = path.join(baseDir, "dist") | ||
|
||
// for outer custom output for dev | ||
// const baseDir = isWatch ? "my-custom-absolute-path" : "./" | ||
// const distDir = isWatch ? baseDir : path.join(baseDir, "dist") | ||
|
||
/** | ||
* 构建配置 | ||
*/ | ||
module.exports = { | ||
entryPoints: ["src/index.ts"], | ||
outfile: path.join(distDir, "index.js"), | ||
bundle: true, | ||
format: "esm", | ||
platform: "node", | ||
plugins: [ | ||
dtsPlugin(), | ||
copy({ | ||
// this is equal to process.cwd(), which means we use cwd path as base path to resolve `to` path | ||
// if not specified, this plugin uses ESBuild.build outdir/outfile options as base path. | ||
resolveFrom: "cwd", | ||
assets: [ | ||
// copy folder | ||
{ | ||
from: "./public/**/*", | ||
to: [path.join(distDir, "assets")], | ||
}, | ||
// copy one file | ||
{ | ||
from: ["./README.md"], | ||
to: [path.join(distDir, "/README.md")], | ||
}, | ||
], | ||
watch: true, | ||
}), | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const sharedConfig = require("jest-config-custom") | ||
|
||
module.exports = { | ||
...sharedConfig, | ||
} |
Oops, something went wrong.