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.
- package/README.md +1 -0
- package/bundle.js +80 -30
- package/dist/common/{dist/module/src/Init.js → Init.js} +28 -0
- package/dist/common/{src/PM → PM}/main.js +138 -95
- package/dist/common/ReportServer.js +22 -0
- package/dist/common/{src/SubPackages → SubPackages}/react/jsx/index.js +0 -12
- package/dist/common/{src/SubPackages → SubPackages}/react-dom/component/node.js +3 -16
- package/dist/common/{src/SubPackages → SubPackages}/react-dom/component/web.js +3 -3
- package/dist/common/{src/SubPackages → SubPackages}/react-dom/jsx/node.js +1 -1
- package/dist/common/{src/SubPackages → SubPackages}/react-dom/jsx/web.js +41 -30
- package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +17 -7
- package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/component/interface.js +17 -7
- package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/fc/node.js +17 -7
- package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/fc/web.js +17 -7
- package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/jsx/index.js +18 -14
- package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/jsx-promised/index.js +17 -7
- package/dist/common/build.js +222 -0
- package/dist/common/{src/defaultConfig.js → defaultConfig.js} +1 -0
- package/dist/common/esbuildConfigs/eslint-formatter-testeranto.js +6 -0
- package/dist/common/esbuildConfigs/inputFilesPlugin.js +27 -0
- package/dist/common/{src/esbuildConfigs → esbuildConfigs}/node.js +2 -10
- package/dist/common/{src/esbuildConfigs → esbuildConfigs}/web.js +2 -13
- package/dist/common/{src/init-docs.js → init-docs.js} +20 -10
- package/dist/common/{src/lib → lib}/abstractBase.js +6 -1
- package/dist/common/{src/lib → lib}/basebuilder.js +23 -10
- package/dist/common/{src/lib → lib}/classBuilder.js +1 -3
- package/dist/common/{src/lib → lib}/core.js +26 -10
- package/dist/common/{src/lib → lib}/index.js +0 -1
- package/dist/common/{src/lib → lib}/types.js +0 -1
- package/dist/common/run.js +297 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/common/utils.js +43 -0
- package/dist/module/Footer.js +4 -0
- package/dist/module/Init.js +63 -0
- package/dist/module/{src/PM → PM}/main.js +119 -86
- package/dist/module/ReportClient.js +97 -0
- package/dist/module/ReportServer.js +17 -0
- package/dist/module/SubPackages/react/jsx/index.js +15 -0
- package/dist/module/{src/SubPackages → SubPackages}/react-dom/component/node.js +3 -16
- package/dist/module/{src/SubPackages → SubPackages}/react-dom/component/web.js +3 -3
- package/dist/module/{src/SubPackages → SubPackages}/react-dom/jsx/node.js +3 -3
- package/dist/module/{src/SubPackages → SubPackages}/react-dom/jsx/web.js +24 -23
- package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/jsx/index.js +1 -7
- package/dist/module/TestReport.js +91 -0
- package/dist/module/build.js +184 -0
- package/dist/module/{src/defaultConfig.js → defaultConfig.js} +1 -0
- package/dist/module/esbuildConfigs/eslint-formatter-testeranto.js +3 -0
- package/dist/module/esbuildConfigs/inputFilesPlugin.js +22 -0
- package/dist/module/{src/esbuildConfigs → esbuildConfigs}/node.js +2 -10
- package/dist/module/{src/esbuildConfigs → esbuildConfigs}/web.js +2 -13
- package/dist/module/{src/init-docs.js → init-docs.js} +1 -1
- package/dist/module/{src/lib → lib}/abstractBase.js +6 -1
- package/dist/module/{src/lib → lib}/basebuilder.js +23 -10
- package/dist/module/{src/lib → lib}/classBuilder.js +1 -3
- package/dist/module/{src/lib → lib}/core.js +26 -10
- package/dist/module/{src/lib → lib}/index.js +0 -1
- package/dist/module/run.js +259 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/module/utils.js +29 -0
- package/dist/prebuild/ReportClient.css +11367 -0
- package/dist/prebuild/ReportClient.js +23641 -0
- package/dist/prebuild/ReportServer.mjs +16 -0
- package/dist/prebuild/TestReport.css +11367 -0
- package/dist/prebuild/TestReport.js +27484 -0
- package/dist/prebuild/build.mjs +376 -0
- package/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs +9 -0
- package/dist/prebuild/init-docs.mjs +64 -8
- package/dist/prebuild/{cli2.mjs → run.mjs} +353 -81
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/Node.d.ts +12 -0
- package/dist/types/{src/PM → PM}/index.d.ts +1 -1
- package/dist/types/{src/PM → PM}/main.d.ts +12 -9
- package/dist/types/{src/PM → PM}/node.d.ts +2 -4
- package/dist/types/{src/PM → PM}/web.d.ts +2 -4
- package/dist/types/SubPackages/react/component/node.d.ts +7 -0
- package/dist/types/SubPackages/react/component/web.d.ts +7 -0
- package/dist/types/SubPackages/react/jsx/index.d.ts +12 -0
- package/dist/types/SubPackages/react/jsx/node.d.ts +4 -0
- package/dist/types/SubPackages/react/jsx/web.d.ts +4 -0
- package/dist/types/SubPackages/react-dom/component/node.d.ts +11 -0
- package/dist/types/SubPackages/react-dom/component/web.d.ts +20 -0
- package/dist/types/SubPackages/react-dom/jsx/index.d.ts +6 -0
- package/dist/types/SubPackages/react-dom/jsx/node.d.ts +7 -0
- package/dist/types/SubPackages/react-dom/jsx/web.d.ts +5 -0
- package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +6 -0
- package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +13 -0
- package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +4 -0
- package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +4 -0
- package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +8 -0
- package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/jsx/index.d.ts +16 -0
- package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +15 -0
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +5 -0
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +5 -0
- package/dist/types/Types.d.ts +61 -0
- package/dist/types/Web.d.ts +9 -0
- package/dist/types/defaultConfig.d.ts +3 -0
- package/dist/types/esbuildConfigs/eslint-formatter-testeranto.d.ts +2 -0
- package/dist/types/{src/esbuildConfigs → esbuildConfigs}/index.d.ts +1 -1
- package/dist/types/{src/esbuildConfigs → esbuildConfigs}/inputFilesPlugin.d.ts +0 -1
- package/dist/types/{src/esbuildConfigs → esbuildConfigs}/node.d.ts +1 -1
- package/dist/types/{src/esbuildConfigs → esbuildConfigs}/web.d.ts +1 -1
- package/dist/types/init-docs.d.ts +1 -0
- package/dist/types/lib/abstractBase.d.ts +110 -0
- package/dist/types/lib/basebuilder.d.ts +27 -0
- package/dist/types/lib/classBuilder.d.ts +7 -0
- package/dist/types/lib/core.d.ts +7 -0
- package/dist/types/lib/index.d.ts +83 -0
- package/dist/types/lib/types.d.ts +14 -0
- package/dist/types/run.d.ts +1 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/utils.d.ts +9 -0
- package/package.json +40 -32
- package/src/Footer.tsx +4 -0
- package/src/Init.ts +48 -0
- package/src/Node.ts +23 -17
- package/src/PM/index.ts +1 -1
- package/src/PM/main.ts +143 -101
- package/src/PM/node.ts +2 -2
- package/src/PM/web.ts +1 -1
- package/src/ReportClient.tsx +155 -0
- package/src/ReportServer.ts +21 -0
- package/src/SubPackages/react/component/node.ts +68 -24
- package/src/SubPackages/react/component/web.ts +68 -25
- package/src/SubPackages/react/jsx/index.ts +39 -18
- package/src/SubPackages/react/jsx/node.ts +12 -10
- package/src/SubPackages/react/jsx/web.ts +27 -14
- package/src/SubPackages/react-dom/component/node.ts +42 -50
- package/src/SubPackages/react-dom/component/web.ts +28 -10
- package/src/SubPackages/react-dom/jsx/node.ts +54 -56
- package/src/SubPackages/react-dom/jsx/web.ts +55 -42
- package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +23 -7
- package/src/SubPackages/react-test-renderer/component/index.ts +38 -5
- package/src/SubPackages/react-test-renderer/component/node.ts +24 -5
- package/src/SubPackages/react-test-renderer/component/web.ts +22 -5
- package/src/SubPackages/react-test-renderer/fc/node.ts +41 -7
- package/src/SubPackages/react-test-renderer/fc/web.ts +43 -11
- package/src/SubPackages/react-test-renderer/jsx/index.ts +39 -16
- package/src/SubPackages/react-test-renderer/jsx/node.ts +8 -6
- package/src/SubPackages/react-test-renderer/jsx/web.ts +22 -5
- package/src/SubPackages/react-test-renderer/jsx-promised/index.ts +39 -6
- package/src/SubPackages/react-test-renderer/jsx-promised/node.ts +27 -10
- package/src/SubPackages/react-test-renderer/jsx-promised/web.ts +26 -12
- package/src/TestReport.tsx +176 -0
- package/src/Types.ts +63 -309
- package/src/Web.ts +24 -18
- package/src/build.ts +240 -0
- package/src/defaultConfig.ts +2 -1
- package/src/esbuildConfigs/eslint-formatter-testeranto.ts +5 -0
- package/src/esbuildConfigs/featuresPlugin.ts +0 -1
- package/src/esbuildConfigs/index.ts +1 -1
- package/src/esbuildConfigs/inputFilesPlugin.ts +2 -135
- package/src/esbuildConfigs/node.ts +4 -13
- package/src/esbuildConfigs/web.ts +3 -19
- package/src/init-docs.ts +2 -1
- package/src/lib/abstractBase.ts +82 -80
- package/src/lib/basebuilder.ts +57 -45
- package/src/lib/classBuilder.ts +15 -15
- package/src/lib/core.ts +44 -35
- package/src/lib/index.ts +47 -98
- package/src/lib/readme.md +12 -0
- package/src/lib/types.ts +53 -70
- package/src/run.ts +398 -0
- package/src/style.css +8 -0
- package/src/utils.ts +74 -2
- package/tsc.log +106 -0
- package/Bundle.Dockerfile +0 -52
- package/bin/init-docs.js +0 -24
- package/dist/common/src/Init.js +0 -40
- package/dist/common/src/SubPackages/puppeteer.js +0 -21
- package/dist/common/src/cli.js +0 -439
- package/dist/common/src/cli2.js +0 -144
- package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +0 -99
- package/dist/common/src/utils.js +0 -16
- package/dist/common/testeranto.js +0 -15
- package/dist/module/src/Init.js +0 -35
- package/dist/module/src/SubPackages/puppeteer.js +0 -16
- package/dist/module/src/SubPackages/react/jsx/index.js +0 -27
- package/dist/module/src/cli.js +0 -411
- package/dist/module/src/cli2.js +0 -116
- package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +0 -94
- package/dist/module/src/lib/types.js +0 -2
- package/dist/module/src/utils.js +0 -9
- package/dist/module/testeranto.js +0 -13
- package/dist/prebuild/cli.mjs +0 -1491
- package/dist/types/dist/module/src/Init.d.ts +0 -2
- package/dist/types/src/Node.d.ts +0 -13
- package/dist/types/src/SubPackages/puppeteer.d.ts +0 -6
- package/dist/types/src/SubPackages/react/component/node.d.ts +0 -7
- package/dist/types/src/SubPackages/react/component/web.d.ts +0 -7
- package/dist/types/src/SubPackages/react/jsx/index.d.ts +0 -12
- package/dist/types/src/SubPackages/react/jsx/node.d.ts +0 -4
- package/dist/types/src/SubPackages/react/jsx/web.d.ts +0 -4
- package/dist/types/src/SubPackages/react-dom/component/node.d.ts +0 -12
- package/dist/types/src/SubPackages/react-dom/component/web.d.ts +0 -11
- package/dist/types/src/SubPackages/react-dom/jsx/index.d.ts +0 -7
- package/dist/types/src/SubPackages/react-dom/jsx/node.d.ts +0 -6
- package/dist/types/src/SubPackages/react-dom/jsx/web.d.ts +0 -5
- package/dist/types/src/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -5
- package/dist/types/src/SubPackages/react-test-renderer/component/index.d.ts +0 -13
- package/dist/types/src/SubPackages/react-test-renderer/component/node.d.ts +0 -8
- package/dist/types/src/SubPackages/react-test-renderer/component/web.d.ts +0 -3
- package/dist/types/src/SubPackages/react-test-renderer/fc/node.d.ts +0 -8
- package/dist/types/src/SubPackages/react-test-renderer/fc/web.d.ts +0 -8
- package/dist/types/src/SubPackages/react-test-renderer/jsx/index.d.ts +0 -17
- package/dist/types/src/SubPackages/react-test-renderer/jsx/node.d.ts +0 -9
- package/dist/types/src/SubPackages/react-test-renderer/jsx/web.d.ts +0 -8
- package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/index.d.ts +0 -16
- package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/node.d.ts +0 -4
- package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/web.d.ts +0 -4
- package/dist/types/src/Types.d.ts +0 -90
- package/dist/types/src/Web.d.ts +0 -10
- package/dist/types/src/defaultConfig.d.ts +0 -3
- package/dist/types/src/lib/abstractBase.d.ts +0 -110
- package/dist/types/src/lib/basebuilder.d.ts +0 -27
- package/dist/types/src/lib/classBuilder.d.ts +0 -7
- package/dist/types/src/lib/core.d.ts +0 -8
- package/dist/types/src/lib/index.d.ts +0 -60
- package/dist/types/src/lib/types.d.ts +0 -40
- package/dist/types/src/utils.d.ts +0 -2
- package/dist/types/testeranto.d.ts +0 -16
- package/docker-compose.yml +0 -37
- package/src/SubPackages/puppeteer.ts +0 -51
- package/src/cli.ts +0 -535
- package/src/cli2.ts +0 -157
- package/testeranto.ts +0 -13
- package/dist/common/{src/Node.js → Node.js} +0 -0
- package/dist/common/{src/PM → PM}/index.js +0 -0
- package/dist/common/{src/PM → PM}/node.js +0 -0
- package/dist/common/{src/PM → PM}/web.js +0 -0
- package/dist/common/{src/SubPackages → SubPackages}/react/component/node.js +0 -0
- package/dist/common/{src/SubPackages → SubPackages}/react/component/web.js +0 -0
- package/dist/common/{src/SubPackages → SubPackages}/react/jsx/node.js +0 -0
- package/dist/common/{src/SubPackages → SubPackages}/react/jsx/web.js +0 -0
- package/dist/common/{src/SubPackages → SubPackages}/react-dom/jsx/index.js +0 -0
- package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/component/index.js +0 -0
- package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/component/node.js +0 -0
- package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/component/web.js +0 -0
- package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/jsx/node.js +0 -0
- package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/jsx/web.js +0 -0
- package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/jsx-promised/node.js +1 -1
- package/dist/common/{src/SubPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
- package/dist/common/{src/Types.js → Types.js} +0 -0
- package/dist/common/{src/Web.js → Web.js} +0 -0
- package/dist/common/{src/esbuildConfigs → esbuildConfigs}/featuresPlugin.js +0 -0
- package/dist/common/{src/esbuildConfigs → esbuildConfigs}/index.js +0 -0
- package/dist/common/{src/puppeteerConfiger.js → puppeteerConfiger.js} +0 -0
- package/dist/common/{src/web.html.js → web.html.js} +0 -0
- package/dist/module/{src/Node.js → Node.js} +0 -0
- package/dist/module/{src/PM → PM}/index.js +0 -0
- package/dist/module/{src/PM → PM}/node.js +0 -0
- package/dist/module/{src/PM → PM}/web.js +0 -0
- package/dist/module/{src/SubPackages → SubPackages}/react/component/node.js +0 -0
- package/dist/module/{src/SubPackages → SubPackages}/react/component/web.js +0 -0
- package/dist/module/{src/SubPackages → SubPackages}/react/jsx/node.js +0 -0
- package/dist/module/{src/SubPackages → SubPackages}/react/jsx/web.js +0 -0
- package/dist/module/{src/SubPackages → SubPackages}/react-dom/jsx/index.js +0 -0
- package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +0 -0
- package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/component/index.js +0 -0
- package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/component/interface.js +0 -0
- package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/component/node.js +0 -0
- package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/component/web.js +0 -0
- package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/fc/node.js +0 -0
- package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/fc/web.js +0 -0
- package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/jsx/node.js +0 -0
- package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/jsx/web.js +0 -0
- package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/jsx-promised/index.js +0 -0
- package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/jsx-promised/node.js +1 -1
- /package/dist/module/{src/SubPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
- /package/dist/module/{src/Types.js → Types.js} +0 -0
- /package/dist/module/{src/Web.js → Web.js} +0 -0
- /package/dist/module/{src/esbuildConfigs → esbuildConfigs}/featuresPlugin.js +0 -0
- /package/dist/module/{src/esbuildConfigs → esbuildConfigs}/index.js +0 -0
- /package/dist/{types/src/cli.d.ts → module/lib/types.js} +0 -0
- /package/dist/module/{src/puppeteerConfiger.js → puppeteerConfiger.js} +0 -0
- /package/dist/module/{src/web.html.js → web.html.js} +0 -0
- /package/dist/types/{src/Init.d.ts → Init.d.ts} +0 -0
- /package/dist/types/{src/cli2.d.ts → ReportServer.d.ts} +0 -0
- /package/dist/types/{src/SubPackages → SubPackages}/react-test-renderer/component/interface.d.ts +0 -0
- /package/dist/types/{src/init-docs.d.ts → build.d.ts} +0 -0
- /package/dist/types/{src/esbuildConfigs → esbuildConfigs}/featuresPlugin.d.ts +0 -0
- /package/dist/types/{src/puppeteerConfiger.d.ts → puppeteerConfiger.d.ts} +0 -0
- /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
|
+
});
|
package/src/defaultConfig.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
|
-
import
|
|
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/
|
|
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
|
|
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
|
};
|