Skip to content

Commit

Permalink
docs: ✏️ update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
huyikai committed Dec 18, 2023
1 parent e88e1af commit 1b1d41c
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 19 deletions.
21 changes: 18 additions & 3 deletions .github/workflows/publish.yml → .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ on:
push:
branches:
- master

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: pages
cancel-in-progress: false

jobs:
build-and-deploy:
runs-on: ubuntu-latest
Expand All @@ -16,9 +32,8 @@ jobs:
run: |
npm i
cd packages/@huyikai/vitepress-helper
npm i
npm run build
- name: Install and Build
- name: Install and Build
run: |
npm i
npm run build
Expand All @@ -33,4 +48,4 @@ jobs:
# 部署到 gh-pages 分支
target_branch: gh-pages
# 部署目录为 vitepress 的默认输出目录
build_dir: docs/.vitepress/dist
build_dir: docs/.vitepress/dist
26 changes: 16 additions & 10 deletions README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,28 @@

## 功能

- 导航:根据文件目录自动生成导航栏
- 侧边栏:根据文件目录自动生成侧边栏
- 脚手架:指导完成初始化操作
- 本地 CMS: 运行本地 CMS 以简化内容管理
- 首页:可以自定义的首页
- 导航:根据文件目录自动生成导航栏
- 侧边栏:根据文件目录自动生成侧边栏
- 脚手架:指导完成初始化操作
- 本地 CMS: 运行本地 CMS 以简化内容管理
- 首页:可以自定义的首页

## 待办

- 国际化:修改边栏和导航栏生成方法以适应国际化设置
- vue 集成:能够在 md 文件中使用 vue 组件
- 国际化兼容:修改边栏和导航栏生成方法以适应国际化设置。
- CMS:
- Markdown 编辑器使用体验优化。
- 文件、目录移动以及拖拽移动。
- 本地文件导入、批处理。
- 链接内容导入。
- 版本控制。
- 静态资源(图片)管理。

## 长期计划

- 代码:增加单测以保证代码质量
- 使用体验:优化 UI、使用逻辑、性能优化
- 文档:提供双语文档、更详细的使用说明、适当的使用示例
- 代码:增加单测以保证代码质量
- 使用体验:优化 UI、使用逻辑、性能优化
- 文档:提供双语文档、更详细的使用说明、适当的使用示例
- 探究:
- 关注 vitepress 的更新,以保持功能和体验的同步。
- 对开发及使用过程中新的灵感进行规划。
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ On the basis of [vitepress](https://vitepress.vuejs.org), optimize the user expe

## ToDo

- Internationalization: Modify the Sidebar and Navbar methods to adapt to internationalization settings
- Internationalization compatibility: Modify the methods for generating sidebar and navigation bar to adapt to internationalization settings.
- CMS:
- Optimize the experience of using Markdown editor.
- Move files and directories, and drag and drop.
- Import local files and batch processing.
- Import linked content.
- Version control.
- Management of static resources (images).

## Long-term Plan

Expand Down
File renamed without changes.
18 changes: 18 additions & 0 deletions docs/Guide/Basic/2.GettingStart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 快速开始

## 安装向导

```shell
npx @huyikai/vitepress-helper init
```

将会被问到一些简单的问题:

```shell
# 项目名称 | Project Name
# 作者 | Author
# 版本号 | Version
# 是否需要本地 CMS ? | Do you need local CMS?
```

初始化完成后,您可以运行 `npm run dev` 进行预览,如果 CMS 选择了 yes,则可以运行 `npm run cms` 进行内容管理。
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@huyikai/local-cms": "^0.0.1",
"@huyikai/vitepress-helper": "^0.0.8",
"@huyikai/vitepress-helper": "^0.0.15",
"git-cz": "^4.9.0",
"vitepress": "^1.0.0-rc.31",
"vue": "^3.3.9"
Expand Down
8 changes: 5 additions & 3 deletions packages/@huyikai/vitepress-helper/bin/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface Answers {
cms: boolean;
version: string;
}

const packageVersion = '0.0.0';
// 获取当前工作目录
const cwd = process.cwd();

Expand All @@ -23,7 +23,9 @@ export default async (answers: Answers) => {

// 初始化package.json
execSync('npm init -y');
execSync('npm install @huyikai/vitepress-helper', { stdio: 'inherit' });
execSync(`npm install @huyikai/vitepress-helper@${packageVersion}`, {
stdio: 'inherit'
});
// execSync('npm link @huyikai/vitepress-helper');

// 模板文件的路径
Expand All @@ -45,7 +47,7 @@ export default async (answers: Answers) => {
packageInfo.scripts['cms'] = cms
? 'node node_modules/@huyikai/local-cms/cms.js docs'
: undefined;
packageInfo.devDependencies['@huyikai/vitepress-helper'] = '^0.0.11';
packageInfo.devDependencies['@huyikai/vitepress-helper'] = `^${packageVersion}`;
packageInfo.devDependencies['@huyikai/local-cms'] = cms
? 'latest'
: undefined;
Expand Down
2 changes: 1 addition & 1 deletion packages/@huyikai/vitepress-helper/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@huyikai/vitepress-helper",
"version": "0.0.11",
"version": "0.0.15",
"private": false,
"description": "This tool is designed to help you to use VitePress more easily.",
"keywords": [
Expand Down
24 changes: 24 additions & 0 deletions packages/@huyikai/vitepress-helper/rollup.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
import addShebang from 'rollup-plugin-add-shebang';
import { fileURLToPath } from 'url';
import fs from 'fs';
import path from 'path';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const replaceVersion = () => {
const packageJson = JSON.parse(
fs.readFileSync(path.resolve(__dirname, 'package.json'), 'utf-8')
);
const version = packageJson.version;

return {
name: 'replace-version',
transform(code, id) {
if (id.endsWith('create.ts')) {
return code.replace(
/const packageVersion = '[^']*'/,
`const packageVersion = '${version}'`
);
}
return null;
}
};
};

export default [
{
Expand All @@ -24,6 +47,7 @@ export default [
}
],
plugins: [
replaceVersion(),
typescript({ tsconfig: 'bin/tsconfig.json' }),
terser(),
addShebang({ include: 'lib/bin/index.js' })
Expand Down

0 comments on commit 1b1d41c

Please sign in to comment.