testeranto 0.85.0 → 0.94.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 (98) hide show
  1. package/README.md +1 -3
  2. package/bin/init-docs.js +24 -0
  3. package/bundle.js +53 -0
  4. package/dist/common/dist/module/src/Init.js +40 -0
  5. package/dist/common/src/Init.js +30 -0
  6. package/dist/common/src/Node.js +5 -3
  7. package/dist/common/src/PM/main.js +136 -90
  8. package/dist/common/src/Project.js +82 -0
  9. package/dist/common/src/Puppeteer.js +0 -2
  10. package/dist/common/src/SubPackages/puppeteer.js +1 -1
  11. package/dist/common/src/SubPackages/react/jsx/index.js +14 -6
  12. package/dist/common/src/SubPackages/react/jsx/node.js +7 -2
  13. package/dist/common/src/SubPackages/react-dom/component/web.js +13 -39
  14. package/dist/common/src/SubPackages/react-test-renderer/component/interface.js +2 -10
  15. package/dist/common/src/Web.js +25 -21
  16. package/dist/common/{run-tests.js → src/build-tests.js} +10 -5
  17. package/dist/common/src/defaultConfig.js +19 -0
  18. package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +26 -16
  19. package/dist/common/src/init-docs.js +43 -0
  20. package/dist/common/src/lib/abstractBase.js +29 -248
  21. package/dist/common/src/lib/basebuilder.js +1 -11
  22. package/dist/common/src/lib/classBuilder.js +1 -1
  23. package/dist/common/src/lib/core.js +8 -26
  24. package/dist/common/{build-tests.js → src/run-tests.js} +10 -9
  25. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  26. package/dist/module/src/Init.js +30 -0
  27. package/dist/module/src/Node.js +5 -3
  28. package/dist/module/src/PM/main.js +136 -90
  29. package/dist/module/src/Project.js +82 -0
  30. package/dist/module/src/Puppeteer.js +0 -2
  31. package/dist/module/src/SubPackages/puppeteer.js +1 -1
  32. package/dist/module/src/SubPackages/react/jsx/index.js +14 -6
  33. package/dist/module/src/SubPackages/react/jsx/node.js +7 -2
  34. package/dist/module/src/SubPackages/react-dom/component/web.js +13 -39
  35. package/dist/module/src/SubPackages/react-test-renderer/component/interface.js +2 -10
  36. package/dist/module/src/Web.js +25 -21
  37. package/dist/module/src/build-tests.js +11 -0
  38. package/dist/module/src/defaultConfig.js +17 -0
  39. package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +26 -16
  40. package/dist/module/src/init-docs.js +15 -0
  41. package/dist/module/src/lib/abstractBase.js +29 -248
  42. package/dist/module/src/lib/basebuilder.js +1 -11
  43. package/dist/module/src/lib/classBuilder.js +1 -1
  44. package/dist/module/src/lib/core.js +8 -26
  45. package/dist/module/src/run-tests.js +11 -0
  46. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  47. package/dist/prebuild/build-tests.mjs +553 -0
  48. package/dist/prebuild/init-docs.mjs +48 -0
  49. package/dist/prebuild/run-tests.mjs +871 -0
  50. package/dist/types/dist/module/src/Init.d.ts +2 -0
  51. package/dist/types/src/Node.d.ts +4 -1
  52. package/dist/types/src/PM/main.d.ts +2 -1
  53. package/dist/types/src/SubPackages/react/jsx/node.d.ts +1 -1
  54. package/dist/types/src/SubPackages/react-test-renderer/component/interface.d.ts +1 -1
  55. package/dist/types/src/Web.d.ts +2 -2
  56. package/dist/types/src/build-tests.d.ts +1 -0
  57. package/dist/types/src/defaultConfig.d.ts +3 -0
  58. package/dist/types/src/init-docs.d.ts +1 -0
  59. package/dist/types/src/lib/abstractBase.d.ts +6 -2
  60. package/dist/types/src/lib/core.d.ts +3 -3
  61. package/dist/types/src/lib/types.d.ts +5 -1
  62. package/dist/types/src/run-tests.d.ts +1 -0
  63. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  64. package/package.json +21 -24
  65. package/src/Init.ts +28 -0
  66. package/src/Node.ts +6 -3
  67. package/src/PM/main.ts +168 -110
  68. package/src/Project.ts +103 -0
  69. package/src/Puppeteer.ts +0 -2
  70. package/src/SubPackages/puppeteer.ts +1 -1
  71. package/src/SubPackages/react/jsx/index.ts +15 -7
  72. package/src/SubPackages/react/jsx/node.ts +6 -5
  73. package/src/SubPackages/react-dom/component/web.ts +28 -51
  74. package/src/SubPackages/react-test-renderer/component/interface.ts +4 -11
  75. package/src/Web.ts +45 -23
  76. package/src/build-tests.ts +12 -0
  77. package/src/defaultConfig.ts +20 -0
  78. package/src/esbuildConfigs/inputFilesPlugin.ts +46 -17
  79. package/src/init-docs.ts +19 -0
  80. package/src/lib/abstractBase.ts +38 -255
  81. package/src/lib/basebuilder.ts +1 -12
  82. package/src/lib/classBuilder.ts +2 -1
  83. package/src/lib/core.ts +17 -29
  84. package/src/lib/types.ts +3 -1
  85. package/src/run-tests.ts +12 -0
  86. package/tsconfig.json +1 -1
  87. package/build-tests.ts +0 -16
  88. package/dist/common/init-docs.js +0 -8
  89. package/dist/module/build-tests.js +0 -10
  90. package/dist/module/init-docs.js +0 -3
  91. package/dist/module/run-tests.js +0 -6
  92. package/dist/prebuild/Puppeteer.mjs +0 -82033
  93. package/dist/types/build-tests.d.ts +0 -3
  94. package/dist/types/init-docs.d.ts +0 -2
  95. package/dist/types/run-tests.d.ts +0 -2
  96. package/init-docs.ts +0 -5
  97. package/pupBuild.js +0 -18
  98. package/run-tests.ts +0 -9
