testeranto 0.100.0 → 0.111.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 (226) hide show
  1. package/README.md +1 -0
  2. package/bundle.js +80 -30
  3. package/package.json +40 -32
  4. package/src/Footer.tsx +4 -0
  5. package/src/Init.ts +48 -0
  6. package/src/Node.ts +23 -17
  7. package/src/PM/index.ts +1 -1
  8. package/src/PM/main.ts +524 -156
  9. package/src/PM/node.ts +2 -2
  10. package/src/PM/web.ts +1 -1
  11. package/src/ReportClient.tsx +163 -0
  12. package/src/ReportServer.ts +21 -0
  13. package/src/SubPackages/react/component/node.ts +68 -24
  14. package/src/SubPackages/react/component/web.ts +68 -25
  15. package/src/SubPackages/react/jsx/index.ts +39 -18
  16. package/src/SubPackages/react/jsx/node.ts +12 -10
  17. package/src/SubPackages/react/jsx/web.ts +27 -14
  18. package/src/SubPackages/react-dom/component/node.ts +42 -50
  19. package/src/SubPackages/react-dom/component/web.ts +28 -10
  20. package/src/SubPackages/react-dom/jsx/node.ts +54 -56
  21. package/src/SubPackages/react-dom/jsx/web.ts +55 -42
  22. package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +23 -7
  23. package/src/SubPackages/react-test-renderer/component/index.ts +38 -5
  24. package/src/SubPackages/react-test-renderer/component/node.ts +24 -5
  25. package/src/SubPackages/react-test-renderer/component/web.ts +22 -5
  26. package/src/SubPackages/react-test-renderer/fc/node.ts +41 -7
  27. package/src/SubPackages/react-test-renderer/fc/web.ts +43 -11
  28. package/src/SubPackages/react-test-renderer/jsx/index.ts +39 -16
  29. package/src/SubPackages/react-test-renderer/jsx/node.ts +8 -6
  30. package/src/SubPackages/react-test-renderer/jsx/web.ts +22 -5
  31. package/src/SubPackages/react-test-renderer/jsx-promised/index.ts +39 -6
  32. package/src/SubPackages/react-test-renderer/jsx-promised/node.ts +27 -10
  33. package/src/SubPackages/react-test-renderer/jsx-promised/web.ts +26 -12
  34. package/src/TestReport.tsx +176 -0
  35. package/src/Types.ts +63 -309
  36. package/src/Web.ts +24 -18
  37. package/src/build.ts +240 -0
  38. package/src/defaultConfig.ts +2 -1
  39. package/src/esbuildConfigs/eslint-formatter-testeranto.ts +5 -0
  40. package/src/esbuildConfigs/featuresPlugin.ts +0 -1
  41. package/src/esbuildConfigs/index.ts +1 -1
  42. package/src/esbuildConfigs/inputFilesPlugin.ts +2 -135
  43. package/src/esbuildConfigs/node.ts +4 -13
  44. package/src/esbuildConfigs/web.ts +3 -19
  45. package/src/init-docs.ts +2 -1
  46. package/src/lib/abstractBase.ts +82 -80
  47. package/src/lib/basebuilder.ts +57 -45
  48. package/src/lib/classBuilder.ts +15 -15
  49. package/src/lib/core.ts +44 -35
  50. package/src/lib/index.ts +47 -98
  51. package/src/lib/readme.md +12 -0
  52. package/src/lib/types.ts +53 -70
  53. package/src/run.ts +31 -0
  54. package/src/style.css +8 -0
  55. package/src/utils.ts +74 -2
  56. package/tsc.log +108 -0
  57. package/Bundle.Dockerfile +0 -52
  58. package/bin/init-docs.js +0 -24
  59. package/dist/common/dist/module/src/Init.js +0 -40
  60. package/dist/common/package.json +0 -3
  61. package/dist/common/src/Init.js +0 -40
  62. package/dist/common/src/Node.js +0 -27
  63. package/dist/common/src/PM/index.js +0 -7
  64. package/dist/common/src/PM/main.js +0 -941
  65. package/dist/common/src/PM/node.js +0 -128
  66. package/dist/common/src/PM/web.js +0 -121
  67. package/dist/common/src/SubPackages/puppeteer.js +0 -21
  68. package/dist/common/src/SubPackages/react/component/node.js +0 -19
  69. package/dist/common/src/SubPackages/react/component/web.js +0 -19
  70. package/dist/common/src/SubPackages/react/jsx/index.js +0 -33
  71. package/dist/common/src/SubPackages/react/jsx/node.js +0 -10
  72. package/dist/common/src/SubPackages/react/jsx/web.js +0 -10
  73. package/dist/common/src/SubPackages/react-dom/component/node.js +0 -101
  74. package/dist/common/src/SubPackages/react-dom/component/web.js +0 -67
  75. package/dist/common/src/SubPackages/react-dom/jsx/index.js +0 -2
  76. package/dist/common/src/SubPackages/react-dom/jsx/node.js +0 -39
  77. package/dist/common/src/SubPackages/react-dom/jsx/web.js +0 -117
  78. package/dist/common/src/SubPackages/react-test-renderer/MemoExoticComponent/node.js +0 -44
  79. package/dist/common/src/SubPackages/react-test-renderer/component/index.js +0 -2
  80. package/dist/common/src/SubPackages/react-test-renderer/component/interface.js +0 -60
  81. package/dist/common/src/SubPackages/react-test-renderer/component/node.js +0 -8
  82. package/dist/common/src/SubPackages/react-test-renderer/component/web.js +0 -8
  83. package/dist/common/src/SubPackages/react-test-renderer/fc/node.js +0 -50
  84. package/dist/common/src/SubPackages/react-test-renderer/fc/web.js +0 -50
  85. package/dist/common/src/SubPackages/react-test-renderer/jsx/index.js +0 -63
  86. package/dist/common/src/SubPackages/react-test-renderer/jsx/node.js +0 -10
  87. package/dist/common/src/SubPackages/react-test-renderer/jsx/web.js +0 -10
  88. package/dist/common/src/SubPackages/react-test-renderer/jsx-promised/index.js +0 -42
  89. package/dist/common/src/SubPackages/react-test-renderer/jsx-promised/node.js +0 -10
  90. package/dist/common/src/SubPackages/react-test-renderer/jsx-promised/web.js +0 -10
  91. package/dist/common/src/Types.js +0 -2
  92. package/dist/common/src/Web.js +0 -49
  93. package/dist/common/src/cli.js +0 -439
  94. package/dist/common/src/cli2.js +0 -144
  95. package/dist/common/src/defaultConfig.js +0 -19
  96. package/dist/common/src/esbuildConfigs/featuresPlugin.js +0 -39
  97. package/dist/common/src/esbuildConfigs/index.js +0 -21
  98. package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +0 -99
  99. package/dist/common/src/esbuildConfigs/node.js +0 -45
  100. package/dist/common/src/esbuildConfigs/web.js +0 -61
  101. package/dist/common/src/init-docs.js +0 -43
  102. package/dist/common/src/lib/abstractBase.js +0 -324
  103. package/dist/common/src/lib/basebuilder.js +0 -85
  104. package/dist/common/src/lib/classBuilder.js +0 -42
  105. package/dist/common/src/lib/core.js +0 -101
  106. package/dist/common/src/lib/index.js +0 -22
  107. package/dist/common/src/lib/types.js +0 -3
  108. package/dist/common/src/puppeteerConfiger.js +0 -24
  109. package/dist/common/src/utils.js +0 -16
  110. package/dist/common/src/web.html.js +0 -22
  111. package/dist/common/testeranto.js +0 -15
  112. package/dist/common/tsconfig.common.tsbuildinfo +0 -1
  113. package/dist/module/package.json +0 -3
  114. package/dist/module/src/Init.js +0 -35
  115. package/dist/module/src/Node.js +0 -20
  116. package/dist/module/src/PM/index.js +0 -3
  117. package/dist/module/src/PM/main.js +0 -911
  118. package/dist/module/src/PM/node.js +0 -121
  119. package/dist/module/src/PM/web.js +0 -117
  120. package/dist/module/src/SubPackages/puppeteer.js +0 -16
  121. package/dist/module/src/SubPackages/react/component/node.js +0 -14
  122. package/dist/module/src/SubPackages/react/component/web.js +0 -14
  123. package/dist/module/src/SubPackages/react/jsx/index.js +0 -27
  124. package/dist/module/src/SubPackages/react/jsx/node.js +0 -5
  125. package/dist/module/src/SubPackages/react/jsx/web.js +0 -5
  126. package/dist/module/src/SubPackages/react-dom/component/node.js +0 -93
  127. package/dist/module/src/SubPackages/react-dom/component/web.js +0 -62
  128. package/dist/module/src/SubPackages/react-dom/jsx/index.js +0 -1
  129. package/dist/module/src/SubPackages/react-dom/jsx/node.js +0 -31
  130. package/dist/module/src/SubPackages/react-dom/jsx/web.js +0 -89
  131. package/dist/module/src/SubPackages/react-test-renderer/MemoExoticComponent/node.js +0 -16
  132. package/dist/module/src/SubPackages/react-test-renderer/component/index.js +0 -1
  133. package/dist/module/src/SubPackages/react-test-renderer/component/interface.js +0 -31
  134. package/dist/module/src/SubPackages/react-test-renderer/component/node.js +0 -3
  135. package/dist/module/src/SubPackages/react-test-renderer/component/web.js +0 -3
  136. package/dist/module/src/SubPackages/react-test-renderer/fc/node.js +0 -22
  137. package/dist/module/src/SubPackages/react-test-renderer/fc/web.js +0 -22
  138. package/dist/module/src/SubPackages/react-test-renderer/jsx/index.js +0 -34
  139. package/dist/module/src/SubPackages/react-test-renderer/jsx/node.js +0 -5
  140. package/dist/module/src/SubPackages/react-test-renderer/jsx/web.js +0 -5
  141. package/dist/module/src/SubPackages/react-test-renderer/jsx-promised/index.js +0 -16
  142. package/dist/module/src/SubPackages/react-test-renderer/jsx-promised/node.js +0 -5
  143. package/dist/module/src/SubPackages/react-test-renderer/jsx-promised/web.js +0 -5
  144. package/dist/module/src/Types.js +0 -1
  145. package/dist/module/src/Web.js +0 -42
  146. package/dist/module/src/cli.js +0 -411
  147. package/dist/module/src/cli2.js +0 -116
  148. package/dist/module/src/defaultConfig.js +0 -17
  149. package/dist/module/src/esbuildConfigs/featuresPlugin.js +0 -34
  150. package/dist/module/src/esbuildConfigs/index.js +0 -19
  151. package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +0 -94
  152. package/dist/module/src/esbuildConfigs/node.js +0 -40
  153. package/dist/module/src/esbuildConfigs/web.js +0 -56
  154. package/dist/module/src/init-docs.js +0 -15
  155. package/dist/module/src/lib/abstractBase.js +0 -316
  156. package/dist/module/src/lib/basebuilder.js +0 -81
  157. package/dist/module/src/lib/classBuilder.js +0 -38
  158. package/dist/module/src/lib/core.js +0 -98
  159. package/dist/module/src/lib/index.js +0 -18
  160. package/dist/module/src/lib/types.js +0 -2
  161. package/dist/module/src/puppeteerConfiger.js +0 -19
  162. package/dist/module/src/utils.js +0 -9
  163. package/dist/module/src/web.html.js +0 -20
  164. package/dist/module/testeranto.js +0 -13
  165. package/dist/module/tsconfig.module.tsbuildinfo +0 -1
  166. package/dist/prebuild/cli.mjs +0 -1491
  167. package/dist/prebuild/cli2.mjs +0 -918
  168. package/dist/prebuild/init-docs.mjs +0 -48
  169. package/dist/types/dist/module/src/Init.d.ts +0 -2
  170. package/dist/types/src/Init.d.ts +0 -2
  171. package/dist/types/src/Node.d.ts +0 -13
  172. package/dist/types/src/PM/index.d.ts +0 -34
  173. package/dist/types/src/PM/main.d.ts +0 -56
  174. package/dist/types/src/PM/node.d.ts +0 -42
  175. package/dist/types/src/PM/web.d.ts +0 -40
  176. package/dist/types/src/SubPackages/puppeteer.d.ts +0 -6
  177. package/dist/types/src/SubPackages/react/component/node.d.ts +0 -7
  178. package/dist/types/src/SubPackages/react/component/web.d.ts +0 -7
  179. package/dist/types/src/SubPackages/react/jsx/index.d.ts +0 -12
  180. package/dist/types/src/SubPackages/react/jsx/node.d.ts +0 -4
  181. package/dist/types/src/SubPackages/react/jsx/web.d.ts +0 -4
  182. package/dist/types/src/SubPackages/react-dom/component/node.d.ts +0 -12
  183. package/dist/types/src/SubPackages/react-dom/component/web.d.ts +0 -11
  184. package/dist/types/src/SubPackages/react-dom/jsx/index.d.ts +0 -7
  185. package/dist/types/src/SubPackages/react-dom/jsx/node.d.ts +0 -6
  186. package/dist/types/src/SubPackages/react-dom/jsx/web.d.ts +0 -5
  187. package/dist/types/src/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -5
  188. package/dist/types/src/SubPackages/react-test-renderer/component/index.d.ts +0 -13
  189. package/dist/types/src/SubPackages/react-test-renderer/component/interface.d.ts +0 -9
  190. package/dist/types/src/SubPackages/react-test-renderer/component/node.d.ts +0 -8
  191. package/dist/types/src/SubPackages/react-test-renderer/component/web.d.ts +0 -3
  192. package/dist/types/src/SubPackages/react-test-renderer/fc/node.d.ts +0 -8
  193. package/dist/types/src/SubPackages/react-test-renderer/fc/web.d.ts +0 -8
  194. package/dist/types/src/SubPackages/react-test-renderer/jsx/index.d.ts +0 -17
  195. package/dist/types/src/SubPackages/react-test-renderer/jsx/node.d.ts +0 -9
  196. package/dist/types/src/SubPackages/react-test-renderer/jsx/web.d.ts +0 -8
  197. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/index.d.ts +0 -16
  198. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/node.d.ts +0 -4
  199. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/web.d.ts +0 -4
  200. package/dist/types/src/Types.d.ts +0 -90
  201. package/dist/types/src/Web.d.ts +0 -10
  202. package/dist/types/src/cli.d.ts +0 -1
  203. package/dist/types/src/cli2.d.ts +0 -1
  204. package/dist/types/src/defaultConfig.d.ts +0 -3
  205. package/dist/types/src/esbuildConfigs/featuresPlugin.d.ts +0 -5
  206. package/dist/types/src/esbuildConfigs/index.d.ts +0 -4
  207. package/dist/types/src/esbuildConfigs/inputFilesPlugin.d.ts +0 -7
  208. package/dist/types/src/esbuildConfigs/node.d.ts +0 -4
  209. package/dist/types/src/esbuildConfigs/web.d.ts +0 -4
  210. package/dist/types/src/init-docs.d.ts +0 -1
  211. package/dist/types/src/lib/abstractBase.d.ts +0 -110
  212. package/dist/types/src/lib/basebuilder.d.ts +0 -27
  213. package/dist/types/src/lib/classBuilder.d.ts +0 -7
  214. package/dist/types/src/lib/core.d.ts +0 -8
  215. package/dist/types/src/lib/index.d.ts +0 -60
  216. package/dist/types/src/lib/types.d.ts +0 -40
  217. package/dist/types/src/puppeteerConfiger.d.ts +0 -4
  218. package/dist/types/src/utils.d.ts +0 -2
  219. package/dist/types/src/web.html.d.ts +0 -2
  220. package/dist/types/testeranto.d.ts +0 -16
  221. package/dist/types/tsconfig.types.tsbuildinfo +0 -1
  222. package/docker-compose.yml +0 -37
  223. package/src/SubPackages/puppeteer.ts +0 -51
  224. package/src/cli.ts +0 -535
  225. package/src/cli2.ts +0 -157
  226. package/testeranto.ts +0 -13
