testeranto 0.100.0 → 0.110.0

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.
Files changed (285) hide show
  1. package/README.md +1 -0
  2. package/bundle.js +80 -30
  3. package/dist/common/{dist/module/src/Init.js → Init.js} +28 -0
  4. package/dist/common/{src/PM → PM}/main.js +138 -95
  5. package/dist/common/ReportServer.js +22 -0
  6. package/dist/common/{src/SubPackages → SubPackages}/react/jsx/index.js +0 -12
  7. package/dist/common/{src/SubPackages → SubPackages}/react-dom/component/node.js +3 -16
  8. package/dist/common/{src/SubPackages → SubPackages}/react-dom/component/web.js +3 -3
  9. package/dist/common/{src/SubPackages → SubPackages}/react-dom/jsx/node.js +1 -1
  10. package/dist/common/{src/SubPackages → SubPackages}/react-dom/jsx/web.js +41 -30
  11. package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +17 -7
  12. package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/component/interface.js +17 -7
  13. package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/fc/node.js +17 -7
  14. package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/fc/web.js +17 -7
  15. package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/jsx/index.js +18 -14
  16. package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/jsx-promised/index.js +17 -7
  17. package/dist/common/build.js +222 -0
  18. package/dist/common/{src/defaultConfig.js → defaultConfig.js} +1 -0
  19. package/dist/common/esbuildConfigs/eslint-formatter-testeranto.js +6 -0
  20. package/dist/common/esbuildConfigs/inputFilesPlugin.js +27 -0
  21. package/dist/common/{src/esbuildConfigs → esbuildConfigs}/node.js +2 -10
  22. package/dist/common/{src/esbuildConfigs → esbuildConfigs}/web.js +2 -13
  23. package/dist/common/{src/init-docs.js → init-docs.js} +20 -10
  24. package/dist/common/{src/lib → lib}/abstractBase.js +6 -1
  25. package/dist/common/{src/lib → lib}/basebuilder.js +23 -10
  26. package/dist/common/{src/lib → lib}/classBuilder.js +1 -3
  27. package/dist/common/{src/lib → lib}/core.js +26 -10
  28. package/dist/common/{src/lib → lib}/index.js +0 -1
  29. package/dist/common/{src/lib → lib}/types.js +0 -1
  30. package/dist/common/run.js +297 -0
  31. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  32. package/dist/common/utils.js +43 -0
  33. package/dist/module/Footer.js +4 -0
  34. package/dist/module/Init.js +63 -0
  35. package/dist/module/{src/PM → PM}/main.js +119 -86
  36. package/dist/module/ReportClient.js +97 -0
  37. package/dist/module/ReportServer.js +17 -0
  38. package/dist/module/SubPackages/react/jsx/index.js +15 -0
  39. package/dist/module/{src/SubPackages → SubPackages}/react-dom/component/node.js +3 -16
  40. package/dist/module/{src/SubPackages → SubPackages}/react-dom/component/web.js +3 -3
  41. package/dist/module/{src/SubPackages → SubPackages}/react-dom/jsx/node.js +3 -3
  42. package/dist/module/{src/SubPackages → SubPackages}/react-dom/jsx/web.js +24 -23
  43. package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/jsx/index.js +1 -7
  44. package/dist/module/TestReport.js +91 -0
  45. package/dist/module/build.js +184 -0
  46. package/dist/module/{src/defaultConfig.js → defaultConfig.js} +1 -0
  47. package/dist/module/esbuildConfigs/eslint-formatter-testeranto.js +3 -0
  48. package/dist/module/esbuildConfigs/inputFilesPlugin.js +22 -0
  49. package/dist/module/{src/esbuildConfigs → esbuildConfigs}/node.js +2 -10
  50. package/dist/module/{src/esbuildConfigs → esbuildConfigs}/web.js +2 -13
  51. package/dist/module/{src/init-docs.js → init-docs.js} +1 -1
  52. package/dist/module/{src/lib → lib}/abstractBase.js +6 -1
  53. package/dist/module/{src/lib → lib}/basebuilder.js +23 -10
  54. package/dist/module/{src/lib → lib}/classBuilder.js +1 -3
  55. package/dist/module/{src/lib → lib}/core.js +26 -10
  56. package/dist/module/{src/lib → lib}/index.js +0 -1
  57. package/dist/module/run.js +259 -0
  58. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  59. package/dist/module/utils.js +29 -0
  60. package/dist/prebuild/ReportClient.css +11367 -0
  61. package/dist/prebuild/ReportClient.js +23641 -0
  62. package/dist/prebuild/ReportServer.mjs +16 -0
  63. package/dist/prebuild/TestReport.css +11367 -0
  64. package/dist/prebuild/TestReport.js +27484 -0
  65. package/dist/prebuild/build.mjs +376 -0
  66. package/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs +9 -0
  67. package/dist/prebuild/init-docs.mjs +64 -8
  68. package/dist/prebuild/{cli2.mjs → run.mjs} +353 -81
  69. package/dist/tsconfig.tsbuildinfo +1 -0
  70. package/dist/types/Node.d.ts +12 -0
  71. package/dist/types/{src/PM → PM}/index.d.ts +1 -1
  72. package/dist/types/{src/PM → PM}/main.d.ts +12 -9
  73. package/dist/types/{src/PM → PM}/node.d.ts +2 -4
  74. package/dist/types/{src/PM → PM}/web.d.ts +2 -4
  75. package/dist/types/SubPackages/react/component/node.d.ts +7 -0
  76. package/dist/types/SubPackages/react/component/web.d.ts +7 -0
  77. package/dist/types/SubPackages/react/jsx/index.d.ts +12 -0
  78. package/dist/types/SubPackages/react/jsx/node.d.ts +4 -0
  79. package/dist/types/SubPackages/react/jsx/web.d.ts +4 -0
  80. package/dist/types/SubPackages/react-dom/component/node.d.ts +11 -0
  81. package/dist/types/SubPackages/react-dom/component/web.d.ts +20 -0
  82. package/dist/types/SubPackages/react-dom/jsx/index.d.ts +6 -0
  83. package/dist/types/SubPackages/react-dom/jsx/node.d.ts +7 -0
  84. package/dist/types/SubPackages/react-dom/jsx/web.d.ts +5 -0
  85. package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +6 -0
  86. package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +13 -0
  87. package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +4 -0
  88. package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +4 -0
  89. package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +8 -0
  90. package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +9 -0
  91. package/dist/types/SubPackages/react-test-renderer/jsx/index.d.ts +16 -0
  92. package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +9 -0
  93. package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +9 -0
  94. package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +15 -0
  95. package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +5 -0
  96. package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +5 -0
  97. package/dist/types/Types.d.ts +61 -0
  98. package/dist/types/Web.d.ts +9 -0
  99. package/dist/types/defaultConfig.d.ts +3 -0
  100. package/dist/types/esbuildConfigs/eslint-formatter-testeranto.d.ts +2 -0
  101. package/dist/types/{src/esbuildConfigs → esbuildConfigs}/index.d.ts +1 -1
  102. package/dist/types/{src/esbuildConfigs → esbuildConfigs}/inputFilesPlugin.d.ts +0 -1
  103. package/dist/types/{src/esbuildConfigs → esbuildConfigs}/node.d.ts +1 -1
  104. package/dist/types/{src/esbuildConfigs → esbuildConfigs}/web.d.ts +1 -1
  105. package/dist/types/init-docs.d.ts +1 -0
  106. package/dist/types/lib/abstractBase.d.ts +110 -0
  107. package/dist/types/lib/basebuilder.d.ts +27 -0
  108. package/dist/types/lib/classBuilder.d.ts +7 -0
  109. package/dist/types/lib/core.d.ts +7 -0
  110. package/dist/types/lib/index.d.ts +83 -0
  111. package/dist/types/lib/types.d.ts +14 -0
  112. package/dist/types/run.d.ts +1 -0
  113. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  114. package/dist/types/utils.d.ts +9 -0
  115. package/package.json +40 -32
  116. package/src/Footer.tsx +4 -0
  117. package/src/Init.ts +48 -0
  118. package/src/Node.ts +23 -17
  119. package/src/PM/index.ts +1 -1
  120. package/src/PM/main.ts +143 -101
  121. package/src/PM/node.ts +2 -2
  122. package/src/PM/web.ts +1 -1
  123. package/src/ReportClient.tsx +155 -0
  124. package/src/ReportServer.ts +21 -0
  125. package/src/SubPackages/react/component/node.ts +68 -24
  126. package/src/SubPackages/react/component/web.ts +68 -25
  127. package/src/SubPackages/react/jsx/index.ts +39 -18
  128. package/src/SubPackages/react/jsx/node.ts +12 -10
  129. package/src/SubPackages/react/jsx/web.ts +27 -14
  130. package/src/SubPackages/react-dom/component/node.ts +42 -50
  131. package/src/SubPackages/react-dom/component/web.ts +28 -10
  132. package/src/SubPackages/react-dom/jsx/node.ts +54 -56
  133. package/src/SubPackages/react-dom/jsx/web.ts +55 -42
  134. package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +23 -7
  135. package/src/SubPackages/react-test-renderer/component/index.ts +38 -5
  136. package/src/SubPackages/react-test-renderer/component/node.ts +24 -5
  137. package/src/SubPackages/react-test-renderer/component/web.ts +22 -5
  138. package/src/SubPackages/react-test-renderer/fc/node.ts +41 -7
  139. package/src/SubPackages/react-test-renderer/fc/web.ts +43 -11
  140. package/src/SubPackages/react-test-renderer/jsx/index.ts +39 -16
  141. package/src/SubPackages/react-test-renderer/jsx/node.ts +8 -6
  142. package/src/SubPackages/react-test-renderer/jsx/web.ts +22 -5
  143. package/src/SubPackages/react-test-renderer/jsx-promised/index.ts +39 -6
  144. package/src/SubPackages/react-test-renderer/jsx-promised/node.ts +27 -10
  145. package/src/SubPackages/react-test-renderer/jsx-promised/web.ts +26 -12
  146. package/src/TestReport.tsx +176 -0
  147. package/src/Types.ts +63 -309
  148. package/src/Web.ts +24 -18
  149. package/src/build.ts +240 -0
  150. package/src/defaultConfig.ts +2 -1
  151. package/src/esbuildConfigs/eslint-formatter-testeranto.ts +5 -0
  152. package/src/esbuildConfigs/featuresPlugin.ts +0 -1
  153. package/src/esbuildConfigs/index.ts +1 -1
  154. package/src/esbuildConfigs/inputFilesPlugin.ts +2 -135
  155. package/src/esbuildConfigs/node.ts +4 -13
  156. package/src/esbuildConfigs/web.ts +3 -19
  157. package/src/init-docs.ts +2 -1
  158. package/src/lib/abstractBase.ts +82 -80
  159. package/src/lib/basebuilder.ts +57 -45
  160. package/src/lib/classBuilder.ts +15 -15
  161. package/src/lib/core.ts +44 -35
  162. package/src/lib/index.ts +47 -98
  163. package/src/lib/readme.md +12 -0
  164. package/src/lib/types.ts +53 -70
  165. package/src/run.ts +398 -0
  166. package/src/style.css +8 -0
  167. package/src/utils.ts +74 -2
  168. package/tsc.log +106 -0
  169. package/Bundle.Dockerfile +0 -52
  170. package/bin/init-docs.js +0 -24
  171. package/dist/common/src/Init.js +0 -40
  172. package/dist/common/src/SubPackages/puppeteer.js +0 -21
  173. package/dist/common/src/cli.js +0 -439
  174. package/dist/common/src/cli2.js +0 -144
  175. package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +0 -99
  176. package/dist/common/src/utils.js +0 -16
  177. package/dist/common/testeranto.js +0 -15
  178. package/dist/module/src/Init.js +0 -35
  179. package/dist/module/src/SubPackages/puppeteer.js +0 -16
  180. package/dist/module/src/SubPackages/react/jsx/index.js +0 -27
  181. package/dist/module/src/cli.js +0 -411
  182. package/dist/module/src/cli2.js +0 -116
  183. package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +0 -94
  184. package/dist/module/src/lib/types.js +0 -2
  185. package/dist/module/src/utils.js +0 -9
  186. package/dist/module/testeranto.js +0 -13
  187. package/dist/prebuild/cli.mjs +0 -1491
  188. package/dist/types/dist/module/src/Init.d.ts +0 -2
  189. package/dist/types/src/Node.d.ts +0 -13
  190. package/dist/types/src/SubPackages/puppeteer.d.ts +0 -6
  191. package/dist/types/src/SubPackages/react/component/node.d.ts +0 -7
  192. package/dist/types/src/SubPackages/react/component/web.d.ts +0 -7
  193. package/dist/types/src/SubPackages/react/jsx/index.d.ts +0 -12
  194. package/dist/types/src/SubPackages/react/jsx/node.d.ts +0 -4
  195. package/dist/types/src/SubPackages/react/jsx/web.d.ts +0 -4
  196. package/dist/types/src/SubPackages/react-dom/component/node.d.ts +0 -12
  197. package/dist/types/src/SubPackages/react-dom/component/web.d.ts +0 -11
  198. package/dist/types/src/SubPackages/react-dom/jsx/index.d.ts +0 -7
  199. package/dist/types/src/SubPackages/react-dom/jsx/node.d.ts +0 -6
  200. package/dist/types/src/SubPackages/react-dom/jsx/web.d.ts +0 -5
  201. package/dist/types/src/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -5
  202. package/dist/types/src/SubPackages/react-test-renderer/component/index.d.ts +0 -13
  203. package/dist/types/src/SubPackages/react-test-renderer/component/node.d.ts +0 -8
  204. package/dist/types/src/SubPackages/react-test-renderer/component/web.d.ts +0 -3
  205. package/dist/types/src/SubPackages/react-test-renderer/fc/node.d.ts +0 -8
  206. package/dist/types/src/SubPackages/react-test-renderer/fc/web.d.ts +0 -8
  207. package/dist/types/src/SubPackages/react-test-renderer/jsx/index.d.ts +0 -17
  208. package/dist/types/src/SubPackages/react-test-renderer/jsx/node.d.ts +0 -9
  209. package/dist/types/src/SubPackages/react-test-renderer/jsx/web.d.ts +0 -8
  210. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/index.d.ts +0 -16
  211. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/node.d.ts +0 -4
  212. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/web.d.ts +0 -4
  213. package/dist/types/src/Types.d.ts +0 -90
  214. package/dist/types/src/Web.d.ts +0 -10
  215. package/dist/types/src/defaultConfig.d.ts +0 -3
  216. package/dist/types/src/lib/abstractBase.d.ts +0 -110
  217. package/dist/types/src/lib/basebuilder.d.ts +0 -27
  218. package/dist/types/src/lib/classBuilder.d.ts +0 -7
  219. package/dist/types/src/lib/core.d.ts +0 -8
  220. package/dist/types/src/lib/index.d.ts +0 -60
  221. package/dist/types/src/lib/types.d.ts +0 -40
  222. package/dist/types/src/utils.d.ts +0 -2
  223. package/dist/types/testeranto.d.ts +0 -16
  224. package/docker-compose.yml +0 -37
  225. package/src/SubPackages/puppeteer.ts +0 -51
  226. package/src/cli.ts +0 -535
  227. package/src/cli2.ts +0 -157
  228. package/testeranto.ts +0 -13
  229. package/dist/common/{src/Node.js → Node.js} +0 -0
  230. package/dist/common/{src/PM → PM}/index.js +0 -0
  231. package/dist/common/{src/PM → PM}/node.js +0 -0
  232. package/dist/common/{src/PM → PM}/web.js +0 -0
  233. package/dist/common/{src/SubPackages → SubPackages}/react/component/node.js +0 -0
  234. package/dist/common/{src/SubPackages → SubPackages}/react/component/web.js +0 -0
  235. package/dist/common/{src/SubPackages → SubPackages}/react/jsx/node.js +0 -0
  236. package/dist/common/{src/SubPackages → SubPackages}/react/jsx/web.js +0 -0
  237. package/dist/common/{src/SubPackages → SubPackages}/react-dom/jsx/index.js +0 -0
  238. package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/component/index.js +0 -0
  239. package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/component/node.js +0 -0
  240. package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/component/web.js +0 -0
  241. package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/jsx/node.js +0 -0
  242. package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/jsx/web.js +0 -0
  243. package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/jsx-promised/node.js +1 -1
  244. package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
  245. package/dist/common/{src/Types.js → Types.js} +0 -0
  246. package/dist/common/{src/Web.js → Web.js} +0 -0
  247. package/dist/common/{src/esbuildConfigs → esbuildConfigs}/featuresPlugin.js +0 -0
  248. package/dist/common/{src/esbuildConfigs → esbuildConfigs}/index.js +0 -0
  249. package/dist/common/{src/puppeteerConfiger.js → puppeteerConfiger.js} +0 -0
  250. package/dist/common/{src/web.html.js → web.html.js} +0 -0
  251. package/dist/module/{src/Node.js → Node.js} +0 -0
  252. package/dist/module/{src/PM → PM}/index.js +0 -0
  253. package/dist/module/{src/PM → PM}/node.js +0 -0
  254. package/dist/module/{src/PM → PM}/web.js +0 -0
  255. package/dist/module/{src/SubPackages → SubPackages}/react/component/node.js +0 -0
  256. package/dist/module/{src/SubPackages → SubPackages}/react/component/web.js +0 -0
  257. package/dist/module/{src/SubPackages → SubPackages}/react/jsx/node.js +0 -0
  258. package/dist/module/{src/SubPackages → SubPackages}/react/jsx/web.js +0 -0
  259. package/dist/module/{src/SubPackages → SubPackages}/react-dom/jsx/index.js +0 -0
  260. package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +0 -0
  261. package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/component/index.js +0 -0
  262. package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/component/interface.js +0 -0
  263. package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/component/node.js +0 -0
  264. package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/component/web.js +0 -0
  265. package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/fc/node.js +0 -0
  266. package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/fc/web.js +0 -0
  267. package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/jsx/node.js +0 -0
  268. package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/jsx/web.js +0 -0
  269. package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/jsx-promised/index.js +0 -0
  270. package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/jsx-promised/node.js +1 -1
  271. /package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
  272. /package/dist/module/{src/Types.js → Types.js} +0 -0
  273. /package/dist/module/{src/Web.js → Web.js} +0 -0
  274. /package/dist/module/{src/esbuildConfigs → esbuildConfigs}/featuresPlugin.js +0 -0
  275. /package/dist/module/{src/esbuildConfigs → esbuildConfigs}/index.js +0 -0
  276. /package/dist/{types/src/cli.d.ts → module/lib/types.js} +0 -0
  277. /package/dist/module/{src/puppeteerConfiger.js → puppeteerConfiger.js} +0 -0
  278. /package/dist/module/{src/web.html.js → web.html.js} +0 -0
  279. /package/dist/types/{src/Init.d.ts → Init.d.ts} +0 -0
  280. /package/dist/types/{src/cli2.d.ts → ReportServer.d.ts} +0 -0
  281. /package/dist/types/{src/SubPackages → SubPackages}/react-test-renderer/component/interface.d.ts +0 -0
  282. /package/dist/types/{src/init-docs.d.ts → build.d.ts} +0 -0
  283. /package/dist/types/{src/esbuildConfigs → esbuildConfigs}/featuresPlugin.d.ts +0 -0
  284. /package/dist/types/{src/puppeteerConfiger.d.ts → puppeteerConfiger.d.ts} +0 -0
  285. /package/dist/types/{src/web.html.d.ts → web.html.d.ts} +0 -0
