testeranto 0.111.0 → 0.112.1
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 +6 -5
- package/dist/common/Init.js +68 -0
- package/dist/common/Node.js +27 -0
- package/dist/common/PM/index.js +7 -0
- package/dist/common/PM/main.js +1176 -0
- package/dist/common/PM/node.js +128 -0
- package/dist/common/PM/web.js +121 -0
- package/dist/common/ReportServer.js +22 -0
- package/dist/common/SubPackages/react/component/node.js +19 -0
- package/dist/common/SubPackages/react/component/web.js +19 -0
- package/dist/common/SubPackages/react/jsx/index.js +21 -0
- package/dist/common/SubPackages/react/jsx/node.js +10 -0
- package/dist/common/SubPackages/react/jsx/web.js +10 -0
- package/dist/common/SubPackages/react-dom/component/node.js +88 -0
- package/dist/common/SubPackages/react-dom/component/web.js +67 -0
- package/dist/common/SubPackages/react-dom/jsx/index.js +2 -0
- package/dist/common/SubPackages/react-dom/jsx/node.js +39 -0
- package/dist/common/SubPackages/react-dom/jsx/web.js +128 -0
- package/dist/common/SubPackages/react-test-renderer/MemoExoticComponent/node.js +54 -0
- package/dist/common/SubPackages/react-test-renderer/component/index.js +2 -0
- package/dist/common/SubPackages/react-test-renderer/component/interface.js +70 -0
- package/dist/common/SubPackages/react-test-renderer/component/node.js +8 -0
- package/dist/common/SubPackages/react-test-renderer/component/web.js +8 -0
- package/dist/common/SubPackages/react-test-renderer/fc/node.js +60 -0
- package/dist/common/SubPackages/react-test-renderer/fc/web.js +60 -0
- package/dist/common/SubPackages/react-test-renderer/jsx/index.js +67 -0
- package/dist/common/SubPackages/react-test-renderer/jsx/node.js +10 -0
- package/dist/common/SubPackages/react-test-renderer/jsx/web.js +10 -0
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/index.js +52 -0
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/node.js +10 -0
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/web.js +10 -0
- package/dist/common/Types.js +2 -0
- package/dist/common/Web.js +49 -0
- package/dist/common/build.js +222 -0
- package/dist/common/defaultConfig.js +20 -0
- package/dist/common/esbuildConfigs/eslint-formatter-testeranto.js +6 -0
- package/dist/common/esbuildConfigs/featuresPlugin.js +39 -0
- package/dist/common/esbuildConfigs/index.js +21 -0
- package/dist/common/esbuildConfigs/inputFilesPlugin.js +27 -0
- package/dist/common/esbuildConfigs/node.js +37 -0
- package/dist/common/esbuildConfigs/web.js +50 -0
- package/dist/common/init-docs.js +53 -0
- package/dist/common/lib/abstractBase.js +329 -0
- package/dist/common/lib/basebuilder.js +98 -0
- package/dist/common/lib/classBuilder.js +40 -0
- package/dist/common/lib/core.js +117 -0
- package/dist/common/lib/index.js +21 -0
- package/dist/common/lib/types.js +2 -0
- package/dist/common/package.json +3 -0
- package/dist/common/puppeteerConfiger.js +24 -0
- package/dist/common/run.js +62 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -0
- package/dist/common/utils.js +43 -0
- package/dist/common/web.html.js +22 -0
- package/dist/module/Footer.js +4 -0
- package/dist/module/Init.js +63 -0
- package/dist/module/Node.js +20 -0
- package/dist/module/PM/index.js +3 -0
- package/dist/module/PM/main.js +1136 -0
- package/dist/module/PM/node.js +121 -0
- package/dist/module/PM/web.js +117 -0
- package/dist/module/ReportClient.js +97 -0
- package/dist/module/ReportServer.js +17 -0
- package/dist/module/SubPackages/react/component/node.js +14 -0
- package/dist/module/SubPackages/react/component/web.js +14 -0
- package/dist/module/SubPackages/react/jsx/index.js +15 -0
- package/dist/module/SubPackages/react/jsx/node.js +5 -0
- package/dist/module/SubPackages/react/jsx/web.js +5 -0
- package/dist/module/SubPackages/react-dom/component/node.js +80 -0
- package/dist/module/SubPackages/react-dom/component/web.js +62 -0
- package/dist/module/SubPackages/react-dom/jsx/index.js +1 -0
- package/dist/module/SubPackages/react-dom/jsx/node.js +31 -0
- package/dist/module/SubPackages/react-dom/jsx/web.js +90 -0
- package/dist/module/SubPackages/react-test-renderer/MemoExoticComponent/node.js +16 -0
- package/dist/module/SubPackages/react-test-renderer/component/index.js +1 -0
- package/dist/module/SubPackages/react-test-renderer/component/interface.js +31 -0
- package/dist/module/SubPackages/react-test-renderer/component/node.js +3 -0
- package/dist/module/SubPackages/react-test-renderer/component/web.js +3 -0
- package/dist/module/SubPackages/react-test-renderer/fc/node.js +22 -0
- package/dist/module/SubPackages/react-test-renderer/fc/web.js +22 -0
- package/dist/module/SubPackages/react-test-renderer/jsx/index.js +28 -0
- package/dist/module/SubPackages/react-test-renderer/jsx/node.js +5 -0
- package/dist/module/SubPackages/react-test-renderer/jsx/web.js +5 -0
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/index.js +16 -0
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/node.js +5 -0
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/web.js +5 -0
- package/dist/module/TestReport.js +91 -0
- package/dist/module/Types.js +1 -0
- package/dist/module/Web.js +42 -0
- package/dist/module/build.js +184 -0
- package/dist/module/defaultConfig.js +18 -0
- package/dist/module/esbuildConfigs/eslint-formatter-testeranto.js +3 -0
- package/dist/module/esbuildConfigs/featuresPlugin.js +34 -0
- package/dist/module/esbuildConfigs/index.js +19 -0
- package/dist/module/esbuildConfigs/inputFilesPlugin.js +22 -0
- package/dist/module/esbuildConfigs/node.js +32 -0
- package/dist/module/esbuildConfigs/web.js +45 -0
- package/dist/module/init-docs.js +15 -0
- package/dist/module/lib/abstractBase.js +321 -0
- package/dist/module/lib/basebuilder.js +94 -0
- package/dist/module/lib/classBuilder.js +36 -0
- package/dist/module/lib/core.js +114 -0
- package/dist/module/lib/index.js +17 -0
- package/dist/module/lib/types.js +1 -0
- package/dist/module/package.json +3 -0
- package/dist/module/puppeteerConfiger.js +19 -0
- package/dist/module/run.js +24 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -0
- package/dist/module/utils.js +29 -0
- package/dist/module/web.html.js +20 -0
- package/dist/prebuild/ReportClient.css +11367 -0
- package/dist/prebuild/ReportClient.js +24641 -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 +104 -0
- package/dist/prebuild/run.mjs +1153 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/Init.d.ts +2 -0
- package/dist/types/Node.d.ts +12 -0
- package/dist/types/PM/index.d.ts +34 -0
- package/dist/types/PM/main.d.ts +66 -0
- package/dist/types/PM/node.d.ts +40 -0
- package/dist/types/PM/web.d.ts +38 -0
- package/dist/types/ReportServer.d.ts +1 -0
- 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/interface.d.ts +9 -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/build.d.ts +1 -0
- package/dist/types/defaultConfig.d.ts +3 -0
- package/dist/types/esbuildConfigs/eslint-formatter-testeranto.d.ts +2 -0
- package/dist/types/esbuildConfigs/featuresPlugin.d.ts +5 -0
- package/dist/types/esbuildConfigs/index.d.ts +4 -0
- package/dist/types/esbuildConfigs/inputFilesPlugin.d.ts +6 -0
- package/dist/types/esbuildConfigs/node.d.ts +4 -0
- package/dist/types/esbuildConfigs/web.d.ts +4 -0
- 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/puppeteerConfiger.d.ts +4 -0
- package/dist/types/run.d.ts +1 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -0
- package/dist/types/utils.d.ts +15 -0
- package/dist/types/web.html.d.ts +2 -0
- package/package.json +1 -1
- package/src/PM/main.ts +25 -57
- package/src/ReportClient.tsx +43 -41
- package/src/run.ts +8 -5
- package/src/utils.ts +10 -0
- package/tsc.log +8 -8
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { createRequire } from 'module';const require = createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/build.ts
|
|
4
|
+
import fs2 from "fs";
|
|
5
|
+
import path3 from "path";
|
|
6
|
+
import readline from "readline";
|
|
7
|
+
import { glob } from "glob";
|
|
8
|
+
import esbuild from "esbuild";
|
|
9
|
+
|
|
10
|
+
// src/esbuildConfigs/index.ts
|
|
11
|
+
var esbuildConfigs_default = (config) => {
|
|
12
|
+
return {
|
|
13
|
+
// packages: "external",
|
|
14
|
+
target: "esnext",
|
|
15
|
+
format: "esm",
|
|
16
|
+
splitting: true,
|
|
17
|
+
outExtension: { ".js": ".mjs" },
|
|
18
|
+
outbase: config.outbase,
|
|
19
|
+
jsx: "transform",
|
|
20
|
+
bundle: true,
|
|
21
|
+
minify: config.minify === true,
|
|
22
|
+
write: true,
|
|
23
|
+
loader: {
|
|
24
|
+
".js": "jsx",
|
|
25
|
+
".png": "binary",
|
|
26
|
+
".jpg": "binary"
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// src/esbuildConfigs/inputFilesPlugin.ts
|
|
32
|
+
import fs from "fs";
|
|
33
|
+
var otherInputs = {};
|
|
34
|
+
var register = (entrypoint, sources) => {
|
|
35
|
+
if (!otherInputs[entrypoint]) {
|
|
36
|
+
otherInputs[entrypoint] = /* @__PURE__ */ new Set();
|
|
37
|
+
}
|
|
38
|
+
sources.forEach((s) => otherInputs[entrypoint].add(s));
|
|
39
|
+
};
|
|
40
|
+
var inputFilesPlugin_default = (platform, entryPoints) => {
|
|
41
|
+
return {
|
|
42
|
+
register,
|
|
43
|
+
inputFilesPluginFactory: {
|
|
44
|
+
name: "metafileWriter",
|
|
45
|
+
setup(build) {
|
|
46
|
+
build.onEnd((result) => {
|
|
47
|
+
fs.writeFileSync(
|
|
48
|
+
`docs/${platform}/metafile.json`,
|
|
49
|
+
JSON.stringify(result, null, 2)
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// src/esbuildConfigs/featuresPlugin.ts
|
|
58
|
+
import path from "path";
|
|
59
|
+
var featuresPlugin_default = {
|
|
60
|
+
name: "feature-markdown",
|
|
61
|
+
setup(build) {
|
|
62
|
+
build.onResolve({ filter: /\.md$/ }, (args) => {
|
|
63
|
+
if (args.resolveDir === "")
|
|
64
|
+
return;
|
|
65
|
+
return {
|
|
66
|
+
path: path.isAbsolute(args.path) ? args.path : path.join(args.resolveDir, args.path),
|
|
67
|
+
namespace: "feature-markdown"
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
build.onLoad(
|
|
71
|
+
{ filter: /.*/, namespace: "feature-markdown" },
|
|
72
|
+
async (args) => {
|
|
73
|
+
return {
|
|
74
|
+
contents: `file://${args.path}`,
|
|
75
|
+
loader: "text"
|
|
76
|
+
// contents: JSON.stringify({ path: args.path }),
|
|
77
|
+
// loader: "json",
|
|
78
|
+
// contents: JSON.stringify({
|
|
79
|
+
// // html: markdownHTML,
|
|
80
|
+
// raw: markdownContent,
|
|
81
|
+
// filename: args.path, //path.basename(args.path),
|
|
82
|
+
// }),
|
|
83
|
+
// loader: "json",
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// src/esbuildConfigs/node.ts
|
|
91
|
+
var node_default = (config, entryPoints) => {
|
|
92
|
+
const { inputFilesPluginFactory, register: register2 } = inputFilesPlugin_default(
|
|
93
|
+
"node",
|
|
94
|
+
entryPoints
|
|
95
|
+
);
|
|
96
|
+
return {
|
|
97
|
+
...esbuildConfigs_default(config),
|
|
98
|
+
splitting: true,
|
|
99
|
+
outdir: config.outdir + "/node",
|
|
100
|
+
// inject: [`./node_modules/testeranto/dist/cjs-shim.js`],
|
|
101
|
+
metafile: true,
|
|
102
|
+
supported: {
|
|
103
|
+
"dynamic-import": true
|
|
104
|
+
},
|
|
105
|
+
define: {
|
|
106
|
+
"process.env.FLUENTFFMPEG_COV": "0"
|
|
107
|
+
},
|
|
108
|
+
absWorkingDir: process.cwd(),
|
|
109
|
+
banner: {
|
|
110
|
+
js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`
|
|
111
|
+
},
|
|
112
|
+
platform: "node",
|
|
113
|
+
external: ["react", ...config.externals],
|
|
114
|
+
entryPoints: [...entryPoints],
|
|
115
|
+
plugins: [
|
|
116
|
+
featuresPlugin_default,
|
|
117
|
+
inputFilesPluginFactory,
|
|
118
|
+
{
|
|
119
|
+
name: "rebuild-notify",
|
|
120
|
+
setup(build) {
|
|
121
|
+
build.onEnd((result) => {
|
|
122
|
+
console.log(
|
|
123
|
+
`> node build ended with ${result.errors.length} errors`
|
|
124
|
+
);
|
|
125
|
+
if (result.errors.length > 0) {
|
|
126
|
+
console.log(result);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
...config.nodePlugins.map((p) => p(register2, entryPoints)) || []
|
|
132
|
+
]
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// src/esbuildConfigs/web.ts
|
|
137
|
+
import path2 from "path";
|
|
138
|
+
var web_default = (config, entryPoints) => {
|
|
139
|
+
const { inputFilesPluginFactory, register: register2 } = inputFilesPlugin_default(
|
|
140
|
+
"web",
|
|
141
|
+
entryPoints
|
|
142
|
+
);
|
|
143
|
+
return {
|
|
144
|
+
...esbuildConfigs_default(config),
|
|
145
|
+
outdir: config.outdir + "/web",
|
|
146
|
+
alias: {
|
|
147
|
+
react: path2.resolve("./node_modules/react")
|
|
148
|
+
},
|
|
149
|
+
metafile: true,
|
|
150
|
+
external: [
|
|
151
|
+
"path",
|
|
152
|
+
"fs",
|
|
153
|
+
"stream",
|
|
154
|
+
"http",
|
|
155
|
+
"constants",
|
|
156
|
+
"net",
|
|
157
|
+
"assert",
|
|
158
|
+
"tls",
|
|
159
|
+
"os",
|
|
160
|
+
"child_process",
|
|
161
|
+
"readline",
|
|
162
|
+
"zlib",
|
|
163
|
+
"crypto",
|
|
164
|
+
"https",
|
|
165
|
+
"util",
|
|
166
|
+
"process",
|
|
167
|
+
"dns"
|
|
168
|
+
],
|
|
169
|
+
platform: "browser",
|
|
170
|
+
entryPoints: [...entryPoints],
|
|
171
|
+
plugins: [
|
|
172
|
+
featuresPlugin_default,
|
|
173
|
+
inputFilesPluginFactory,
|
|
174
|
+
{
|
|
175
|
+
name: "rebuild-notify",
|
|
176
|
+
setup(build) {
|
|
177
|
+
build.onEnd((result) => {
|
|
178
|
+
console.log(
|
|
179
|
+
`> web build ended with ${result.errors.length} errors`
|
|
180
|
+
);
|
|
181
|
+
if (result.errors.length > 0) {
|
|
182
|
+
console.log(result);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
...config.nodePlugins.map((p) => p(register2, entryPoints)) || []
|
|
188
|
+
]
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
// src/web.html.ts
|
|
193
|
+
var web_html_default = (jsfilePath, htmlFilePath) => `
|
|
194
|
+
<!DOCTYPE html>
|
|
195
|
+
<html lang="en">
|
|
196
|
+
|
|
197
|
+
<head>
|
|
198
|
+
<script type="module" src="${jsfilePath}"></script>
|
|
199
|
+
|
|
200
|
+
</head>
|
|
201
|
+
|
|
202
|
+
<body>
|
|
203
|
+
<h1>${htmlFilePath}</h1>
|
|
204
|
+
<div id="root">
|
|
205
|
+
|
|
206
|
+
</div>
|
|
207
|
+
</body>
|
|
208
|
+
|
|
209
|
+
<footer></footer>
|
|
210
|
+
|
|
211
|
+
</html>
|
|
212
|
+
`;
|
|
213
|
+
|
|
214
|
+
// src/build.ts
|
|
215
|
+
readline.emitKeypressEvents(process.stdin);
|
|
216
|
+
if (process.stdin.isTTY)
|
|
217
|
+
process.stdin.setRawMode(true);
|
|
218
|
+
var getRunnables = (tests, payload = {
|
|
219
|
+
nodeEntryPoints: {},
|
|
220
|
+
webEntryPoints: {}
|
|
221
|
+
}) => {
|
|
222
|
+
return tests.reduce((pt, cv, cndx, cry) => {
|
|
223
|
+
if (cv[1] === "node") {
|
|
224
|
+
pt.nodeEntryPoints[cv[0]] = path3.resolve(
|
|
225
|
+
`./docs/node/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`
|
|
226
|
+
);
|
|
227
|
+
} else if (cv[1] === "web") {
|
|
228
|
+
pt.webEntryPoints[cv[0]] = path3.resolve(
|
|
229
|
+
`./docs/web/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
if (cv[3].length) {
|
|
233
|
+
getRunnables(cv[3], payload);
|
|
234
|
+
}
|
|
235
|
+
return pt;
|
|
236
|
+
}, payload);
|
|
237
|
+
};
|
|
238
|
+
import(process.cwd() + "/" + process.argv[2]).then(async (module) => {
|
|
239
|
+
const rawConfig = module.default;
|
|
240
|
+
const getSecondaryEndpointsPoints = (runtime) => {
|
|
241
|
+
const meta = (ts, st) => {
|
|
242
|
+
ts.forEach((t) => {
|
|
243
|
+
if (t[1] === runtime) {
|
|
244
|
+
st.add(t[0]);
|
|
245
|
+
}
|
|
246
|
+
if (Array.isArray(t[3])) {
|
|
247
|
+
meta(t[3], st);
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
return st;
|
|
251
|
+
};
|
|
252
|
+
return Array.from(meta(config.tests, /* @__PURE__ */ new Set()));
|
|
253
|
+
};
|
|
254
|
+
const config = {
|
|
255
|
+
...rawConfig,
|
|
256
|
+
buildDir: process.cwd() + "/" + rawConfig.outdir
|
|
257
|
+
};
|
|
258
|
+
let nodeDone = false;
|
|
259
|
+
let webDone = false;
|
|
260
|
+
let mode = config.devMode ? "DEV" : "PROD";
|
|
261
|
+
let status = "build";
|
|
262
|
+
const { nodeEntryPoints, webEntryPoints } = getRunnables(config.tests);
|
|
263
|
+
const onNodeDone = () => {
|
|
264
|
+
nodeDone = true;
|
|
265
|
+
onDone();
|
|
266
|
+
};
|
|
267
|
+
const onWebDone = () => {
|
|
268
|
+
webDone = true;
|
|
269
|
+
onDone();
|
|
270
|
+
};
|
|
271
|
+
const onDone = async () => {
|
|
272
|
+
if (nodeDone && webDone) {
|
|
273
|
+
status = "built";
|
|
274
|
+
}
|
|
275
|
+
if (nodeDone && webDone && status === "built") {
|
|
276
|
+
}
|
|
277
|
+
if (nodeDone && webDone && mode === "PROD") {
|
|
278
|
+
console.log("Testeranto-EsBuild is all done. Goodbye!");
|
|
279
|
+
process.exit();
|
|
280
|
+
} else {
|
|
281
|
+
if (mode === "PROD") {
|
|
282
|
+
console.log("waiting for tests to finish");
|
|
283
|
+
console.log(
|
|
284
|
+
JSON.stringify(
|
|
285
|
+
{
|
|
286
|
+
nodeDone,
|
|
287
|
+
webDone,
|
|
288
|
+
mode
|
|
289
|
+
},
|
|
290
|
+
null,
|
|
291
|
+
2
|
|
292
|
+
)
|
|
293
|
+
);
|
|
294
|
+
} else {
|
|
295
|
+
console.log("waiting for tests to change");
|
|
296
|
+
}
|
|
297
|
+
if (config.devMode) {
|
|
298
|
+
console.log("ready and watching for changes...");
|
|
299
|
+
} else {
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
console.log(
|
|
304
|
+
`Press 'q' to shutdown gracefully. Press 'x' to shutdown forcefully.`
|
|
305
|
+
);
|
|
306
|
+
process.stdin.on("keypress", (str, key) => {
|
|
307
|
+
if (key.name === "q") {
|
|
308
|
+
console.log("Testeranto-Build is shutting down...");
|
|
309
|
+
mode = "PROD";
|
|
310
|
+
onDone();
|
|
311
|
+
}
|
|
312
|
+
if (key.name === "x") {
|
|
313
|
+
console.log("Testeranto-Build is shutting down forcefully...");
|
|
314
|
+
process.exit(-1);
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
fs2.writeFileSync(
|
|
318
|
+
`${config.outdir}/testeranto.json`,
|
|
319
|
+
JSON.stringify(config, null, 2)
|
|
320
|
+
);
|
|
321
|
+
Promise.resolve(
|
|
322
|
+
Promise.all(
|
|
323
|
+
[...getSecondaryEndpointsPoints("web")].map(async (sourceFilePath) => {
|
|
324
|
+
const sourceFileSplit = sourceFilePath.split("/");
|
|
325
|
+
const sourceDir = sourceFileSplit.slice(0, -1);
|
|
326
|
+
const sourceFileName = sourceFileSplit[sourceFileSplit.length - 1];
|
|
327
|
+
const sourceFileNameMinusJs = sourceFileName.split(".").slice(0, -1).join(".");
|
|
328
|
+
const htmlFilePath = path3.normalize(
|
|
329
|
+
`${process.cwd()}/${config.outdir}/web/${sourceDir.join(
|
|
330
|
+
"/"
|
|
331
|
+
)}/${sourceFileNameMinusJs}.html`
|
|
332
|
+
);
|
|
333
|
+
const jsfilePath = `./${sourceFileNameMinusJs}.mjs`;
|
|
334
|
+
return fs2.promises.mkdir(path3.dirname(htmlFilePath), { recursive: true }).then(
|
|
335
|
+
(x) => fs2.writeFileSync(
|
|
336
|
+
htmlFilePath,
|
|
337
|
+
web_html_default(jsfilePath, htmlFilePath)
|
|
338
|
+
)
|
|
339
|
+
);
|
|
340
|
+
})
|
|
341
|
+
)
|
|
342
|
+
);
|
|
343
|
+
glob(`./${config.outdir}/chunk-*.mjs`, {
|
|
344
|
+
ignore: "node_modules/**"
|
|
345
|
+
}).then((chunks) => {
|
|
346
|
+
chunks.forEach((chunk) => {
|
|
347
|
+
fs2.unlinkSync(chunk);
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
await Promise.all([
|
|
351
|
+
esbuild.context(node_default(config, Object.keys(nodeEntryPoints))).then(async (nodeContext) => {
|
|
352
|
+
if (config.devMode) {
|
|
353
|
+
await nodeContext.watch().then((v) => {
|
|
354
|
+
onNodeDone();
|
|
355
|
+
});
|
|
356
|
+
} else {
|
|
357
|
+
nodeContext.rebuild().then((v) => {
|
|
358
|
+
onNodeDone();
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
return nodeContext;
|
|
362
|
+
}),
|
|
363
|
+
esbuild.context(web_default(config, Object.keys(webEntryPoints))).then(async (webContext) => {
|
|
364
|
+
if (config.devMode) {
|
|
365
|
+
await webContext.watch().then((v) => {
|
|
366
|
+
onWebDone();
|
|
367
|
+
});
|
|
368
|
+
} else {
|
|
369
|
+
webContext.rebuild().then((v) => {
|
|
370
|
+
onWebDone();
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
return webContext;
|
|
374
|
+
})
|
|
375
|
+
]);
|
|
376
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createRequire } from 'module';const require = createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/esbuildConfigs/eslint-formatter-testeranto.ts
|
|
4
|
+
function eslint_formatter_testeranto_default(results) {
|
|
5
|
+
return JSON.stringify(results, null, 2);
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
eslint_formatter_testeranto_default as default
|
|
9
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { createRequire } from 'module';const require = createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/init-docs.ts
|
|
4
|
+
import fs2 from "fs";
|
|
5
|
+
|
|
6
|
+
// src/Init.ts
|
|
7
|
+
import fs from "fs";
|
|
8
|
+
var Init_default = async (partialConfig) => {
|
|
9
|
+
const config = {
|
|
10
|
+
...partialConfig,
|
|
11
|
+
buildDir: process.cwd() + "/" + partialConfig.outdir
|
|
12
|
+
};
|
|
13
|
+
try {
|
|
14
|
+
fs.mkdirSync(`${process.cwd()}/${config.outdir}`);
|
|
15
|
+
} catch {
|
|
16
|
+
}
|
|
17
|
+
fs.writeFileSync(
|
|
18
|
+
`${config.outdir}/index.html`,
|
|
19
|
+
`
|
|
20
|
+
<!DOCTYPE html>
|
|
21
|
+
<html lang="en">
|
|
22
|
+
|
|
23
|
+
<head>
|
|
24
|
+
<meta name="description" content="Webpage description goes here" />
|
|
25
|
+
<meta charset="utf-8" />
|
|
26
|
+
<title>kokomoBay - testeranto</title>
|
|
27
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
28
|
+
<meta name="author" content="" />
|
|
29
|
+
|
|
30
|
+
<link rel="stylesheet" href="/kokomoBay/docs/ReportClient.css" />
|
|
31
|
+
<script type="module" src="/kokomoBay/docs/ReportClient.js"></script>
|
|
32
|
+
|
|
33
|
+
</head>
|
|
34
|
+
|
|
35
|
+
<body>
|
|
36
|
+
<div id="root">
|
|
37
|
+
react is loading
|
|
38
|
+
</div>
|
|
39
|
+
</body>
|
|
40
|
+
|
|
41
|
+
</html>
|
|
42
|
+
`
|
|
43
|
+
);
|
|
44
|
+
fs.copyFileSync(
|
|
45
|
+
`node_modules/testeranto/dist/prebuild/ReportClient.js`,
|
|
46
|
+
`${config.outdir}/ReportClient.js`
|
|
47
|
+
);
|
|
48
|
+
fs.copyFileSync(
|
|
49
|
+
`node_modules/testeranto/dist/prebuild/ReportClient.css`,
|
|
50
|
+
`${config.outdir}/ReportClient.css`
|
|
51
|
+
);
|
|
52
|
+
fs.copyFileSync(
|
|
53
|
+
`node_modules/testeranto/dist/prebuild/TestReport.js`,
|
|
54
|
+
`${config.outdir}/TestReport.js`
|
|
55
|
+
);
|
|
56
|
+
fs.copyFileSync(
|
|
57
|
+
`node_modules/testeranto/dist/prebuild/TestReport.css`,
|
|
58
|
+
`${config.outdir}/TestReport.css`
|
|
59
|
+
);
|
|
60
|
+
fs.writeFileSync(
|
|
61
|
+
`${config.outdir}/testeranto.json`,
|
|
62
|
+
JSON.stringify(
|
|
63
|
+
{
|
|
64
|
+
...config,
|
|
65
|
+
buildDir: process.cwd() + "/" + config.outdir
|
|
66
|
+
},
|
|
67
|
+
null,
|
|
68
|
+
2
|
|
69
|
+
)
|
|
70
|
+
);
|
|
71
|
+
try {
|
|
72
|
+
fs.mkdirSync(`${process.cwd()}/${config.outdir}/node`);
|
|
73
|
+
} catch {
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
fs.mkdirSync(`${process.cwd()}/${config.outdir}/web`);
|
|
77
|
+
} catch {
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
fs.mkdirSync(`${process.cwd()}/${config.outdir}/features`);
|
|
81
|
+
} catch {
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
fs.mkdirSync(`${process.cwd()}/${config.outdir}/ts`);
|
|
85
|
+
} catch {
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// src/init-docs.ts
|
|
90
|
+
console.log("Initializing a testeranto project");
|
|
91
|
+
if (!process.argv[2]) {
|
|
92
|
+
console.log("You didn't pass a config file, so I will create one for you.");
|
|
93
|
+
fs2.writeFileSync(
|
|
94
|
+
"testeranto.mts",
|
|
95
|
+
fs2.readFileSync("node_modules/testeranto/src/defaultConfig.ts")
|
|
96
|
+
);
|
|
97
|
+
import(process.cwd() + "/testeranto.mts").then((module) => {
|
|
98
|
+
Init_default(module.default);
|
|
99
|
+
});
|
|
100
|
+
} else {
|
|
101
|
+
import(process.cwd() + "/" + process.argv[2]).then((module) => {
|
|
102
|
+
Init_default(module.default);
|
|
103
|
+
});
|
|
104
|
+
}
|