@liuli-util/cli 3.17.2 → 3.18.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.18.0
4
+
5
+ - feat: 支持自定义 `repo/remote/branch` 等配置
6
+
3
7
  ## 3.17.0
4
8
 
5
9
  - feat: 不再处理并发发布的问题
package/README.md CHANGED
@@ -1,49 +1,51 @@
1
1
  # @liuli-util/cli
2
2
 
3
- 一个针对于库和 CLI 应用程序打包的零配置 CLI。
3
+ > [中文](https://github.com/rxliuli/liuli-tools/tree/master/apps/liuli-cli/README.zh-CN.md)
4
4
 
5
- ## 起步
5
+ A zero-configuration CLI packaged for libraries and CLI applications.
6
6
 
7
- ### 安装
7
+ ## Getting started
8
+
9
+ ### Install
8
10
 
9
11
  ```sh
10
- yarn add -D @liuli-util/cli # 局部安装
11
- npm i -g @liuli-util/cli # 全局安装
12
+ yarn add -D @liuli-util/cli # local installation
13
+ npm i -g @liuli-util/cli # install globally
12
14
  ```
13
15
 
14
- ### 打包
16
+ ### Bale
15
17
 
16
18
  ```sh
17
- yarn liuli-cli build lib # 打包库
18
- yarn liuli-cli build cli # 打包 cli 引用程序
19
+ yarn liuli-cli build lib # package library
20
+ yarn liuli-cli build cli # package cli reference program
19
21
  ```
20
22
 
21
- > 添加 `-w` 选项则启动 rollup 的监视模式,打包出来的 dist/ 不会压缩且不会将依赖项打进 bundle
23
+ > Add the `-w` option to start the watch mode of rollup, the packaged dist/ will not be compressed and the dependencies will not be included in the bundle.
22
24
 
23
- ![监视模式](https://liuli.dev/images/liuli-cli%20%E7%9B%91%E8%A7%86%E6%A8%A1%E5%BC%8F.gif)
25
+ ![Monitor Mode](https://liuli.dev/images/liuli-cli%20%E7%9B%91%E8%A7%86%E6%A8%A1%E5%BC%8F.gif)
24
26
 
25
- ### 生成
27
+ ### Generate
26
28
 
27
29
  ```sh
28
- yarn liuli-cli generate <name> --template lib # 生成 ts-lib 项目
29
- yarn liuli-cli generate <name> --template cli # 生成 cli 项目
30
+ yarn liuli-cli generate <name> --template lib # Generate ts-lib project
31
+ yarn liuli-cli generate <name> --template cli # Generate cli project
30
32
  ```
31
33
 
32
- util 也支持交互式的创建项目
34
+ util also supports interactive project creation
33
35
 
34
36
  ```shell
35
37
  yarn liuli-cli generate
36
38
  ```
37
39
 
38
- ![liuli-cli 交互式创建截图](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)
40
+ ![Liuli-cli interactively create screenshots](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)
39
41
 
40
- ### 同步配置
42
+ ### Sync configuration
41
43
 
42
44
  ```shell
43
45
  yarn liuli-cli sync
44
46
  ```
45
47
 
46
- 需要在 package.json 中指定同步哪些配置
48
+ Which configuration needs to be synced in package.json
47
49
 
48
50
  ```json
49
51
  {
@@ -51,7 +53,7 @@ yarn liuli-cli sync
51
53
  }
52
54
  ```
53
55
 
54
- 目前支持的配置项
56
+ Currently supported configuration items
55
57
 
56
58
  - prettier
57
59
  - commitlint
@@ -62,39 +64,25 @@ yarn liuli-cli sync
62
64
  - eslint-vue-ts
63
65
  - jest
64
66
 
65
- 未来的目标:默认将包括检查 cli 自身的同步(如果需要在 monorepo 之外使用的话),eslint/style-lint 之类,还有在没有配置时实现交互式 cli
67
+ Future goals: By default will include checking the synchronization of the cli itself (if it needs to be used outside of a monorepo), eslint/style-lint etc., and implementing an interactive cli when not configured
66
68
 
67
- > 注:目前仅同步依赖而不会执行安装
69
+ > Note: Currently only the dependencies are synced and no installation is performed
68
70
 
69
- 也支持交互式的初始化同步配置
71
+ Interactive initialization synchronization configuration is also supported
70
72
 
71
73
  ```shell
72
74
  yarn liuli-cli sync init
73
75
  ```
74
76
 
75
- ## 设计理念
77
+ ## design concept
76
78
 
77
- - 约定大于配置,如果可能应该不提供配置。VitePress 也是这样做的,参考:https://vitepress.vuejs.org/#lighter-page-weight 这会导致一些约束,包括以下内容
78
- - 打包库时入口文件必须是 `src/index.ts`,出口文件则是 `dist/index.esm.js` `dist/index.js`
79
- - 打包 CLI 时入口文件必须是 `src/bin.ts`,出口文件则是 `dist/bin.js`
80
- - 在打包 lib 时会将所有的依赖作为外部依赖处理,而在打包 cli 时会将所有依赖项打进 bundle
79
+ - Convention over configuration, configuration should not be provided if possible. VitePress does this too, reference: https://vitepress.vuejs.org/#lighter-page-weight This leads to some constraints, including the following
80
+ - When packaging the library, the entry file must be `src/index.ts`, and the export file must be `dist/index.esm.js` and `dist/index.js`
81
+ - When packaging the CLI, the entry file must be `src/bin.ts`, and the exit file must be `dist/bin.js`
82
+ - All dependencies will be treated as external dependencies when packaging lib, and all dependencies will be bundled when packaging cli
81
83
 
82
84
  ## FAQ
83
85
 
84
- ### 为什么底层没有选择 esbuild
85
-
86
- 事实上,esbuild 本身非常非常非常快(重要的事情说三遍),但如果使用 js 封装 CLI,则性能会迅速降低。
87
-
88
- 打包这个项目使用 esbuild、cli 封装、rollup 的时间对比如下
89
-
90
- | 打包方式 | 时间 |
91
- | -------- | ----- |
92
- | esbuild | 0.49s |
93
- | cli 封装 | 3.2s |
94
- | rollup | 3.65s |
95
-
96
- > 现在 [vscode 插件打包官方推荐使用 esbuild](https://code.visualstudio.com/api/working-with-extensions/bundling-extension) ,吾辈在生产项目中也有过实践,长期而言吾辈比较看好这类更高性能的打包工具。
97
-
98
- ### 为什么不捆绑外部依赖项
86
+ ### Why not bundle external dependencies
99
87
 
100
- 主要原因是希望将捆绑的工作交由最终应用完成,避免重复捆绑相同的依赖,而且还可以避免处理 nodejs 中直接基于文件系统使用 `worker_threads` 的问题。
88
+ The main reason is that you want to leave the bundling work to the final application, avoid bundling the same dependencies repeatedly, and also avoid dealing with the problem of using `worker_threads` directly based on the file system in nodejs.
@@ -0,0 +1,86 @@
1
+ # @liuli-util/cli
2
+
3
+ 一个针对于库和 CLI 应用程序打包的零配置 CLI。
4
+
5
+ ## 起步
6
+
7
+ ### 安装
8
+
9
+ ```sh
10
+ yarn add -D @liuli-util/cli # 局部安装
11
+ npm i -g @liuli-util/cli # 全局安装
12
+ ```
13
+
14
+ ### 打包
15
+
16
+ ```sh
17
+ yarn liuli-cli build lib # 打包库
18
+ yarn liuli-cli build cli # 打包 cli 引用程序
19
+ ```
20
+
21
+ > 添加 `-w` 选项则启动 rollup 的监视模式,打包出来的 dist/ 不会压缩且不会将依赖项打进 bundle。
22
+
23
+ ![监视模式](https://liuli.dev/images/liuli-cli%20%E7%9B%91%E8%A7%86%E6%A8%A1%E5%BC%8F.gif)
24
+
25
+ ### 生成
26
+
27
+ ```sh
28
+ yarn liuli-cli generate <name> --template lib # 生成 ts-lib 项目
29
+ yarn liuli-cli generate <name> --template cli # 生成 cli 项目
30
+ ```
31
+
32
+ util 也支持交互式的创建项目
33
+
34
+ ```shell
35
+ yarn liuli-cli generate
36
+ ```
37
+
38
+ ![liuli-cli 交互式创建截图](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)
39
+
40
+ ### 同步配置
41
+
42
+ ```shell
43
+ yarn liuli-cli sync
44
+ ```
45
+
46
+ 需要在 package.json 中指定同步哪些配置
47
+
48
+ ```json
49
+ {
50
+ "sync": ["prettier", "workspaces", "commitlint", "simplehooks"]
51
+ }
52
+ ```
53
+
54
+ 目前支持的配置项
55
+
56
+ - prettier
57
+ - commitlint
58
+ - simplehooks
59
+ - workspaces
60
+ - gitignore
61
+ - eslint-ts
62
+ - eslint-vue-ts
63
+ - jest
64
+
65
+ 未来的目标:默认将包括检查 cli 自身的同步(如果需要在 monorepo 之外使用的话),eslint/style-lint 之类,还有在没有配置时实现交互式 cli
66
+
67
+ > 注:目前仅同步依赖而不会执行安装
68
+
69
+ 也支持交互式的初始化同步配置
70
+
71
+ ```shell
72
+ yarn liuli-cli sync init
73
+ ```
74
+
75
+ ## 设计理念
76
+
77
+ - 约定大于配置,如果可能应该不提供配置。VitePress 也是这样做的,参考:https://vitepress.vuejs.org/#lighter-page-weight 这会导致一些约束,包括以下内容
78
+ - 打包库时入口文件必须是 `src/index.ts`,出口文件则是 `dist/index.esm.js` 与 `dist/index.js`
79
+ - 打包 CLI 时入口文件必须是 `src/bin.ts`,出口文件则是 `dist/bin.js`
80
+ - 在打包 lib 时会将所有的依赖作为外部依赖处理,而在打包 cli 时会将所有依赖项打进 bundle
81
+
82
+ ## FAQ
83
+
84
+ ### 为什么不捆绑外部依赖项
85
+
86
+ 主要原因是希望将捆绑的工作交由最终应用完成,避免重复捆绑相同的依赖,而且还可以避免处理 nodejs 中直接基于文件系统使用 `worker_threads` 的问题。