diff --git a/README.md b/README.md index 05c74070..ed983559 100644 --- a/README.md +++ b/README.md @@ -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/ simple + - SSR blog homepage: http://127.0.0.1:6806/appearance/themes/zhi/server/blog/ seo friendly + - 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. \ No newline at end of file diff --git a/README_zh_CN.md b/README_zh_CN.md new file mode 100644 index 00000000..52eeecd9 --- /dev/null +++ b/README_zh_CN.md @@ -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` 主题,然后在 设置 - 外观 - 主题 选择 `zhi` 主题即可 + +## 设计哲学 + +- 主题核心尽量保持足够轻量、小巧 +- 尽可能的使用插件实现功能 +- 插件功能单一化,杜绝功能无脑堆积 +- 组件尽可能保持可重用 + +## 核心特性 + +- 主题灵感源自于知乎但不限于知乎风格,外观优化包括不限于: + + - 字体样式美化,英文以 `Open Sans` 为主, 中文以 `落霞孤鹜` 为主 + - 背景色优化,整体布局、间距优化 + - 代码块美化,类似 `Mac` 窗口风格 + +- 天生支持插件系统,并内置诸多使用插件,插件系统由社区开发者提供支持 + + - 思源笔记发布工具插件 + - 文档图片背景自动透明插件 + - 博客插件 + +- 同时搞定主题与预览,安装了 zhi 主题相当于额外安装了一个插件系统,两个在线博客 + + 静态博客主页:http://127.0.0.1:6806/appearance/themes/zhi/web/blog/ 简单 + 动态博客主页:http://127.0.0.1:3000/appearance/themes/zhi/server/blog/ SEO 友好 + + 特别说明: + + 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) 提供的插件系统 \ No newline at end of file diff --git a/apps/zhi-device-detection/.env.development.example b/apps/zhi-device-detection/.env.development.example new file mode 100644 index 00000000..42c92bd3 --- /dev/null +++ b/apps/zhi-device-detection/.env.development.example @@ -0,0 +1 @@ +VITE_DEBUG_MODE=true \ No newline at end of file diff --git a/apps/zhi-device-detection/.env.production.example b/apps/zhi-device-detection/.env.production.example new file mode 100644 index 00000000..303ce5b0 --- /dev/null +++ b/apps/zhi-device-detection/.env.production.example @@ -0,0 +1 @@ +VITE_DEBUG_MODE=false \ No newline at end of file diff --git a/apps/zhi-device-detection/.env.test.example b/apps/zhi-device-detection/.env.test.example new file mode 100644 index 00000000..42c92bd3 --- /dev/null +++ b/apps/zhi-device-detection/.env.test.example @@ -0,0 +1 @@ +VITE_DEBUG_MODE=true \ No newline at end of file diff --git a/apps/zhi-device-detection/.eslintrc.cjs b/apps/zhi-device-detection/.eslintrc.cjs new file mode 100644 index 00000000..c8df6075 --- /dev/null +++ b/apps/zhi-device-detection/.eslintrc.cjs @@ -0,0 +1,4 @@ +module.exports = { + root: true, + extends: ["custom"], +}; diff --git a/apps/zhi-device-detection/.gitignore b/apps/zhi-device-detection/.gitignore new file mode 100644 index 00000000..d6ee86d1 --- /dev/null +++ b/apps/zhi-device-detection/.gitignore @@ -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 \ No newline at end of file diff --git a/apps/zhi-device-detection/README.md b/apps/zhi-device-detection/README.md new file mode 100644 index 00000000..9f598dbd --- /dev/null +++ b/apps/zhi-device-detection/README.md @@ -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) \ No newline at end of file diff --git a/apps/zhi-device-detection/api-extractor.json b/apps/zhi-device-detection/api-extractor.json new file mode 100644 index 00000000..34cc2c8c --- /dev/null +++ b/apps/zhi-device-detection/api-extractor.json @@ -0,0 +1,8 @@ +{ + "extends": "api-docs/api-extractor-base.json", + + "apiReport": { + "enabled": true, + "reportFolder": "../../reports/api/" + } +} \ No newline at end of file diff --git a/apps/zhi-device-detection/babel.config.cjs b/apps/zhi-device-detection/babel.config.cjs new file mode 100644 index 00000000..36012d6d --- /dev/null +++ b/apps/zhi-device-detection/babel.config.cjs @@ -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, +} diff --git a/apps/zhi-device-detection/env.d.ts b/apps/zhi-device-detection/env.d.ts new file mode 100644 index 00000000..244ec48c --- /dev/null +++ b/apps/zhi-device-detection/env.d.ts @@ -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 +} diff --git a/apps/zhi-device-detection/esbuild.config.cjs b/apps/zhi-device-detection/esbuild.config.cjs new file mode 100644 index 00000000..c7b7cc1a --- /dev/null +++ b/apps/zhi-device-detection/esbuild.config.cjs @@ -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, + }), + ], +} diff --git a/apps/zhi-device-detection/jest.config.cjs b/apps/zhi-device-detection/jest.config.cjs new file mode 100644 index 00000000..be7e57a3 --- /dev/null +++ b/apps/zhi-device-detection/jest.config.cjs @@ -0,0 +1,5 @@ +const sharedConfig = require("jest-config-custom") + +module.exports = { + ...sharedConfig, +} \ No newline at end of file diff --git a/apps/zhi-device-detection/package.json b/apps/zhi-device-detection/package.json new file mode 100644 index 00000000..d640fee7 --- /dev/null +++ b/apps/zhi-device-detection/package.json @@ -0,0 +1,30 @@ +{ + "name": "zhi-device-detection", + "version": "0.1.0", + "type": "module", + "description": "please input project description", + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "repository": "terwer/zhi", + "homepage": "terwer/zhi/tree/main/apps/zhi-device-detection", + "author": "please input author", + "license": "GPL", + "keywords": [], + "scripts": { + "dev": "zhi-build --watch", + "build": "zhi-build --production", + "test": "jest --coverage=true --coverageDirectory=../../reports/test/zhi-device-detection", + "lint": "eslint 'src/**/*.{ts,js}' --fix", + "doc": "../../packages/api-docs/node_modules/.bin/api-extractor run --local --verbose", + "md": "../../packages/api-docs/node_modules/.bin/api-documenter markdown -i temp -o ../zhi-docs/src/api/zhi-device-detection && pnpm mdfix", + "mdfix": "pnpm mdfmt && rm ../zhi-docs/src/api/zhi-device-detection/index.md", + "mdfmt": "echo '---\ntitle: zhi-device-detection\n---' | cat - ../zhi-docs/src/api/zhi-device-detection/index.md > ../zhi-docs/src/api/zhi-device-detection/README.md" + }, + "devDependencies": { + "api-docs": "workspace:*", + "esbuild-config-custom": "workspace:*", + "eslint-config-custom": "workspace:*", + "jest-config-custom": "workspace:*", + "tsconfig": "workspace:*" + } +} \ No newline at end of file diff --git a/apps/zhi-device-detection/src/index.spec.ts b/apps/zhi-device-detection/src/index.spec.ts new file mode 100644 index 00000000..b273da82 --- /dev/null +++ b/apps/zhi-device-detection/src/index.spec.ts @@ -0,0 +1,33 @@ +/* + * 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. + */ + +import { describe, expect, test } from "@jest/globals" +import { hello } from "./index" + +describe("zhi-cli", () => { + test("index", () => { + expect(hello()).toBe("hello world") + }) +}) diff --git a/apps/zhi-device-detection/src/index.ts b/apps/zhi-device-detection/src/index.ts new file mode 100644 index 00000000..e4899375 --- /dev/null +++ b/apps/zhi-device-detection/src/index.ts @@ -0,0 +1,6 @@ +/** + * zhi-cli 入口 + */ +export function hello() { + return "hello world" +} diff --git a/apps/zhi-device-detection/tsconfig.json b/apps/zhi-device-detection/tsconfig.json new file mode 100644 index 00000000..efb171a3 --- /dev/null +++ b/apps/zhi-device-detection/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../packages/tsconfig/base.json", + "compilerOptions": { + "target": "esnext", + "module": "esnext", + "moduleResolution": "node", + "isolatedModules": false, + "esModuleInterop": true, + "outDir": "./lib" + }, + "include": ["env.d.ts", "**/*.ts", "**/*.spec.ts"], + "exclude": ["node_modules"] +} \ No newline at end of file diff --git a/apps/zhi-device-detection/tsdoc.json b/apps/zhi-device-detection/tsdoc.json new file mode 100644 index 00000000..ba203624 --- /dev/null +++ b/apps/zhi-device-detection/tsdoc.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json", + + "extends": ["api-docs/tsdoc.base.json"] +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e1722beb..97662dca 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -76,6 +76,24 @@ importers: specifier: workspace:* version: link:../../packages/tsconfig + apps/zhi-device-detection: + devDependencies: + api-docs: + specifier: workspace:* + version: link:../../packages/api-docs + esbuild-config-custom: + specifier: workspace:* + version: link:../../packages/esbuild-config-custom + eslint-config-custom: + specifier: workspace:* + version: link:../../packages/eslint-config-custom + jest-config-custom: + specifier: workspace:* + version: link:../../packages/jest-config-custom + tsconfig: + specifier: workspace:* + version: link:../../packages/tsconfig + apps/zhi-docs: devDependencies: '@vuepress/client': diff --git a/tech.md b/tech.md new file mode 100644 index 00000000..bad1ca18 --- /dev/null +++ b/tech.md @@ -0,0 +1,73 @@ +# zhi + +This is zhi source tree using [turborepo](https://turbo.build/repo) and [pnpm workspace](https://pnpm.io/workspaces). + +## What's inside? + +This turborepo uses [pnpm](​https://pnpm.io) as a package manager. It includes the following packages/apps: + +### Apps and Packages + +- `zhi-cli`: zhi project generator, itself is also generated by `zhi-cli` +- `zhi-device-detection`: auto check environment whether in browser, browser extension, electron, node and more +- `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 + +Each package/app is 100% [TypeScript](​https://www.typescriptlang.org/). + +### Utilities + +This turborepo has some additional tools already setup for you: + +- [TypeScript](​https://www.typescriptlang.org/) for static type checking +- [ESLint](​https://eslint.org/) for code linting +- [Prettier](​https://prettier.io) for code formatting + +### Build + +To build all apps and packages, run the following command: + +``` +cd my-turborepo +pnpm run build +``` + +### Develop + +To develop all apps and packages, run the following command: + +``` +cd my-turborepo +pnpm run dev +``` + +### Remote Caching + +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. + +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: + +``` +cd my-turborepo +pnpm dlx turbo login +``` + +This will authenticate the Turborepo CLI with your [Vercel account](​https://vercel.com/docs/concepts/personal-accounts/overview). + +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) \ No newline at end of file diff --git a/tech_zh_CN.md b/tech_zh_CN.md new file mode 100644 index 00000000..622e4d2e --- /dev/null +++ b/tech_zh_CN.md @@ -0,0 +1,73 @@ +# zhi + +这是使用 [turborepo](https://turbo.build/repo) 和 [pnpm workspace](https://pnpm.io/workspaces) 搭建的 zhi 主题的所有源码 + +## 里面有什么? + +本项目使用 turborepo 构建,并使用 [pnpm](https://pnpm.io) 作为包管理器。它包括以下包含的子项目 : + +### 子项目 + +- `zhi-cli`:zhi 项目的脚手架,它本身也是用 `zhi-cli` 生成的 +- `web`:另一个[Next. js](https://nextjs.org/)应用程序 +-'用户界面':'web'和'docs'应用程序共享的存根React组件库 +-'eslint-config-自定义':'eslint'配置(包括'eslint-config-next'和'eslint-config-漂亮') +-'tsconfig':'tsconfig. json在整个monorepo中使用 + +每个包/应用程序都是100%[TypeScript](https://www.typescriptlang.org/)。 + +###实用程序 + +这款Turborepo已经为您设置了一些额外的工具: + +-[TypeScript](https://www.typescriptlang.org/)用于静态类型检查 +-[ESLint](https://eslint.org/)用于代码lint +https://prettier.io)用于代码格式化 + +###构建 + +要构建所有应用程序和包,请运行以下命令: + +“” +cd my-turborepo +pnpm运行构建 +“” + +###开发 + +要开发所有应用程序和包,请运行以下命令: + +“” +cd my-turborepo +pnpm运行开发 +“” + +###远程缓存 + +Turborepo可以使用一种称为[远程缓存](https://turbo.build/repo/docs/core-concepts/remote-caching)的技术来跨机器共享缓存工件,使您能够与您的团队和CI/CD管道共享构建缓存。 + +默认情况下,Turborepo将在本地缓存。要启用远程缓存,您需要一个Vercel帐户。如果您没有帐户,您可以[创建一个](https://vercel.com/signup),然后输入以下命令: + +“” +cd my-turborepo +pnpm dlx turbo登录 +“” + +这将使用您的[Vercel帐户](https://vercel.com/docs/concepts/personal-accounts/overview)验证Turborepo CLI。 + +接下来,您可以通过从turborepo的根目录运行以下命令将Turborepo链接到远程缓存: + +“” +pnpm dlx turbo link +“” + +##有用的链接 + +了解有关Turborepo强大功能的更多信息: + +-[任务](https://turbo.build/repo/docs/core-concepts/monorepos/running-tasks) +-[缓存](https://turbo.build/repo/docs/core-concepts/caching) +-[远程缓存](https://turbo.build/repo/docs/core-concepts/remote-caching) +-[过滤](https://turbo.build/repo/docs/core-concepts/monorepos/filtering) +-[配置选项](https://turbo.build/repo/docs/reference/configuration) +-[CLI用法](https://turbo.build/repo/docs/reference/command-line-reference) \ No newline at end of file