jiek 2.0.2-alpha.2 → 2.0.2-alpha.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/package.json +36 -6
  2. package/README.md +0 -78
  3. package/bin/jiek-build.js +0 -16
  4. package/bin/jiek.js +0 -13
  5. package/dist/cli-only-build.cjs +0 -701
  6. package/dist/cli-only-build.d.cts +0 -91
  7. package/dist/cli-only-build.d.ts +0 -91
  8. package/dist/cli-only-build.js +0 -693
  9. package/dist/cli.cjs +0 -4638
  10. package/dist/cli.d.cts +0 -14
  11. package/dist/cli.d.ts +0 -14
  12. package/dist/cli.js +0 -4608
  13. package/dist/index.cjs +0 -5
  14. package/dist/index.d.cts +0 -112
  15. package/dist/index.d.ts +0 -112
  16. package/dist/index.js +0 -3
  17. package/dist/package.json +0 -125
  18. package/dist/rollup/index.cjs +0 -4893
  19. package/dist/rollup/index.d.cts +0 -10
  20. package/dist/rollup/index.d.ts +0 -10
  21. package/dist/rollup/index.js +0 -4880
  22. package/src/cli-only-build.ts +0 -7
  23. package/src/cli.ts +0 -2
  24. package/src/commands/base.ts +0 -18
  25. package/src/commands/build.ts +0 -459
  26. package/src/commands/descriptions.ts +0 -17
  27. package/src/commands/meta.ts +0 -5
  28. package/src/commands/publish.ts +0 -242
  29. package/src/index.ts +0 -8
  30. package/src/inner.ts +0 -11
  31. package/src/rollup/base.ts +0 -137
  32. package/src/rollup/index.ts +0 -565
  33. package/src/rollup/plugins/progress.ts +0 -26
  34. package/src/rollup/plugins/skip.ts +0 -21
  35. package/src/rollup/utils/commonOptions.ts +0 -9
  36. package/src/rollup/utils/externalResolver.ts +0 -35
  37. package/src/rollup/utils/globalResolver.ts +0 -13
  38. package/src/rollup/utils/withMinify.ts +0 -18
  39. package/src/utils/filterSupport.ts +0 -91
  40. package/src/utils/getExports.ts +0 -140
  41. package/src/utils/getRoot.ts +0 -16
  42. package/src/utils/getWD.ts +0 -31
  43. package/src/utils/loadConfig.ts +0 -111
  44. package/src/utils/recusiveListFiles.ts +0 -13
  45. package/src/utils/ts.ts +0 -94
  46. 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.2-alpha.2",
4
+ "version": "2.0.2-alpha.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": {
@@ -25,10 +25,26 @@
25
25
  ],
26
26
  "exports": {
27
27
  "./package.json": "./package.json",
28
- ".": "./src/index.ts",
29
- "./cli": "./src/cli.ts",
30
- "./cli-only-build": "./src/cli-only-build.ts",
31
- "./rollup": "./src/rollup/index.ts"
28
+ ".": {
29
+ "source": "./src/index.ts",
30
+ "require": "./dist/index.cjs",
31
+ "default": "./dist/index.js"
32
+ },
33
+ "./cli": {
34
+ "source": "./src/cli.ts",
35
+ "require": "./dist/cli.cjs",
36
+ "default": "./dist/cli.js"
37
+ },
38
+ "./cli-only-build": {
39
+ "source": "./src/cli-only-build.ts",
40
+ "require": "./dist/cli-only-build.cjs",
41
+ "default": "./dist/cli-only-build.js"
42
+ },
43
+ "./rollup": {
44
+ "source": "./src/rollup/index.ts",
45
+ "require": "./dist/rollup/index.cjs",
46
+ "default": "./dist/rollup/index.js"
47
+ }
32
48
  },
33
49
  "imports": {
34
50
  "#~/*": "./src/*"
@@ -103,6 +119,20 @@
103
119
  "rollup-plugin-swc3": "^0.12.1"
104
120
  },
105
121
  "scripts": {
106
- "prepublish": "jb -nm -nc"
122
+ "prepublish-0": "jb -nm && jk pp",
123
+ "prepublish": "jk"
124
+ },
125
+ "main": "./dist/index.cjs",
126
+ "module": "./dist/index.js",
127
+ "typesVersions": {
128
+ "<5.0": {
129
+ "*": [
130
+ "*",
131
+ "./dist/*",
132
+ "./dist/*/index.d.ts",
133
+ "./dist/*/index.d.mts",
134
+ "./dist/*/index.d.cts"
135
+ ]
136
+ }
107
137
  }
108
138
  }
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
- }