jiek 0.4.5 → 0.4.7-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. package/README.md +22 -1
  2. package/bin/jiek.js +2 -1
  3. package/dist/cli.d.mts +97 -0
  4. package/dist/cli.d.mts.map +1 -0
  5. package/dist/cli.d.ts +96 -1
  6. package/dist/cli.d.ts.map +1 -0
  7. package/dist/{cli.cjs → cli.js} +361 -226
  8. package/dist/cli.js.map +1 -0
  9. package/dist/cli.min.js +1 -0
  10. package/dist/cli.min.js.map +1 -0
  11. package/dist/cli.min.mjs +1 -0
  12. package/dist/cli.min.mjs.map +1 -0
  13. package/dist/cli.mjs +803 -0
  14. package/dist/cli.mjs.map +1 -0
  15. package/dist/index.d.mts +58 -0
  16. package/dist/index.d.mts.map +1 -0
  17. package/dist/index.d.ts +47 -46
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/{index.cjs → index.js} +0 -1
  20. package/dist/index.js.map +1 -0
  21. package/dist/{index.min.cjs → index.min.js} +0 -1
  22. package/dist/index.min.js.map +1 -0
  23. package/dist/index.min.mjs +1 -0
  24. package/dist/index.min.mjs.map +1 -0
  25. package/dist/{index.esm.js → index.mjs} +0 -1
  26. package/dist/index.mjs.map +1 -0
  27. package/dist/rollup/index.d.mts +53 -0
  28. package/dist/rollup/index.d.mts.map +1 -0
  29. package/dist/rollup/index.d.ts +53 -0
  30. package/dist/rollup/index.d.ts.map +1 -0
  31. package/dist/rollup/index.js +553 -0
  32. package/dist/rollup/index.js.map +1 -0
  33. package/dist/rollup/index.min.js +1 -0
  34. package/dist/rollup/index.min.js.map +1 -0
  35. package/dist/rollup/index.min.mjs +1 -0
  36. package/dist/rollup/index.min.mjs.map +1 -0
  37. package/dist/rollup/index.mjs +551 -0
  38. package/dist/rollup/index.mjs.map +1 -0
  39. package/package.json +52 -35
  40. package/src/cli.ts +9 -0
  41. package/src/commands/base.ts +9 -0
  42. package/src/commands/build.ts +156 -0
  43. package/src/commands/init.ts +373 -0
  44. package/src/commands/publish.ts +156 -0
  45. package/src/index.ts +8 -0
  46. package/src/inner.ts +11 -0
  47. package/src/merge-package-json.ts +75 -0
  48. package/src/pkg.ts +1 -0
  49. package/src/rollup/base.ts +72 -0
  50. package/src/rollup/index.ts +420 -0
  51. package/src/rollup/plugins/globals.ts +34 -0
  52. package/src/rollup/plugins/progress.ts +26 -0
  53. package/src/rollup/plugins/skip.ts +23 -0
  54. package/src/rollup/utils/commonOptions.ts +9 -0
  55. package/src/rollup/utils/externalResolver.ts +21 -0
  56. package/src/rollup/utils/globalResolver.ts +13 -0
  57. package/src/rollup/utils/withMinify.ts +18 -0
  58. package/src/utils/filterSupport.ts +82 -0
  59. package/src/utils/getExports.ts +100 -0
  60. package/src/utils/getRoot.ts +16 -0
  61. package/src/utils/getWD.ts +31 -0
  62. package/src/utils/loadConfig.ts +93 -0
  63. package/src/utils/tsRegister.ts +22 -0
  64. package/dist/base.esm.d.ts +0 -55
  65. package/dist/cli.cjs.map +0 -1
  66. package/dist/cli.esm.d.ts +0 -2
  67. package/dist/cli.esm.js +0 -9
  68. package/dist/cli.esm.js.map +0 -1
  69. package/dist/cli.esm.min.js +0 -2
  70. package/dist/cli.esm.min.js.map +0 -1
  71. package/dist/cli.min.cjs +0 -2
  72. package/dist/cli.min.cjs.map +0 -1
  73. package/dist/commands/base.esm.js +0 -5
  74. package/dist/commands/base.esm.js.map +0 -1
  75. package/dist/commands/base.esm.min.js +0 -2
  76. package/dist/commands/base.esm.min.js.map +0 -1
  77. package/dist/commands/build.esm.js +0 -58
  78. package/dist/commands/build.esm.js.map +0 -1
  79. package/dist/commands/build.esm.min.js +0 -2
  80. package/dist/commands/build.esm.min.js.map +0 -1
  81. package/dist/commands/init.esm.js +0 -271
  82. package/dist/commands/init.esm.js.map +0 -1
  83. package/dist/commands/init.esm.min.js +0 -2
  84. package/dist/commands/init.esm.min.js.map +0 -1
  85. package/dist/commands/publish.esm.js +0 -76
  86. package/dist/commands/publish.esm.js.map +0 -1
  87. package/dist/commands/publish.esm.min.js +0 -2
  88. package/dist/commands/publish.esm.min.js.map +0 -1
  89. package/dist/index.cjs.map +0 -1
  90. package/dist/index.esm.d.ts +0 -6
  91. package/dist/index.esm.js.map +0 -1
  92. package/dist/index.esm.min.js +0 -2
  93. package/dist/index.esm.min.js.map +0 -1
  94. package/dist/index.min.cjs.map +0 -1
  95. package/dist/inner.esm.js +0 -10
  96. package/dist/inner.esm.js.map +0 -1
  97. package/dist/inner.esm.min.js +0 -2
  98. package/dist/inner.esm.min.js.map +0 -1
  99. package/dist/merge-package-json.esm.js +0 -64
  100. package/dist/merge-package-json.esm.js.map +0 -1
  101. package/dist/merge-package-json.esm.min.js +0 -2
  102. package/dist/merge-package-json.esm.min.js.map +0 -1
  103. package/dist/pkg.esm.js +0 -4
  104. package/dist/pkg.esm.js.map +0 -1
  105. package/dist/pkg.esm.min.js +0 -2
  106. package/dist/pkg.esm.min.js.map +0 -1
  107. package/dist/rollup/plugins/globals.esm.js +0 -31
  108. package/dist/rollup/plugins/globals.esm.js.map +0 -1
  109. package/dist/rollup/plugins/globals.esm.min.js +0 -2
  110. package/dist/rollup/plugins/globals.esm.min.js.map +0 -1
  111. package/dist/rollup/plugins/skip.esm.js +0 -16
  112. package/dist/rollup/plugins/skip.esm.js.map +0 -1
  113. package/dist/rollup/plugins/skip.esm.min.js +0 -2
  114. package/dist/rollup/plugins/skip.esm.min.js.map +0 -1
  115. package/dist/rollup/utils/commonOptions.esm.js +0 -9
  116. package/dist/rollup/utils/commonOptions.esm.js.map +0 -1
  117. package/dist/rollup/utils/commonOptions.esm.min.js +0 -2
  118. package/dist/rollup/utils/commonOptions.esm.min.js.map +0 -1
  119. package/dist/rollup/utils/externalResolver.esm.js +0 -12
  120. package/dist/rollup/utils/externalResolver.esm.js.map +0 -1
  121. package/dist/rollup/utils/externalResolver.esm.min.js +0 -2
  122. package/dist/rollup/utils/externalResolver.esm.min.js.map +0 -1
  123. package/dist/rollup/utils/globalResolver.esm.js +0 -9
  124. package/dist/rollup/utils/globalResolver.esm.js.map +0 -1
  125. package/dist/rollup/utils/globalResolver.esm.min.js +0 -2
  126. package/dist/rollup/utils/globalResolver.esm.min.js.map +0 -1
  127. package/dist/rollup/utils/withMinify.esm.js +0 -15
  128. package/dist/rollup/utils/withMinify.esm.js.map +0 -1
  129. package/dist/rollup/utils/withMinify.esm.min.js +0 -2
  130. package/dist/rollup/utils/withMinify.esm.min.js.map +0 -1
  131. package/dist/rollup.cjs +0 -330
  132. package/dist/rollup.cjs.map +0 -1
  133. package/dist/rollup.d.ts +0 -23
  134. package/dist/rollup.esm.d.ts +0 -23
  135. package/dist/rollup.esm.js +0 -248
  136. package/dist/rollup.esm.js.map +0 -1
  137. package/dist/rollup.esm.min.js +0 -2
  138. package/dist/rollup.esm.min.js.map +0 -1
  139. package/dist/rollup.min.cjs +0 -2
  140. package/dist/rollup.min.cjs.map +0 -1
  141. package/dist/utils/commondir.esm.js +0 -25
  142. package/dist/utils/commondir.esm.js.map +0 -1
  143. package/dist/utils/commondir.esm.min.js +0 -2
  144. package/dist/utils/commondir.esm.min.js.map +0 -1
  145. package/dist/utils/filterSupport.esm.js +0 -67
  146. package/dist/utils/filterSupport.esm.js.map +0 -1
  147. package/dist/utils/filterSupport.esm.min.js +0 -2
  148. package/dist/utils/filterSupport.esm.min.js.map +0 -1
  149. package/dist/utils/getRoot.esm.js +0 -14
  150. package/dist/utils/getRoot.esm.js.map +0 -1
  151. package/dist/utils/getRoot.esm.min.js +0 -2
  152. package/dist/utils/getRoot.esm.min.js.map +0 -1
  153. package/dist/utils/getWD.esm.js +0 -31
  154. package/dist/utils/getWD.esm.js.map +0 -1
  155. package/dist/utils/getWD.esm.min.js +0 -2
  156. package/dist/utils/getWD.esm.min.js.map +0 -1
  157. package/dist/utils/loadConfig.esm.js +0 -75
  158. package/dist/utils/loadConfig.esm.js.map +0 -1
  159. package/dist/utils/loadConfig.esm.min.js +0 -2
  160. package/dist/utils/loadConfig.esm.min.js.map +0 -1
  161. package/dist/utils/tsRegister.esm.js +0 -24
  162. package/dist/utils/tsRegister.esm.js.map +0 -1
  163. package/dist/utils/tsRegister.esm.min.js +0 -2
  164. package/dist/utils/tsRegister.esm.min.js.map +0 -1