@@ -0,0 +1,553 @@
1
+ import { createRequire } from 'module';const require = createRequire(import.meta.url);
2
+
3
+ // src/build-tests.ts
4
+ import process2 from "process";
5
+
6
+ // src/Project.ts
7
+ import { spawn } from "child_process";
8
+ import esbuild from "esbuild";
9
+ import fs2 from "fs";
10
+ import path4 from "path";
11
+ import readline from "readline";
12
+ import { glob } from "glob";
13
+
14
+ // src/esbuildConfigs/index.ts
15
+ var esbuildConfigs_default = (config) => {
16
+ return {
17
+ // packages: "external",
18
+ target: "esnext",
19
+ format: "esm",
20
+ splitting: true,
21
+ outExtension: { ".js": ".mjs" },
22
+ outbase: config.outbase,
23
+ jsx: "transform",
24
+ bundle: true,
25
+ minify: config.minify === true,
26
+ write: true,
27
+ loader: {
28
+ ".js": "jsx",
29
+ ".png": "binary",
30
+ ".jpg": "binary"
31
+ }
32
+ };
33
+ };
34
+
35
+ // src/esbuildConfigs/inputFilesPlugin.ts
36
+ import fs from "fs";
37
+ import path from "path";
38
+ var otherInputs = {};
39
+ var register = (entrypoint, sources) => {
40
+ if (!otherInputs[entrypoint]) {
41
+ otherInputs[entrypoint] = /* @__PURE__ */ new Set();
42
+ }
43
+ sources.forEach((s) => otherInputs[entrypoint].add(s));
44
+ };
45
+ function tree(meta, key) {
46
+ const outputKey = Object.keys(meta.outputs).find((k) => {
47
+ return meta.outputs[k].entryPoint === key;
48
+ });
49
+ if (!outputKey) {
50
+ console.error("No outputkey found");
51
+ process.exit(-1);
52
+ }
53
+ return Object.keys(meta.outputs[outputKey].inputs).filter(
54
+ (k) => k.startsWith("src")
55
+ );
56
+ }
57
+ var inputFilesPlugin_default = (platform, entryPoints) => {
58
+ return {
59
+ register,
60
+ inputFilesPluginFactory: {
61
+ name: "metafileWriter",
62
+ setup(build) {
63
+ build.onEnd((result) => {
64
+ fs.writeFileSync(
65
+ `docs/${platform}/metafile.json`,
66
+ JSON.stringify(result, null, 2)
67
+ );
68
+ if (result.errors.length === 0) {
69
+ entryPoints.forEach((entryPoint) => {
70
+ const filePath = path.join(
71
+ "./docs/",
72
+ platform,
73
+ entryPoint.split(".").slice(0, -1).join("."),
74
+ `inputFiles.json`
75
+ );
76
+ const dirName = path.dirname(filePath);
77
+ if (!fs.existsSync(dirName)) {
78
+ fs.mkdirSync(dirName, { recursive: true });
79
+ }
80
+ const promptPath = path.join(
81
+ "./docs/",
82
+ platform,
83
+ entryPoint.split(".").slice(0, -1).join("."),
84
+ `prompt.txt`
85
+ );
86
+ const testPaths = path.join(
87
+ "./docs/",
88
+ platform,
89
+ entryPoint.split(".").slice(0, -1).join("."),
90
+ `tests.json`
91
+ );
92
+ const featuresPath = path.join(
93
+ "./docs/",
94
+ platform,
95
+ entryPoint.split(".").slice(0, -1).join("."),
96
+ `featurePrompt.txt`
97
+ );
98
+ const stderrPath = path.join(
99
+ "./docs/",
100
+ platform,
101
+ entryPoint.split(".").slice(0, -1).join("."),
102
+ `stderr.log`
103
+ );
104
+ const stdoutPath = path.join(
105
+ "./docs/",
106
+ platform,
107
+ entryPoint.split(".").slice(0, -1).join("."),
108
+ `stdout.log`
109
+ );
110
+ if (result.metafile) {
111
+ const addableFiles = tree(
112
+ result.metafile,
113
+ entryPoint.split("/").slice(1).join("/")
114
+ ).map((y) => {
115
+ if (otherInputs[y]) {
116
+ return Array.from(otherInputs[y]);
117
+ }
118
+ return y;
119
+ }).flat();
120
+ const typeErrorFiles = addableFiles.map(
121
+ (t) => `docs/types/${t}.type_errors.txt`
122
+ );
123
+ fs.writeFileSync(
124
+ promptPath,
125
+ `
126
+ ${addableFiles.map((x) => {
127
+ return `/add ${x}`;
128
+ }).join("\n")}
129
+
130
+ ${typeErrorFiles.map((x) => {
131
+ return `/read ${x}`;
132
+ }).join("\n")}
133
+
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."
143
+ `
144
+ );
145
+ }
146
+ });
147
+ }
148
+ });
149
+ }
150
+ }
151
+ };
152
+ };
153
+
154
+ // src/esbuildConfigs/featuresPlugin.ts
155
+ import path2 from "path";
156
+ var featuresPlugin_default = {
157
+ name: "feature-markdown",
158
+ setup(build) {
159
+ build.onResolve({ filter: /\.md$/ }, (args) => {
160
+ if (args.resolveDir === "")
161
+ return;
162
+ return {
163
+ path: path2.isAbsolute(args.path) ? args.path : path2.join(args.resolveDir, args.path),
164
+ namespace: "feature-markdown"
165
+ };
166
+ });
167
+ build.onLoad(
168
+ { filter: /.*/, namespace: "feature-markdown" },
169
+ async (args) => {
170
+ return {
171
+ contents: `file://${args.path}`,
172
+ loader: "text"
173
+ // contents: JSON.stringify({ path: args.path }),
174
+ // loader: "json",
175
+ // contents: JSON.stringify({
176
+ // // html: markdownHTML,
177
+ // raw: markdownContent,
178
+ // filename: args.path, //path.basename(args.path),
179
+ // }),
180
+ // loader: "json",
181
+ };
182
+ }
183
+ );
184
+ }
185
+ };
186
+
187
+ // src/esbuildConfigs/node.ts
188
+ var node_default = (config, entryPoints) => {
189
+ const { inputFilesPluginFactory, register: register2 } = inputFilesPlugin_default(
190
+ "node",
191
+ entryPoints
192
+ );
193
+ return {
194
+ ...esbuildConfigs_default(config),
195
+ splitting: true,
196
+ outdir: config.outdir + "/node",
197
+ // inject: [`./node_modules/testeranto/dist/cjs-shim.js`],
198
+ metafile: true,
199
+ supported: {
200
+ "dynamic-import": true
201
+ },
202
+ define: {
203
+ "process.env.FLUENTFFMPEG_COV": "0"
204
+ },
205
+ absWorkingDir: process.cwd(),
206
+ banner: {
207
+ js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`
208
+ },
209
+ platform: "node",
210
+ external: [
211
+ // "testeranto.json",
212
+ // "features.test.js",
213
+ "react",
214
+ // "events",
215
+ // "ganache"
216
+ ...config.externals
217
+ ],
218
+ entryPoints: [...entryPoints],
219
+ plugins: [
220
+ featuresPlugin_default,
221
+ // markdownPlugin({}),
222
+ ...config.nodePlugins.map((p) => p(register2, entryPoints)) || [],
223
+ inputFilesPluginFactory,
224
+ // inputFilesPlugin("node", entryPoints),
225
+ {
226
+ name: "rebuild-notify",
227
+ setup(build) {
228
+ build.onEnd((result) => {
229
+ console.log(`node build ended with ${result.errors.length} errors`);
230
+ if (result.errors.length > 0) {
231
+ console.log(result);
232
+ }
233
+ });
234
+ }
235
+ }
236
+ ]
237
+ };
238
+ };
239
+
240
+ // src/esbuildConfigs/web.ts
241
+ import path3 from "path";
242
+ var web_default = (config, entryPoints) => {
243
+ const { inputFilesPluginFactory, register: register2 } = inputFilesPlugin_default(
244
+ "web",
245
+ entryPoints
246
+ );
247
+ return {
248
+ ...esbuildConfigs_default(config),
249
+ // inject: ["./node_modules/testeranto/dist/cjs-shim.js"],
250
+ // banner: {
251
+ // js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`,
252
+ // },
253
+ // splitting: true,
254
+ outdir: config.outdir + "/web",
255
+ alias: {
256
+ react: path3.resolve("./node_modules/react")
257
+ },
258
+ metafile: true,
259
+ external: [
260
+ // "testeranto.json",
261
+ // "features.test.ts",
262
+ // "url",
263
+ // "react",
264
+ "path",
265
+ "fs",
266
+ "stream",
267
+ "http",
268
+ "constants",
269
+ "net",
270
+ "assert",
271
+ "tls",
272
+ "os",
273
+ "child_process",
274
+ "readline",
275
+ "zlib",
276
+ "crypto",
277
+ "https",
278
+ "util",
279
+ "process",
280
+ "dns"
281
+ ],
282
+ platform: "browser",
283
+ entryPoints: [...entryPoints],
284
+ plugins: [
285
+ featuresPlugin_default,
286
+ // markdownPlugin({}),
287
+ ...config.nodePlugins.map((p) => p(register2, entryPoints)) || [],
288
+ inputFilesPluginFactory,
289
+ {
290
+ name: "rebuild-notify",
291
+ setup(build) {
292
+ build.onEnd((result) => {
293
+ console.log(`web build ended with ${result.errors.length} errors`);
294
+ if (result.errors.length > 0) {
295
+ console.log(result);
296
+ }
297
+ });
298
+ }
299
+ }
300
+ ]
301
+ };
302
+ };
303
+
304
+ // src/web.html.ts
305
+ var web_html_default = (jsfilePath, htmlFilePath) => `
306
+ <!DOCTYPE html>
307
+ <html lang="en">
308
+
309
+ <head>
310
+ <script type="module" src="${jsfilePath}"></script>
311
+
312
+ </head>
313
+
314
+ <body>
315
+ <h1>${htmlFilePath}</h1>
316
+ <div id="root">
317
+
318
+ </div>
319
+ </body>
320
+
321
+ <footer></footer>
322
+
323
+ </html>
324
+ `;
325
+
326
+ // src/Project.ts
327
+ readline.emitKeypressEvents(process.stdin);
328
+ if (process.stdin.isTTY)
329
+ process.stdin.setRawMode(true);
330
+ var logContent = [];
331
+ function parseTsErrors() {
332
+ try {
333
+ const regex = /(^src(.*?))\(\d*,\d*\): error/gm;
334
+ const brokenFilesToLines = {};
335
+ for (let i = 0; i < logContent.length - 1; i++) {
336
+ let m;
337
+ while ((m = regex.exec(logContent[i])) !== null) {
338
+ if (m.index === regex.lastIndex) {
339
+ regex.lastIndex++;
340
+ }
341
+ if (!brokenFilesToLines[m[1]]) {
342
+ brokenFilesToLines[m[1]] = /* @__PURE__ */ new Set();
343
+ }
344
+ brokenFilesToLines[m[1]].add(i);
345
+ }
346
+ }
347
+ const final = Object.keys(brokenFilesToLines).reduce((mm, lm, ndx) => {
348
+ mm[lm] = Array.from(brokenFilesToLines[lm]).map((l, ndx3) => {
349
+ const a = Array.from(brokenFilesToLines[lm]);
350
+ return Object.keys(a).reduce((mm2, lm2, ndx2) => {
351
+ const acc = [];
352
+ let j = a[lm2] + 1;
353
+ let working = true;
354
+ while (j < logContent.length - 1 && working) {
355
+ if (!logContent[j].match(regex) && working && !logContent[j].match(/^..\/(.*?)\(\d*,\d*\)/)) {
356
+ acc.push(logContent[j]);
357
+ } else {
358
+ working = false;
359
+ }
360
+ j++;
361
+ }
362
+ mm2[lm] = [logContent[l], ...acc];
363
+ return mm2;
364
+ }, {})[lm];
365
+ });
366
+ return mm;
367
+ }, {});
368
+ Object.keys(final).forEach((k) => {
369
+ fs2.mkdirSync(`./docs/types/${k.split("/").slice(0, -1).join("/")}`, {
370
+ recursive: true
371
+ });
372
+ fs2.writeFileSync(
373
+ `./docs/types/${k}.type_errors.txt`,
374
+ final[k].flat().flat().join("\r\n")
375
+ );
376
+ });
377
+ } catch (error) {
378
+ console.error("Error reading or parsing the log file:", error);
379
+ process.exit(1);
380
+ }
381
+ }
382
+ var compile = () => {
383
+ return new Promise((resolve, reject) => {
384
+ const tsc = spawn("tsc", ["-noEmit"]);
385
+ tsc.stdout.on("data", (data) => {
386
+ const lines = data.toString().split("\n");
387
+ logContent.push(...lines);
388
+ });
389
+ tsc.stderr.on("data", (data) => {
390
+ console.error(`stderr: ${data}`);
391
+ process.exit(-1);
392
+ });
393
+ tsc.on("close", (code) => {
394
+ parseTsErrors();
395
+ console.log("tsc done");
396
+ resolve(`tsc process exited with code ${code}`);
397
+ });
398
+ });
399
+ };
400
+ var ITProject = class {
401
+ constructor(configs) {
402
+ this.nodeDone = false;
403
+ this.webDone = false;
404
+ this.onNodeDone = () => {
405
+ this.nodeDone = true;
406
+ this.onDone();
407
+ };
408
+ this.onWebDone = () => {
409
+ this.webDone = true;
410
+ this.onDone();
411
+ };
412
+ this.onDone = () => {
413
+ if (this.nodeDone && this.webDone && this.mode === "PROD") {
414
+ console.log("Testeranto-EsBuild is all done. Goodbye!");
415
+ process.exit();
416
+ } else {
417
+ if (this.mode === "PROD") {
418
+ console.log("waiting for tests to finish");
419
+ console.log(
420
+ JSON.stringify(
421
+ {
422
+ nodeDone: this.nodeDone,
423
+ webDone: this.webDone,
424
+ mode: this.mode
425
+ },
426
+ null,
427
+ 2
428
+ )
429
+ );
430
+ } else {
431
+ console.log("waiting for tests to change");
432
+ }
433
+ console.log("press 'q' to quit");
434
+ }
435
+ };
436
+ this.config = configs;
437
+ this.mode = this.config.devMode ? "DEV" : "PROD";
438
+ process.stdin.on("keypress", (str, key) => {
439
+ if (key.name === "q") {
440
+ console.log("Testeranto-EsBuild is shutting down...");
441
+ this.mode = "PROD";
442
+ this.onDone();
443
+ }
444
+ });
445
+ fs2.writeFileSync(
446
+ `${this.config.outdir}/testeranto.json`,
447
+ JSON.stringify(
448
+ {
449
+ ...this.config,
450
+ buildDir: process.cwd() + "/" + this.config.outdir
451
+ },
452
+ null,
453
+ 2
454
+ )
455
+ );
456
+ Promise.resolve(
457
+ Promise.all(
458
+ [...this.getSecondaryEndpointsPoints("web")].map(
459
+ async (sourceFilePath) => {
460
+ const sourceFileSplit = sourceFilePath.split("/");
461
+ const sourceDir = sourceFileSplit.slice(0, -1);
462
+ const sourceFileName = sourceFileSplit[sourceFileSplit.length - 1];
463
+ const sourceFileNameMinusJs = sourceFileName.split(".").slice(0, -1).join(".");
464
+ const htmlFilePath = path4.normalize(
465
+ `${process.cwd()}/${this.config.outdir}/web/${sourceDir.join(
466
+ "/"
467
+ )}/${sourceFileNameMinusJs}.html`
468
+ );
469
+ const jsfilePath = `./${sourceFileNameMinusJs}.mjs`;
470
+ return fs2.promises.mkdir(path4.dirname(htmlFilePath), { recursive: true }).then(
471
+ (x) => fs2.writeFileSync(
472
+ htmlFilePath,
473
+ web_html_default(jsfilePath, htmlFilePath)
474
+ )
475
+ );
476
+ }
477
+ )
478
+ )
479
+ );
480
+ const [nodeEntryPoints, webEntryPoints] = getRunnables(this.config.tests);
481
+ glob(`./${this.config.outdir}/chunk-*.mjs`, {
482
+ ignore: "node_modules/**"
483
+ }).then((chunks) => {
484
+ chunks.forEach((chunk) => {
485
+ fs2.unlinkSync(chunk);
486
+ });
487
+ });
488
+ Promise.all([
489
+ compile(),
490
+ esbuild.context(node_default(this.config, nodeEntryPoints)).then(async (nodeContext) => {
491
+ if (this.config.devMode) {
492
+ await nodeContext.watch().then((v) => {
493
+ this.onNodeDone();
494
+ });
495
+ } else {
496
+ nodeContext.rebuild().then((v) => {
497
+ this.onNodeDone();
498
+ });
499
+ }
500
+ return nodeContext;
501
+ }),
502
+ esbuild.context(web_default(this.config, webEntryPoints)).then(async (webContext) => {
503
+ if (this.config.devMode) {
504
+ await webContext.watch().then((v) => {
505
+ this.onWebDone();
506
+ });
507
+ } else {
508
+ webContext.rebuild().then((v) => {
509
+ this.onWebDone();
510
+ });
511
+ }
512
+ return webContext;
513
+ })
514
+ ]);
515
+ }
516
+ getSecondaryEndpointsPoints(runtime) {
517
+ const meta = (ts, st) => {
518
+ ts.forEach((t) => {
519
+ if (t[1] === runtime) {
520
+ st.add(t[0]);
521
+ }
522
+ if (Array.isArray(t[3])) {
523
+ meta(t[3], st);
524
+ }
525
+ });
526
+ return st;
527
+ };
528
+ return Array.from(meta(this.config.tests, /* @__PURE__ */ new Set()));
529
+ }
530
+ };
531
+ var getRunnables = (tests, payload = [/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set()]) => {
532
+ return tests.reduce((pt, cv, cndx, cry) => {
533
+ if (cv[1] === "node") {
534
+ pt[0].add(cv[0]);
535
+ } else if (cv[1] === "web") {
536
+ pt[1].add(cv[0]);
537
+ }
538
+ if (cv[3].length) {
539
+ getRunnables(cv[3], payload);
540
+ }
541
+ return pt;
542
+ }, payload);
543
+ };
544
+
545
+ // src/build-tests.ts
546
+ if (!process2.argv[2]) {
547
+ console.log("You didn't pass a config file");
548
+ process2.exit(-1);
549
+ } else {
550
+ import(process2.cwd() + "/" + process2.argv[2]).then((module) => {
551
+ new ITProject(module.default);
552
+ });
553
+ }
@@ -0,0 +1,48 @@
1
+ import { createRequire } from 'module';const require = createRequire(import.meta.url);
2
+
3
+ // src/init-docs.ts
4
+ import fs2 from "fs";
5
+
6
+ // dist/module/src/Init.js
7
+ import fs from "fs";
8
+ var Init_default = async (partialConfig) => {
9
+ const config = Object.assign(Object.assign({}, partialConfig), { buildDir: process.cwd() + "/" + partialConfig.outdir });
10
+ try {
11
+ fs.mkdirSync(`${process.cwd()}/${config.outdir}`);
12
+ } catch (_a) {
13
+ }
14
+ fs.writeFileSync(`${config.outdir}/testeranto.json`, JSON.stringify(Object.assign(Object.assign({}, config), { buildDir: process.cwd() + "/" + config.outdir }), null, 2));
15
+ try {
16
+ fs.mkdirSync(`${process.cwd()}/${config.outdir}/node`);
17
+ } catch (_b) {
18
+ }
19
+ try {
20
+ fs.mkdirSync(`${process.cwd()}/${config.outdir}/web`);
21
+ } catch (_c) {
22
+ }
23
+ try {
24
+ fs.mkdirSync(`${process.cwd()}/${config.outdir}/features`);
25
+ } catch (_d) {
26
+ }
27
+ try {
28
+ fs.mkdirSync(`${process.cwd()}/${config.outdir}/ts`);
29
+ } catch (_e) {
30
+ }
31
+ };
32
+
33
+ // src/init-docs.ts
34
+ console.log("Initializing a testeranto project");
35
+ if (!process.argv[2]) {
36
+ console.log("You didn't pass a config file, so I will create one for you.");
37
+ fs2.writeFileSync(
38
+ "testeranto.mts",
39
+ fs2.readFileSync("node_modules/testeranto/src/defaultConfig.ts")
40
+ );
41
+ import(process.cwd() + "/testeranto.mts").then((module) => {
42
+ Init_default(module.default);
43
+ });
44
+ } else {
45
+ import(process.cwd() + "/" + process.argv[2]).then((module) => {
46
+ Init_default(module.default);
47
+ });
48
+ }