Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
57e41a7fd6 | |||
9832aea099 | |||
dcb0c1667c | |||
25a9ba86fa | |||
cadc7dad14 | |||
a24f6a91a4 | |||
0f091beebd | |||
2c276e72ac | |||
313df63ce2 | |||
9e3b2b913f | |||
ce71a63350 | |||
96c50ca289 | |||
4460aa9246 | |||
877a763274 | |||
15c899a89f | |||
4275ee8ace | |||
7db4389708 | |||
3b8415f692 | |||
6baf60a095 | |||
489f29bb14 | |||
1dad75e9b2 |
2
.github/workflows/ci.yml
vendored
@ -45,7 +45,7 @@ jobs:
|
||||
name: ${{ steps.create_tag.outputs.version }}
|
||||
tag: ${{ steps.create_tag.outputs.version }}
|
||||
body: |
|
||||
Documentation ${{ needs.build.outputs.create_tag_version }}: https://raw.githack.com/jaywcjlove/reference/${{ needs.build.outputs.gh-pages-short-hash }}/index.html
|
||||
Documentation ${{ needs.build.outputs.create_tag_version }}: https://raw.githack.com/jaywcjlove/reference/${{ steps.changelog.outputs.gh-pages-short-hash }}/index.html
|
||||
Comparing Changes: ${{ steps.changelog.outputs.compareurl }}
|
||||
|
||||
${{ steps.changelog.outputs.changelog }}
|
||||
|
32
README.md
@ -15,32 +15,39 @@ Quick Reference
|
||||
## 编程
|
||||
|
||||
[Bash](./docs/bash.md)<!--rehype:style=background: rgb(72 143 223/var(\-\-bg\-opacity));-->
|
||||
[C](./docs/c.md)<!--rehype:style=background: rgb(92 107 192/var(\-\-bg\-opacity));-->
|
||||
[Docker](./docs/docker.md)<!--rehype:style=background: rgb(72 143 223/var(\-\-bg\-opacity));-->
|
||||
[Dockerfile](./docs/dockerfile.md)<!--rehype:style=background: rgb(0 72 153/var(\-\-bg\-opacity));-->
|
||||
[Electron](./docs/electron.md)<!--rehype:style=background: rgb(0 72 153/var(\-\-bg\-opacity));-->
|
||||
[JavaScript](./docs/javascript.md)<!--rehype:style=background: rgb(203 183 31/var(\-\-bg\-opacity));-->
|
||||
[JSON](./docs/json.md)<!--rehype:style=background: rgb(57 59 60/var(\-\-bg\-opacity));-->
|
||||
[React](./docs/react.md)<!--rehype:style=background: rgb(34 143 173/var(\-\-bg\-opacity));-->
|
||||
[HTML](./docs/html.md)<!--rehype:style=background: rgb(228 77 39/var(\-\-bg\-opacity));-->
|
||||
[Styled Components](./docs/styled-components.md)<!--rehype:style=background: rgb(221 60 184/var(\-\-bg\-opacity));-->
|
||||
[TOML](./docs/toml.md)<!--rehype:style=background: rgb(132 132 132/var(\-\-bg\-opacity));-->
|
||||
[Markdown](./docs/markdown.md)<!--rehype:style=background: rgb(103 61 156/var(\-\-bg\-opacity));-->
|
||||
[TOML](./docs/toml.md)<!--rehype:style=background: rgb(132 132 132/var(\-\-bg\-opacity));-->
|
||||
[YAML](./docs/yaml.md)<!--rehype:style=background: rgb(91 163 230/var(\-\-bg\-opacity));-->
|
||||
<!--rehype:class=home-card-->
|
||||
|
||||
## 前端
|
||||
|
||||
[CSS 3](./docs/css.md)<!--rehype:style=background: rgb(35 115 205/var(\-\-bg\-opacity));-->
|
||||
[Electron](./docs/electron.md)<!--rehype:style=background: rgb(0 72 153/var(\-\-bg\-opacity));-->
|
||||
[Emmet](./docs/emmet.md)<!--rehype:style=background: rgb(122 203 23/var(\-\-bg\-opacity));-->
|
||||
[Styled Components](./docs/styled-components.md)<!--rehype:style=background: rgb(221 60 184/var(\-\-bg\-opacity));-->
|
||||
[HTML](./docs/html.md)<!--rehype:style=background: rgb(228 77 39/var(\-\-bg\-opacity));-->
|
||||
[JavaScript](./docs/javascript.md)<!--rehype:style=background: rgb(203 183 31/var(\-\-bg\-opacity));-->
|
||||
[Jest](./docs/jest.md)<!--rehype:style=background: rgb(153 66 91/var(\-\-bg\-opacity));-->
|
||||
[Lerna](./docs/lerna.md)<!--rehype:style=background: rgb(192 132 252/var(\-\-bg\-opacity));-->
|
||||
[npm](./docs/npm.md)<!--rehype:style=background: rgb(203 2 0/var(\-\-bg\-opacity));-->
|
||||
[package.json](./docs/package.json.md)<!--rehype:style=background: rgb(132 132 132/var(\-\-bg\-opacity));-->
|
||||
[React](./docs/react.md)<!--rehype:style=background: rgb(34 143 173/var(\-\-bg\-opacity));-->
|
||||
[RegEx](./docs/regex.md)<!--rehype:style=background: rgb(149 36 155/var(\-\-bg\-opacity));-->
|
||||
[TypeScript](./docs/typescript.md)<!--rehype:style=background: rgb(49 120 198/var(\-\-bg\-opacity));-->
|
||||
[Vue 2](./docs/vue2.md)<!--rehype:style=background: rgb(64 184 131/var(\-\-bg\-opacity));-->
|
||||
[YAML](./docs/yaml.md)<!--rehype:style=background: rgb(91 163 230/var(\-\-bg\-opacity));-->
|
||||
<!--rehype:class=home-card-->
|
||||
|
||||
## 工具包
|
||||
|
||||
[Emmet](./docs/emmet.md)<!--rehype:style=background: rgb(122 203 23/var(\-\-bg\-opacity));-->
|
||||
[nginx](./docs/nginx.md)<!--rehype:style=background: rgb(0 193 9/var(\-\-bg\-opacity));-->
|
||||
[npm](./docs/npm.md)<!--rehype:style=background: rgb(203 2 0/var(\-\-bg\-opacity));-->
|
||||
[package.json](./docs/package.json.md)<!--rehype:style=background: rgb(132 132 132/var(\-\-bg\-opacity));-->
|
||||
[Semver](./docs/semver.md)<!--rehype:style=background: rgb(106 111 141/var(\-\-bg\-opacity));-->
|
||||
[Sketch](./docs/sketch.md)<!--rehype:style=background: rgb(223 148 0/var(\-\-bg\-opacity));-->
|
||||
[Sublime Text](./docs/sublime-text.md)<!--rehype:style=background: rgb(223 148 0/var(\-\-bg\-opacity));-->
|
||||
[Jest](./docs/jest.md)<!--rehype:style=background: rgb(153 66 91/var(\-\-bg\-opacity));-->
|
||||
[RegEx](./docs/regex.md)<!--rehype:style=background: rgb(149 36 155/var(\-\-bg\-opacity));-->
|
||||
[VSCode](./docs/vscode.md)<!--rehype:style=background: rgb(91 163 230/var(\-\-bg\-opacity));-->
|
||||
[Vim](./docs/vim.md)<!--rehype:style=background: rgb(9 150 8/var(\-\-bg\-opacity));-->
|
||||
[XPath](./docs/xpath.md)<!--rehype:style=background: rgb(91 163 230/var(\-\-bg\-opacity));-->
|
||||
@ -53,6 +60,7 @@ Quick Reference
|
||||
[Git](./docs/git.md)<!--rehype:style=background: rgb(215 89 62/var(\-\-bg\-opacity));-->
|
||||
[Grep](./docs/grep.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
|
||||
[find](./docs/find.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
|
||||
[htop](./docs/htop.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
|
||||
[Sed](./docs/sed.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
|
||||
[SSH](./docs/ssh.md)<!--rehype:style=background: rgb(99 99 99/var(\-\-bg\-opacity));-->
|
||||
[Screen](./docs/screen.md)<!--rehype:style=background: rgb(99 99 99/var(\-\-bg\-opacity));-->
|
||||
|
1384
docs/css.md
Normal file
@ -232,17 +232,17 @@ docker network create -d overlay \
|
||||
`docker login ` | 向 docker hub 进行身份验证
|
||||
`docker push user/image ` | 将镜像上传到 docker hub。
|
||||
|
||||
### 注册表命令
|
||||
### 镜像仓库命令
|
||||
<!--rehype:wrap-class=row-span-3-->
|
||||
|
||||
登录到注册表
|
||||
登录到镜像仓库
|
||||
|
||||
```shell
|
||||
$ docker login
|
||||
$ docker login localhost:8080
|
||||
```
|
||||
|
||||
从注册表注销
|
||||
从镜像仓库注销
|
||||
|
||||
```shell
|
||||
$ docker logout
|
||||
|
111
docs/htop.md
Normal file
@ -0,0 +1,111 @@
|
||||
htop 备忘清单
|
||||
===
|
||||
|
||||
htop 是一个交互式流程查看器,此 htop 备忘清单包含 htop 命令
|
||||
|
||||
入门
|
||||
----
|
||||
|
||||
### htop 用法
|
||||
|
||||
htop 是一个互动的进程查看器,动态观察系统进程状况
|
||||
|
||||
- [命令 htop 的官网](https://htop.sourceforge.net/)
|
||||
|
||||
```bash
|
||||
$ htop [-dChustv]
|
||||
```
|
||||
|
||||
#### 安装
|
||||
|
||||
```bash
|
||||
$ apt install htop # Debian
|
||||
$ dnf install htop # Fedora
|
||||
$ emerge sys-process/htop # Gentoo
|
||||
$ pacman -S htop # Arch Linux
|
||||
$ Compile htop # GoboLinux
|
||||
```
|
||||
|
||||
htop 的软件包在大多数发行版中都[可用下载](https://htop.dev/downloads.html)
|
||||
|
||||
### 选项示例
|
||||
<!--rehype:wrap-class=col-span-2-->
|
||||
|
||||
长选项的强制参数对于短选项也是强制的
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`-d --delay=DELAY` | 更新之间的延迟,以十分之一秒为单位
|
||||
`-C --no-color --no-colour` | 以单色模式启动 `htop`
|
||||
`-h --help` | 显示帮助消息并退出
|
||||
`-p --pid=PID,PID...` | 仅显示给定的PID
|
||||
`-s --sort-key COLUMN` | 按此列排序(对列列表使用`--sort-key`帮助)
|
||||
`-u --user=USERNAME` | 仅显示给定用户的进程
|
||||
`-v --version` | 输出版本信息并退出
|
||||
`-t --tree` | 在树状视图中显示流程
|
||||
|
||||
### 状态
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`R` | 运行中
|
||||
`S` | 休眠
|
||||
`T` | 追踪/停止
|
||||
`Z` | 僵尸
|
||||
`D` | 磁盘睡眠
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
### 交互式命令
|
||||
<!--rehype:wrap-class=col-span-2 row-span-3-->
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`F1`, `h`, `?` | 转到帮助屏幕
|
||||
`F10`, `q` | 退出
|
||||
`Space` | 标记或取消标记进程
|
||||
`U` | 取消标记所有进程(删除所有使用 Space 键添加的标记)
|
||||
`s` | 跟踪进程系统调用:如果安装了 `strace(1)`,按下此键会将其附加到当前选定的进程,呈现进程发出的系统调用的实时更新
|
||||
`l` | 显示进程打开的文件:如果安装了 `lsof(1)`,按下该键将显示进程打开的文件描述符列表
|
||||
`F2`, `S` | 转到设置屏幕,您可以在其中配置屏幕顶部显示的仪表,设置各种显示选项,在配色方案中进行选择,并选择显示的列,以何种顺序显示
|
||||
`F3`, `/` | 逐步搜索所有显示进程的命令行。当前选定(突出显示)的命令将在您键入时更新。在搜索模式下,按 `F3` 将循环匹配出现的事件
|
||||
`F4`, `\` | 增量进程过滤:输入部分进程命令行,仅显示名称匹配的进程。要取消过滤,请再次输入过滤选项并按 `Esc`
|
||||
`F5`, `t` | 树视图:按父级组织进程,并将它们之间的关系布局为树。切换键将在树和您之前选择的排序视图之间切换。选择排序视图将退出树视图
|
||||
`F6` | 在排序视图上,选择一个字段进行排序,也可以通过 < 和 > 访问。当前排序字段由标题中的突出显示。在树视图中,展开或折叠当前子树。树节点中的“+”指示符表示它已折叠
|
||||
`F7`, `]` | 增加所选进程的优先级(从“nice”值中减去)。这只能由超级用户完成
|
||||
`F8`, `[` | 降低选定进程的优先级(添加到“nice”值)
|
||||
`F9`, `k` | “杀死”进程:向一个或一组进程发送一个在菜单中选择的信号。如果进程被标记,则将信号发送到所有标记的进程。如果没有标记,则发送到当前选定的进程
|
||||
`+`, `-` | 在树视图模式下,展开或折叠子树。
|
||||
`a` | (在多 CPU 机器上)设置 CPU 亲和性:标记允许进程使用的 CPU
|
||||
`u` | 仅显示指定用户拥有的进程
|
||||
`F` | “跟随”进程:如果排序顺序导致当前选定的进程在列表中移动,则使选择栏跟随它。这对于监控进程很有用:这样,您可以使进程始终在屏幕上可见。使用移动键时,“跟随”失效。
|
||||
`p` | 在适用的情况下显示运行程序的完整路径(这是一个切换键)
|
||||
`Ctrl-L` | 刷新:重绘屏幕并重新计算数值
|
||||
`Numbers` | PID搜索:输入进程ID,选择突出显示将移至它
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
### 排序/线程
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`M` | 按`内存`使用情况排序 _(最高兼容性键)_
|
||||
`P` | 按`CPU`使用情况排序 _(最高兼容性键)_
|
||||
`T` | 按`时间`排序 _(最高兼容性键)_
|
||||
`I` | `反转`排序顺序
|
||||
`K` | 隐藏`内核`线程
|
||||
`H` | 隐藏`用户`线程
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
### 滚动
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`Up`, `Alt-k` | 在流程列表中选择(突出)`上`一个流程
|
||||
`Down`, `Alt-j` | 在流程列表中选择(突出)`下`一个流程
|
||||
`Left`, `Alt-h` | 向`左`滚动流程列表
|
||||
`Right`, `Alt-l` | 向`右`滚动进程列表
|
||||
`PgUp`, `PgDn` | 将流程列表`向上`或`向下`滚动一个窗口
|
||||
`Home` | 滚动到流程列表的`顶部` <br /> _选择第一个流程_
|
||||
`End` | 滚动到流程列表的`底部` <br /> _选择最后一个流程_
|
||||
`Ctrl-A`, `^` | 向`左`滚动到流程条目`开头` _(即行开头)_
|
||||
`Ctrl-E`, `$` | 向`右`滚动到流程条目`末尾` _(即行尾)_
|
||||
<!--rehype:className=shortcuts-->
|
@ -8,70 +8,70 @@ HTTP 状态码
|
||||
|
||||
### Means
|
||||
|
||||
- [1xx: Informational](#1xx-information) _这意味着已收到请求并且该过程正在继续。_<!--rehype:tooltips-->
|
||||
- [2xx: Success](#2xx-successful) _这意味着该操作已成功接收、理解和接受。_<!--rehype:tooltips-->
|
||||
- [3xx: Redirection](#3xx-redirection) _这意味着必须采取进一步行动才能完成请求。_<!--rehype:tooltips-->
|
||||
- [4xx: Client Error](#4xx-client-error) _这意味着请求包含不正确的语法或无法完成。_<!--rehype:tooltips-->
|
||||
- [5xx: Server Error](#5xx-server-error) _这意味着服务器未能满足明显有效的请求。_<!--rehype:tooltips-->
|
||||
- [1xx: Informational](#1xx-information) _这意味着已收到请求并且该过程正在继续_<!--rehype:tooltips-->
|
||||
- [2xx: Success](#2xx-successful) _这意味着该操作已成功接收、理解和接受_<!--rehype:tooltips-->
|
||||
- [3xx: Redirection](#3xx-redirection) _这意味着必须采取进一步行动才能完成请求_<!--rehype:tooltips-->
|
||||
- [4xx: Client Error](#4xx-client-error) _这意味着请求包含不正确的语法或无法完成_<!--rehype:tooltips-->
|
||||
- [5xx: Server Error](#5xx-server-error) _这意味着服务器未能满足明显有效的请求_<!--rehype:tooltips-->
|
||||
|
||||
### 2xx. 成功的
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
|
||||
* [200: OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) _请求没问题。_<!--rehype:tooltips-->
|
||||
* [201: Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) _请求完成,并创建了一个新资源。_<!--rehype:tooltips-->
|
||||
* [202: Accepted](https://tools.ietf.org/html/rfc7231#section-6.3.3) _接受请求进行处理,但处理未完成。_<!--rehype:tooltips-->
|
||||
* [203: Non-Authoritative Information](https://tools.ietf.org/html/rfc7231#section-6.3.4) _实体标头中的信息来自本地或第三方副本,而不是来自原始服务器。_<!--rehype:tooltips-->
|
||||
* [204: No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) _响应中给出了状态码和标头,但响应中没有实体主体。_<!--rehype:tooltips-->
|
||||
* [205: Reset Content](https://tools.ietf.org/html/rfc7231#section-6.3.6) _浏览器应清除用于此事务的表单以获取其他输入。_<!--rehype:tooltips-->
|
||||
* [206: Partial Content](https://tools.ietf.org/html/rfc7233#section-4.1) _服务器正在返回请求大小的部分数据。 用于响应指定 Range 标头的请求。 服务器必须使用 Content-Range 标头指定响应中包含的范围。_<!--rehype:tooltips-->
|
||||
* [200: OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) _请求没问题_<!--rehype:tooltips-->
|
||||
* [201: Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) _请求完成,并创建了一个新资源_<!--rehype:tooltips-->
|
||||
* [202: Accepted](https://tools.ietf.org/html/rfc7231#section-6.3.3) _接受请求进行处理,但处理未完成_<!--rehype:tooltips-->
|
||||
* [203: Non-Authoritative Information](https://tools.ietf.org/html/rfc7231#section-6.3.4) _实体标头中的信息来自本地或第三方副本,而不是来自原始服务器_<!--rehype:tooltips-->
|
||||
* [204: No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) _响应中给出了状态码和标头,但响应中没有实体主体_<!--rehype:tooltips-->
|
||||
* [205: Reset Content](https://tools.ietf.org/html/rfc7231#section-6.3.6) _浏览器应清除用于此事务的表单以获取其他输入_<!--rehype:tooltips-->
|
||||
* [206: Partial Content](https://tools.ietf.org/html/rfc7233#section-4.1) _服务器正在返回请求大小的部分数据。 用于响应指定 Range 标头的请求。 服务器必须使用 Content-Range 标头指定响应中包含的范围_<!--rehype:tooltips-->
|
||||
|
||||
### 4xx. 客户端错误
|
||||
<!--rehype:wrap-class=row-span-3-->
|
||||
|
||||
* [400: Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1) _服务器不理解该请求。_<!--rehype:tooltips-->
|
||||
* [401: Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1) _请求的页面需要用户名和密码。_<!--rehype:tooltips-->
|
||||
* [402: Payment Required](https://tools.ietf.org/html/rfc7231#section-6.5.2) _您还不能使用此代码。_<!--rehype:tooltips-->
|
||||
* [403: Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3) _禁止访问请求的页面。_<!--rehype:tooltips-->
|
||||
* [404: Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4) _服务器找不到请求的页面。_<!--rehype:tooltips-->
|
||||
* [405: Method Not Allowed](https://tools.ietf.org/html/rfc7231#section-6.5.5) _请求中指定的方法是不允许的。_<!--rehype:tooltips-->
|
||||
* [406: Not Acceptable](https://tools.ietf.org/html/rfc7231#section-6.5.6) _服务器只能生成客户端不接受的响应。_<!--rehype:tooltips-->
|
||||
* [407: Proxy Authentication Required](https://tools.ietf.org/html/rfc7235#section-3.2) _您必须先通过代理服务器进行身份验证,然后才能提供此请求。_<!--rehype:tooltips-->
|
||||
* [408: Request Timeout](https://tools.ietf.org/html/rfc7231#section-6.5.7) _请求花费的时间比服务器准备等待的时间长。_<!--rehype:tooltips-->
|
||||
* [409: Conflict](https://tools.ietf.org/html/rfc7231#section-6.5.8) _由于冲突,请求无法完成。_<!--rehype:tooltips-->
|
||||
* [410: Gone](https://tools.ietf.org/html/rfc7231#section-6.5.9) _请求的页面不再可用。_<!--rehype:tooltips-->
|
||||
* [411: Length Required](https://tools.ietf.org/html/rfc7231#section-6.5.10) _“Content-Length”未定义。 没有它,服务器将不会接受请求。_<!--rehype:tooltips-->
|
||||
* [412: Precondition Failed](https://tools.ietf.org/html/rfc7232#section-4.2) _请求中给出的前提条件被服务器评估为 false。_<!--rehype:tooltips-->
|
||||
* [413: Payload Too Large](https://tools.ietf.org/html/rfc7231#section-6.5.11) _服务器不会接受请求,因为请求实体太大。_<!--rehype:tooltips-->
|
||||
* [414: URI Too Long](https://tools.ietf.org/html/rfc7231#section-6.5.12) _服务器不会接受请求,因为 url 太长。 当您将“发布”请求转换为具有长查询信息的“获取”请求时发生。_<!--rehype:tooltips-->
|
||||
* [415: Unsupported Media Type](https://tools.ietf.org/html/rfc7231#section-6.5.13) _服务器不会接受请求,因为不支持媒体类型。_<!--rehype:tooltips-->
|
||||
* [416: Range Not Satisfiable](https://tools.ietf.org/html/rfc7233#section-4.4) _请求的字节范围不可用且超出范围。_<!--rehype:tooltips-->
|
||||
* [417: Expectation Failed](https://tools.ietf.org/html/rfc7231#section-6.5.14) _此服务器无法满足在 Expect 请求标头字段中给出的期望。_<!--rehype:tooltips-->
|
||||
* [426: Upgrade Required](https://tools.ietf.org/html/rfc7231#section-6.5.15) _服务器拒绝使用当前协议执行请求,但在客户端升级到不同协议后可能愿意这样做。_<!--rehype:tooltips-->
|
||||
* [451: Unavailable For Legal Reasons](https://datatracker.ietf.org/doc/html/rfc7725#section-3) _此状态代码表示服务器拒绝访问资源作为法律要求的结果。_<!--rehype:tooltips-->
|
||||
* [400: Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1) _服务器不理解该请求_<!--rehype:tooltips-->
|
||||
* [401: Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1) _请求的页面需要用户名和密码_<!--rehype:tooltips-->
|
||||
* [402: Payment Required](https://tools.ietf.org/html/rfc7231#section-6.5.2) _您还不能使用此代码_<!--rehype:tooltips-->
|
||||
* [403: Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3) _禁止访问请求的页面_<!--rehype:tooltips-->
|
||||
* [404: Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4) _服务器找不到请求的页面_<!--rehype:tooltips-->
|
||||
* [405: Method Not Allowed](https://tools.ietf.org/html/rfc7231#section-6.5.5) _请求中指定的方法是不允许的_<!--rehype:tooltips-->
|
||||
* [406: Not Acceptable](https://tools.ietf.org/html/rfc7231#section-6.5.6) _服务器只能生成客户端不接受的响应_<!--rehype:tooltips-->
|
||||
* [407: Proxy Authentication Required](https://tools.ietf.org/html/rfc7235#section-3.2) _您必须先通过代理服务器进行身份验证,然后才能提供此请求_<!--rehype:tooltips-->
|
||||
* [408: Request Timeout](https://tools.ietf.org/html/rfc7231#section-6.5.7) _请求花费的时间比服务器准备等待的时间长_<!--rehype:tooltips-->
|
||||
* [409: Conflict](https://tools.ietf.org/html/rfc7231#section-6.5.8) _由于冲突,请求无法完成_<!--rehype:tooltips-->
|
||||
* [410: Gone](https://tools.ietf.org/html/rfc7231#section-6.5.9) _请求的页面不再可用_<!--rehype:tooltips-->
|
||||
* [411: Length Required](https://tools.ietf.org/html/rfc7231#section-6.5.10) _“Content-Length”未定义。 没有它,服务器将不会接受请求_<!--rehype:tooltips-->
|
||||
* [412: Precondition Failed](https://tools.ietf.org/html/rfc7232#section-4.2) _请求中给出的前提条件被服务器评估为 false_<!--rehype:tooltips-->
|
||||
* [413: Payload Too Large](https://tools.ietf.org/html/rfc7231#section-6.5.11) _服务器不会接受请求,因为请求实体太大_<!--rehype:tooltips-->
|
||||
* [414: URI Too Long](https://tools.ietf.org/html/rfc7231#section-6.5.12) _服务器不会接受请求,因为 url 太长。 当您将“发布”请求转换为具有长查询信息的“获取”请求时发生_<!--rehype:tooltips-->
|
||||
* [415: Unsupported Media Type](https://tools.ietf.org/html/rfc7231#section-6.5.13) _服务器不会接受请求,因为不支持媒体类型_<!--rehype:tooltips-->
|
||||
* [416: Range Not Satisfiable](https://tools.ietf.org/html/rfc7233#section-4.4) _请求的字节范围不可用且超出范围_<!--rehype:tooltips-->
|
||||
* [417: Expectation Failed](https://tools.ietf.org/html/rfc7231#section-6.5.14) _此服务器无法满足在 Expect 请求标头字段中给出的期望_<!--rehype:tooltips-->
|
||||
* [426: Upgrade Required](https://tools.ietf.org/html/rfc7231#section-6.5.15) _服务器拒绝使用当前协议执行请求,但在客户端升级到不同协议后可能愿意这样做_<!--rehype:tooltips-->
|
||||
* [451: Unavailable For Legal Reasons](https://datatracker.ietf.org/doc/html/rfc7725#section-3) _此状态代码表示服务器拒绝访问资源作为法律要求的结果_<!--rehype:tooltips-->
|
||||
|
||||
### 1xx. 信息
|
||||
|
||||
* [100: Continue](https://tools.ietf.org/html/rfc7231#section-6.2.1) _服务器只收到了请求的一部分,但只要没有被拒绝,客户端就应该继续请求。_<!--rehype:tooltips-->
|
||||
* [101: Switching Protocols](https://tools.ietf.org/html/rfc7231#section-6.2.2) _服务器切换协议。_<!--rehype:tooltips-->
|
||||
* [102: Processing](https://tools.ietf.org/html/rfc2518#section-10.1) _用于通知客户端服务器已接受完整请求但尚未完成的临时响应。_<!--rehype:tooltips-->
|
||||
* [100: Continue](https://tools.ietf.org/html/rfc7231#section-6.2.1) _服务器只收到了请求的一部分,但只要没有被拒绝,客户端就应该继续请求_<!--rehype:tooltips-->
|
||||
* [101: Switching Protocols](https://tools.ietf.org/html/rfc7231#section-6.2.2) _服务器切换协议_<!--rehype:tooltips-->
|
||||
* [102: Processing](https://tools.ietf.org/html/rfc2518#section-10.1) _用于通知客户端服务器已接受完整请求但尚未完成的临时响应_<!--rehype:tooltips-->
|
||||
|
||||
### 3xx. 重定向
|
||||
|
||||
* [300: Multiple Choices](https://tools.ietf.org/html/rfc7231#section-6.4.1) _一个链接列表。 用户可以选择一个链接并转到该位置。 最多五个地址。_<!--rehype:tooltips-->
|
||||
* [301: Moved Permanently](https://tools.ietf.org/html/rfc7231#section-6.4.2) _请求的页面已移至新的 url 。_<!--rehype:tooltips-->
|
||||
* [302: Found](https://tools.ietf.org/html/rfc7231#section-6.4.3) _请求的页面已临时移动到新的 url 。_<!--rehype:tooltips-->
|
||||
* [303: See Other](https://tools.ietf.org/html/rfc7231#section-6.4.4) _请求的页面可以在不同的 url 下找到。_<!--rehype:tooltips-->
|
||||
* [304: Not Modified](https://tools.ietf.org/html/rfc7232#section-4.1) _这是对 If-Modified-Since 或 If-None-Match 标头的响应代码,其中 URL 自指定日期以来未修改。_<!--rehype:tooltips-->
|
||||
* [305: Use Proxy](https://tools.ietf.org/html/rfc7231#section-6.4.5) _请求的 URL 必须通过 Location 标头中提到的代理访问。_<!--rehype:tooltips-->
|
||||
* [306: Unused](https://tools.ietf.org/html/rfc7231#section-6.4.6) _此代码在以前的版本中使用过。 它不再使用,但代码被保留。_<!--rehype:tooltips-->
|
||||
* [307: Temporary Redirect](https://tools.ietf.org/html/rfc7231#section-6.4.7) _请求的页面已临时移动到新的 url。_<!--rehype:tooltips-->
|
||||
* [300: Multiple Choices](https://tools.ietf.org/html/rfc7231#section-6.4.1) _一个链接列表。 用户可以选择一个链接并转到该位置。 最多五个地址_<!--rehype:tooltips-->
|
||||
* [301: Moved Permanently](https://tools.ietf.org/html/rfc7231#section-6.4.2) _请求的页面已移至新的 url _<!--rehype:tooltips-->
|
||||
* [302: Found](https://tools.ietf.org/html/rfc7231#section-6.4.3) _请求的页面已临时移动到新的 url _<!--rehype:tooltips-->
|
||||
* [303: See Other](https://tools.ietf.org/html/rfc7231#section-6.4.4) _请求的页面可以在不同的 url 下找到_<!--rehype:tooltips-->
|
||||
* [304: Not Modified](https://tools.ietf.org/html/rfc7232#section-4.1) _这是对 If-Modified-Since 或 If-None-Match 标头的响应代码,其中 URL 自指定日期以来未修改_<!--rehype:tooltips-->
|
||||
* [305: Use Proxy](https://tools.ietf.org/html/rfc7231#section-6.4.5) _请求的 URL 必须通过 Location 标头中提到的代理访问_<!--rehype:tooltips-->
|
||||
* [306: Unused](https://tools.ietf.org/html/rfc7231#section-6.4.6) _此代码在以前的版本中使用过。 它不再使用,但代码被保留_<!--rehype:tooltips-->
|
||||
* [307: Temporary Redirect](https://tools.ietf.org/html/rfc7231#section-6.4.7) _请求的页面已临时移动到新的 url_<!--rehype:tooltips-->
|
||||
|
||||
### 5xx. 服务器错误
|
||||
|
||||
* [500: Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1) _请求未完成。 服务器遇到了意外情况_<!--rehype:tooltips-->
|
||||
* [501: Not Implemented](https://tools.ietf.org/html/rfc7231#section-6.6.2) _请求未完成。 服务器不支持所需的功能_<!--rehype:tooltips-->
|
||||
* [502: Bad Gateway](https://tools.ietf.org/html/rfc7231#section-6.6.3) _请求未完成。 服务器收到来自上游服务器的无效响应_<!--rehype:tooltips-->
|
||||
* [503: Service Unavailable](https://tools.ietf.org/html/rfc7231#section-6.6.4) _请求未完成。 服务器暂时超载或停机_<!--rehype:tooltips-->
|
||||
* [500: Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1) _请求未完成。服务器遇到了意外情况_<!--rehype:tooltips-->
|
||||
* [501: Not Implemented](https://tools.ietf.org/html/rfc7231#section-6.6.2) _请求未完成。服务器不支持所需的功能_<!--rehype:tooltips-->
|
||||
* [502: Bad Gateway](https://tools.ietf.org/html/rfc7231#section-6.6.3) _请求未完成。服务器收到来自上游服务器的无效响应_<!--rehype:tooltips-->
|
||||
* [503: Service Unavailable](https://tools.ietf.org/html/rfc7231#section-6.6.4) _请求未完成。服务器暂时超载或停机_<!--rehype:tooltips-->
|
||||
* [504: Gateway Timeout](https://tools.ietf.org/html/rfc7231#section-6.6.5) _网关已超时_<!--rehype:tooltips-->
|
||||
* [505: HTTP Version Not Supported](https://tools.ietf.org/html/rfc7231#section-6.6.6) _服务器不支持“http 协议”版本_<!--rehype:tooltips-->
|
||||
|
||||
@ -79,41 +79,41 @@ HTTP 状态码
|
||||
|
||||
:- | -
|
||||
---- | ----
|
||||
`200` | 返回成功,GET,DELETE 请求成功。
|
||||
`204` | 无内容,POST 请求成功。
|
||||
`301` | 永久重定向。
|
||||
`302/307` | 临时重定向。
|
||||
`304` | 未修改,自上次请求以来。
|
||||
`331` | 用户名正确,需要密码。
|
||||
`332` | 需要登录帐户。
|
||||
`400` | 错误请求,缺少 API 请求的必需属性。
|
||||
`401` | 未授权,无效凭据进行身份验证将。
|
||||
`403` | 禁地,该请求不被允许。
|
||||
`404` | 未找到,无法访问资源
|
||||
`405` | 方法不允许,不支持该请求。
|
||||
`409` | 冲突,冲突资源已存在。
|
||||
`412` | 该请求被拒绝。
|
||||
`422` | 无法处理,无法处理该实体。
|
||||
`429` | 请求过多,用户超出了应用速率限制。
|
||||
`500` | 服务器错误,在处理请求时,服务器出现问题。
|
||||
`530` | 未登录。
|
||||
`200` | 返回成功,GET,DELETE 请求成功
|
||||
`204` | 无内容,POST 请求成功
|
||||
`301` | 永久重定向
|
||||
`302/307` | 临时重定向
|
||||
`304` | 未修改,自上次请求以来
|
||||
`331` | 用户名正确,需要密码
|
||||
`332` | 需要登录帐户
|
||||
`400` | 错误请求,缺少 API 请求的必需属性
|
||||
`401` | 未授权,无效凭据进行身份验证将
|
||||
`403` | 禁地,该请求不被允许
|
||||
`404` | 未找到,无法访问资
|
||||
`405` | 方法不允许,不支持该请求
|
||||
`409` | 冲突,冲突资源已存在
|
||||
`412` | 该请求被拒绝
|
||||
`422` | 无法处理,无法处理该实体
|
||||
`429` | 请求过多,用户超出了应用速率限制
|
||||
`500` | 服务器错误,在处理请求时,服务器出现问题
|
||||
`530` | 未登录
|
||||
|
||||
### 5xx 永久性否定
|
||||
<!--rehype:wrap-class=col-span-2-->
|
||||
|
||||
:- | -
|
||||
---- | ----
|
||||
`500` | 语法错误,命令无法识别。这可能包括诸如命令行太长之类的错误。
|
||||
`501` | 在参数中有语法错误。
|
||||
`502` | 未执行命令。
|
||||
`503` | 错误的命令序列。
|
||||
`504` | 未执行该参数的命令。
|
||||
`530` | 未登录。
|
||||
`532` | 存储文件需要帐户。
|
||||
`550` | 未执行请求的操作。文件不可用(例如,未找到文件,没有访问权限)。
|
||||
`551` | 请求的操作异常终止:未知的页面类型。
|
||||
`552` | 请求的文件操作异常终止:超出存储分配(对于当前目录或数据集)。
|
||||
`553` | 未执行请求的操作。不允许的文件名。
|
||||
`500` | 语法错误,命令无法识别。这可能包括诸如命令行太长之类的错误
|
||||
`501` | 在参数中有语法错误
|
||||
`502` | 未执行命令
|
||||
`503` | 错误的命令序列
|
||||
`504` | 未执行该参数的命令
|
||||
`530` | 未登录
|
||||
`532` | 存储文件需要帐户
|
||||
`550` | 未执行请求的操作。文件不可用(例如,未找到文件,没有访问权限)
|
||||
`551` | 请求的操作异常终止:未知的页面类型
|
||||
`552` | 请求的文件操作异常终止:超出存储分配(对于当前目录或数据集)
|
||||
`553` | 未执行请求的操作。不允许的文件名
|
||||
|
||||
永久性否定的完成答复,该命令不成功,错误是永久性的。如果客户端重试命令,将再次出现同样的错误。
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
Jest 备忘清单
|
||||
===
|
||||
|
||||
Jest 是一款优雅、简洁的 JavaScript 测试框架。
|
||||
Jest 是一款优雅、简洁的 JavaScript 测试框架,这里介绍了它的入门和 一些 API 的索引。
|
||||
|
||||
入门
|
||||
----
|
||||
@ -10,7 +10,7 @@ Jest 是一款优雅、简洁的 JavaScript 测试框架。
|
||||
### 介绍
|
||||
<!--rehype:wrap-class=col-span-2 row-span-2-->
|
||||
|
||||
[Jest](https://jestjs.io/) 是一款优雅、简洁的 JavaScript 测试框架。
|
||||
[Jest v29](https://jestjs.io/) 是一款优雅、简洁的 JavaScript 测试框架。
|
||||
|
||||
- `无需配置` 大多数 JS 项目中即装即用,无需配置
|
||||
- `优秀接口` 从 `it` 到 `expect` - Jest 将工具包整合在一处。文档齐全、不断维护,非常不错。
|
||||
|
568
docs/lerna.md
Normal file
@ -0,0 +1,568 @@
|
||||
Lerna 备忘清单
|
||||
===
|
||||
|
||||
本备忘单旨在快速理解 [Lerna v6](https://github.com/lerna/lerna) 所涉及的主要概念,显示了它的常用命令使用清单。
|
||||
|
||||
入门
|
||||
----
|
||||
|
||||
### 介绍
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
|
||||
现代构建系统,用于管理和发布来自同一存储库的多个 JavaScript/TypeScript 包。
|
||||
|
||||
```bash
|
||||
$ npx lerna@latest init
|
||||
```
|
||||
|
||||
下面是示例目录结构
|
||||
|
||||
```shell {15}
|
||||
├── README.md
|
||||
├── remixapp # web 应用 (remixapp)
|
||||
│ ├── src
|
||||
│ └── package.json
|
||||
│
|
||||
├── packages
|
||||
│ ├── footer # 组件(@remixapp/footer)
|
||||
│ │ ├── src
|
||||
│ │ └── package.json
|
||||
│ │
|
||||
│ └── header # 组件(@remixapp/header)
|
||||
│ ├── src
|
||||
│ └── package.json
|
||||
│
|
||||
├── lerna.json
|
||||
└── package.json
|
||||
```
|
||||
|
||||
### 引导程序 (Bootstrap)
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
|
||||
它在 `package.json` 中依赖于它们,如下所示:
|
||||
|
||||
```json {3,4}
|
||||
"dependencies": {
|
||||
// ....
|
||||
"@remixapp/header": "*",
|
||||
"@remixapp/footer": "*"
|
||||
}
|
||||
```
|
||||
|
||||
`remixapp` 应用程序导入`页眉`和`页脚`库,如下所示:
|
||||
|
||||
```jsx
|
||||
import { Header } from "header";
|
||||
import { Footer } from "footer";
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<>
|
||||
<Header />
|
||||
<div>Content!</div>
|
||||
<Footer />
|
||||
</>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
### useWorkspaces
|
||||
|
||||
```json {3}
|
||||
{
|
||||
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
|
||||
"useWorkspaces": true,
|
||||
"version": "0.0.0"
|
||||
}
|
||||
```
|
||||
<!--rehype:className=wrap-text -->
|
||||
|
||||
在 `lerna.json` 中配置 `useWorkspaces` 告诉 `Lerna` 将包链接过程委托给你的包管理器 (此功能由 npm、yarn 和 pnpm 支持)。
|
||||
|
||||
### 任务运行
|
||||
|
||||
```bash
|
||||
npx lerna run test --scope=header # 单个
|
||||
```
|
||||
|
||||
多个任务运行
|
||||
|
||||
```bash
|
||||
npx lerna run test --scope=header,footer
|
||||
```
|
||||
|
||||
忽略 `header`,`footer` 其它包中运行任务运行
|
||||
|
||||
```bash
|
||||
npx lerna run build --ignore=header,footer
|
||||
```
|
||||
|
||||
命令索引
|
||||
---
|
||||
|
||||
### run/exec 运行命令
|
||||
|
||||
```bash
|
||||
# 在所有包含它的包中运行 npm run my-script
|
||||
$ lerna run <script> -- [..args]
|
||||
$ lerna run test
|
||||
$ lerna run build
|
||||
|
||||
# 观看所有包并在更改时转换,流式前缀输出
|
||||
$ lerna run --parallel watch
|
||||
|
||||
# 在所有包中运行命令
|
||||
$ lerna exec -- <command> [..args]
|
||||
$ lerna exec -- rm -rf ./node_modules
|
||||
$ lerna exec -- protractor conf.js
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`--npm-client <client>` [#](https://github.com/lerna/lerna/tree/main/commands/run#--npm-client-client) | 必须是知道如何运行 npm 生命周期脚本的可执行文件,默认值是 `npm`
|
||||
`--stream` [#](https://github.com/lerna/lerna/tree/main/commands/run#--stream) | 立即从子进程流式输出,以原始包名称为前缀
|
||||
`--parallel` [#](https://github.com/lerna/lerna/tree/main/commands/run#--parallel) | 类似于 `--stream` 但完全忽略并发和拓扑排序,立即在所有匹配的包中运行给定的命令或脚本,并带有前缀流输出
|
||||
`--no-bail` [#](https://github.com/lerna/lerna/tree/main/commands/run#--no-bail) | 默认情况下,如果任何脚本运行返回非零退出代码,`lerna run` 将退出并出现错误。传递 `--no-bail` 以禁用此行为
|
||||
`--no-prefix` [#](https://github.com/lerna/lerna/tree/main/commands/run#--no-prefix) | 当输出为流式传输(`--stream` 或 `--parallel`)时禁用包名称前缀。当将结果传送到其他进程(例如编辑器插件)时,此选项很有用
|
||||
`--profile` [#](https://github.com/lerna/lerna/tree/main/commands/run#--profile) | 分析脚本执行并生成性能配置文件
|
||||
`--profile-location <location>` [#](https://github.com/lerna/lerna/tree/main/commands/run#--profile-location-location) | 您可以为性能配置文件输出提供自定义位置。提供的路径将相对于当前工作目录进行解析。
|
||||
`useNx=false` [#](https://github.com/lerna/lerna/tree/main/commands/run#usenxfalse) | 通过将 `useNx` 设置为 `false`,您可以使用 `lerna` 中的遗留任务运行实现 (`p-map` 和 `p-queue`),而不是使用由 [Nx](https://nx.dev) 提供支持的默认现代任务运行器实现。
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
### publish 发布包
|
||||
<!--rehype:wrap-class=row-span-3-->
|
||||
|
||||
```bash
|
||||
# 发布自上次发布以来已更改的软件包
|
||||
$ lerna publish
|
||||
# 显式发布在当前提交中标记的包
|
||||
$ lerna publish from-git
|
||||
# 显式发布注册表中不存在最新版本的软件包
|
||||
$ lerna publish from-package
|
||||
# 使用下一个语义预发布版本,例如
|
||||
$ lerna publish --canary
|
||||
# 1.0.0 => 1.0.1-alpha.0+${SHA}
|
||||
# 自上次提交以来更改的包
|
||||
# 随后的金丝雀发布将产生1.0.1-alpha.1+${SHA}等
|
||||
|
||||
$ lerna publish --canary --preid beta
|
||||
# 1.0.0 => 1.0.1-beta.0+${SHA}
|
||||
|
||||
# 以下是等价的:
|
||||
$ lerna publish --canary minor
|
||||
$ lerna publish --canary preminor
|
||||
# 1.0.0 => 1.1.0-alpha.0+${SHA}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`--canary` [#](https://github.com/lerna/lerna/tree/main/commands/publish#--canary) | 使用此标志运行时,以更精细的方式(每次提交)发布包
|
||||
`--contents <dir>` [#](https://github.com/lerna/lerna/tree/main/commands/publish#--contents-dir) | 要发布的子目录。 必须适用于所有包,并且必须包含 `package.json` 文件
|
||||
`--dist-tag <tag>` [#](https://github.com/lerna/lerna/tree/main/commands/publish#--dist-tag-tag) | 使用此标志运行时,将使用给定的 `npm dist-tag`(默认为 `latest`)发布到 `npm`
|
||||
`--git-head <sha>` [#](https://github.com/lerna/lerna/tree/main/commands/publish#--git-head-sha) | 打包 `tarball` 时将显式 `SHA` 设置为清单上的 `gitHead`,仅允许使用 `from-package` 位置
|
||||
`--graph-type <all\|dependencies>` [#](https://github.com/lerna/lerna/tree/main/commands/publish#--graph-type-alldependencies) | 设置在构建包图时使用哪种依赖项。默认值是依赖项,即仅包含包的 `package.json` 的依赖项部分中列出的包
|
||||
`--ignore-scripts` [#](https://github.com/lerna/lerna/tree/main/commands/publish#--ignore-scripts) | 传递时,此标志将在 `lerna` 发布期间禁用运行[生命周期脚本](https://github.com/lerna/lerna/tree/main/commands/publish#lifecycle-scripts)
|
||||
`--ignore-prepublish` [#](https://github.com/lerna/lerna/tree/main/commands/publish#--ignore-prepublish) | 传递时,此标志将禁用在 `lerna` 发布期间运行[已弃用](https://docs.npmjs.com/cli/v8/using-npm/scripts#prepare-and-prepublish)的[预发布脚本](https://github.com/lerna/lerna/tree/main/commands/publish#lifecycle-scripts)
|
||||
`--legacy-auth` [#](https://github.com/lerna/lerna/tree/main/commands/publish#--legacy-auth) | 发布需要身份验证的包时,您正在使用仅使用旧版 `Base64` `用户名:密码` 的内部托管 NPM 注册表。这与 NPM 发布 `_auth` 标志相同
|
||||
`--no-git-reset` [#](https://github.com/lerna/lerna/tree/main/commands/publish#--no-git-reset) | 默认情况下,`lerna publish` 确保对工作树的任何更改都已重置
|
||||
`--no-granular-pathspec` [#](https://github.com/lerna/lerna/tree/main/commands/publish#--no-granular-pathspec) | 默认情况下,`lerna publish` 将尝试(如果启用)`git checkout` 仅在发布过程中临时修改的叶包清单
|
||||
`--verify-access` [#](https://github.com/lerna/lerna/tree/main/commands/publish#--verify-access) | 从历史上看,`lerna` 试图通过使用给定令牌执行一些抢占式 `npm API` 请求来快速解决授权/身份验证问题
|
||||
`--otp` [#](https://github.com/lerna/lerna/tree/main/commands/publish#--otp) | 发布需要双重身份验证的包时,您可以使用 `--otp` 指定一次性密码
|
||||
`--preid` [#](https://github.com/lerna/lerna/tree/main/commands/publish#--preid) | 与同名的 `lerna` 版本选项不同,该选项只适用于 `--canary` 版本计算
|
||||
`--pre-dist-tag <tag>` [#](https://github.com/lerna/lerna/tree/main/commands/publish#--pre-dist-tag-tag) | 与 `--dist-tag` 的工作方式相同,但仅适用于使用预发布版本发布的软件包
|
||||
`--registry <url>` [#](https://github.com/lerna/lerna/tree/main/commands/publish#--registry-url) | 使用此标志运行时,转发的 `npm` 命令将为您的包使用指定的注册表
|
||||
`--tag-version-prefix` [#](https://github.com/lerna/lerna/tree/main/commands/publish#--tag-version-prefix) | 此选项允许提供自定义前缀而不是默认前缀:`v`
|
||||
`--temp-tag` [#](https://github.com/lerna/lerna/tree/main/commands/publish#--temp-tag) | 传递时,此标志将更改默认发布过程,首先将所有更改的包发布到临时 `dist-tag(lerna-temp)`,然后将新版本移动到 `--dist-tag` 配置的 `dist-tag` (默认`latest`)
|
||||
`--yes` [#](https://github.com/lerna/lerna/tree/main/commands/publish#--yes) | 使用此标志运行时,`lerna publish` 将跳过所有确认提示
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
#### 不推荐使用的选项
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`--no-verify-access` [#](https://github.com/lerna/lerna/tree/main/commands/publish#--no-verify-access) | 旧的抢先访问验证现在默认关闭,因此不需要 `--no-verify-access`
|
||||
`--skip-npm` [#](https://github.com/lerna/lerna/tree/main/commands/publish#--skip-npm) | 直接调用 [lerna version](#version-修改版本号)
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
#### 每个包中的配置
|
||||
|
||||
```json
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"registry": "http://my-registry.com",
|
||||
"tag": "flippin-sweet",
|
||||
"directory": "dist"
|
||||
}
|
||||
```
|
||||
|
||||
----
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`access` [#](https://github.com/lerna/lerna/tree/main/commands/publish#publishconfigaccess) | 要发布具有范围的包(例如,`@mycompany/rocks`)
|
||||
`registry` [#](https://github.com/lerna/lerna/tree/main/commands/publish#publishconfigregistry) | 通过设置注册表来自定义每个包的注册表
|
||||
`tag` [#](https://github.com/lerna/lerna/tree/main/commands/publish#publishconfigtag) | 您可以通过设置标签来自定义每个包的 `dist-tag`
|
||||
`directory` [#](https://github.com/lerna/lerna/tree/main/commands/publish#publishconfigtag) | 这个 _非标准_ 字段允许您像 `--contents` 一样自定义发布的子目录,但基于每个包
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
### version 修改版本号
|
||||
<!--rehype:wrap-class=row-span-3-->
|
||||
|
||||
```bash
|
||||
$ lerna version 1.0.1 # 明确的
|
||||
$ lerna version patch # semver 关键字
|
||||
$ lerna version # 从提示中选择
|
||||
|
||||
$ lerna version [major | minor | ...]
|
||||
# 使用下一个语义版本值
|
||||
# 这会跳过“为...选择新版本”提示
|
||||
# 强制所有包版本化
|
||||
$ lerna version --force-publish
|
||||
$ lerna version -m "chore(doc): publish %s"
|
||||
# 提交消息 = "chore(doc): publish v1.0.0"
|
||||
$ lerna version -m "chore(doc): publish %v"
|
||||
# 提交消息 = "chore(doc): publish 1.0.0"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
- `major` 重大的
|
||||
- `minor` 次要的
|
||||
- `patch` 修补
|
||||
- `premajor` 主要的
|
||||
- `preminor` 初级
|
||||
- `prepatch` 预补丁
|
||||
- `prerelease` 预发行
|
||||
<!--rehype:className=cols-2-->
|
||||
|
||||
----
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`--allow-branch <glob>` [#](https://github.com/lerna/lerna/tree/main/commands/version#--allow-branch-glob) | 与启用 `lerna version` 的 `git` 分支匹配的 `glob` 白名单
|
||||
`--amend` [#](https://github.com/lerna/lerna/tree/main/commands/version#--amend) | 使用此标志运行时,`lerna version` 将在当前提交上执行所有更改,而不是添加新的
|
||||
`--changelog-preset` [#](https://github.com/lerna/lerna/tree/main/commands/version#--changelog-preset) | 默认情况下,更改日志预设设置为 [angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular#angular-convention)
|
||||
`--conventional-commits` [#](https://github.com/lerna/lerna/tree/main/commands/version#--conventional-commits) | 使用常规提交规范来确定[版本 bump](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-recommended-bump) 并生成 CHANGELOG.md 文件
|
||||
`--conventional-graduate` [#](https://github.com/lerna/lerna/tree/main/commands/version#--conventional-graduate) | 将使用 `*` 对指定的包(逗号分隔)或所有包进行分级
|
||||
`--conventional-prerelease` [#](https://github.com/lerna/lerna/tree/main/commands/version#--conventional-prerelease) | 预发布版本发布指定的包
|
||||
`--create-release <type>` [#](https://github.com/lerna/lerna/tree/main/commands/version#--create-release-type) | 根据更改的包创建正式的 `GitHub` 或 `GitLab` 版本
|
||||
`--exact` [#](https://github.com/lerna/lerna/tree/main/commands/version#--exact) | 在更新的包中精确指定更新的依赖项(没有标点符号),而不是与 [semver](./semver.md) 兼容(使用`^`)
|
||||
`--force-publish` [#](https://github.com/lerna/lerna/tree/main/commands/version#--force-publish) | 强制发布指定的包
|
||||
`--git-remote <name>` [#](https://github.com/lerna/lerna/tree/main/commands/version#--git-remote-name) | 把 `git` 更改推送到指定的远程位置,而不是`origin`
|
||||
`--ignore-changes` [#](https://github.com/lerna/lerna/tree/main/commands/version#--ignore-changes) | 检测更改的包时忽略与 `glob` 匹配的文件中的更改
|
||||
`--ignore-scripts` [#](https://github.com/lerna/lerna/tree/main/commands/version#--ignore-scripts) | 禁用在 `lerna version` 期间运行的生命周期脚本
|
||||
`--include-merged-tags` [#](https://github.com/lerna/lerna/tree/main/commands/version#--include-merged-tags) | 在检测到更改的包时包括来自合并分支的标签
|
||||
`--message <msg>` [#](https://github.com/lerna/lerna/tree/main/commands/version#--message-msg) | 此选项别名为 `-m` 以与 `git commit` 进行奇偶校验
|
||||
`--no-changelog` [#](https://github.com/lerna/lerna/tree/main/commands/version#--no-changelog) | 使用常规提交时,不要生成任何 CHANGELOG.md 文件
|
||||
`--no-commit-hooks` [#](https://github.com/lerna/lerna/tree/main/commands/version#--no-commit-hooks) | 允许 `git commit hooks` 在提交版本更改时运行。通过 `--no-commit-hooks` 禁用此行为
|
||||
`--no-git-tag-version` [#](https://github.com/lerna/lerna/tree/main/commands/version#--no-git-tag-version) | 将提交对 `package.json` 文件的更改并标记发布。通过 `--no-git-tag-version` 禁用该行为
|
||||
`--no-granular-pathspec` [#](https://github.com/lerna/lerna/tree/main/commands/version#--no-granular-pathspec) | 仅添加在版本控制过程中更改的叶包清单(可能还有变更日志)。这产生了 `git add --packages/*/package.json` 的等价物,但针对更改的内容量身定制
|
||||
`--no-private` [#](https://github.com/lerna/lerna/tree/main/commands/version#--no-private) | 在选择版本、提交和标记版本时包含私有包。通过 `--no-private` 禁用此行为
|
||||
`--no-push` [#](https://github.com/lerna/lerna/tree/main/commands/version#--no-push) | 将已提交和标记的更改推送到配置的 `git remote`。通过 `--no-push` 禁用此行为
|
||||
`--preid` [#](https://github.com/lerna/lerna/tree/main/commands/version#--preid) | 使用此标志运行时,lerna 版本将使用指定的[预发布标识符](https://semver.org/#spec-item-9)增加 `premajor`、`preminor`、`prepatch` 或 `prerelease` [semver](./semver.md) bumps
|
||||
`--sign-git-commit` [#](https://github.com/lerna/lerna/tree/main/commands/version#--sign-git-commit) | 此选项类似于同名的 npm 版本选项
|
||||
`--sign-git-tag` [#](https://github.com/lerna/lerna/tree/main/commands/version#--sign-git-tag) | 此选项类似于同名的 `npm` 版本选项
|
||||
`--force-git-tag` [#](https://github.com/lerna/lerna/tree/main/commands/version#--force-git-tag) | 此选项替换任何现有标记而不是失败
|
||||
`--tag-version-prefix` [#](https://github.com/lerna/lerna/tree/main/commands/version#--tag-version-prefix) | 此选项允许提供自定义前缀而不是默认前缀:`v`
|
||||
`--yes` [#](https://github.com/lerna/lerna/tree/main/commands/version#--yes) | 使用此标志运行时,`lerna` 版本将跳过所有确认提示
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
#### 不推荐使用的选项
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`--cd-version` [#](https://github.com/lerna/lerna/tree/main/commands/version#--cd-version) | 将 `semver` 关键字传递给 [bump](https://github.com/lerna/lerna/tree/main/commands/version#semver-bump) 位置
|
||||
`--repo-version` [#](https://github.com/lerna/lerna/tree/main/commands/version#--repo-version) | 将明确的版本号传递给 [bump](https://github.com/lerna/lerna/tree/main/commands/version#semver-bump) 位置
|
||||
`--skip-git` [#](https://github.com/lerna/lerna/tree/main/commands/version#--skip-git) | 请改用 `--no-git-tag-version` 和 `--no-push`
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
### bootstrap
|
||||
|
||||
将本地包`链接`在一起,并`安装`其余的包依赖项
|
||||
|
||||
```bash
|
||||
$ lerna bootstrap -- --production \
|
||||
--no-optional
|
||||
$ lerna bootstrap --hoist
|
||||
```
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`--hoist [glob]` [#](https://github.com/lerna/lerna/tree/main/commands/bootstrap#--strict) | 在 `repo` 根目录安装与 `glob` 匹配的外部依赖项,以便它们可用于所有包
|
||||
`--strict` [#](https://github.com/lerna/lerna/tree/main/commands/bootstrap#--nohoist-glob) | 与提升 _(hoist)_ 一起使用时,会在发出版本警告后抛出错误并停止引导
|
||||
`--nohoist [glob]` [#](https://github.com/lerna/lerna/tree/main/commands/bootstrap#--nohoist-glob) | 不要在 `repo` 根目录安装与 `glob` 匹配的外部依赖项。这可用于选择不提升某些依赖项
|
||||
`--ignore` [#](https://github.com/lerna/lerna/tree/main/commands/bootstrap#--ignore) | 当与 `bootstrap` 命令一起使用时,还可以在 `lerna` 中设置 `--ignore` 标志
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
#### 选项
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`--ignore-prepublish` [#](https://github.com/lerna/lerna/tree/main/commands/bootstrap#--ignore-prepublish) | 跳过默认在引导程序包中运行的预发布生命周期脚本
|
||||
`--ignore-scripts` [#](https://github.com/lerna/lerna/tree/main/commands/bootstrap#--ignore-scripts) | 跳过通常在引导程序包中运行(准备等)的任何生命周期脚本
|
||||
`--registry <url>` [#](https://github.com/lerna/lerna/tree/main/commands/bootstrap#--registry-url) | 指定 npm 包的仓库地址
|
||||
`--npm-client <client>` [#](https://github.com/lerna/lerna/tree/main/commands/bootstrap#--npm-client-client) | 必须是知道如何安装 `npm` 包依赖项的可执行文件
|
||||
`--use-workspaces` [#](https://github.com/lerna/lerna/tree/main/commands/bootstrap#--use-workspaces) | 启用与 `Yarn Workspaces` 的集成(从 `yarn@0.27+` 开始可用)
|
||||
`--no-ci` [#](https://github.com/lerna/lerna/tree/main/commands/bootstrap#--no-ci) | 在 `CI` 环境中调用 `npm ci` 而不是 `npm install`
|
||||
`--force-local` [#](https://github.com/lerna/lerna/tree/main/commands/bootstrap#--force-local) | 此标志会导致引导命令始终对本地依赖项进行符号链接,而不管匹配的版本范围如何
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
|
||||
### info 本地环境信息
|
||||
|
||||
```bash
|
||||
$ lerna info
|
||||
|
||||
lerna notice cli v6.0.0
|
||||
Environment info:
|
||||
|
||||
System(系统):
|
||||
OS: macOS 12.2
|
||||
CPU: (8) x64 Apple M1
|
||||
Binaries(二进制文件):
|
||||
Node: 16.17.0 - /usr/local/bin/node
|
||||
Yarn: 1.22.10 - /usr/local/bin/yarn
|
||||
npm: 8.5.0 - /usr/local/bin/npm
|
||||
Utilities(实用程序):
|
||||
Git: 2.33.0 - /opt/homebrew/bin/git
|
||||
npmPackages:
|
||||
lerna: ^6.0.0 => 6.0.0
|
||||
```
|
||||
|
||||
### 过滤选项
|
||||
<!--rehype:wrap-class=col-span-2 row-span-2-->
|
||||
|
||||
```bash
|
||||
$ lerna exec --scope my-component -- ls -la
|
||||
$ lerna run --scope toolbar-* test
|
||||
$ lerna run --scope package-1 --scope *-2 lint
|
||||
|
||||
$ lerna exec --ignore package-{1,2,5} -- ls -la
|
||||
$ lerna run --ignore package-1 test
|
||||
$ lerna run --ignore package-@(1|2) --ignore package-3 lint
|
||||
|
||||
# 列出自最新标签以来已更改的包的内容
|
||||
$ lerna exec --since -- ls -la
|
||||
# 对自 main 以来发生更改的所有包运行测试
|
||||
$ lerna run test --since main
|
||||
# 列出自 some-branch 以来发生变化的所有包
|
||||
$ lerna ls --since some-branch
|
||||
|
||||
# my-component 及其所有依赖项将被引导
|
||||
$ lerna bootstrap --scope my-component --include-dependencies
|
||||
|
||||
$ lerna bootstrap --scope "package-*" --ignore "package-util-*" --include-dependencies
|
||||
# 所有匹配 “package-util-*” 的包都将被忽略,除非它们是
|
||||
# 依赖于名称与 “package-*” 匹配的包
|
||||
```
|
||||
|
||||
#### 选项
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`--scope <glob>` [#](https://github.com/lerna/lerna/tree/main/core/filter-options#--scope-glob) | 仅包括名称与给定 `glob` 匹配的包
|
||||
`--ignore <glob>` [#](https://github.com/lerna/lerna/tree/main/core/filter-options#--ignore-glob) | 排除名称与给定 `glob` 匹配的包
|
||||
`--no-private` [#](https://github.com/lerna/lerna/tree/main/core/filter-options#--no-private) | 排除私有包
|
||||
`--since [ref]` [#](https://github.com/lerna/lerna/tree/main/core/filter-options#--since-ref) | 仅包括自指定 `ref` 以来已更改的包
|
||||
`--exclude-dependents` [#](https://github.com/lerna/lerna/tree/main/core/filter-options#--exclude-dependents) | 使用 `--since` 运行命令时排除所有传递依赖项,覆盖默认的“changed”算法
|
||||
`--include-dependents` [#](https://github.com/lerna/lerna/tree/main/core/filter-options#--include-dependents) | 无论 `--scope`、`--ignore` 或 `--since` 是什么,在运行命令时都包括所有传递依赖项
|
||||
`--include-dependencies` [#](https://github.com/lerna/lerna/tree/main/core/filter-options#--include-dependencies) | 无论 `--scope`、`--ignore` 或 `--since` [#](https://github.com/lerna/lerna/tree/main/core/filter-options#--since-ref) 是什么,在运行命令时都包括所有传递依赖项
|
||||
`--include-merged-tags` [#](https://github.com/lerna/lerna/tree/main/core/filter-options#--include-merged-tags) | 使用 `--since` 运行命令时包括来自合并分支的标签
|
||||
|
||||
### list
|
||||
|
||||
列出本地程序包,也尊重所有可用的[过滤选项](#过滤选项)
|
||||
|
||||
```bash
|
||||
# 与 lerna list 相同,它本身类似于 ls 命令
|
||||
lerna ls
|
||||
# 相当于 lerna ls -l,显示长输出
|
||||
lerna ll
|
||||
# 相当于 lerna ls -la,显示所有包(包括私有包)
|
||||
lerna la
|
||||
```
|
||||
|
||||
#### 选项
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`--json` | 显示为 JSON [#](https://github.com/lerna/lerna/tree/main/commands/publish#--json)
|
||||
`--ndjson` | 换行符分隔 [#](https://github.com/lerna/lerna/tree/main/commands/publish#--ndjson)
|
||||
`-a,--all` | 所有包 [#](https://github.com/lerna/lerna/tree/main/commands/publish#--all)
|
||||
`-l,--long` | 显示扩展信息 [#](https://github.com/lerna/lerna/tree/main/commands/publish#--long)
|
||||
`-p,--parseable` | 显示可解析的输出 [#](https://github.com/lerna/lerna/tree/main/commands/publish#--parseable)
|
||||
`--toposort` | 按拓扑排序 [#](https://github.com/lerna/lerna/tree/main/commands/publish#--toposort)
|
||||
`--graph` | JSON 格式邻接依赖关系图 [#](https://github.com/lerna/lerna/tree/main/commands/publish#--graph)
|
||||
|
||||
### changed
|
||||
|
||||
列出自上次标记版本以来已更改的本地软件包
|
||||
|
||||
- `lerna changed` 支持 `lerna ls` 支持的所有[选项](#选项-1)
|
||||
- 与 `lerna ls` 不同的是不支持过滤器选项
|
||||
<!--rehype:className=style-round-->
|
||||
|
||||
`lerna changed` 支持 `lerna version` 的以下选项
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`--conventional-graduate` | [#](https://github.com/lerna/lerna/tree/main/commands/publishhttps://github.com/lerna/lerna/tree/main/commands/version#--conventional-graduate)
|
||||
`--force-publish` | [#](https://github.com/lerna/lerna/tree/main/commands/publishhttps://github.com/lerna/lerna/tree/main/commands/version#--force-publish)
|
||||
`--ignore-changes` | [#](https://github.com/lerna/lerna/tree/main/commands/publishhttps://github.com/lerna/lerna/tree/main/commands/version#--ignore-changes)
|
||||
`--include-merged-tags` | [#](https://github.com/lerna/lerna/tree/main/commands/publishhttps://github.com/lerna/lerna/tree/main/commands/version#--include-merged-tags)
|
||||
|
||||
### init
|
||||
|
||||
创建新的 Lerna 仓库或将现有仓库升级到当前版本 Lerna
|
||||
|
||||
- 如果 `lerna` 不存在,请将其添加到 `package.json` 中的 `devDependency`
|
||||
- 创建一个 `lerna.json` 配置文件来存储版本号
|
||||
- 如果不存在 `.gitignore`,则生成一个忽略文件
|
||||
<!--rehype:className=style-timeline-->
|
||||
|
||||
----
|
||||
|
||||
```shell
|
||||
$ lerna init --independent
|
||||
```
|
||||
|
||||
----
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`--independent` [#](https://github.com/lerna/lerna/tree/main/commands/init#--independent) | 使用独立版本控制模式 [#](https://github.com/lerna/lerna/tree/main/commands/init#--independent)
|
||||
`--exact` [#](https://github.com/lerna/lerna/tree/main/commands/init#--exact) | 添加或更新 `lerna` 的本地版本时将使用插入符范围 [#](https://github.com/lerna/lerna/tree/main/commands/init#--exact)
|
||||
|
||||
它将配置 `lerna.json` 以强制所有后续执行完全匹配
|
||||
|
||||
```js
|
||||
{
|
||||
"command": {
|
||||
"init": {
|
||||
"exact": true
|
||||
}
|
||||
},
|
||||
"version": "0.0.0"
|
||||
}
|
||||
```
|
||||
|
||||
### import
|
||||
|
||||
将一个包导入到带有提交历史的 `monorepo`
|
||||
|
||||
```bash
|
||||
# 开始使用 Lerna
|
||||
$ git init lerna-repo && cd lerna-repo
|
||||
$ npx lerna init
|
||||
$ npm install
|
||||
# 添加提交
|
||||
$ git add .
|
||||
# 如果没有提交,导入命令将失败
|
||||
$ git commit -m "Initial lerna commit"
|
||||
# 导入其他存储库
|
||||
$ npx lerna import <外部存储库的路径>
|
||||
$ npx lerna import ~/Product --flatten
|
||||
```
|
||||
|
||||
选项
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`--flatten` [#](https://github.com/lerna/lerna/tree/main/commands/import#--flatten) | 当导入具有冲突的合并提交的存储库时,导入命令将无法尝试应用所有提交
|
||||
`--dest` [#](https://github.com/lerna/lerna/tree/main/commands/import#--dest) | 导入仓库时,可以通过 `lerna.json` 中列出的目录来指定目标目录
|
||||
`--preserve-commit` [#](https://github.com/lerna/lerna/tree/main/commands/import#--preserve-commit) | 每个 git 提交都有一个作者和一个提交者
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
### add
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
|
||||
将依赖项添加到匹配的包
|
||||
|
||||
```shell
|
||||
$ lerna add <package>[@version] \
|
||||
[--dev] [--exact] [--peer]
|
||||
```
|
||||
|
||||
选项
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`--dev` [#](https://github.com/lerna/lerna/tree/main/commands/add#--dev) | 将新包添加到 `devDependencies`
|
||||
`--exact` [#](https://github.com/lerna/lerna/tree/main/commands/add#--exact) | 添加具有精确版本(例如 `1.0.1`)而不是默认 `^` semver 范围(例如 `^1.0.1`)的新包
|
||||
`--peer` [#](https://github.com/lerna/lerna/tree/main/commands/add#--peer) | 将新包添加到 `peerDependencies`
|
||||
`--registry <url>` [#](https://github.com/lerna/lerna/tree/main/commands/add#--registry-url) | 使用自定义注册表安装目标包
|
||||
`--no-bootstrap` [#](https://github.com/lerna/lerna/tree/main/commands/add#--no-bootstrap) | 跳过链式 `lerna bootstrap`
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
实例
|
||||
|
||||
```bash
|
||||
# 将 mod-1 包添加到“prefix-”前缀文件夹中的包中
|
||||
$ lerna add mod-1 packages/prefix-*
|
||||
# 将 mod-1 安装到mod-2
|
||||
$ lerna add mod-1 --scope=mod-2
|
||||
# 在 devDependencies 中安装 mod-1 到 mod-2
|
||||
$ lerna add mod-1 --scope=mod-2 --dev
|
||||
# 在 peerDependencies 中安装 mod-1 到 mod-2
|
||||
$ lerna add mod-1 --scope=mod-2 --peer
|
||||
# 在除 mod-1 之外的所有模块中安装 mod-1
|
||||
$ lerna add mod-1
|
||||
# 在所有模块中安装 babel-core
|
||||
$ lerna add babel-core
|
||||
```
|
||||
|
||||
### diff
|
||||
|
||||
比较自上次发布以来的所有包或单个包
|
||||
|
||||
```bash
|
||||
$ lerna diff [package]
|
||||
$ lerna diff
|
||||
$ lerna diff package-name # 区分一个特定的包
|
||||
```
|
||||
|
||||
类似于 `lerna changed`,此命令运行 `git diff`
|
||||
|
||||
|
||||
### clean
|
||||
|
||||
从所有包中删除 `node_modules` 目录
|
||||
|
||||
```bash
|
||||
$ lerna clean
|
||||
```
|
||||
|
||||
接受所有[过滤选项](#过滤选项)。`lerna clean` 不会从根 `node_modules` 目录中删除模块,即使您启用了 `--hoist` 选项
|
||||
|
||||
### add-caching
|
||||
|
||||
运行设置基本缓存选项的向导
|
||||
|
||||
```bash
|
||||
$ lerna add-caching
|
||||
```
|
||||
|
||||
### link
|
||||
|
||||
将所有相互依赖的包符号链接在一起
|
||||
|
||||
```bash
|
||||
$ lerna link
|
||||
```
|
||||
|
||||
[`--force-local`](https://github.com/lerna/lerna/tree/main/commands/link#--force-local) 设置会导致链接命令始终对本地依赖项进行符号链接
|
||||
|
||||
### repair
|
||||
|
||||
更新配置文件以匹配当前安装的 lerna 版本
|
||||
|
||||
```bash
|
||||
$ npm i lerna@latest
|
||||
$ lerna repair
|
||||
```
|
||||
|
||||
[`lerna repair`](https://github.com/lerna/lerna/tree/main/core/lerna/commands/repair#usage) 在升级后最有用,可确保应用新版本 lerna 的任何配置文件更改
|
@ -475,8 +475,19 @@ https://registry.npmjs.org/[包名]/-/[包名]-[version].tgz
|
||||
|
||||
这些是只在你的包开发期间需要,但是生产环境不会被安装的包。
|
||||
|
||||
### `overrides`
|
||||
|
||||
```json
|
||||
{
|
||||
"overrides": {
|
||||
"foo": "1.0.0"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
对依赖项的依赖项进行特定更改,例如用已知的安全问题替换依赖项的版本
|
||||
|
||||
### `peerDependencies`
|
||||
<!--rehype:wrap-class=col-span-2-->
|
||||
|
||||
```json
|
||||
{
|
||||
@ -530,6 +541,8 @@ https://registry.npmjs.org/[包名]/-/[包名]-[version].tgz
|
||||
}
|
||||
```
|
||||
|
||||
它允许对等依赖项标记为可选
|
||||
|
||||
系统
|
||||
----
|
||||
|
||||
|
@ -578,6 +578,17 @@ H2 部分
|
||||
|
||||
`<!--rehype:className=style-list-->`
|
||||
|
||||
### 列表箭头样式展示表格
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`visualEffectState.inactive` | 后台应一直显示为非激活状态。
|
||||
`titleBarStyle` _string_ _(win/mac)_ | 窗口标题栏样式。默认值 _(default)_
|
||||
`titleBarStyle.default` | 分别返回 _mac_ 或者 _win_ 的标准标题栏
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
`<!--rehype:className=style-list-arrow-->`
|
||||
|
||||
列表
|
||||
---
|
||||
|
||||
@ -644,6 +655,15 @@ H2 部分
|
||||
|
||||
`<!--rehype:className=style-round-->`
|
||||
|
||||
### 箭头标记
|
||||
|
||||
- Item 1
|
||||
- Item 2
|
||||
- Item 3
|
||||
<!--rehype:className=style-arrow-->
|
||||
|
||||
`<!--rehype:className=style-arrow-->`
|
||||
|
||||
H2 部分 - 5列效果展示
|
||||
---
|
||||
<!--rehype:body-class=cols-5-->
|
||||
|
@ -1,6 +1,8 @@
|
||||
Sed 备忘清单
|
||||
====
|
||||
|
||||
Sed 是一个流编辑器,此 Sed 备忘清单包含 Sed 命令和一些常见的 Sed 技巧。
|
||||
|
||||
入门
|
||||
----
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "reference",
|
||||
"version": "1.2.0",
|
||||
"name": "@wcj/reference",
|
||||
"version": "1.3.0",
|
||||
"description": "为开发人员分享快速参考备忘单(主要是方便自己)。",
|
||||
"author": "jaywcjlove",
|
||||
"license": "MIT",
|
||||
|
3
scripts/assets/c.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="1em" width="1em" viewBox="0 0 38 42">
|
||||
<path fill="currentColor" fill-rule="evenodd" d="M20.096,0.28575 C21.6507561,1.15835976 24.653163,2.84381008 27.7615951,4.58873655 L28.7451648,5.14086432 C32.0250464,6.98202246 35.2659268,8.80121341 36.903,9.71975 C37.582,10.09975 38,10.80375 38,11.56575 L38,30.43275 C38,31.19475 37.582,31.89875 36.903,32.27975 C35.3482439,33.1523598 32.345837,34.8378101 29.2374049,36.5827365 L28.2538352,37.1348643 C24.9739536,38.9760225 21.7330732,40.7952134 20.096,41.71375 C19.417,42.09475 18.581,42.09475 17.903,41.71375 C16.3482439,40.8411402 13.345837,39.1556899 10.2374049,37.4107635 L9.2538352,36.8586357 C5.9739536,35.0174775 2.73307317,33.1982866 1.096,32.27975 C0.418,31.89875 0,31.19575 0,30.43375 L0,11.56675 C0,10.80475 0.418,10.10075 1.097,9.71975 C4.451,7.83675 14.549,2.16875 17.903,0.28575 C18.582,-0.09525 19.418,-0.09525 20.096,0.28575 Z M19,6.99975 C11.273,6.99975 5,13.27275 5,20.99975 C5,28.72675 11.273,34.99975 19,34.99975 C24.2106279,34.99975 28.7600712,32.1471979 31.1706024,27.9198213 L25.0359394,24.544542 C23.8185152,26.6113911 21.5699125,27.99975 19,27.99975 C15.137,27.99975 12,24.86275 12,20.99975 C12,17.13575 15.136,13.99975 19,13.99975 C21.527968,13.99975 23.7450291,15.3427307 24.9755084,17.353858 L31.0544381,13.8798146 C28.6157645,9.76264004 24.1280833,6.99975 19,6.99975 Z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.4 KiB |
3
scripts/assets/css.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 512 512" height="1em" width="1em">
|
||||
<path d="m64 32 35 403.22L255.77 480 413 435.15 448 32Zm290.68 334.9L256.07 395l-98.46-28.24-6.75-77.76h48.26l3.43 39.56 53.59 15.16.13.28 53.47-14.85 5.64-64.15H203l-4-50h120.65l4.35-51H140l-4-49h240.58Z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 325 B |
@ -1,3 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 1024 1024" height="1em" width="1em">
|
||||
<path d="m145.2 96 66 746.6L512 928l299.6-85.4L878.9 96H145.2zm595 177.1-4.8 47.2-1.7 19.5H382.3l8.2 94.2h335.1l-3.3 24.3-21.2 242.2-1.7 16.2-187 51.6v.3h-1.2l-.3.1v-.1h-.1l-188.6-52L310.8 572h91.1l6.5 73.2 102.4 27.7h.4l102-27.6 11.4-118.6H510.9v-.1H306l-22.8-253.5-1.7-24.3h460.3l-1.6 24.3z"/>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 512 512" height="1em" width="1em">
|
||||
<path d="m64 32 34.94 403.21L255.77 480 413 435.15 448 32Zm308 132H188l4 51h176l-13.51 151.39L256 394.48l-98.68-28-6.78-77.48h48.26l3.42 39.29L256 343.07l53.42-14.92L315 264H148l-12.59-149.59H376.2Z"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 415 B After Width: | Height: | Size: 319 B |
3
scripts/assets/htop.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" height="1em" width="1em">
|
||||
<path d="M16.19 2H7.81C4.17 2 2 4.17 2 7.81v8.37C2 19.83 4.17 22 7.81 22h8.37c3.64 0 5.81-2.17 5.81-5.81V7.81C22 4.17 19.83 2 16.19 2ZM7.63 18.15c0 .41-.34.75-.75.75s-.75-.34-.75-.75v-2.07c0-.41.34-.75.75-.75s.75.34.75.75v2.07Zm5.12 0c0 .41-.34.75-.75.75s-.75-.34-.75-.75V14c0-.41.34-.75.75-.75s.75.34.75.75v4.15Zm5.12 0c0 .41-.34.75-.75.75s-.75-.34-.75-.75v-6.22c0-.41.34-.75.75-.75s.75.34.75.75v6.22Zm0-9.38c0 .41-.34.75-.75.75s-.75-.34-.75-.75V7.8a19.532 19.532 0 0 1-9.31 5.36c-.06.02-.12.02-.18.02-.34 0-.64-.23-.73-.57-.1-.4.14-.81.55-.91a18.07 18.07 0 0 0 8.75-5.11H14.2c-.41 0-.75-.34-.75-.75s.34-.75.75-.75h2.93c.04 0 .07.02.11.02.05.01.1.01.15.03.05.02.09.05.14.08.03.02.06.03.09.05.01.01.01.02.02.02.04.04.07.08.1.12.03.04.06.07.07.11.02.04.02.08.03.13.01.05.03.1.03.16 0 .01.01.02.01.03v2.93h-.01Z" fill="currentColor"/>
|
||||
</svg>
|
After Width: | Height: | Size: 940 B |
3
scripts/assets/lerna.svg
Normal file
After Width: | Height: | Size: 224 KiB |
@ -1,5 +1,5 @@
|
||||
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" height="1em" width="1em">
|
||||
<path opacity=".4" d="m21.66 10.44-.98 4.18c-.84 3.61-2.5 5.07-5.62 4.77-.5-.04-1.04-.13-1.62-.27l-1.68-.4c-4.17-.99-5.46-3.05-4.48-7.23l.98-4.19c.2-.85.44-1.59.74-2.2 1.17-2.42 3.16-3.07 6.5-2.28l1.67.39c4.19.98 5.47 3.05 4.49 7.23Z" fill="currentColor"/>
|
||||
<path d="M15.06 19.39c-.62.42-1.4.77-2.35 1.08l-1.58.52c-3.97 1.28-6.06.21-7.35-3.76L2.5 13.28c-1.28-3.97-.22-6.07 3.75-7.35l1.58-.52c.41-.13.8-.24 1.17-.31-.3.61-.54 1.35-.74 2.2l-.98 4.19c-.98 4.18.31 6.24 4.48 7.23l1.68.4c.58.14 1.12.23 1.62.27Zm2.43-8.88c-.06 0-.12-.01-.19-.02l-4.85-1.23a.75.75 0 0 1 .37-1.45l4.85 1.23a.748.748 0 0 1-.18 1.47Z" fill="currentColor" />
|
||||
<path d="M14.56 13.89c-.06 0-.12-.01-.19-.02l-2.91-.74a.75.75 0 0 1 .37-1.45l2.91.74c.4.1.64.51.54.91-.08.34-.38.56-.72.56Z" fill="currentColor" />
|
||||
<path d="m21.66 10.44-.98 4.18c-.84 3.61-2.5 5.07-5.62 4.77-.5-.04-1.04-.13-1.62-.27l-1.68-.4c-4.17-.99-5.46-3.05-4.48-7.23l.98-4.19c.2-.85.44-1.59.74-2.2 1.17-2.42 3.16-3.07 6.5-2.28l1.67.39c4.19.98 5.47 3.05 4.49 7.23Z" fill="#c9d1d9"/>
|
||||
<path d="M15.06 19.39c-.62.42-1.4.77-2.35 1.08l-1.58.52c-3.97 1.28-6.06.21-7.35-3.76L2.5 13.28c-1.28-3.97-.22-6.07 3.75-7.35l1.58-.52c.41-.13.8-.24 1.17-.31-.3.61-.54 1.35-.74 2.2l-.98 4.19c-.98 4.18.31 6.24 4.48 7.23l1.68.4c.58.14 1.12.23 1.62.27Zm2.43-8.88c-.06 0-.12-.01-.19-.02l-4.85-1.23a.75.75 0 0 1 .37-1.45l4.85 1.23a.748.748 0 0 1-.18 1.47Z" fill="#228e6c" />
|
||||
<path d="M14.56 13.89c-.06 0-.12-.01-.19-.02l-2.91-.74a.75.75 0 0 1 .37-1.45l2.91.74c.4.1.64.51.54.91-.08.34-.38.56-.72.56Z" fill="#228e6c" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 890 B After Width: | Height: | Size: 862 B |
@ -1,4 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 512 470.647">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" height="1em" width="1em" viewBox="0 0 512 470.647">
|
||||
<polygon points="235.793 0 143.978 137.674 143.978 224.949 87.702 224.949 87.702 137.674 0 0 63.25 0 119.018 88.646 175.243 0 235.793 0 235.793 0"/>
|
||||
<path d="M330.294,175.451h-101.861l-20.717,50.024h-45.106l95.38,-224.949h46.137l91.51,224.949h-48.2l-17.144,-50.024zm-16.92,-44.911l-31.226,-82.55l-34.837,82.55h66.063z"/>
|
||||
<polygon points="87.701 250.177 87.701 470.647 135.004 470.647 135.004 318.569 184.509 420.789 221.743 420.789 272.939 314.976 272.939 470.602 318.318 470.602 318.318 250.177 256.358 250.177 201.381 349.883 149.021 250.177 87.701 250.177 87.701 250.177"/>
|
||||
|
Before Width: | Height: | Size: 810 B After Width: | Height: | Size: 835 B |
@ -10,8 +10,9 @@ import { rehypeUrls } from './utils/rehypeUrls.mjs';
|
||||
import { tooltips } from './utils/tooltips.mjs';
|
||||
import { homeCardIcons } from './utils/homeCardIcons.mjs';
|
||||
import { getTocsTree } from './utils/getTocsTree.mjs';
|
||||
import { rehypeTitle } from './utils/rehypeTitle.mjs';
|
||||
|
||||
const favicon = `data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20height%3D%221em%22%20width%3D%221em%22%3E%20%3Cpath%20opacity%3D%22.4%22%20d%3D%22m21.66%2010.44-.98%204.18c-.84%203.61-2.5%205.07-5.62%204.77-.5-.04-1.04-.13-1.62-.27l-1.68-.4c-4.17-.99-5.46-3.05-4.48-7.23l.98-4.19c.2-.85.44-1.59.74-2.2%201.17-2.42%203.16-3.07%206.5-2.28l1.67.39c4.19.98%205.47%203.05%204.49%207.23Z%22%20fill%3D%22%23777%22%2F%3E%20%3Cpath%20d%3D%22M15.06%2019.39c-.62.42-1.4.77-2.35%201.08l-1.58.52c-3.97%201.28-6.06.21-7.35-3.76L2.5%2013.28c-1.28-3.97-.22-6.07%203.75-7.35l1.58-.52c.41-.13.8-.24%201.17-.31-.3.61-.54%201.35-.74%202.2l-.98%204.19c-.98%204.18.31%206.24%204.48%207.23l1.68.4c.58.14%201.12.23%201.62.27Zm2.43-8.88c-.06%200-.12-.01-.19-.02l-4.85-1.23a.75.75%200%200%201%20.37-1.45l4.85%201.23a.748.748%200%200%201-.18%201.47Z%22%20fill%3D%22%23999%22%20%2F%3E%20%3Cpath%20d%3D%22M14.56%2013.89c-.06%200-.12-.01-.19-.02l-2.91-.74a.75.75%200%200%201%20.37-1.45l2.91.74c.4.1.64.51.54.91-.08.34-.38.56-.72.56Z%22%20fill%3D%22%23999%22%20%2F%3E%20%3C%2Fsvg%3E`;
|
||||
const favicon = `data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20height%3D%221em%22%20width%3D%221em%22%3E%20%3Cpath%20d%3D%22m21.66%2010.44-.98%204.18c-.84%203.61-2.5%205.07-5.62%204.77-.5-.04-1.04-.13-1.62-.27l-1.68-.4c-4.17-.99-5.46-3.05-4.48-7.23l.98-4.19c.2-.85.44-1.59.74-2.2%201.17-2.42%203.16-3.07%206.5-2.28l1.67.39c4.19.98%205.47%203.05%204.49%207.23Z%22%20fill%3D%22%23c9d1d9%22%2F%3E%20%3Cpath%20d%3D%22M15.06%2019.39c-.62.42-1.4.77-2.35%201.08l-1.58.52c-3.97%201.28-6.06.21-7.35-3.76L2.5%2013.28c-1.28-3.97-.22-6.07%203.75-7.35l1.58-.52c.41-.13.8-.24%201.17-.31-.3.61-.54%201.35-.74%202.2l-.98%204.19c-.98%204.18.31%206.24%204.48%207.23l1.68.4c.58.14%201.12.23%201.62.27Zm2.43-8.88c-.06%200-.12-.01-.19-.02l-4.85-1.23a.75.75%200%200%201%20.37-1.45l4.85%201.23a.748.748%200%200%201-.18%201.47Z%22%20fill%3D%22%23228e6c%22%20%2F%3E%20%3Cpath%20d%3D%22M14.56%2013.89c-.06%200-.12-.01-.19-.02l-2.91-.74a.75.75%200%200%201%20.37-1.45l2.91.74c.4.1.64.51.54.91-.08.34-.38.56-.72.56Z%22%20fill%3D%22%23228e6c%22%20%2F%3E%20%3C%2Fsvg%3E`;
|
||||
|
||||
export function create(str = '', options = {}) {
|
||||
let title = str.match(/[^===]+(?=[===])/g) || [];
|
||||
@ -39,6 +40,7 @@ export function create(str = '', options = {}) {
|
||||
}],
|
||||
],
|
||||
rewrite: (node, index, parent) => {
|
||||
rehypeTitle(node, options.filename);
|
||||
homeCardIcons(node, parent, options.isHome);
|
||||
tooltips(node, index, parent);
|
||||
htmlTagAddAttri(node, options);
|
||||
|
@ -1,3 +1,6 @@
|
||||
html {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
body {
|
||||
-webkit-text-size-adjust: 100%;
|
||||
tab-size: 4;
|
||||
@ -146,7 +149,7 @@ pur {
|
||||
}
|
||||
|
||||
.wrap-body em, .wrap-body sup, .wrap-body sub {
|
||||
color: var(--color-prettylights-syntax-sublimelinter-gutter-mark);
|
||||
color: var(--color-fg-subtle);
|
||||
}
|
||||
|
||||
table {
|
||||
@ -208,14 +211,26 @@ table.show-header thead {
|
||||
display: table-header-group;
|
||||
}
|
||||
|
||||
table.style-list td + td {
|
||||
table.style-list td + td, table.style-list-arrow td + td {
|
||||
padding-top: 0 !important;
|
||||
}
|
||||
table.style-list td {
|
||||
|
||||
table.style-list td, table.style-list-arrow td {
|
||||
display: block;
|
||||
text-align: left !important;
|
||||
}
|
||||
|
||||
table.style-list-arrow td:first-child::before, ul.style-arrow li:before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
width: 0px;
|
||||
height: 0px;
|
||||
border-right: 6px solid transparent;
|
||||
border-top: 5px solid transparent;
|
||||
border-left: 6px solid #228e6c;
|
||||
border-bottom: 5px solid transparent;
|
||||
}
|
||||
|
||||
tt, code {
|
||||
font-family: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace;
|
||||
font-size: 1em;
|
||||
@ -286,6 +301,9 @@ body.home .h1wrap .wrap-body p {
|
||||
text-indent: 2rem;
|
||||
}
|
||||
|
||||
body:not(.home) .h2wrap > .wrap-body > ul {
|
||||
list-style: initial;
|
||||
}
|
||||
|
||||
body.home .h1wrap p {
|
||||
text-align: left;
|
||||
@ -438,6 +456,11 @@ a.text-grey {
|
||||
font-size: 3rem;
|
||||
line-height: 1;
|
||||
margin-bottom: 3rem;
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
.wrap-header.h1wrap > h1 > svg {
|
||||
margin-right: 1rem;
|
||||
}
|
||||
|
||||
.h1wrap-body {
|
||||
@ -465,24 +488,32 @@ a.text-grey {
|
||||
color: rgb(148 163 184/1);
|
||||
}
|
||||
|
||||
body:not(.home) .h2wrap > h2 a::after {
|
||||
body:not(.home) .h2wrap > h2 a::after, body:not(.home) .h3wrap > h3 a::after {
|
||||
content: '#';
|
||||
padding-right: 0.5rem;
|
||||
color: rgb(16 185 129/1);
|
||||
}
|
||||
body:not(.home) .h3wrap > h3 a::after {
|
||||
position: absolute;
|
||||
left: -18px;
|
||||
font-size: 1rem;
|
||||
display: none;
|
||||
}
|
||||
body:not(.home) .h2wrap-body > .wrap:hover .h3wrap > h3 a::after {
|
||||
display: initial;
|
||||
}
|
||||
|
||||
.wrap-header.h3wrap {
|
||||
z-index: 0;
|
||||
display: flex;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.wrap-header.h3wrap > h3 {
|
||||
position: sticky;
|
||||
float: right;
|
||||
margin-top: -24px;
|
||||
color: rgb(226 232 240/1);
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
top: 0px;
|
||||
z-index: 10;
|
||||
border-top-right-radius: 0.5rem;
|
||||
@ -640,9 +671,18 @@ body:not(.home) .h2wrap > h2 a::after {
|
||||
width: 0.5rem;
|
||||
border-color: #228e6c;
|
||||
background: transparent;
|
||||
border-style: solid;
|
||||
top: 14px;
|
||||
}
|
||||
|
||||
.h2wrap-body ul.style-arrow li:before {
|
||||
position: absolute;
|
||||
background-color: transparent;
|
||||
border-radius: initial;
|
||||
left: 16px;
|
||||
top: 13px;
|
||||
}
|
||||
|
||||
.wrap-body ul:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import { getSVGNode } from './getSVGNode.mjs';
|
||||
|
||||
const ICONS_PATH = path.resolve(process.cwd(), 'scripts/assets')
|
||||
export const ICONS_PATH = path.resolve(process.cwd(), 'scripts/assets')
|
||||
|
||||
export function homeCardIcons(node, parent, isHome) {
|
||||
if (isHome && node && node.type === 'element' && node.properties?.class?.includes('home-card')) {
|
||||
|
19
scripts/utils/rehypeTitle.mjs
Normal file
@ -0,0 +1,19 @@
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import { getSVGNode } from './getSVGNode.mjs';
|
||||
import { ICONS_PATH } from './homeCardIcons.mjs';
|
||||
|
||||
export function rehypeTitle(node, iconName) {
|
||||
if (node.type === 'element' && node.tagName === 'h1' && iconName !== 'index') {
|
||||
const iconPath = path.resolve(ICONS_PATH, `${iconName}.svg`);
|
||||
const iconDefaultPath = path.resolve(ICONS_PATH, `list.svg`);
|
||||
const iconExist = fs.existsSync(iconPath);
|
||||
if (iconExist) {
|
||||
const svgNode = getSVGNode(iconPath);
|
||||
node.children = [ ...svgNode, ...node.children ];
|
||||
} else {
|
||||
const svgNode = getSVGNode(iconDefaultPath);
|
||||
node.children = [ ...svgNode, ...node.children ];
|
||||
}
|
||||
}
|
||||
}
|