jiek 2.1.2 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -2
 - package/dist/cli-only-build.cjs +1 -1
 - package/dist/cli-only-build.js +1 -1
 - package/dist/cli.cjs +1 -0
 - package/dist/cli.js +1 -0
 - package/dist/rollup/index.cjs +1 -0
 - package/dist/rollup/index.js +1 -0
 - package/package.json +6 -6
 - package/src/utils/getExports.ts +1 -0
 
    
        package/README.md
    CHANGED
    
    | 
         @@ -79,8 +79,129 @@ yarn add -D jiek 
     | 
|
| 
       79 
79 
     | 
    
         | 
| 
       80 
80 
     | 
    
         
             
            ## CLI
         
     | 
| 
       81 
81 
     | 
    
         | 
| 
       82 
     | 
    
         
            -
            ``` 
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
      
 82 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 83 
     | 
    
         
            +
            jk/jiek [options] [command]
         
     | 
| 
      
 84 
     | 
    
         
            +
            jb/jiek-build [options] [filters/entries]
         
     | 
| 
      
 85 
     | 
    
         
            +
            ```
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
            ### 自定义构建入口
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
            你可以通过 `--entries` 来指定构建入口,这里的入口定义是基于 `package.json` 中的 `exports` 字段来进行的。
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 92 
     | 
    
         
            +
            jb -e .
         
     | 
| 
      
 93 
     | 
    
         
            +
            jb --entries .
         
     | 
| 
      
 94 
     | 
    
         
            +
            jb --entries ./foo
         
     | 
| 
      
 95 
     | 
    
         
            +
            jb --entries ./foo,./bar
         
     | 
| 
      
 96 
     | 
    
         
            +
            ```
         
     | 
| 
      
 97 
     | 
    
         
            +
             
     | 
| 
      
 98 
     | 
    
         
            +
            当你的项目是一个非 `monorepo` 项目时,你可以直接通过 `jb [entries]` 来进行构建。
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
      
 100 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 101 
     | 
    
         
            +
            jb .
         
     | 
| 
      
 102 
     | 
    
         
            +
            jb ./foo
         
     | 
| 
      
 103 
     | 
    
         
            +
            jb ./foo,./bar
         
     | 
| 
      
 104 
     | 
    
         
            +
            ```
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
            ### 过滤器
         
     | 
| 
      
 107 
     | 
    
         
            +
             
     | 