package/README.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Jiek
2
2
 
3
- A powerful and clever monorepo cli tool.
3
+ 为什么没有一个在 monorepo 下面足够现代又足够简单的构建工具呢?恭喜你发现了宝藏~
4
4
 
5
5
  ## Features
6
+
7
+ ### build
8
+
9
+ 写构建脚本一直不是一件简单的事情,那么怎么把一个复杂的事情变简单呢?我们回到需求的本身,那就是「定义什么便构建什么」。在这里我们用自然的方式来定义构建产物,而不需要去多写一行多余的代码。
10
+
11
+ > 在这里你需要了解足够先进和现代的「[模块管理]()」以及「[导出策略]()」,在这里我们便是基于这俩点达成的一些自然而然的约定来实现的减轻负担。
12
+
13
+ 接下来我们可以一步步的来看看我们的构建工具是如何工作的。
14
+
15
+ #### 定义入口
16
+
17
+ #### 运行指令
18
+
19
+ #### 个性化需求
20
+
21
+ #### 幕后的故事
22
+
23
+ 一些关于本工具的设计思路和实现细节,不阅读也不会影响各位的使用,感兴趣的各位可以看看。
24
+
25
+ - 入口的约定
26
+ - 插件的抉择
package/bin/jiek.js CHANGED
@@ -5,5 +5,6 @@ const path = require('node:path')
5
5
  if (fs.existsSync(path.join(__dirname, '../.jiek-dev-tag'))) {
6
6
  require('esbuild-register')
7
7
  require('../src/cli.ts')
8
- } else
8
+ } else {
9
9
  require('../dist/cli.cjs')
10
+ }
package/dist/cli.d.mts ADDED
@@ -0,0 +1,97 @@
1
+ import { OutputOptions } from 'rollup';
2
+
3
+ type Mapping2ROO<K extends keyof OutputOptions> = OutputOptions[K] | {
4
+ js?: OutputOptions[K];
5
+ dts?: OutputOptions[K];
6
+ };
7
+ interface TemplateOptions {
8
+ /**
9
+ * When the user configures type: module, the generated output from entry points that don't
10
+ * have cts as a suffix will automatically include the CJS version.
11
+ * if it is not configured, and the generated output from entry points that do not have mts
12
+ * as a suffix will automatically include the ESM version.
13
+ *
14
+ * @default true
15
+ */
16
+ crossModuleConvertor?: boolean;
17
+ output?: {
18
+ /**
19
+ * @default true
20
+ *
21
+ * When minify is set to true, the output will with minified files.
22
+ * When minify is set to 'only-minify', the output will direct output minified files.
23
+ */
24
+ minify?: boolean | 'only-minify';
25
+ /**
26
+ * @default 'dist'
27
+ */
28
+ dir?: Mapping2ROO<'dir'>;
29
+ sourcemap?: Mapping2ROO<'sourcemap'>;
30
+ strict?: Mapping2ROO<'strict'>;
31
+ };
32
+ }
33
+ declare module 'jiek' {
34
+ interface Config {
35
+ build?: TemplateOptions & {
36
+ /**
37
+ * Whether to run in silent mode, only active when configured in the workspace root or cwd.
38
+ *
39
+ * @default false
40
+ */
41
+ silent?: boolean;
42
+ };
43
+ }
44
+ }
45
+
46
+ declare module 'jiek' {
47
+ type InitNamedFunction = (argument: string, paths: {
48
+ full: string;
49
+ relative: string;
50
+ basename?: string;
51
+ }) => [name?: string, path?: string];
52
+ type InitNamed = InitNamedFunction | {
53
+ [key: string]: string | InitNamedFunction;
54
+ };
55
+ interface Config {
56
+ init?: {
57
+ /**
58
+ * the package.json template file path or file content
59
+ *
60
+ * if it can be parsed as json, it will be parsed
61
+ * if it is a relative file path, it will be resolved to an absolute path based on the current working directory
62
+ * if it is an absolute file path, it will be used directly
63
+ * @default '.jiek.template.package.json'
64
+ */
65
+ template?: string;
66
+ /**
67
+ * the readme content
68
+ *
69
+ * $name will be replaced with the package name
70
+ * $license will be replaced with the license
71
+ */
72
+ readme?: string | ((ctx: {
73
+ dir: string;
74
+ packageJson: Record<string, any>;
75
+ }) => string);
76
+ /**
77
+ * the readme template file path
78
+ * @default '.jiek.template.readme.md'
79
+ */
80
+ readmeTemplate?: string;
81
+ bug?: {
82
+ /**
83
+ * @default 'bug_report.yml'
84
+ */
85
+ template?: string;
86
+ /**
87
+ * @default ['bug']
88
+ */
89
+ labels?: string[] | ((ctx: {
90
+ name: string;
91
+ dir: string;
92
+ }) => string[]);
93
+ };
94
+ named?: InitNamed;
95
+ };
96
+ }
97
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.mts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/dist/cli.d.ts CHANGED
@@ -1,2 +1,97 @@
1
+ import { OutputOptions } from 'rollup';
1
2
 
2
- export { }
3
+ type Mapping2ROO<K extends keyof OutputOptions> = OutputOptions[K] | {
4
+ js?: OutputOptions[K];
5
+ dts?: OutputOptions[K];
6
+ };
7
+ interface TemplateOptions {
8
+ /**
9
+ * When the user configures type: module, the generated output from entry points that don't
10
+ * have cts as a suffix will automatically include the CJS version.
11
+ * if it is not configured, and the generated output from entry points that do not have mts
12
+ * as a suffix will automatically include the ESM version.
13
+ *
14
+ * @default true
15
+ */
16
+ crossModuleConvertor?: boolean;
17
+ output?: {
18
+ /**
19
+ * @default true
20
+ *
21
+ * When minify is set to true, the output will with minified files.
22
+ * When minify is set to 'only-minify', the output will direct output minified files.
23
+ */
24
+ minify?: boolean | 'only-minify';
25
+ /**
26
+ * @default 'dist'
27
+ */
28
+ dir?: Mapping2ROO<'dir'>;
29
+ sourcemap?: Mapping2ROO<'sourcemap'>;
30
+ strict?: Mapping2ROO<'strict'>;
31
+ };
32
+ }
33
+ declare module 'jiek' {
34
+ interface Config {
35
+ build?: TemplateOptions & {
36
+ /**
37
+ * Whether to run in silent mode, only active when configured in the workspace root or cwd.
38
+ *
39
+ * @default false
40
+ */
41
+ silent?: boolean;
42
+ };
43
+ }
44
+ }
45
+
46
+ declare module 'jiek' {
47
+ type InitNamedFunction = (argument: string, paths: {
48
+ full: string;
49
+ relative: string;
50
+ basename?: string;
51
+ }) => [name?: string, path?: string];
52
+ type InitNamed = InitNamedFunction | {
53
+ [key: string]: string | InitNamedFunction;
54
+ };
55
+ interface Config {
56
+ init?: {
57
+ /**
58
+ * the package.json template file path or file content
59
+ *
60
+ * if it can be parsed as json, it will be parsed
61
+ * if it is a relative file path, it will be resolved to an absolute path based on the current working directory
62
+ * if it is an absolute file path, it will be used directly
63
+ * @default '.jiek.template.package.json'
64
+ */
65
+ template?: string;
66
+ /**
67
+ * the readme content
68
+ *
69
+ * $name will be replaced with the package name
70
+ * $license will be replaced with the license
71
+ */
72
+ readme?: string | ((ctx: {
73
+ dir: string;
74
+ packageJson: Record<string, any>;
75
+ }) => string);
76
+ /**
77
+ * the readme template file path
78
+ * @default '.jiek.template.readme.md'
79
+ */
80
+ readmeTemplate?: string;
81
+ bug?: {
82
+ /**
83
+ * @default 'bug_report.yml'
84
+ */
85
+ template?: string;
86
+ /**
87
+ * @default ['bug']
88
+ */
89
+ labels?: string[] | ((ctx: {
90
+ name: string;
91
+ dir: string;
92
+ }) => string[]);
93
+ };
94
+ named?: InitNamed;
95
+ };
96
+ }
97
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}