@liuli-util/cli 3.20.2 → 3.21.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +22 -0
- package/README.md +69 -25
- package/README.zh-CN.md +7 -7
- package/dist/bin.js +43 -43
- package/dist/bin.js.map +2 -2
- package/dist/commands/deploy/DeployService.d.ts +4 -0
- package/dist/commands/deploy/DeployService.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/commands/deploy/DeployService.ts +20 -2
- package/src/commands/deploy/__tests__/DeployService.test.ts +23 -4
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 3.21.0
|
4
|
+
|
5
|
+
- feat: 支持配置增量更新,将部署 gh-pages 的默认行为修改为清理 dest
|
6
|
+
|
7
|
+
## 3.20.2
|
8
|
+
|
9
|
+
- fix: 修复使用 boolean 类型无法设置默认为 true 的问题
|
10
|
+
|
11
|
+
## 3.20.1
|
12
|
+
|
13
|
+
- fix: 修复 liuli-cli generate 命令行参数声明的问题
|
14
|
+
|
15
|
+
## 3.20.0
|
16
|
+
|
17
|
+
- feat: 支持以非交互式的方式创建模板项目
|
18
|
+
- fix: 恢复错误被删除的 userjs 插件
|
19
|
+
- feat: 添加一些 esbuild 插件
|
20
|
+
|
21
|
+
## 3.19.2
|
22
|
+
|
23
|
+
- fix: 修复拉取项目时没有指定参数 --allow-unrelated-histories 的问题
|
24
|
+
|
3
25
|
## 3.19.1
|
4
26
|
|
5
27
|
- fix: 修复同步 eslint+simple hooks 错误处理 css 文件的问题
|
package/README.md
CHANGED
@@ -2,50 +2,94 @@
|
|
2
2
|
|
3
3
|
> [中文](https://github.com/rxliuli/liuli-tools/tree/master/apps/liuli-cli/README.zh-CN.md)
|
4
4
|
|
5
|
-
A zero-configuration CLI
|
5
|
+
A zero-configuration CLI for packaging libraries and CLI applications.
|
6
6
|
|
7
|
-
## Getting
|
7
|
+
## Getting Started
|
8
8
|
|
9
9
|
### Install
|
10
10
|
|
11
11
|
```sh
|
12
|
-
|
13
|
-
|
12
|
+
pnpm i -D @liuli-util/cli # Local installation
|
13
|
+
pnpm i -g @liuli-util/cli # global install
|
14
14
|
```
|
15
15
|
|
16
|
-
###
|
16
|
+
### Packages
|
17
17
|
|
18
18
|
```sh
|
19
|
-
|
20
|
-
|
19
|
+
liuli-cli build lib # Package the library
|
20
|
+
liuli-cli build cli # Package cli references
|
21
21
|
```
|
22
22
|
|
23
|
-
>
|
23
|
+
> Adding the `-w` option starts the rollup monitoring mode, the dist/ will not be compressed and the dependencies will not be added to the bundle.
|
24
24
|
|
25
|
-
![
|
25
|
+
![watchdog mode](https://liuli.dev/images/liuli-cli%20%E7%9B%91%E8%A7%86%E6%A8%A1%E5%BC%8F.gif)
|
26
26
|
|
27
27
|
### Generate
|
28
28
|
|
29
29
|
```sh
|
30
|
-
|
31
|
-
|
30
|
+
liuli-cli generate <name> --template lib # Generate ts-lib project
|
31
|
+
liuli-cli generate <name> --template cli # generate cli project
|
32
32
|
```
|
33
33
|
|
34
34
|
util also supports interactive project creation
|
35
35
|
|
36
36
|
```shell
|
37
|
-
|
37
|
+
liuli-cli generate
|
38
38
|
```
|
39
39
|
|
40
|
-
![
|
40
|
+
![liuli-cli interactive creation screenshot](https://liuli.dev/images/liuli-cli%20%E4%BA%A4%E4%BA%92%E5%BC%8F%E5%88%9B%E5%BB%BA%E6%88%AA%E5%9B%BE.gif)
|
41
|
+
|
42
|
+
### Deployment
|
43
|
+
|
44
|
+
Support for deploying front-end resources to a remote location via sftp/gh-pages, with configuration information in the `deploy` field in package.json
|
45
|
+
|
46
|
+
```sh
|
47
|
+
liuli deploy
|
48
|
+
```
|
49
|
+
|
50
|
+
public
|
51
|
+
|
52
|
+
| configuration | description | defaults |
|
53
|
+
| ------------- | --------------------------------- | -------- |
|
54
|
+
| ``type` | deployment type, ``sftp/gh-pgaes` | none |
|
55
|
+
| `dist` | Static resource directory | None |
|
56
|
+
| `dest` | deployed remote directory | none |
|
57
|
+
|
58
|
+
sftp
|
59
|
+
|
60
|
+
| configuration | description | defaults |
|
61
|
+
| -------------------- | ----------------- | -------- |
|
62
|
+
| `sshConfig.host` | ip address of ssh | |
|
63
|
+
| `sshConfig.port` | ssh's port number | 22 |
|
64
|
+
| `sshConfig.username` | ssh's username | |
|
65
|
+
|
66
|
+
gh-pages
|
67
|
+
|
68
|
+
| configuration | description | default |
|
69
|
+
| ----------------- | ----------------------------------------- | --------------------------------------- |
|
70
|
+
| `repo?: string` | the git address of the project to push to | the default is the current project |
|
71
|
+
| `remote?: string` | push remote | defaults to origin |
|
72
|
+
| `branch?: string` | remote branch name | defaults to gh-pages |
|
73
|
+
| `add?: boolean` | whether to push incrementally | cleans up the dest directory by default |
|
74
|
+
|
75
|
+
Example configuration for deploying a vuepress documentation site
|
76
|
+
|
77
|
+
```json
|
78
|
+
{
|
79
|
+
"deploy": {
|
80
|
+
"type": "gh-pages",
|
81
|
+
"dist": "docs/.vuepress/dist"
|
82
|
+
}
|
83
|
+
}
|
84
|
+
```
|
41
85
|
|
42
86
|
### Sync configuration
|
43
87
|
|
44
88
|
```shell
|
45
|
-
|
89
|
+
liuli-cli sync
|
46
90
|
```
|
47
91
|
|
48
|
-
|
92
|
+
You need to specify which configuration to sync in package.json
|
49
93
|
|
50
94
|
```json
|
51
95
|
{
|
@@ -64,25 +108,25 @@ Currently supported configuration items
|
|
64
108
|
- eslint-vue-ts
|
65
109
|
- jest
|
66
110
|
|
67
|
-
Future goals: By default will include checking the
|
111
|
+
Future goals: By default, this will include checking the cli's own sync (if it needs to be used outside of monorepo), eslint/style-lint, and interactive cli when not configured
|
68
112
|
|
69
|
-
> Note: Currently only
|
113
|
+
> Note: Currently, only dependencies are synchronized and no installation is performed
|
70
114
|
|
71
|
-
Interactive initialization
|
115
|
+
Interactive initialization of synchronized configuration is also supported
|
72
116
|
|
73
117
|
```shell
|
74
|
-
|
118
|
+
liuli-cli sync init
|
75
119
|
```
|
76
120
|
|
77
|
-
##
|
121
|
+
## Design philosophy
|
78
122
|
|
79
|
-
-
|
80
|
-
-
|
81
|
-
-
|
82
|
-
-
|
123
|
+
- Conventions outweigh configuration and should be left out if possible. VitePress does the same thing, see: https://vitepress.vuejs.org/#lighter-page-weight This leads to a number of constraints, including the following
|
124
|
+
- The entry file must be `src/index.ts` when packaging the library, and the exit file must be `dist/index.esm.js` and `dist/index.js`
|
125
|
+
- The entry file must be `src/bin.ts` and the exit file is `dist/bin.js` when packaging the CLI.
|
126
|
+
- When packaging lib, all dependencies are treated as external dependencies, while when packaging cli, all dependencies are typed into the bundle
|
83
127
|
|
84
128
|
## FAQ
|
85
129
|
|
86
130
|
### Why not bundle external dependencies
|
87
131
|
|
88
|
-
The main reason is that
|
132
|
+
The main reason is that we want to leave the bundling to the final application, to avoid bundling the same dependencies over and over again, and to avoid dealing with the problem of using `worker_threads` directly on the filesystem in nodejs.
|
package/README.zh-CN.md
CHANGED
@@ -63,11 +63,12 @@ sftp
|
|
63
63
|
|
64
64
|
gh-pages
|
65
65
|
|
66
|
-
| 配置
|
67
|
-
|
|
68
|
-
| `repo` |
|
69
|
-
| `remote` |
|
70
|
-
| `branch` |
|
66
|
+
| 配置 | 说明 | 默认值 |
|
67
|
+
| ----------------- | ------------------- | -------------------- |
|
68
|
+
| `repo?: string` | 推送的项目 git 地址 | 默认为当前项目 |
|
69
|
+
| `remote?: string` | 推送的远端 | 默认为 origin |
|
70
|
+
| `branch?: string` | 远端分支名 | 默认为 gh-pages |
|
71
|
+
| `add?: boolean` | 是否增量推送 | 默认会清理 dest 目录 |
|
71
72
|
|
72
73
|
部署 vuepress 文档网站示例配置
|
73
74
|
|
@@ -75,8 +76,7 @@ gh-pages
|
|
75
76
|
{
|
76
77
|
"deploy": {
|
77
78
|
"type": "gh-pages",
|
78
|
-
"
|
79
|
-
"remote": "/"
|
79
|
+
"dist": "docs/.vuepress/dist"
|
80
80
|
}
|
81
81
|
}
|
82
82
|
```
|