jiek 2.0.1 → 2.0.2-alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +8 -5
- package/README.md +0 -78
- package/bin/jiek-build.js +0 -16
- package/bin/jiek.js +0 -13
- package/dist/cli-only-build.cjs +0 -743
- package/dist/cli-only-build.d.cts +0 -91
- package/dist/cli-only-build.d.ts +0 -91
- package/dist/cli-only-build.js +0 -735
- package/dist/cli.cjs +0 -4888
- package/dist/cli.d.cts +0 -67
- package/dist/cli.d.ts +0 -67
- package/dist/cli.js +0 -4857
- package/dist/index.cjs +0 -5
- package/dist/index.d.cts +0 -165
- package/dist/index.d.ts +0 -165
- package/dist/index.js +0 -3
- package/dist/rollup/index.cjs +0 -4893
- package/dist/rollup/index.d.cts +0 -10
- package/dist/rollup/index.d.ts +0 -10
- package/dist/rollup/index.js +0 -4880
- package/src/cli-only-build.ts +0 -7
- package/src/cli.ts +0 -3
- package/src/commands/base.ts +0 -18
- package/src/commands/build.ts +0 -462
- package/src/commands/descriptions.ts +0 -17
- package/src/commands/init.ts +0 -373
- package/src/commands/meta.ts +0 -5
- package/src/commands/publish.ts +0 -204
- package/src/index.ts +0 -8
- package/src/inner.ts +0 -11
- package/src/rollup/base.ts +0 -137
- package/src/rollup/index.ts +0 -565
- package/src/rollup/plugins/progress.ts +0 -26
- package/src/rollup/plugins/skip.ts +0 -21
- package/src/rollup/utils/commonOptions.ts +0 -9
- package/src/rollup/utils/externalResolver.ts +0 -35
- package/src/rollup/utils/globalResolver.ts +0 -13
- package/src/rollup/utils/withMinify.ts +0 -18
- package/src/utils/filterSupport.ts +0 -91
- package/src/utils/getExports.ts +0 -140
- package/src/utils/getRoot.ts +0 -16
- package/src/utils/getWD.ts +0 -31
- package/src/utils/loadConfig.ts +0 -111
- package/src/utils/recusiveListFiles.ts +0 -13
- package/src/utils/ts.ts +0 -94
- package/src/utils/tsRegister.ts +0 -26
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "jiek",
|
3
3
|
"type": "module",
|
4
|
-
"version": "2.0.1",
|
4
|
+
"version": "2.0.2-alpha.1",
|
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": {
|
@@ -51,6 +51,7 @@
|
|
51
51
|
},
|
52
52
|
"dependencies": {
|
53
53
|
"@jiek/rollup-plugin-dts": "^6.2.1",
|
54
|
+
"@inquirer/prompts": "^7.1.0",
|
54
55
|
"@rollup/plugin-commonjs": "^28.0.0",
|
55
56
|
"@rollup/plugin-json": "^6.0.1",
|
56
57
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
@@ -58,12 +59,11 @@
|
|
58
59
|
"commander": "^12.0.0",
|
59
60
|
"detect-indent": "^6.1.0",
|
60
61
|
"execa": "9.3.1",
|
61
|
-
"inquirer": "^8.2.6",
|
62
62
|
"js-yaml": "^4.1.0",
|
63
63
|
"jsonc-parser": "^3.2.1",
|
64
64
|
"rollup": "4.13.2",
|
65
|
-
"@jiek/
|
66
|
-
"@jiek/
|
65
|
+
"@jiek/utils": "^0.2.3",
|
66
|
+
"@jiek/pkger": "^0.2.0"
|
67
67
|
},
|
68
68
|
"peerDependencies": {
|
69
69
|
"@rollup/plugin-terser": "^0.4.4",
|
@@ -118,8 +118,11 @@
|
|
118
118
|
"rollup-plugin-esbuild": "^6.1.0",
|
119
119
|
"rollup-plugin-swc3": "^0.12.1"
|
120
120
|
},
|
121
|
+
"publishConfig": {
|
122
|
+
"directory": "./dist"
|
123
|
+
},
|
121
124
|
"scripts": {
|
122
|
-
"prepublish": "jb
|
125
|
+
"prepublish": "jb -nm -nc"
|
123
126
|
},
|
124
127
|
"main": "./dist/index.cjs",
|
125
128
|
"module": "./dist/index.js",
|
package/README.md
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
# Jiek
|
2
|
-
|
3
|
-
| zh-Hans
|
4
|
-
| [en](https://github.com/NWYLZW/jiek/blob/master/packages/jiek/.about/en/README.md)
|
5
|
-
|
6
|
-
[![npm version](https://img.shields.io/npm/v/jiek)](https://npmjs.com/package/jiek)
|
7
|
-
[![npm downloads](https://img.shields.io/npm/dm/jiek)](https://npm.chart.dev/jiek)
|
8
|
-
|
9
|
-
> 基于 `package.json` 元数据并适用于 `Monorepo` 的**轻便**工具库编译管理套件。
|
10
|
-
|
11
|
-
- [x] 自动推断:基于 `package.json` 的相关字段自动推断出构建规则,减少配置文件的编写,更加轻便与符合标准
|
12
|
-
- `exports`:根据入口文件推断构建目标与类型
|
13
|
-
- `imports`:定义路径别名,并在构建的时候自动 bundle 进来
|
14
|
-
- `type: module`:根据选项智能决定输出文件后缀,不需要考虑 `cjs` 与 `esm` 的适配问题
|
15
|
-
- `dependencies`、`peerDependencies`、`optionalDependencies`:自动将符合规则的依赖标记为 `external`
|
16
|
-
- `devDependencies`:将标记为开发依赖的 bundle 进对应的最终产物之中
|
17
|
-
- [ ] 构建工具:支持多种构建工具,无需纠结于用 swc 还是 esbuild 又或者是 tsc
|
18
|
-
- [x] `esbuild`
|
19
|
-
- [x] `swc`
|
20
|
-
- [ ] `typescript`
|
21
|
-
- [x] 工作空间友好:支持在 pnpm 下的工作空间开发范式
|
22
|
-
- [ ] 支持更多的 PM
|
23
|
-
- [ ] 更好的工作空间任务流
|
24
|
-
- [x] 类型定义文件:支持聚合生成类型定义文件
|
25
|
-
- [x] 监听模式:适配 rollup 的监听模式
|
26
|
-
- [x] 发布适配:支持同构生成 `package.json` 等相关字段
|
27
|
-
- [ ] 根据 `package.json` 中的路径自动替换 README.md 中的相对路径链接为对应的网络链接
|
28
|
-
- [x] CommonJS:产物兼容正在使用 cjs 的用户
|
29
|
-
- [ ] 插件化
|
30
|
-
- [ ] Dotenv:支持 dotenv 配置文件
|
31
|
-
- [ ] Replacer:支持替换文件内容
|
32
|
-
|
33
|
-
## 安装
|
34
|
-
|
35
|
-
```bash
|
36
|
-
npm i -D jiek
|
37
|
-
# or
|
38
|
-
pnpm i -D jiek
|
39
|
-
# or
|
40
|
-
yarn add -D jiek
|
41
|
-
```
|
42
|
-
|
43
|
-
## 快速起步
|
44
|
-
|
45
|
-
通过一些简单的方式能又快又轻松的生成需要的产物。
|
46
|
-
|
47
|
-
- 在 `package.json` 中添加入口文件,这里需要设置为原文件路径。
|
48
|
-
|
49
|
-
你可以在 Node.js 文档中查看更多对于 [exports](https://nodejs.org/api/packages.html#exports) 的相关内容。
|
50
|
-
|
51
|
-
```json
|
52
|
-
{
|
53
|
-
...
|
54
|
-
"exports": "./src/index.ts",
|
55
|
-
...
|
56
|
-
}
|
57
|
-
```
|
58
|
-
|
59
|
-
- 假设你在工作空间下有一个包名字为 `@monorepo/utils` ,那么你可以运行 `jb utils` 来构建这个包。
|
60
|
-
|
61
|
-
- 当你完成了开发的相关步骤后,在发布阶段你可以使用 `jk -f utils publish` 来发布你的包,本工具会自动转化并填充 `package.json` 对应的字段。
|
62
|
-
|
63
|
-
你可以添加 `-p/--preview` 参数来预览待发布的 `package.json` 的内容。
|
64
|
-
|
65
|
-
## CLI
|
66
|
-
|
67
|
-
```text
|
68
|
-
Usage: jk [options] [command]
|
69
|
-
```
|
70
|
-
|
71
|
-
## 为什么不使用 X?
|
72
|
-
|
73
|
-
在这里与 `jiek` 类似的工具有:[tsup](https://github.com/egoist/tsup)、[unbuild](https://github.com/unjs/unbuild)、[bunchee](https://github.com/huozhi/bunchee)、[pkgroll](https://github.com/privatenumber/pkgroll)、[tsdown](https://github.com/sxzz/tsdown)。但是他们都有着一些共同问题没有解决,比如说:
|
74
|
-
|
75
|
-
- `monorepo` 的支持存在一定的问题,在依赖工作空间其他的包时必须重新编译相关依赖
|
76
|
-
- 编写入口文件的规则过于繁琐,不够自然
|
77
|
-
- 无法处理 `tsconfig.json` 中的 `Project Reference` 相关问题
|
78
|
-
- 根据`conditions`
|
package/bin/jiek-build.js
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env node
|
2
|
-
import { existsSync } from 'node:fs'
|
3
|
-
import { createRequire } from 'node:module'
|
4
|
-
import { dirname, resolve } from 'node:path'
|
5
|
-
import process from 'node:process'
|
6
|
-
|
7
|
-
process.env.JIEK_IS_ONLY_BUILD = 'true'
|
8
|
-
|
9
|
-
const __dirname = dirname(import.meta.url.replace('file://', ''))
|
10
|
-
if (existsSync(resolve(__dirname, '../.jiek-dev-tag'))) {
|
11
|
-
const require = createRequire(import.meta.url)
|
12
|
-
require('esbuild-register')
|
13
|
-
require('../src/cli-only-build.ts')
|
14
|
-
} else {
|
15
|
-
import('jiek/cli-only-build')
|
16
|
-
}
|
package/bin/jiek.js
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env node
|
2
|
-
import { existsSync } from 'node:fs'
|
3
|
-
import { createRequire } from 'node:module'
|
4
|
-
import { dirname, resolve } from 'node:path'
|
5
|
-
|
6
|
-
const __dirname = dirname(import.meta.url.replace('file://', ''))
|
7
|
-
if (existsSync(resolve(__dirname, '../.jiek-dev-tag'))) {
|
8
|
-
const require = createRequire(import.meta.url)
|
9
|
-
require('esbuild-register')
|
10
|
-
require('../src/cli.ts')
|
11
|
-
} else {
|
12
|
-
import('jiek/cli')
|
13
|
-
}
|