testeranto 0.80.0 → 0.81.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/.aider.chat.history.md +980 -0
- package/.aider.input.history +87 -0
- package/.aider.tags.cache.v3/1c/30/af1de2ad7a137afeddb1b01e0c27.val +0 -0
- package/.aider.tags.cache.v3/1d/63/88318b65ce58b6bb0487e8ce2656.val +0 -0
- package/.aider.tags.cache.v3/2e/67/16ae65530b40038e48e00d666c63.val +0 -0
- package/.aider.tags.cache.v3/6f/94/80488a232866fcce7ee657da488b.val +0 -0
- package/.aider.tags.cache.v3/cache.db +0 -0
- package/.gitattributes +1 -0
- package/README.md +10 -6
- package/dist/common/src/Aider.js +116 -69
- package/dist/common/src/PM/main.js +49 -46
- package/dist/common/src/PM/node.js +1 -1
- package/dist/common/src/Project.js +46 -38
- package/dist/common/src/Puppeteer.js +44 -37
- package/dist/common/src/SubPackages/react-test-renderer/jsx/index.js +17 -2
- package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +39 -12
- package/dist/common/src/esbuildConfigs/web.js +3 -3
- package/dist/common/src/lib/abstractBase.js +41 -13
- package/dist/common/src/lib/basebuilder.js +6 -3
- package/dist/common/src/lib/core.js +47 -3
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/src/Aider.js +116 -69
- package/dist/module/src/PM/main.js +49 -46
- package/dist/module/src/PM/node.js +1 -1
- package/dist/module/src/Project.js +46 -38
- package/dist/module/src/Puppeteer.js +44 -37
- package/dist/module/src/SubPackages/react-test-renderer/jsx/index.js +17 -2
- package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +39 -12
- package/dist/module/src/esbuildConfigs/web.js +3 -3
- package/dist/module/src/lib/abstractBase.js +41 -13
- package/dist/module/src/lib/basebuilder.js +6 -3
- package/dist/module/src/lib/core.js +47 -3
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/types/src/PM/main.d.ts +7 -1
- package/dist/types/src/Project.d.ts +6 -1
- package/dist/types/src/lib/abstractBase.d.ts +1 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +11 -15
- package/secret +1 -0
- package/secret.env +2 -0
- package/src/Aider.ts +140 -97
- package/src/PM/main.ts +60 -56
- package/src/PM/node.ts +1 -1
- package/src/Project.ts +55 -48
- package/src/Puppeteer.ts +56 -49
- package/src/SubPackages/react-test-renderer/jsx/index.ts +25 -2
- package/src/esbuildConfigs/inputFilesPlugin.ts +77 -32
- package/src/esbuildConfigs/web.ts +3 -3
- package/src/lib/abstractBase.ts +48 -17
- package/src/lib/basebuilder.ts +8 -3
- package/src/lib/core.ts +55 -13
package/dist/module/src/Aider.js
CHANGED
|
@@ -1,27 +1,39 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import { spawn } from "child_process";
|
|
3
3
|
export const execCommand = async (command) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
childProcess.on("exit", (code) => {
|
|
17
|
-
if (code === 0) {
|
|
18
|
-
resolve();
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
reject(new Error(`Command exited with code ${code}.`));
|
|
22
|
-
}
|
|
23
|
-
});
|
|
4
|
+
const ls = spawn(command.split(" ")[0], command.split(" ").slice(1, -1));
|
|
5
|
+
process.stdin.pipe(ls.stdin);
|
|
6
|
+
ls.stdout.pipe(process.stdout);
|
|
7
|
+
ls.stderr.pipe(process.stdout);
|
|
8
|
+
// ls.stdout.on("data", function (data) {
|
|
9
|
+
// console.log("stdout: " + data.toString());
|
|
10
|
+
// });
|
|
11
|
+
// ls.stderr.on("data", function (data) {
|
|
12
|
+
// console.log("stderr: " + data.toString());
|
|
13
|
+
// });
|
|
14
|
+
ls.on("exit", function (code) {
|
|
15
|
+
console.log("child process exited with code " + (code === null || code === void 0 ? void 0 : code.toString()) || -1);
|
|
24
16
|
});
|
|
17
|
+
// return new Promise<void>((resolve, reject) => {
|
|
18
|
+
// const [cmd, ...args] = command.split(" ");
|
|
19
|
+
// const childProcess = spawn(cmd, args);
|
|
20
|
+
// childProcess.stdout.on("data", (data) => {
|
|
21
|
+
// process.stdout.write(data.toString());
|
|
22
|
+
// });
|
|
23
|
+
// childProcess.stderr.on("data", (data) => {
|
|
24
|
+
// process.stderr.write(data.toString());
|
|
25
|
+
// });
|
|
26
|
+
// childProcess.on("error", (error) => {
|
|
27
|
+
// reject(error);
|
|
28
|
+
// });
|
|
29
|
+
// childProcess.on("exit", (code) => {
|
|
30
|
+
// if (code === 0) {
|
|
31
|
+
// resolve();
|
|
32
|
+
// } else {
|
|
33
|
+
// reject(new Error(`Command exited with code ${code}.`));
|
|
34
|
+
// }
|
|
35
|
+
// });
|
|
36
|
+
// });
|
|
25
37
|
};
|
|
26
38
|
const key = process.argv[2];
|
|
27
39
|
console.log(key);
|
|
@@ -31,55 +43,90 @@ console.log("exitcode", exitcode);
|
|
|
31
43
|
if (exitcode != "0") {
|
|
32
44
|
const inputFiles = JSON.parse(fs.readFileSync(`${key}/inputFiles.json`).toString());
|
|
33
45
|
inputFiles.push(`${key}/tests.json`);
|
|
34
|
-
const features = await
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
46
|
+
// const features = await await Promise.all(
|
|
47
|
+
// Array.from(
|
|
48
|
+
// new Set(
|
|
49
|
+
// JSON.parse(fs.readFileSync(`${key}/tests.json`).toString())
|
|
50
|
+
// .givens.reduce((mm: any[], lm: { features: any[] }) => {
|
|
51
|
+
// mm.push(
|
|
52
|
+
// lm.features.reduce((mm2: any[], lm2: any) => {
|
|
53
|
+
// mm2.push(lm2);
|
|
54
|
+
// return mm2;
|
|
55
|
+
// }, [])
|
|
56
|
+
// );
|
|
57
|
+
// return mm;
|
|
58
|
+
// }, [])
|
|
59
|
+
// .flat()
|
|
60
|
+
// .flat()
|
|
61
|
+
// )
|
|
62
|
+
// ) as string[]
|
|
63
|
+
// );
|
|
64
|
+
// const final = features.reduce((mm, [k, v], ndx) => {
|
|
65
|
+
// mm[k] = v;
|
|
66
|
+
// return mm;
|
|
67
|
+
// }, {});
|
|
68
|
+
// const as = JSON.stringify(final);
|
|
69
|
+
// const scriptCommand = `aider --model deepseek --api-key deepseek=${
|
|
70
|
+
// process.env.DEEPSEEK_KEY
|
|
71
|
+
// } --message "Fix the failing tests" --read ${key}/inputFiles.json ${inputFiles
|
|
72
|
+
// .map((i) => `--file ${i}`)
|
|
73
|
+
// .join(" ")}`;
|
|
74
|
+
const scriptCommand = `aider --message "Fix the failing tests" --model deepseek --api-key deepseek=${process.env.DEEPSEEK_KEY} --file ./${inputFiles.join(" ./")}`;
|
|
75
|
+
console.log("scriptCommand", scriptCommand);
|
|
76
|
+
execCommand(scriptCommand);
|
|
77
|
+
// fs.writeFile(`./${key}/features.json`, as, () => {
|
|
78
|
+
// inputFiles.push(`./${key}/features.json`);
|
|
79
|
+
// // itermTab(scriptCommand).then(() => console.log("yay"));
|
|
80
|
+
// // const child = spawn("xterm -e", scriptCommand.split(" "), {
|
|
81
|
+
// // detached: true,
|
|
82
|
+
// // stdio: "ignore",
|
|
83
|
+
// // });
|
|
84
|
+
// // runCommandInITerm(scriptCommand);
|
|
85
|
+
// });
|
|
86
|
+
// .reduce(async (mm, feature) => {
|
|
87
|
+
// const req = await octokit.request(
|
|
88
|
+
// `GET /repos/adamwong246/kokomobay-taskman/contents/Task/${feature}.json`,
|
|
89
|
+
// {
|
|
90
|
+
// owner: "adamwong246",
|
|
91
|
+
// repo: "kokomoBay-taskman",
|
|
92
|
+
// path: `Task/${feature}.json`,
|
|
93
|
+
// headers: {
|
|
94
|
+
// "X-GitHub-Api-Version": "2022-11-28",
|
|
95
|
+
// },
|
|
96
|
+
// }
|
|
97
|
+
// );
|
|
98
|
+
// const j = JSON.parse(atob(req.data.content));
|
|
99
|
+
// (await mm).push([
|
|
100
|
+
// feature,
|
|
101
|
+
// JSON.stringify({
|
|
102
|
+
// name: j.name,
|
|
103
|
+
// body: j.body,
|
|
104
|
+
// }),
|
|
105
|
+
// ]);
|
|
106
|
+
// return mm;
|
|
107
|
+
// }, Promise.resolve<[string, string][]>([]))
|
|
108
|
+
// .then((z) => {
|
|
109
|
+
// const final = z.reduce((mm, [k, v], ndx) => {
|
|
110
|
+
// mm[k] = v;
|
|
111
|
+
// return mm;
|
|
112
|
+
// }, {});
|
|
113
|
+
// const as = JSON.stringify(final);
|
|
114
|
+
// fs.writeFile(`./${key}/features.json`, as, () => {
|
|
115
|
+
// inputFiles.push(`./${key}/features.json`);
|
|
116
|
+
// const scriptCommand = `aider --model deepseek --api-key deepseek=${
|
|
117
|
+
// process.env.DEEPSEEK_KEY
|
|
118
|
+
// } --message "Fix the failing tests" ${inputFiles.join(" ")}`;
|
|
119
|
+
// console.log("scriptCommand", scriptCommand);
|
|
120
|
+
// execCommand(scriptCommand);
|
|
121
|
+
// // itermTab(scriptCommand).then(() => console.log("yay"));
|
|
122
|
+
// // const child = spawn("xterm -e", scriptCommand.split(" "), {
|
|
123
|
+
// // detached: true,
|
|
124
|
+
// // stdio: "ignore",
|
|
125
|
+
// // });
|
|
126
|
+
// // runCommandInITerm(scriptCommand);
|
|
127
|
+
// });
|
|
128
|
+
// //
|
|
129
|
+
// });
|
|
83
130
|
// features.then((x) => {
|
|
84
131
|
// console.log("done", x);
|
|
85
132
|
// });
|
|
@@ -10,8 +10,32 @@ const screenshots = {};
|
|
|
10
10
|
export class PM_Main extends PM {
|
|
11
11
|
constructor(configs) {
|
|
12
12
|
super();
|
|
13
|
+
this.shutdownMode = false;
|
|
14
|
+
this.checkForShutdown = () => {
|
|
15
|
+
const anyRunning = Object.values(this.registry).filter((x) => x === false).length > 0;
|
|
16
|
+
if (anyRunning) {
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
this.browser.disconnect().then(() => {
|
|
20
|
+
console.log("Goodbye");
|
|
21
|
+
process.exit();
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
this.register = (src) => {
|
|
26
|
+
// console.log("register", src);
|
|
27
|
+
this.registry[src] = false;
|
|
28
|
+
};
|
|
29
|
+
this.deregister = (src) => {
|
|
30
|
+
// console.log("deregister", src, this.shutdownMode);
|
|
31
|
+
this.registry[src] = true;
|
|
32
|
+
if (this.shutdownMode) {
|
|
33
|
+
this.checkForShutdown();
|
|
34
|
+
}
|
|
35
|
+
};
|
|
13
36
|
this.launchNode = async (src, dest) => {
|
|
14
37
|
console.log("launchNode", src);
|
|
38
|
+
this.register(src);
|
|
15
39
|
const destFolder = dest.replace(".mjs", "");
|
|
16
40
|
let argz = "";
|
|
17
41
|
const testConfig = this.configs.tests.find((t) => {
|
|
@@ -34,7 +58,6 @@ export class PM_Main extends PM {
|
|
|
34
58
|
}
|
|
35
59
|
else if (testConfigResource.ports > 0) {
|
|
36
60
|
const openPorts = Object.entries(this.ports).filter(([portnumber, portopen]) => portopen);
|
|
37
|
-
console.log("openPorts", openPorts);
|
|
38
61
|
if (openPorts.length >= testConfigResource.ports) {
|
|
39
62
|
for (let i = 0; i < testConfigResource.ports; i++) {
|
|
40
63
|
portsToUse.push(openPorts[i][0]);
|
|
@@ -71,16 +94,15 @@ export class PM_Main extends PM {
|
|
|
71
94
|
return module.default.then((defaultModule) => {
|
|
72
95
|
defaultModule
|
|
73
96
|
.receiveTestResourceConfig(argz)
|
|
74
|
-
.then((x) => {
|
|
75
|
-
console.log("then", x);
|
|
76
|
-
return x;
|
|
77
|
-
})
|
|
78
97
|
.catch((e) => {
|
|
79
98
|
console.log("catch", e);
|
|
99
|
+
})
|
|
100
|
+
.finally(() => {
|
|
101
|
+
this.deregister(src);
|
|
80
102
|
});
|
|
81
103
|
});
|
|
82
104
|
});
|
|
83
|
-
console.log("portsToUse", portsToUse);
|
|
105
|
+
// console.log("portsToUse", portsToUse);
|
|
84
106
|
for (let i = 0; i <= portsToUse.length; i++) {
|
|
85
107
|
if (portsToUse[i]) {
|
|
86
108
|
this.ports[portsToUse[i]] = "true"; //port is open again
|
|
@@ -114,7 +136,7 @@ export class PM_Main extends PM {
|
|
|
114
136
|
// console.log(`${i}: ${msg._args[i]}`);
|
|
115
137
|
});
|
|
116
138
|
page.exposeFunction("custom-screenshot", async (ssOpts, testName) => {
|
|
117
|
-
console.log("main.ts browser custom-screenshot", testName);
|
|
139
|
+
// console.log("main.ts browser custom-screenshot", testName);
|
|
118
140
|
const p = ssOpts.path;
|
|
119
141
|
const dir = path.dirname(p);
|
|
120
142
|
fs.mkdirSync(dir, {
|
|
@@ -185,7 +207,7 @@ export class PM_Main extends PM {
|
|
|
185
207
|
delete files[testName];
|
|
186
208
|
Promise.all(screenshots[testName] || []).then(() => {
|
|
187
209
|
delete screenshots[testName];
|
|
188
|
-
page.close();
|
|
210
|
+
// page.close();
|
|
189
211
|
});
|
|
190
212
|
// globalThis["writeFileSync"](
|
|
191
213
|
// p + "/manifest.json",
|
|
@@ -219,7 +241,6 @@ export class PM_Main extends PM {
|
|
|
219
241
|
});
|
|
220
242
|
});
|
|
221
243
|
};
|
|
222
|
-
// launchNodeSideCar = async (src: string, dest: string) => {};
|
|
223
244
|
this.launchNodeSideCar = async (src, dest, testConfig) => {
|
|
224
245
|
const d = dest + ".mjs";
|
|
225
246
|
console.log("launchNodeSideCar", src, dest, d);
|
|
@@ -245,7 +266,7 @@ export class PM_Main extends PM {
|
|
|
245
266
|
}
|
|
246
267
|
else if (testConfigResource.ports > 0) {
|
|
247
268
|
const openPorts = Object.entries(this.ports).filter(([portnumber, portopen]) => portopen);
|
|
248
|
-
console.log("openPorts", openPorts);
|
|
269
|
+
// console.log("openPorts", openPorts);
|
|
249
270
|
if (openPorts.length >= testConfigResource.ports) {
|
|
250
271
|
for (let i = 0; i < testConfigResource.ports; i++) {
|
|
251
272
|
portsToUse.push(openPorts[i][0]);
|
|
@@ -276,7 +297,7 @@ export class PM_Main extends PM {
|
|
|
276
297
|
// );
|
|
277
298
|
this.server[builtfile] = await import(`${builtfile}?cacheBust=${Date.now()}`).then((module) => {
|
|
278
299
|
return module.default.then((defaultModule) => {
|
|
279
|
-
console.log("defaultModule", defaultModule);
|
|
300
|
+
// console.log("defaultModule", defaultModule);
|
|
280
301
|
const s = new defaultModule();
|
|
281
302
|
s.receiveTestResourceConfig(argz);
|
|
282
303
|
// Object.create(defaultModule);
|
|
@@ -291,7 +312,7 @@ export class PM_Main extends PM {
|
|
|
291
312
|
// });
|
|
292
313
|
});
|
|
293
314
|
});
|
|
294
|
-
console.log("portsToUse", portsToUse);
|
|
315
|
+
// console.log("portsToUse", portsToUse);
|
|
295
316
|
for (let i = 0; i <= portsToUse.length; i++) {
|
|
296
317
|
if (portsToUse[i]) {
|
|
297
318
|
this.ports[portsToUse[i]] = "true"; //port is open again
|
|
@@ -300,6 +321,7 @@ export class PM_Main extends PM {
|
|
|
300
321
|
};
|
|
301
322
|
this.launchWeb = (t, dest, sidecars) => {
|
|
302
323
|
console.log("launchWeb", t, dest);
|
|
324
|
+
this.register(t);
|
|
303
325
|
sidecars.map((sidecar) => {
|
|
304
326
|
if (sidecar[1] === "node") {
|
|
305
327
|
return this.launchNodeSideCar(sidecar[0], destinationOfRuntime(sidecar[0], "node", this.configs), sidecar);
|
|
@@ -333,7 +355,7 @@ export class PM_Main extends PM {
|
|
|
333
355
|
// console.log(`${i}: ${msg._args[i]}`);
|
|
334
356
|
});
|
|
335
357
|
page.exposeFunction("customScreenShot", async (ssOpts, testName) => {
|
|
336
|
-
console.log("main.ts browser custom-screenshot", testName);
|
|
358
|
+
// console.log("main.ts browser custom-screenshot", testName);
|
|
337
359
|
const p = ssOpts.path;
|
|
338
360
|
const dir = path.dirname(p);
|
|
339
361
|
fs.mkdirSync(dir, {
|
|
@@ -403,12 +425,15 @@ export class PM_Main extends PM {
|
|
|
403
425
|
return fileStreams2[uid].end();
|
|
404
426
|
});
|
|
405
427
|
page.exposeFunction("customclose", (p, testName) => {
|
|
406
|
-
console.log("
|
|
428
|
+
// console.log("closing", p);
|
|
407
429
|
fs.writeFileSync(p + "/manifest.json", JSON.stringify(Array.from(files[testName])));
|
|
408
430
|
delete files[testName];
|
|
431
|
+
// console.log("screenshots[testName]", screenshots[testName]);
|
|
409
432
|
Promise.all(screenshots[testName] || []).then(() => {
|
|
410
433
|
delete screenshots[testName];
|
|
411
434
|
// page.close();
|
|
435
|
+
// console.log("\t GOODBYE");
|
|
436
|
+
// whyIsNodeRunning();
|
|
412
437
|
});
|
|
413
438
|
// globalThis["writeFileSync"](
|
|
414
439
|
// p + "/manifest.json",
|
|
@@ -442,6 +467,9 @@ export class PM_Main extends PM {
|
|
|
442
467
|
})
|
|
443
468
|
.finally(() => {
|
|
444
469
|
console.log("evaluation complete.", dest);
|
|
470
|
+
// page.close();
|
|
471
|
+
this.deregister(t);
|
|
472
|
+
// whyIsNodeRunning();
|
|
445
473
|
});
|
|
446
474
|
return page;
|
|
447
475
|
});
|
|
@@ -449,6 +477,7 @@ export class PM_Main extends PM {
|
|
|
449
477
|
this.server = {};
|
|
450
478
|
this.configs = configs;
|
|
451
479
|
this.ports = {};
|
|
480
|
+
this.registry = {};
|
|
452
481
|
this.configs.ports.forEach((element) => {
|
|
453
482
|
this.ports[element] = "true"; // set ports as open
|
|
454
483
|
});
|
|
@@ -461,7 +490,7 @@ export class PM_Main extends PM {
|
|
|
461
490
|
return false;
|
|
462
491
|
};
|
|
463
492
|
globalThis["writeFileSync"] = (filepath, contents, testName) => {
|
|
464
|
-
console.log("globalThis-writeFileSync", filepath);
|
|
493
|
+
// console.log("globalThis-writeFileSync", filepath);
|
|
465
494
|
// Create directories if they don't exist
|
|
466
495
|
const dir = path.dirname(filepath.split("/").slice(0, -1).join("/"));
|
|
467
496
|
fs.mkdirSync(dir, {
|
|
@@ -490,15 +519,6 @@ export class PM_Main extends PM {
|
|
|
490
519
|
fileStreams3[uid].end();
|
|
491
520
|
};
|
|
492
521
|
globalThis["customScreenShot"] = async (opts, page) => {
|
|
493
|
-
// // fileStreams3[uid].write(contents);
|
|
494
|
-
// // console.log("asd", opts.path.split("/").slice(0, -1).join("/"));
|
|
495
|
-
// // const dir = path.dirname(opts.path.split("/").slice(0, -1).join("/"));
|
|
496
|
-
// // console.log("dir", dir);
|
|
497
|
-
// fs.mkdirSync(opts.path.split("/").slice(0, -1).join("/"), {
|
|
498
|
-
// recursive: true,
|
|
499
|
-
// });
|
|
500
|
-
// return page.screenshot(opts);
|
|
501
|
-
console.log("main.ts node custom-screenshot", page);
|
|
502
522
|
const p = opts.path;
|
|
503
523
|
const dir = path.dirname(p);
|
|
504
524
|
fs.mkdirSync(dir, {
|
|
@@ -522,29 +542,12 @@ export class PM_Main extends PM {
|
|
|
522
542
|
}
|
|
523
543
|
fs.writeFileSync(p + "/manifest.json", JSON.stringify(Array.from(files[testName])));
|
|
524
544
|
delete files[testName];
|
|
525
|
-
// globalThis["writeFileSync"](
|
|
526
|
-
// p + "/manifest.json",
|
|
527
|
-
// // files.entries()
|
|
528
|
-
// JSON.stringify(Array.from(files[testName]))
|
|
529
|
-
// );
|
|
530
|
-
// fileStreams3[uid].end();
|
|
531
545
|
};
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
// });
|
|
538
|
-
// // page.close();
|
|
539
|
-
// // Promise.all(screenshots).then(() => {
|
|
540
|
-
// // page.close();
|
|
541
|
-
// // });
|
|
542
|
-
// // setTimeout(() => {
|
|
543
|
-
// // console.log("Delayed for 1 second.");
|
|
544
|
-
// // page.close();
|
|
545
|
-
// // }, 5000);
|
|
546
|
-
// // return page.close();
|
|
547
|
-
// });
|
|
546
|
+
}
|
|
547
|
+
shutDown() {
|
|
548
|
+
console.log("shutting down...");
|
|
549
|
+
this.shutdownMode = true;
|
|
550
|
+
this.checkForShutdown();
|
|
548
551
|
}
|
|
549
552
|
customScreenShot(opts) {
|
|
550
553
|
throw new Error("Method not implemented.");
|
|
@@ -22,7 +22,7 @@ export class PM_Node extends PM {
|
|
|
22
22
|
return globalThis["write"](writeObject.uid, contents);
|
|
23
23
|
}
|
|
24
24
|
writeFileSync(filepath, contents) {
|
|
25
|
-
console.log("pm_node-writeFileSync", this.testResourceConfiguration);
|
|
25
|
+
// console.log("pm_node-writeFileSync", this.testResourceConfiguration);
|
|
26
26
|
return globalThis["writeFileSync"](this.testResourceConfiguration.fs + "/" + filepath, contents, this.testResourceConfiguration.name);
|
|
27
27
|
}
|
|
28
28
|
createWriteStream(filepath) {
|
|
@@ -6,44 +6,52 @@ import { glob } from "glob";
|
|
|
6
6
|
import esbuildNodeConfiger from "./esbuildConfigs/node.js";
|
|
7
7
|
import esbuildWebConfiger from "./esbuildConfigs/web.js";
|
|
8
8
|
import webHtmlFrame from "./web.html.js";
|
|
9
|
-
var mode = process.argv[2] === "-dev" ? "DEV" : "PROD";
|
|
9
|
+
// var mode: "DEV" | "PROD" = process.argv[2] === "-dev" ? "DEV" : "PROD";
|
|
10
10
|
readline.emitKeypressEvents(process.stdin);
|
|
11
11
|
if (process.stdin.isTTY)
|
|
12
12
|
process.stdin.setRawMode(true);
|
|
13
|
-
process.stdin.on("keypress", (str, key) => {
|
|
14
|
-
if (key.name === "q") {
|
|
15
|
-
console.log("Testeranto-EsBuild is shutting down...");
|
|
16
|
-
mode = "PROD";
|
|
17
|
-
onDone();
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
let nodeDone, webDone = false;
|
|
21
|
-
const onNodeDone = () => {
|
|
22
|
-
nodeDone = true;
|
|
23
|
-
onDone();
|
|
24
|
-
};
|
|
25
|
-
const onWebDone = () => {
|
|
26
|
-
webDone = true;
|
|
27
|
-
onDone();
|
|
28
|
-
};
|
|
29
|
-
const onDone = () => {
|
|
30
|
-
console.log(JSON.stringify({
|
|
31
|
-
nodeDone,
|
|
32
|
-
webDone,
|
|
33
|
-
mode,
|
|
34
|
-
}, null, 2));
|
|
35
|
-
if (nodeDone && webDone && mode === "PROD") {
|
|
36
|
-
console.log("Testeranto-EsBuild is all done. Goodbye!");
|
|
37
|
-
process.exit();
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
console.log("Testeranto-EsBuild is still working...");
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
13
|
export class ITProject {
|
|
44
14
|
constructor(configs) {
|
|
45
|
-
this.
|
|
15
|
+
this.nodeDone = false;
|
|
16
|
+
this.webDone = false;
|
|
17
|
+
this.onNodeDone = () => {
|
|
18
|
+
this.nodeDone = true;
|
|
19
|
+
this.onDone();
|
|
20
|
+
};
|
|
21
|
+
this.onWebDone = () => {
|
|
22
|
+
this.webDone = true;
|
|
23
|
+
this.onDone();
|
|
24
|
+
};
|
|
25
|
+
this.onDone = () => {
|
|
26
|
+
// console.log(this.nodeDone && this.webDone && this.mode === "PROD");
|
|
27
|
+
if (this.nodeDone && this.webDone && this.mode === "PROD") {
|
|
28
|
+
console.log("Testeranto-EsBuild is all done. Goodbye!");
|
|
29
|
+
process.exit();
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
if (this.mode === "PROD") {
|
|
33
|
+
console.log("waiting for tests to finish");
|
|
34
|
+
console.log(JSON.stringify({
|
|
35
|
+
nodeDone: this.nodeDone,
|
|
36
|
+
webDone: this.webDone,
|
|
37
|
+
mode: this.mode,
|
|
38
|
+
}, null, 2));
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
console.log("waiting for tests to change");
|
|
42
|
+
}
|
|
43
|
+
console.log("press 'q' to quit");
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
46
|
this.config = configs;
|
|
47
|
+
this.mode = this.config.devMode ? "DEV" : "PROD";
|
|
48
|
+
process.stdin.on("keypress", (str, key) => {
|
|
49
|
+
if (key.name === "q") {
|
|
50
|
+
console.log("Testeranto-EsBuild is shutting down...");
|
|
51
|
+
this.mode = "PROD";
|
|
52
|
+
this.onDone();
|
|
53
|
+
}
|
|
54
|
+
});
|
|
47
55
|
fs.writeFileSync(`${this.config.outdir}/testeranto.json`, JSON.stringify(Object.assign(Object.assign({}, this.config), { buildDir: process.cwd() + "/" + this.config.outdir }), null, 2));
|
|
48
56
|
Promise.resolve(Promise.all([...this.getSecondaryEndpointsPoints("web")].map(async (sourceFilePath) => {
|
|
49
57
|
const sourceFileSplit = sourceFilePath.split("/");
|
|
@@ -72,14 +80,14 @@ export class ITProject {
|
|
|
72
80
|
esbuild
|
|
73
81
|
.context(esbuildNodeConfiger(this.config, nodeEntryPoints))
|
|
74
82
|
.then(async (nodeContext) => {
|
|
75
|
-
if (
|
|
83
|
+
if (this.config.devMode) {
|
|
76
84
|
await nodeContext.watch().then((v) => {
|
|
77
|
-
onNodeDone();
|
|
85
|
+
this.onNodeDone();
|
|
78
86
|
});
|
|
79
87
|
}
|
|
80
88
|
else {
|
|
81
89
|
nodeContext.rebuild().then((v) => {
|
|
82
|
-
onNodeDone();
|
|
90
|
+
this.onNodeDone();
|
|
83
91
|
});
|
|
84
92
|
}
|
|
85
93
|
return nodeContext;
|
|
@@ -87,14 +95,14 @@ export class ITProject {
|
|
|
87
95
|
esbuild
|
|
88
96
|
.context(esbuildWebConfiger(this.config, webEntryPoints))
|
|
89
97
|
.then(async (webContext) => {
|
|
90
|
-
if (
|
|
98
|
+
if (this.config.devMode) {
|
|
91
99
|
await webContext.watch().then((v) => {
|
|
92
|
-
onWebDone();
|
|
100
|
+
this.onWebDone();
|
|
93
101
|
});
|
|
94
102
|
}
|
|
95
103
|
else {
|
|
96
104
|
webContext.rebuild().then((v) => {
|
|
97
|
-
onWebDone();
|
|
105
|
+
this.onWebDone();
|
|
98
106
|
});
|
|
99
107
|
}
|
|
100
108
|
return webContext;
|
|
@@ -3,20 +3,14 @@ import fs from "fs";
|
|
|
3
3
|
import watch from "recursive-watch";
|
|
4
4
|
import { PM_Main } from "./PM/main.js";
|
|
5
5
|
import { destinationOfRuntime } from "./utils.js";
|
|
6
|
-
var mode = process.argv[2] === "-dev" ? "DEV" : "PROD";
|
|
7
|
-
const node2web = {};
|
|
8
|
-
const web2node = {};
|
|
9
|
-
const childProcesses = {};
|
|
6
|
+
// var mode: "DEV" | "PROD" = process.argv[2] === "-dev" ? "DEV" : "PROD";
|
|
7
|
+
// const node2web: Record<string, string[]> = {};
|
|
8
|
+
// const web2node: Record<string, string[]> = {};
|
|
9
|
+
// const childProcesses: Record<string, "loaded" | "running" | "done"> = {};
|
|
10
10
|
readline.emitKeypressEvents(process.stdin);
|
|
11
11
|
if (process.stdin.isTTY)
|
|
12
12
|
process.stdin.setRawMode(true);
|
|
13
|
-
//
|
|
14
|
-
console.log("\n Puppeteer is running. Press 'q' to quit\n");
|
|
15
|
-
process.stdin.on("keypress", (str, key) => {
|
|
16
|
-
if (key.name === "q") {
|
|
17
|
-
process.exit();
|
|
18
|
-
}
|
|
19
|
-
});
|
|
13
|
+
// let shutDownMode = false;
|
|
20
14
|
export default async (partialConfig) => {
|
|
21
15
|
const config = Object.assign(Object.assign({}, partialConfig), { buildDir: process.cwd() + "/" + partialConfig.outdir });
|
|
22
16
|
fs.writeFileSync(`${config.outdir}/testeranto.json`, JSON.stringify(Object.assign(Object.assign({}, config), { buildDir: process.cwd() + "/" + config.outdir }), null, 2));
|
|
@@ -61,6 +55,13 @@ export default async (partialConfig) => {
|
|
|
61
55
|
// "--start-maximized",
|
|
62
56
|
],
|
|
63
57
|
}, ".");
|
|
58
|
+
console.log("\n Puppeteer is running. Press 'q' to quit\n");
|
|
59
|
+
process.stdin.on("keypress", (str, key) => {
|
|
60
|
+
if (key.name === "q") {
|
|
61
|
+
pm.shutDown();
|
|
62
|
+
// process.exit();
|
|
63
|
+
}
|
|
64
|
+
});
|
|
64
65
|
config.tests.forEach(([test, runtime, tr, sidecars]) => {
|
|
65
66
|
if (runtime === "node") {
|
|
66
67
|
pm.launchNode(test, destinationOfRuntime(test, "node", config));
|
|
@@ -72,33 +73,39 @@ export default async (partialConfig) => {
|
|
|
72
73
|
console.error("runtime makes no sense", runtime);
|
|
73
74
|
}
|
|
74
75
|
});
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
76
|
+
if (config.devMode) {
|
|
77
|
+
console.log("ready and watching for changes...", config.buildDir);
|
|
78
|
+
watch(config.buildDir, (eventType, changedFile) => {
|
|
79
|
+
if (changedFile) {
|
|
80
|
+
config.tests.forEach(([test, runtime, tr, sidecars]) => {
|
|
81
|
+
if (eventType === "change" || eventType === "rename") {
|
|
82
|
+
if (changedFile ===
|
|
83
|
+
test
|
|
84
|
+
.replace("./", "node/")
|
|
85
|
+
.split(".")
|
|
86
|
+
.slice(0, -1)
|
|
87
|
+
.concat("mjs")
|
|
88
|
+
.join(".")) {
|
|
89
|
+
pm.launchNode(test, destinationOfRuntime(test, "node", config));
|
|
90
|
+
}
|
|
91
|
+
if (changedFile ===
|
|
92
|
+
test
|
|
93
|
+
.replace("./", "web/")
|
|
94
|
+
.split(".")
|
|
95
|
+
.slice(0, -1)
|
|
96
|
+
.concat("mjs")
|
|
97
|
+
.join(".")) {
|
|
98
|
+
pm.launchWeb(test, destinationOfRuntime(test, "web", config), sidecars);
|
|
99
|
+
}
|
|
97
100
|
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
pm.shutDown();
|
|
107
|
+
}
|
|
108
|
+
// pm.browser.close();
|
|
102
109
|
// does not work on linux
|
|
103
110
|
// fs.watch(
|
|
104
111
|
// config.buildDir,
|