Skip to main content

Docusaurus Tips

wKevin
一颗向上的水滴

最近学习使用 MidwayTauri,忽然对网站是怎么做出来的来了兴趣,尤其是“侧边栏和 ToC 分列左右”特别喜欢,我多年来一直使用的 Docsify 总是 ToC 混入侧边栏,让我总有些别扭。

把 Midway 和 Tauri 的网站源码下载下来,发现都是基于同一个框架:Docusaurus,就花了一些时间研究,并且把公司团队的技术积累平台修改成此框架,感觉一下高大上起来了。

官方文档已经很详细了,我这里只能做一些小提示吧。

对比 yarn 和 npm 创建 Tauri 项目

wKevin
一颗向上的水滴

一直想用前后端技术栈做个跨平台(Win/Linux/macOS)的 APP,前几年了解过 Electron,到后来始终没有应用场景,就放下了,最近又掌握了一下最新情况:

框架前端后端
ElectronAngular/VUE/Reacttypescript
WailsVUE/Reactgo
GoxygenAngular/VUE/Reactgo
TauriAngular/VUE/React/Vite/...rust

前几天恰逢有个场景,就试了一下 Tauri,相比 Electron, Tauri 不会把 node 和 chromium 打包到最终 APP,所以最终构建出的版本会小很多,运行速度也快很多。

用了 2 天跑起来了一个基本的 APP,前端 Vite + VUE4 + Element-plus + TypeScript,后端 Rust,过程记录如下。

github 无奈之举

wKevin
一颗向上的水滴

国内经常无法顺畅的连接 github,各类 git 操作都无法进行,但其实已经有团队做了 github 镜像站,比如下面要介绍的 2 个。

两个 rename

wKevin
一颗向上的水滴

windows 中有个 rename 命令,linux、macOS 中对应 mv,但其实 linux、macOS 中也有 rename,并且不止一个,语法和入参还不一样,容易让人混淆:

  1. perl rename:
  2. util-linux rename:

令人头疼的 git submodule

wKevin
一颗向上的水滴

发现若干 submodule 处于修改状态,想清理到初始状态。

$ git st
...
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
modified: AI/ML-DL/100-Days-Of-ML-Code/100-Days-Of-ML-Code (new commits)
modified: AI/ML-DL/Andrew.Ng/machine-learning-yearning (new commits)
modified: AI/challenge/kaggle/cifar-10/CIFAR10_mxnet (modified content)
modified: AI/challenge/kaggle/cifar-10/cifar10-gluon (modified content)
modified: AI/challenge/kaggle/cifar-10/densenet.pytorch (modified content)

执行下面 4 类操作都都无法清理。

git 命令演进历史

wKevin
一颗向上的水滴

对 git 的源码进行了一些分析,统计 Documentation/ 文件夹下的 git-xxx 命名的文件(即 git 命令的帮助文件)出现的版本号(tag),可以看出其生命周期,有些只出现一个版本就消亡掉了(git upload-tar),有些很晚才出现(git switch