package/src/build.ts ADDED
@@ -0,0 +1,240 @@
1
+ import fs, { watch } from "fs";
2
+ import path from "path";
3
+ import readline from "readline";
4
+ import { glob } from "glob";
5
+ import esbuild from "esbuild";
6
+
7
+ import esbuildNodeConfiger from "./esbuildConfigs/node.js";
8
+ import esbuildWebConfiger from "./esbuildConfigs/web.js";
9
+ import webHtmlFrame from "./web.html.js";
10
+ import {
11
+ ITestTypes,
12
+ IRunnables,
13
+ IBaseConfig,
14
+ IRunTime,
15
+ IBuiltConfig,
16
+ } from "./lib/index.js";
17
+
18
+ readline.emitKeypressEvents(process.stdin);
19
+ if (process.stdin.isTTY) process.stdin.setRawMode(true);
20
+
21
+ const getRunnables = (
22
+ tests: ITestTypes[],
23
+ payload = {
24
+ nodeEntryPoints: {},
25
+ webEntryPoints: {},
26
+ }
27
+ ): IRunnables => {
28
+ return tests.reduce((pt, cv, cndx, cry) => {
29
+ if (cv[1] === "node") {
30
+ pt.nodeEntryPoints[cv[0]] = path.resolve(
31
+ `./docs/node/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`
32
+ );
33
+ } else if (cv[1] === "web") {
34
+ pt.webEntryPoints[cv[0]] = path.resolve(
35
+ `./docs/web/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`
36
+ );
37
+ }
38
+
39
+ if (cv[3].length) {
40
+ getRunnables(cv[3], payload);
41
+ }
42
+
43
+ return pt;
44
+ }, payload as IRunnables);
45
+ };
46
+
47
+ import(process.cwd() + "/" + process.argv[2]).then(async (module) => {
48
+ const rawConfig: IBaseConfig = module.default;
49
+
50
+ const getSecondaryEndpointsPoints = (runtime?: IRunTime): string[] => {
51
+ const meta = (ts: ITestTypes[], st: Set<string>): Set<string> => {
52
+ ts.forEach((t) => {
53
+ if (t[1] === runtime) {
54
+ st.add(t[0]);
55
+ }
56
+ if (Array.isArray(t[3])) {
57
+ meta(t[3], st);
58
+ }
59
+ });
60
+ return st;
61
+ };
62
+ return Array.from(meta(config.tests, new Set()));
63
+ };
64
+
65
+ const config: IBuiltConfig = {
66
+ ...rawConfig,
67
+ buildDir: process.cwd() + "/" + rawConfig.outdir,
68
+ };
69
+
70
+ let nodeDone: boolean = false;
71
+ let webDone: boolean = false;
72
+ let mode = config.devMode ? "DEV" : "PROD";
73
+ let status: "build" | "built" = "build";
74
+ // let pm: PM_Main | undefined = new PM_Main(config);
75
+ // const fileHashes = {};
76
+ const { nodeEntryPoints, webEntryPoints } = getRunnables(config.tests);
77
+
78
+ const onNodeDone = () => {
79
+ nodeDone = true;
80
+ onDone();
81
+ };
82
+
83
+ const onWebDone = () => {
84
+ webDone = true;
85
+ onDone();
86
+ };
87
+
88
+ const onDone = async () => {
89
+ if (nodeDone && webDone) {
90
+ status = "built";
91
+ }
92
+ if (nodeDone && webDone && status === "built") {
93
+ // Object.entries(nodeEntryPoints).forEach(([k, outputFile]) => {
94
+ // console.log("watching", outputFile);
95
+ // try {
96
+ // watch(outputFile, async (filename) => {
97
+ // const hash = await fileHash(outputFile);
98
+ // if (fileHashes[k] !== hash) {
99
+ // fileHashes[k] = hash;
100
+ // console.log(`< ${filename} `);
101
+ // pm.launchNode(k, outputFile);
102
+ // }
103
+ // });
104
+ // } catch (e) {
105
+ // console.error(e);
106
+ // }
107
+ // });
108
+ // Object.entries(webEntryPoints).forEach(([k, outputFile]) => {
109
+ // console.log("watching", outputFile);
110
+ // watch(outputFile, async (filename) => {
111
+ // const hash = await fileHash(outputFile);
112
+ // console.log(`< ${filename} ${hash}`);
113
+ // if (fileHashes[k] !== hash) {
114
+ // fileHashes[k] = hash;
115
+ // pm.launchWeb(k, outputFile);
116
+ // }
117
+ // });
118
+ // });
119
+ }
120
+
121
+ if (nodeDone && webDone && mode === "PROD") {
122
+ console.log("Testeranto-EsBuild is all done. Goodbye!");
123
+ process.exit();
124
+ } else {
125
+ if (mode === "PROD") {
126
+ console.log("waiting for tests to finish");
127
+ console.log(
128
+ JSON.stringify(
129
+ {
130
+ nodeDone: nodeDone,
131
+ webDone: webDone,
132
+ mode: mode,
133
+ },
134
+ null,
135
+ 2
136
+ )
137
+ );
138
+ } else {
139
+ console.log("waiting for tests to change");
140
+ }
141
+
142
+ if (config.devMode) {
143
+ console.log("ready and watching for changes...");
144
+ } else {
145
+ // pm.shutDown();
146
+ }
147
+ ////////////////////////////////////////////////////////////////////////////////
148
+ }
149
+ };
150
+
151
+ console.log(
152
+ `Press 'q' to shutdown gracefully. Press 'x' to shutdown forcefully.`
153
+ );
154
+ process.stdin.on("keypress", (str, key) => {
155
+ if (key.name === "q") {
156
+ console.log("Testeranto-Build is shutting down...");
157
+ mode = "PROD";
158
+ onDone();
159
+ }
160
+ if (key.name === "x") {
161
+ console.log("Testeranto-Build is shutting down forcefully...");
162
+ process.exit(-1);
163
+ }
164
+ });
165
+
166
+ fs.writeFileSync(
167
+ `${config.outdir}/testeranto.json`,
168
+ JSON.stringify(config, null, 2)
169
+ );
170
+
171
+ Promise.resolve(
172
+ Promise.all(
173
+ [...getSecondaryEndpointsPoints("web")].map(async (sourceFilePath) => {
174
+ const sourceFileSplit = sourceFilePath.split("/");
175
+ const sourceDir = sourceFileSplit.slice(0, -1);
176
+ const sourceFileName = sourceFileSplit[sourceFileSplit.length - 1];
177
+ const sourceFileNameMinusJs = sourceFileName
178
+ .split(".")
179
+ .slice(0, -1)
180
+ .join(".");
181
+
182
+ const htmlFilePath = path.normalize(
183
+ `${process.cwd()}/${config.outdir}/web/${sourceDir.join(
184
+ "/"
185
+ )}/${sourceFileNameMinusJs}.html`
186
+ );
187
+ const jsfilePath = `./${sourceFileNameMinusJs}.mjs`;
188
+
189
+ return fs.promises
190
+ .mkdir(path.dirname(htmlFilePath), { recursive: true })
191
+ .then((x) =>
192
+ fs.writeFileSync(
193
+ htmlFilePath,
194
+ webHtmlFrame(jsfilePath, htmlFilePath)
195
+ )
196
+ );
197
+ })
198
+ )
199
+ );
200
+
201
+ glob(`./${config.outdir}/chunk-*.mjs`, {
202
+ ignore: "node_modules/**",
203
+ }).then((chunks) => {
204
+ chunks.forEach((chunk) => {
205
+ fs.unlinkSync(chunk);
206
+ });
207
+ });
208
+
209
+ await Promise.all([
210
+ esbuild
211
+ .context(esbuildNodeConfiger(config, Object.keys(nodeEntryPoints)))
212
+ .then(async (nodeContext) => {
213
+ if (config.devMode) {
214
+ await nodeContext.watch().then((v) => {
215
+ onNodeDone();
216
+ });
217
+ } else {
218
+ nodeContext.rebuild().then((v) => {
219
+ onNodeDone();
220
+ });
221
+ }
222
+
223
+ return nodeContext;
224
+ }),
225
+ esbuild
226
+ .context(esbuildWebConfiger(config, Object.keys(webEntryPoints)))
227
+ .then(async (webContext) => {
228
+ if (config.devMode) {
229
+ await webContext.watch().then((v) => {
230
+ onWebDone();
231
+ });
232
+ } else {
233
+ webContext.rebuild().then((v) => {
234
+ onWebDone();
235
+ });
236
+ }
237
+ return webContext;
238
+ }),
239
+ ]);
240
+ });
@@ -1,6 +1,7 @@
1
- import { IBaseConfig } from "testeranto/src/lib/types.js";
1
+ import { IBaseConfig } from "./lib";
2
2
 