| 
      
 108 
     | 
    
         
            +
            你可以通过 `--filter` 来过滤需要构建的包,我们使用了和 pnpm 一样的过滤器规则,所以你可以在这里查阅 [pnpm 的过滤器规则](https://pnpm.io/filtering)
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 111 
     | 
    
         
            +
            jb --filter @monorepo/*
         
     | 
| 
      
 112 
     | 
    
         
            +
            jb --filter @monorepo/utils
         
     | 
| 
      
 113 
     | 
    
         
            +
            jb -f utils
         
     | 
| 
      
 114 
     | 
    
         
            +
            ```
         
     | 
| 
      
 115 
     | 
    
         
            +
             
     | 
| 
      
 116 
     | 
    
         
            +
            当你的项目是一个 `monorepo` 项目时,你可以直接通过 `jb [filters]` 来进行构建。
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
      
 118 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 119 
     | 
    
         
            +
            jb @monorepo/*
         
     | 
| 
      
 120 
     | 
    
         
            +
            jb @monorepo/utils
         
     | 
| 
      
 121 
     | 
    
         
            +
            jb utils
         
     | 
| 
      
 122 
     | 
    
         
            +
            ```
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
            ### 自定义构建工具
         
     | 
| 
      
 125 
     | 
    
         
            +
             
     | 
| 
      
 126 
     | 
    
         
            +
            我们支持多种构建工具,你可以通过 `--type <type: esbuild | swc>` 来指定构建工具。
         
     | 
| 
      
 127 
     | 
    
         
            +
             
     | 
| 
      
 128 
     | 
    
         
            +
            - 默认会使用 `esbuild`(`rollup-plugin-esbuild`)
         
     | 
| 
      
 129 
     | 
    
         
            +
            - 如果你的依赖空间中存在 `swc`(`rollup-plugin-swc3`) 依赖,那么我们会自动切换到 `swc`
         
     | 
| 
      
 130 
     | 
    
         
            +
            - 如果俩个都存在,默认会使用 `esbuild`
         
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
      
 132 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 133 
     | 
    
         
            +
            jb --type swc
         
     | 
| 
      
 134 
     | 
    
         
            +
            ```
         
     | 
| 
      
 135 
     | 
    
         
            +
             
     | 
| 
      
 136 
     | 
    
         
            +
            > 如果使用类型的构建工具依赖没有安装,那我们会提示你安装对应的依赖。
         
     | 
| 
      
 137 
     | 
    
         
            +
             
     | 
| 
      
 138 
     | 
    
         
            +
            ### 最小化
         
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
      
 140 
     | 
    
         
            +
            我们提供了多种方式来支持最小化的构建,默认会自动启用,同时我们默认会选择使用构建工具内置的最小化插件来进行最小化。
         
     | 
| 
      
 141 
     | 
    
         
            +
             
     | 
| 
      
 142 
     | 
    
         
            +
            - 你可以通过 `--minType` 选择使用 `terser`(`rollup-plugin-terser`) 来进行最小化,如果你没有安装 `terser`,我们会提示你安装。
         
     | 
| 
      
 143 
     | 
    
         
            +
            - 你可以通过 `--noMin` 来关闭生成最小化产物。
         
     | 
| 
      
 144 
     | 
    
         
            +
            - 你可以通过 `--onlyMinify` 来只生成最小化产物,这样我们会直接替换原产物路径,而不是添加一个 `.min` 后缀再进行输出。
         
     | 
| 
      
 145 
     | 
    
         
            +
             
     | 
| 
      
 146 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 147 
     | 
    
         
            +
            jb --minType terser
         
     | 
| 
      
 148 
     | 
    
         
            +
            jb --onlyMinify
         
     | 
| 
      
 149 
     | 
    
         
            +
            ```
         
     | 
| 
      
 150 
     | 
    
         
            +
             
     | 
| 
      
 151 
     | 
    
         
            +
            ### 去除指定构建内容
         
     | 
| 
      
 152 
     | 
    
         
            +
             
     | 
| 
      
 153 
     | 
    
         
            +
            你可以通过 `--noJs` 来关闭 `js` 的构建,通过 `--noDts` 来关闭 `dts` 的构建。
         
     | 
| 
      
 154 
     | 
    
         
            +
             
     | 
| 
      
 155 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 156 
     | 
    
         
            +
            jb --noJs
         
     | 
| 
      
 157 
     | 
    
         
            +
            jb --noDts
         
     | 
| 
      
 158 
     | 
    
         
            +
            ```
         
     | 
| 
      
 159 
     | 
    
         
            +
             
     | 
| 
      
 160 
     | 
    
         
            +
            ### 自定义产物目录
         
     | 
| 
      
 161 
     | 
    
         
            +
             
     | 
| 
      
 162 
     | 
    
         
            +
            你可以通过 `--outdir` 来指定产物目录。
         
     | 
| 
      
 163 
     | 
    
         
            +
             
     | 
| 
      
 164 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 165 
     | 
    
         
            +
            jb --outdir lib
         
     | 
| 
      
 166 
     | 
    
         
            +
            ```
         
     | 
| 
      
 167 
     | 
    
         
            +
             
     | 
| 
      
 168 
     | 
    
         
            +
            ### 监听模式
         
     | 
| 
      
 169 
     | 
    
         
            +
             
     | 
| 
      
 170 
     | 
    
         
            +
            你可以通过 `--watch` 来开启监听模式。
         
     | 
| 
      
 171 
     | 
    
         
            +
             
     | 
| 
      
 172 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 173 
     | 
    
         
            +
            jb --watch
         
     | 
| 
      
 174 
     | 
    
         
            +
            ```
         
     | 
| 
      
 175 
     | 
    
         
            +
             
     | 
| 
      
 176 
     | 
    
         
            +
            ### 外部模块
         
     | 
| 
      
 177 
     | 
    
         
            +
             
     | 
| 
      
 178 
     | 
    
         
            +
            除了通过 `package.json` 中的 `dependencies`、`peerDependencies`、`optionalDependencies` 来自动标记外部模块外,你还可以通过 `--external` 来手动标记外部模块。
         
     | 
| 
      
 179 
     | 
    
         
            +
             
     | 
| 
      
 180 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 181 
     | 
    
         
            +
            jb --external react
         
     | 
| 
      
 182 
     | 
    
         
            +
            jb --external react,react-dom
         
     | 
| 
      
 183 
     | 
    
         
            +
            ```
         
     | 
| 
      
 184 
     | 
    
         
            +
             
     | 
| 
      
 185 
     | 
    
         
            +
            ### 关闭产物的自动清理
         
     | 
| 
      
 186 
     | 
    
         
            +
             
     | 
| 
      
 187 
     | 
    
         
            +
            你可以通过 `--noClean` 来关闭产物的自动清理。
         
     | 
| 
      
 188 
     | 
    
         
            +
             
     | 
| 
      
 189 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 190 
     | 
    
         
            +
            jb --noClean
         
     | 
| 
      
 191 
     | 
    
         
            +
            ```
         
     | 
| 
      
 192 
     | 
    
         
            +
             
     | 
| 
      
 193 
     | 
    
         
            +
            ### 自定义 tsconfig 路径
         
     | 
| 
      
 194 
     | 
    
         
            +
             
     | 
| 
      
 195 
     | 
    
         
            +
            你可以通过 `--tsconfig` 来指定 `tsconfig` 的路径。
         
     | 
| 
      
 196 
     | 
    
         
            +
             
     | 
| 
      
 197 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 198 
     | 
    
         
            +
            jb --tsconfig ./tsconfig.custom-build.json
         
     | 
| 
      
 199 
     | 
    
         
            +
            ```
         
     | 
| 
      
 200 
     | 
    
         
            +
             
     | 
| 
      
 201 
     | 
    
         
            +
            同时你还可以通过 `--dtsconfig` 来指定 `dts` 插件使用的 `tsconfig` 的路径(当然我不建议你这么做)。
         
     | 
| 
      
 202 
     | 
    
         
            +
             
     | 
| 
      
 203 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 204 
     | 
    
         
            +
            jb --dtsconfig ./tsconfig.custom-dts.json
         
     | 
| 
       84 
205 
     | 
    
         
             
            ```
         
     | 
| 
       85 
206 
     | 
    
         | 
| 
       86 
207 
     | 
    
         
             
            ## 为什么不使用 X?
         
     | 
    
        package/dist/cli-only-build.cjs
    CHANGED
    
    | 
         @@ -116,7 +116,7 @@ async function getSelectedProjectsGraph(filter = commander.program.getOptionValu 
     | 
|
| 
       116 
116 
     | 
    
         | 
| 
       117 
117 
     | 
    
         
             
            var name = "jiek";
         
     | 
| 
       118 
118 
     | 
    
         
             
            var type = "module";
         
     | 
| 
       119 
     | 
    
         
            -
            var version = "2.1. 
     | 
| 
      
 119 
     | 
    
         
            +
            var version = "2.1.3";
         
     | 
| 
       120 
120 
     | 
    
         
             
            var description$1 = "A lightweight toolkit for compiling and managing libraries based on `package.json` metadata and suitable for `Monorepo`.";
         
     | 
| 
       121 
121 
     | 
    
         
             
            var author = "YiJie <yijie4188@gmail.com>";
         
     | 
| 
       122 
122 
     | 
    
         
             
            var repository = {
         
     | 
    
        package/dist/cli-only-build.js
    CHANGED
    
    | 
         @@ -108,7 +108,7 @@ async function getSelectedProjectsGraph(filter = program.getOptionValue("filter" 
     | 
|
| 
       108 
108 
     | 
    
         | 
| 
       109 
109 
     | 
    
         
             
            var name = "jiek";
         
     | 
| 
       110 
110 
     | 
    
         
             
            var type = "module";
         
     | 
| 
       111 
     | 
    
         
            -
            var version = "2.1. 
     | 
| 
      
 111 
     | 
    
         
            +
            var version = "2.1.3";
         
     | 
| 
       112 
112 
     | 
    
         
             
            var description$1 = "A lightweight toolkit for compiling and managing libraries based on `package.json` metadata and suitable for `Monorepo`.";
         
     | 
| 
       113 
113 
     | 
    
         
             
            var author = "YiJie <yijie4188@gmail.com>";
         
     | 
| 
       114 
114 
     | 
    
         
             
            var repository = {
         
     | 
    
        package/dist/cli.cjs
    CHANGED
    
    | 
         @@ -4324,6 +4324,7 @@ function getExports({ 
     | 
|
| 
       4324 
4324 
     | 
    
         
             
                filteredResolvedEntrypoints,
         
     | 
| 
       4325 
4325 
     | 
    
         
             
                entrypoints.entrypoints2Exports(filteredResolvedEntrypoints, {
         
     | 
| 
       4326 
4326 
     | 
    
         
             
                  outdir,
         
     | 
| 
      
 4327 
     | 
    
         
            +
                  sourceTag: pkgName,
         
     | 
| 
       4327 
4328 
     | 
    
         
             
                  withSuffix: isPublish ? withSuffix : void 0,
         
     | 
| 
       4328 
4329 
     | 
    
         
             
                  withSource: isPublish ? withSource : void 0,
         
     | 
| 
       4329 
4330 
     | 
    
         
             
                  withConditional: {
         
     | 
    
        package/dist/cli.js
    CHANGED
    
    | 
         @@ -4294,6 +4294,7 @@ function getExports({ 
     | 
|
| 
       4294 
4294 
     | 
    
         
             
                filteredResolvedEntrypoints,
         
     | 
| 
       4295 
4295 
     | 
    
         
             
                entrypoints2Exports(filteredResolvedEntrypoints, {
         
     | 
| 
       4296 
4296 
     | 
    
         
             
                  outdir,
         
     | 
| 
      
 4297 
     | 
    
         
            +
                  sourceTag: pkgName,
         
     | 
| 
       4297 
4298 
     | 
    
         
             
                  withSuffix: isPublish ? withSuffix : void 0,
         
     | 
| 
       4298 
4299 
     | 
    
         
             
                  withSource: isPublish ? withSource : void 0,
         
     | 
| 
       4299 
4300 
     | 
    
         
             
                  withConditional: {
         
     | 
    
        package/dist/rollup/index.cjs
    CHANGED
    
    | 
         @@ -4225,6 +4225,7 @@ function getExports({ 
     | 
|
| 
       4225 
4225 
     | 
    
         
             
                filteredResolvedEntrypoints,
         
     | 
| 
       4226 
4226 
     | 
    
         
             
                entrypoints.entrypoints2Exports(filteredResolvedEntrypoints, {
         
     | 
| 
       4227 
4227 
     | 
    
         
             
                  outdir,
         
     | 
| 
      
 4228 
     | 
    
         
            +
                  sourceTag: pkgName,
         
     | 
| 
       4228 
4229 
     | 
    
         
             
                  withSuffix: isPublish ? withSuffix : void 0,
         
     | 
| 
       4229 
4230 
     | 
    
         
             
                  withSource: isPublish ? withSource : void 0,
         
     | 
| 
       4230 
4231 
     | 
    
         
             
                  withConditional: {
         
     | 
    
        package/dist/rollup/index.js
    CHANGED
    
    | 
         @@ -4212,6 +4212,7 @@ function getExports({ 
     | 
|
| 
       4212 
4212 
     | 
    
         
             
                filteredResolvedEntrypoints,
         
     | 
| 
       4213 
4213 
     | 
    
         
             
                entrypoints2Exports(filteredResolvedEntrypoints, {
         
     | 
| 
       4214 
4214 
     | 
    
         
             
                  outdir,
         
     | 
| 
      
 4215 
     | 
    
         
            +
                  sourceTag: pkgName,
         
     | 
| 
       4215 
4216 
     | 
    
         
             
                  withSuffix: isPublish ? withSuffix : void 0,
         
     | 
| 
       4216 
4217 
     | 
    
         
             
                  withSource: isPublish ? withSource : void 0,
         
     | 
| 
       4217 
4218 
     | 
    
         
             
                  withConditional: {
         
     | 
    
        package/package.json
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            {
         
     | 
| 
       2 
2 
     | 
    
         
             
              "name": "jiek",
         
     | 
| 
       3 
3 
     | 
    
         
             
              "type": "module",
         
     | 
| 
       4 
     | 
    
         
            -
              "version": "2.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              "version": "2.1.4",
         
     | 
| 
       5 
5 
     | 
    
         
             
              "description": "A lightweight toolkit for compiling and managing libraries based on `package.json` metadata and suitable for `Monorepo`.",
         
     | 
| 
       6 
6 
     | 
    
         
             
              "author": "YiJie <yijie4188@gmail.com>",
         
     | 
| 
       7 
7 
     | 
    
         
             
              "repository": {
         
     | 
| 
         @@ -19,22 +19,22 @@ 
     | 
|
| 
       19 
19 
     | 
    
         
             
              "exports": {
         
     | 
| 
       20 
20 
     | 
    
         
             
                "./package.json": "./package.json",
         
     | 
| 
       21 
21 
     | 
    
         
             
                ".": {
         
     | 
| 
       22 
     | 
    
         
            -
                  " 
     | 
| 
      
 22 
     | 
    
         
            +
                  "jiek/__source__": "./src/index.ts",
         
     | 
| 
       23 
23 
     | 
    
         
             
                  "require": "./dist/index.cjs",
         
     | 
| 
       24 
24 
     | 
    
         
             
                  "default": "./dist/index.js"
         
     | 
| 
       25 
25 
     | 
    
         
             
                },
         
     | 
| 
       26 
26 
     | 
    
         
             
                "./cli": {
         
     | 
| 
       27 
     | 
    
         
            -
                  " 
     | 
| 
      
 27 
     | 
    
         
            +
                  "jiek/__source__": "./src/cli.ts",
         
     | 
| 
       28 
28 
     | 
    
         
             
                  "require": "./dist/cli.cjs",
         
     | 
| 
       29 
29 
     | 
    
         
             
                  "default": "./dist/cli.js"
         
     | 
| 
       30 
30 
     | 
    
         
             
                },
         
     | 
| 
       31 
31 
     | 
    
         
             
                "./cli-only-build": {
         
     | 
| 
       32 
     | 
    
         
            -
                  " 
     | 
| 
      
 32 
     | 
    
         
            +
                  "jiek/__source__": "./src/cli-only-build.ts",
         
     | 
| 
       33 
33 
     | 
    
         
             
                  "require": "./dist/cli-only-build.cjs",
         
     | 
| 
       34 
34 
     | 
    
         
             
                  "default": "./dist/cli-only-build.js"
         
     | 
| 
       35 
35 
     | 
    
         
             
                },
         
     | 
| 
       36 
36 
     | 
    
         
             
                "./rollup": {
         
     | 
| 
       37 
     | 
    
         
            -
                  " 
     | 
| 
      
 37 
     | 
    
         
            +
                  "jiek/__source__": "./src/rollup/index.ts",
         
     | 
| 
       38 
38 
     | 
    
         
             
                  "require": "./dist/rollup/index.cjs",
         
     | 
| 
       39 
39 
     | 
    
         
             
                  "default": "./dist/rollup/index.js"
         
     | 
| 
       40 
40 
     | 
    
         
             
                }
         
     | 
| 
         @@ -55,7 +55,7 @@ 
     | 
|
| 
       55 
55 
     | 
    
         
             
                "js-yaml": "^4.1.0",
         
     | 
| 
       56 
56 
     | 
    
         
             
                "jsonc-parser": "^3.2.1",
         
     | 
| 
       57 
57 
     | 
    
         
             
                "rollup": "4.13.2",
         
     | 
| 
       58 
     | 
    
         
            -
                "@jiek/pkger": "^0.2. 
     | 
| 
      
 58 
     | 
    
         
            +
                "@jiek/pkger": "^0.2.1",
         
     | 
| 
       59 
59 
     | 
    
         
             
                "@jiek/utils": "^0.2.3"
         
     | 
| 
       60 
60 
     | 
    
         
             
              },
         
     | 
| 
       61 
61 
     | 
    
         
             
              "peerDependencies": {
         
     | 
    
        package/src/utils/getExports.ts
    CHANGED
    
    | 
         @@ -129,6 +129,7 @@ export function getExports({ 
     | 
|
| 
       129 
129 
     | 
    
         
             
                filteredResolvedEntrypoints,
         
     | 
| 
       130 
130 
     | 
    
         
             
                entrypoints2Exports(filteredResolvedEntrypoints, {
         
     | 
| 
       131 
131 
     | 
    
         
             
                  outdir,
         
     | 
| 
      
 132 
     | 
    
         
            +
                  sourceTag: pkgName,
         
     | 
| 
       132 
133 
     | 
    
         
             
                  withSuffix: isPublish ? withSuffix : undefined,
         
     | 
| 
       133 
134 
     | 
    
         
             
                  withSource: isPublish ? withSource : undefined,
         
     | 
| 
       134 
135 
     | 
    
         
             
                  withConditional: {
         
     |