@@ -1,116 +0,0 @@
1
- import { watch } from "fs";
2
- import { PM_Main } from "./PM/main";
3
- import path from "path";
4
- import crypto from "node:crypto";
5
- import fs from "fs";
6
- const fileHashes = {};
7
- async function fileHash(filePath, algorithm = "md5") {
8
- return new Promise((resolve, reject) => {
9
- const hash = crypto.createHash(algorithm);
10
- const fileStream = fs.createReadStream(filePath);
11
- fileStream.on("data", (data) => {
12
- hash.update(data);
13
- });
14
- fileStream.on("end", () => {
15
- const fileHash = hash.digest("hex");
16
- resolve(fileHash);
17
- });
18
- fileStream.on("error", (error) => {
19
- reject(`Error reading file: ${error.message}`);
20
- });
21
- });
22
- }
23
- const getRunnables = (tests, payload = {
24
- nodeEntryPoints: {},
25
- webEntryPoints: {},
26
- }) => {
27
- return tests.reduce((pt, cv, cndx, cry) => {
28
- if (cv[1] === "node") {
29
- pt.nodeEntryPoints[cv[0]] = path.resolve(`./docs/node/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`);
30
- }
31
- else if (cv[1] === "web") {
32
- pt.webEntryPoints[cv[0]] = path.resolve(`./docs/web/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`);
33
- }
34
- if (cv[3].length) {
35
- getRunnables(cv[3], payload);
36
- }
37
- return pt;
38
- }, payload);
39
- };
40
- import(process.cwd() + "/" + process.argv[2]).then(async (module) => {
41
- const rawConfig = module.default;
42
- const config = Object.assign(Object.assign({}, rawConfig), { buildDir: process.cwd() + "/" + rawConfig.outdir });
43
- let pm = new PM_Main(config);
44
- await pm.startPuppeteer({
45
- slowMo: 1,
46
- // timeout: 1,
47
- waitForInitialPage: false,
48
- executablePath:
49
- // process.env.CHROMIUM_PATH || "/opt/homebrew/bin/chromium",
50
- "/opt/homebrew/bin/chromium",
51
- headless: true,
52
- dumpio: true,
53
- // timeout: 0,
54
- devtools: true,
55
- args: [
56
- "--auto-open-devtools-for-tabs",
57
- `--remote-debugging-port=3234`,
58
- // "--disable-features=IsolateOrigins,site-per-process",
59
- "--disable-site-isolation-trials",
60
- "--allow-insecure-localhost",
61
- "--allow-file-access-from-files",
62
- "--allow-running-insecure-content",
63
- "--disable-dev-shm-usage",
64
- "--disable-extensions",
65
- "--disable-gpu",
66
- "--disable-setuid-sandbox",
67
- "--disable-site-isolation-trials",
68
- "--disable-web-security",
69
- "--no-first-run",
70
- "--no-sandbox",
71
- "--no-startup-window",
72
- // "--no-zygote",
73
- "--reduce-security-for-testing",
74
- "--remote-allow-origins=*",
75
- "--unsafely-treat-insecure-origin-as-secure=*",
76
- // "--disable-features=IsolateOrigins",
77
- // "--remote-allow-origins=ws://localhost:3234",
78
- // "--single-process",
79
- // "--unsafely-treat-insecure-origin-as-secure",
80
- // "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
81
- // "--disk-cache-dir=/dev/null",
82
- // "--disk-cache-size=1",
83
- // "--start-maximized",
84
- ],
85
- }, ".");
86
- const { nodeEntryPoints, webEntryPoints } = getRunnables(config.tests);
87
- Object.entries(nodeEntryPoints).forEach(([k, outputFile]) => {
88
- console.log("watching and running", outputFile);
89
- pm.launchNode(k, outputFile);
90
- try {
91
- watch(outputFile, async (e, filename) => {
92
- const hash = await fileHash(outputFile);
93
- if (fileHashes[k] !== hash) {
94
- fileHashes[k] = hash;
95
- console.log(`< ${e} ${filename} ${hash}`);
96
- pm.launchNode(k, outputFile);
97
- }
98
- });
99
- }
100
- catch (e) {
101
- console.error(e);
102
- }
103
- });
104
- Object.entries(webEntryPoints).forEach(([k, outputFile]) => {
105
- console.log("watching and running", outputFile);
106
- pm.launchWeb(k, outputFile);
107
- watch(outputFile, async (e, filename) => {
108
- const hash = await fileHash(outputFile);
109
- console.log(`< ${e} ${filename} ${hash}`);
110
- if (fileHashes[k] !== hash) {
111
- fileHashes[k] = hash;
112
- pm.launchWeb(k, outputFile);
113
- }
114
- });
115
- });
116
- });
@@ -1,17 +0,0 @@
1
- const config = {
2
- outdir: "docs",
3
- tests: [],
4
- debugger: true,
5
- clearScreen: false,
6
- devMode: true,
7
- minify: false,
8
- outbase: ".",
9
- ports: ["3001"],
10
- externals: [],
11
- nodePlugins: [],
12
- webPlugins: [],
13
- featureIngestor: function (s) {
14
- throw new Error("Function not implemented.");
15
- },
16
- };
17
- export default config;
@@ -1,34 +0,0 @@
1
- import path from "path";
2
- export default {
3
- name: "feature-markdown",
4
- setup(build) {
5
- build.onResolve({ filter: /\.md$/ }, (args) => {
6
- if (args.resolveDir === "")
7
- return;
8
- return {
9
- path: path.isAbsolute(args.path)
10
- ? args.path
11
- : path.join(args.resolveDir, args.path),
12
- namespace: "feature-markdown",
13
- };
14
- });
15
- build.onLoad({ filter: /.*/, namespace: "feature-markdown" }, async (args) => {
16
- // const markdownContent = new TextDecoder().decode(
17
- // await fs.readFileSync(args.path)
18
- // );
19
- // markdownHTML = marked(markdownContent, options?.markedOptions);
20
- return {
21
- contents: `file://${args.path}`,
22
- loader: "text",
23
- // contents: JSON.stringify({ path: args.path }),
24
- // loader: "json",
25
- // contents: JSON.stringify({
26
- // // html: markdownHTML,
27
- // raw: markdownContent,
28
- // filename: args.path, //path.basename(args.path),
29
- // }),
30
- // loader: "json",
31
- };
32
- });
33
- },
34
- };
@@ -1,19 +0,0 @@
1
- export default (config) => {
2
- return {
3
- // packages: "external",
4
- target: "esnext",
5
- format: "esm",
6
- splitting: true,
7
- outExtension: { ".js": ".mjs" },
8
- outbase: config.outbase,
9
- jsx: "transform",
10
- bundle: true,
11
- minify: config.minify === true,
12
- write: true,
13
- loader: {
14
- ".js": "jsx",
15
- ".png": "binary",
16
- ".jpg": "binary",
17
- },
18
- };
19
- };
@@ -1,94 +0,0 @@
1
- import fs from "fs";
2
- import path from "path";
3
- import { spawn } from "child_process";
4
- const otherInputs = {};
5
- const register = (entrypoint, sources) => {
6
- if (!otherInputs[entrypoint]) {
7
- otherInputs[entrypoint] = new Set();
8
- }
9
- sources.forEach((s) => otherInputs[entrypoint].add(s));
10
- };
11
- function tree(meta, key) {
12
- const outputKey = Object.keys(meta.outputs).find((k) => {
13
- return meta.outputs[k].entryPoint === key;
14
- });
15
- if (!outputKey) {
16
- console.error("No outputkey found");
17
- process.exit(-1);
18
- }
19
- return Object.keys(meta.outputs[outputKey].inputs).filter((k) => k.startsWith("src"));
20
- }
21
- export default (platform, entryPoints) => {
22
- return {
23
- register,
24
- inputFilesPluginFactory: {
25
- name: "metafileWriter",
26
- setup(build) {
27
- build.onEnd((result) => {
28
- fs.writeFileSync(`docs/${platform}/metafile.json`, JSON.stringify(result, null, 2));
29
- if (result.errors.length === 0) {
30
- entryPoints.forEach((entryPoint) => {
31
- const filePath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `inputFiles.json`);
32
- const dirName = path.dirname(filePath);
33
- if (!fs.existsSync(dirName)) {
34
- fs.mkdirSync(dirName, { recursive: true });
35
- }
36
- const promptPath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `prompt.txt`);
37
- const testPaths = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `tests.json`);
38
- const featuresPath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `featurePrompt.txt`);
39
- const stderrPath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `stderr.log`);
40
- const stdoutPath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `stdout.log`);
41
- if (result.metafile) {
42
- const addableFiles = tree(result.metafile, entryPoint.split("/").slice(1).join("/"))
43
- .map((y) => {
44
- if (otherInputs[y]) {
45
- return Array.from(otherInputs[y]);
46
- }
47
- return y;
48
- })
49
- .flat();
50
- const typeErrorFiles = addableFiles.map((t) => `docs/types/${t}.type_errors.txt`);
51
- const lintPath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `lint_errors.txt`);
52
- fs.writeFileSync(promptPath, `
53
- ${addableFiles
54
- .map((x) => {
55
- return `/add ${x}`;
56
- })
57
- .join("\n")}
58
-
59
- ${typeErrorFiles
60
- .map((x) => {
61
- return `/read ${x}`;
62
- })
63
- .join("\n")}
64
-
65
- /read ${lintPath}
66
- /read ${testPaths}
67
- /read ${stdoutPath}
68
- /read ${stderrPath}
69
-
70
- /load ${featuresPath}
71
-
72
- /code Fix the failing tests described in ${testPaths}. Correct any type signature errors described in the files [${typeErrorFiles.join(", ")}]. Implement any method which throws "Function not implemented. Resolve the lint errors described in ${lintPath}"
73
- `);
74
- const logContent = [];
75
- const tsc = spawn("eslint", addableFiles);
76
- tsc.stdout.on("data", (data) => {
77
- const lines = data.toString().split("\n");
78
- logContent.push(...lines);
79
- });
80
- tsc.stderr.on("data", (data) => {
81
- console.error(`stderr: ${data}`);
82
- process.exit(-1);
83
- });
84
- tsc.on("close", (code) => {
85
- fs.writeFileSync(lintPath, logContent.join("\n"));
86
- });
87
- }
88
- });
89
- }
90
- });
91
- },
92
- },
93
- };
94
- };
@@ -1,40 +0,0 @@
1
- import baseEsBuildConfig from "./index.js";
2
- import inputFilesPlugin from "./inputFilesPlugin.js";
3
- import featuresPlugin from "./featuresPlugin";
4
- export default (config, entryPoints) => {
5
- const { inputFilesPluginFactory, register } = inputFilesPlugin("node", entryPoints);
6
- return Object.assign(Object.assign({}, baseEsBuildConfig(config)), { splitting: true, outdir: config.outdir + "/node",
7
- // inject: [`./node_modules/testeranto/dist/cjs-shim.js`],
8
- metafile: true, supported: {
9
- "dynamic-import": true,
10
- }, define: {
11
- "process.env.FLUENTFFMPEG_COV": "0",
12
- }, absWorkingDir: process.cwd(), banner: {
13
- js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`,
14
- }, platform: "node", external: [
15
- // "testeranto.json",
16
- // "features.test.js",
17
- "react",
18
- // "events",
19
- // "ganache"
20
- ...config.externals,
21
- ], entryPoints: [...entryPoints], plugins: [
22
- featuresPlugin,
23
- ...(config.nodePlugins.map((p) => p(register, entryPoints)) || []),
24
- inputFilesPluginFactory,
25
- // inputFilesPlugin("node", entryPoints),
26
- {
27
- name: "rebuild-notify",
28
- setup(build) {
29
- build.onEnd((result) => {
30
- console.log(`> node build ended with ${result.errors.length} errors`);
31
- if (result.errors.length > 0) {
32
- console.log(result);
33
- }
34
- // console.log(result);
35
- // result.errors.length !== 0 && process.exit(-1);
36
- });
37
- },
38
- },
39
- ] });
40
- };
@@ -1,56 +0,0 @@
1
- import path from "path";
2
- import baseEsBuildConfig from "./index.js";
3
- import inputFilesPlugin from "./inputFilesPlugin.js";
4
- import featuresPlugin from "./featuresPlugin.js";
5
- export default (config, entryPoints) => {
6
- const { inputFilesPluginFactory, register } = inputFilesPlugin("web", entryPoints);
7
- return Object.assign(Object.assign({}, baseEsBuildConfig(config)), {
8
- // inject: ["./node_modules/testeranto/dist/cjs-shim.js"],
9
- // banner: {
10
- // js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`,
11
- // },
12
- // splitting: true,
13
- outdir: config.outdir + "/web", alias: {
14
- react: path.resolve("./node_modules/react"),
15
- }, metafile: true, external: [
16
- // "testeranto.json",
17
- // "features.test.ts",
18
- // "url",
19
- // "react",
20
- "path",
21
- "fs",
22
- "stream",
23
- "http",
24
- "constants",
25
- "net",
26
- "assert",
27
- "tls",
28
- "os",
29
- "child_process",
30
- "readline",
31
- "zlib",
32
- "crypto",
33
- "https",
34
- "util",
35
- "process",
36
- "dns",
37
- ], platform: "browser", entryPoints: [...entryPoints], plugins: [
38
- featuresPlugin,
39
- // markdownPlugin({}),
40
- ...(config.nodePlugins.map((p) => p(register, entryPoints)) || []),
41
- inputFilesPluginFactory,
42
- {
43
- name: "rebuild-notify",
44
- setup(build) {
45
- build.onEnd((result) => {
46
- console.log(`> web build ended with ${result.errors.length} errors`);
47
- if (result.errors.length > 0) {
48
- console.log(result);
49
- }
50
- // console.log(result);
51
- // result.errors.length !== 0 && process.exit(-1);
52
- });
53
- },
54
- },
55
- ] });
56
- };
@@ -1,15 +0,0 @@
1
- import fs from "fs";
2
- import Init from "../dist/module/src/Init";
3
- console.log("Initializing a testeranto project");
4
- if (!process.argv[2]) {
5
- console.log("You didn't pass a config file, so I will create one for you.");
6
- fs.writeFileSync("testeranto.mts", fs.readFileSync("node_modules/testeranto/src/defaultConfig.ts"));
7
- import(process.cwd() + "/" + "testeranto.mts").then((module) => {
8
- Init(module.default);
9
- });
10
- }
11
- else {
12
- import(process.cwd() + "/" + process.argv[2]).then((module) => {
13
- Init(module.default);
14
- });
15
- }