3
3
  const config: IBaseConfig = {
4
+ src: "src",
4
5
  outdir: "docs",
5
6
  tests: [],
6
7
  debugger: true,
@@ -0,0 +1,5 @@
1
+ import { LintResult } from "eslint/lib/linter";
2
+
3
+ export default function (results: LintResult[]) {
4
+ return JSON.stringify(results, null, 2);
5
+ }
@@ -1,4 +1,3 @@
1
- import fs from "fs";
2
1
  import path from "path";
3
2
 
4
3
  export default {
@@ -1,6 +1,6 @@
1
1
  import { BuildOptions } from "esbuild";
2
2
 
3
- import { IBaseConfig } from "../lib/types";
3
+ import { IBaseConfig } from "../lib";
4
4
 
5
5
  export default (config: IBaseConfig): BuildOptions => {
6
6
  return {
@@ -1,7 +1,5 @@
1
1
  import fs from "fs";
2
- import path from "path";
3
- import type { ImportKind, Metafile, Plugin } from "esbuild";
4
- import { spawn } from "child_process";
2
+ import type { Plugin } from "esbuild";
5
3
 
6
4
  const otherInputs: Record<string, Set<string>> = {};
7
5
 
@@ -12,21 +10,6 @@ const register = (entrypoint: string, sources: string[]): void => {
12
10
  sources.forEach((s) => otherInputs[entrypoint].add(s));
13
11
  };
14
12
 
15
- function tree(meta: Metafile, key: string) {
16
- const outputKey = Object.keys(meta.outputs).find((k) => {
17
- return meta.outputs[k].entryPoint === key;
18
- });
19
-
20
- if (!outputKey) {
21
- console.error("No outputkey found");
22
- process.exit(-1);
23
- }
24
-
25
- return Object.keys(meta.outputs[outputKey].inputs).filter((k) =>
26
- k.startsWith("src")
27
- );
28
- }
29
-
30
13
  export default (
31
14
  platform: "web" | "node",
32
15
  entryPoints: Set<string> | string[]
@@ -41,127 +24,11 @@ export default (
41
24
  name: "metafileWriter",
42
25
  setup(build) {
43
26
  build.onEnd((result) => {
27
+ // console.log("build.onEnd", entryPoints);
44
28
  fs.writeFileSync(
45
29
  `docs/${platform}/metafile.json`,
46
30
  JSON.stringify(result, null, 2)
47
31
  );
48
-
49
- if (result.errors.length === 0) {
50
- entryPoints.forEach((entryPoint) => {
51
- const filePath = path.join(
52
- "./docs/",
53
- platform,
54
- entryPoint.split(".").slice(0, -1).join("."),
55
- `inputFiles.json`
56
- );
57
- const dirName = path.dirname(filePath);
58
-
59
- if (!fs.existsSync(dirName)) {
60
- fs.mkdirSync(dirName, { recursive: true });
61
- }
62
-
63
- const promptPath = path.join(
64
- "./docs/",
65
- platform,
66
- entryPoint.split(".").slice(0, -1).join("."),
67
- `prompt.txt`
68
- );
69
- const testPaths = path.join(
70
- "./docs/",
71
- platform,
72
- entryPoint.split(".").slice(0, -1).join("."),
73
- `tests.json`
74
- );
75
- const featuresPath = path.join(
76
- "./docs/",
77
- platform,
78
- entryPoint.split(".").slice(0, -1).join("."),
79
- `featurePrompt.txt`
80
- );
81
-
82
- const stderrPath = path.join(
83
- "./docs/",
84
- platform,
85
- entryPoint.split(".").slice(0, -1).join("."),
86
- `stderr.log`
87
- );
88
- const stdoutPath = path.join(
89
- "./docs/",
90
- platform,
91
- entryPoint.split(".").slice(0, -1).join("."),
92
- `stdout.log`
93
- );
94
-
95
- if (result.metafile) {
96
- const addableFiles = tree(
97
- result.metafile,
98
- entryPoint.split("/").slice(1).join("/")
99
- )
100
- .map((y) => {
101
- if (otherInputs[y]) {
102
- return Array.from(otherInputs[y]);
103
- }
104
- return y;
105
- })
106
- .flat();
107
-
108
- const typeErrorFiles = addableFiles.map(
109
- (t) => `docs/types/${t}.type_errors.txt`
110
- );
111
-
112
- const lintPath = path.join(
113
- "./docs/",
114
- platform,
115
- entryPoint.split(".").slice(0, -1).join("."),
116
- `lint_errors.txt`
117
- );
118
- fs.writeFileSync(
119
- promptPath,
120
- `
121
- ${addableFiles
122
- .map((x) => {
123
- return `/add ${x}`;
124
- })
125
- .join("\n")}
126
-
127
- ${typeErrorFiles
128
- .map((x) => {
129
- return `/read ${x}`;
130
- })
131
- .join("\n")}
132
-
133
- /read ${lintPath}
134
- /read ${testPaths}
135
- /read ${stdoutPath}
136
- /read ${stderrPath}
137
-
138
- /load ${featuresPath}
139
-
140
- /code Fix the failing tests described in ${testPaths}. Correct any type signature errors described in the files [${typeErrorFiles.join(
141
- ", "
142
- )}]. Implement any method which throws "Function not implemented. Resolve the lint errors described in ${lintPath}"
143
- `
144
- );
145
-
146
- const logContent: string[] = [];
147
- const tsc = spawn("eslint", addableFiles);
148
-
149
- tsc.stdout.on("data", (data) => {
150
- const lines = data.toString().split("\n");
151
- logContent.push(...lines);
152
- });
153
-
154
- tsc.stderr.on("data", (data) => {
155
- console.error(`stderr: ${data}`);
156
- process.exit(-1);
157
- });
158
-
159
- tsc.on("close", (code) => {
160
- fs.writeFileSync(lintPath, logContent.join("\n"));
161
- });
162
- }
163
- });
164
- }
165
32
  });
166
33
  },
167
34
  },
@@ -1,6 +1,6 @@
1
1
  import { BuildOptions } from "esbuild";
2
2
 
3
- import { IBaseConfig } from "../lib/types";
3
+ import { IBaseConfig } from "../lib/index.js";
4
4
 
5
5
  import baseEsBuildConfig from "./index.js";
6
6
  import inputFilesPlugin from "./inputFilesPlugin.js";
@@ -36,24 +36,13 @@ export default (
36
36
  },
37
37
  platform: "node",
38
38
 
39
- external: [
40
- // "testeranto.json",
41
- // "features.test.js",
42
- "react",
43
- // "events",
44
- // "ganache"
45
- ...config.externals,
46
- ],
39
+ external: ["react", ...config.externals],
47
40
 
48
41
  entryPoints: [...entryPoints],
49
42
  plugins: [
50
43
  featuresPlugin,
51
44
 
52
- ...(config.nodePlugins.map((p) => p(register, entryPoints)) || []),
53
-
54
45
  inputFilesPluginFactory,
55
- // inputFilesPlugin("node", entryPoints),
56
-
57
46
  {
58
47
  name: "rebuild-notify",
59
48
  setup(build) {
@@ -69,6 +58,8 @@ export default (
69
58
  });
70
59
  },
71
60
  },
61
+
62
+ ...(config.nodePlugins.map((p) => p(register, entryPoints)) || []),
72
63
  ],
73
64
  };
74
65
  };
@@ -1,9 +1,7 @@
1
1
  import { BuildOptions } from "esbuild";
2
2
  import path from "path";
3
3
 
4
- import pkg from "esbuild-plugin-markdown";
5
-
6
- import { IBaseConfig } from "../lib/types.js";
4
+ import { IBaseConfig } from "../lib/index.js";
7
5
 
8
6
  import baseEsBuildConfig from "./index.js";
9
7
  import inputFilesPlugin from "./inputFilesPlugin.js";
@@ -21,13 +19,6 @@ export default (
21
19
  return {
22
20
  ...baseEsBuildConfig(config),
23
21
 
24
- // inject: ["./node_modules/testeranto/dist/cjs-shim.js"],
25
- // banner: {
26
- // js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`,
27
- // },
28
-
29
- // splitting: true,
30
-
31
22
  outdir: config.outdir + "/web",
32
23
 
33
24
  alias: {
@@ -37,11 +28,6 @@ export default (
37
28
  metafile: true,
38
29
 
39
30
  external: [
40
- // "testeranto.json",
41
- // "features.test.ts",
42
- // "url",
43
- // "react",
44
-
45
31
  "path",
46
32
  "fs",
47
33
  "stream",
@@ -56,7 +42,6 @@ export default (
56
42
  "zlib",
57
43
  "crypto",
58
44
  "https",
59
-
60
45
  "util",
61
46
  "process",
62
47
  "dns",
@@ -68,9 +53,6 @@ export default (
68
53
 
69
54
  plugins: [
70
55
  featuresPlugin,
71
-
72
- // markdownPlugin({}),
73
- ...(config.nodePlugins.map((p) => p(register, entryPoints)) || []),
74
56
  inputFilesPluginFactory,
75
57
  {
76
58
  name: "rebuild-notify",
@@ -87,6 +69,8 @@ export default (
87
69
  });
88
70
  },
89
71
  },
72
+
73
+ ...(config.nodePlugins.map((p) => p(register, entryPoints)) || []),
90
74
  ],
91
75
  };
92
76
  };
package/src/init-docs.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import fs from "fs";
2
- import Init from "../dist/module/src/Init";
2
+ import Init from "./Init";
3
+
3
4
  console.log("Initializing a testeranto project");
4
5
 
5
6
  if (!process.argv[2]) {