testeranto 0.79.37 → 0.79.39

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "testeranto",
3
3
  "description": "teeny tiny tightly-typed typescript tests",
4
- "version": "0.79.37",
4
+ "version": "0.79.39",
5
5
  "engines": {
6
6
  "node": "18.18.0"
7
7
  },
@@ -141,6 +141,10 @@
141
141
  "import": "./dist/module/TaskManBackEnd.js",
142
142
  "require": "./dist/common/TaskManBackEnd.js"
143
143
  },
144
+ "./src/Init": {
145
+ "import": "./dist/module/Init.js",
146
+ "require": "./dist/common/Init.js"
147
+ },
144
148
  "./src/preload": {
145
149
  "import": "./dist/module/preload.js",
146
150
  "require": "./dist/common/preload.js"
@@ -249,4 +253,4 @@
249
253
  "uuid": "^10.0.0",
250
254
  "ws": "^8.16.0"
251
255
  }
252
- }
256
+ }
package/src/Init.ts ADDED
@@ -0,0 +1,54 @@
1
+ import readline from "readline";
2
+ import fs from "fs";
3
+ import path from "path";
4
+ import { jsonc } from "jsonc";
5
+ import { v4 as uuidv4 } from "uuid";
6
+
7
+ import { IBuiltConfig, IRunTime } from "./lib/types";
8
+
9
+ import { PM_Main } from "./PM/main.js";
10
+ import { destinationOfRuntime } from "./utils.js";
11
+
12
+ var mode: "DEV" | "PROD" = process.argv[2] === "-dev" ? "DEV" : "PROD";
13
+
14
+ const node2web: Record<string, string[]> = {};
15
+ const web2node: Record<string, string[]> = {};
16
+ const childProcesses: Record<string, "loaded" | "running" | "done"> = {};
17
+
18
+ readline.emitKeypressEvents(process.stdin);
19
+ if (process.stdin.isTTY) process.stdin.setRawMode(true);
20
+
21
+ console.log("\n Puppeteer is running. Press 'q' to quit\n");
22
+ process.stdin.on("keypress", (str, key) => {
23
+ if (key.name === "q") {
24
+ process.exit();
25
+ }
26
+ });
27
+
28
+ export default async (partialConfig) => {
29
+ const config = {
30
+ ...partialConfig,
31
+ buildDir: process.cwd() + "/" + partialConfig.outdir,
32
+ };
33
+
34
+ fs.writeFileSync(
35
+ `${config.outdir}/testeranto.json`,
36
+ JSON.stringify(
37
+ {
38
+ ...config,
39
+ buildDir: process.cwd() + "/" + config.outdir,
40
+ },
41
+ null,
42
+ 2
43
+ )
44
+ );
45
+
46
+ fs.copyFileSync(
47
+ "./node_modules/testeranto/dist/prebuild/TaskManFrontEnd.js",
48
+ "docs/TaskManFrontEnd.js"
49
+ );
50
+ fs.copyFileSync(
51
+ "./node_modules/testeranto/dist/prebuild/TaskManFrontEnd.css",
52
+ "docs/TaskManFrontEnd.css"
53
+ );
54
+ };
package/src/Project.ts CHANGED
@@ -6,11 +6,7 @@ import { glob } from "glob";
6
6
 
7
7
  import esbuildNodeConfiger from "./esbuildConfigs/node.js";
8
8
  import esbuildWebConfiger from "./esbuildConfigs/web.js";
9
- // import esbuildFeaturesConfiger from "./esbuildConfigs/features.js";
10
-
11
9
  import webHtmlFrame from "./web.html.js";
12
- // import reportHtmlFrame from "./report.html.js";
13
-
14
10
  import { ITestTypes, IBaseConfig, IRunTime } from "./lib/types.js";
15
11
 
16
12
  var mode: "DEV" | "PROD" = process.argv[2] === "-dev" ? "DEV" : "PROD";
@@ -26,17 +22,9 @@ process.stdin.on("keypress", (str, key) => {
26
22
  }
27
23
  });
28
24
 
29
- // setInterval(() => {
30
- // const memoryUsage = process.memoryUsage();
31
- // console.log("Memory usage:", memoryUsage);
32
- // }, 10000); // Check every 10 seconds
33
-
34
25
  let nodeDone,
35
26
  webDone = false;
36
- const onFeaturesDone = () => {
37
- // featuresDone = true;
38
- onDone();
39
- };
27
+
40
28
  const onNodeDone = () => {
41
29
  nodeDone = true;
42
30
  onDone();
@@ -50,7 +38,6 @@ const onDone = () => {
50
38
  console.log(
51
39
  JSON.stringify(
52
40
  {
53
- // featuresDone,
54
41
  nodeDone,
55
42
  webDone,
56
43
  mode,
@@ -72,17 +59,14 @@ export class ITProject {
72
59
  mode: `up` | `down` = `up`;
73
60
 
74
61
  constructor(configs: IBaseConfig) {
75
- const config = {
76
- ...configs,
77
- buildDir: process.cwd() + "/" + configs.outdir,
78
- };
62
+ this.config = configs;
79
63
 
80
64
  fs.writeFileSync(
81
- `${config.outdir}/testeranto.json`,
65
+ `${this.config.outdir}/testeranto.json`,
82
66
  JSON.stringify(
83
67
  {
84
- ...config,
85
- buildDir: process.cwd() + "/" + config.outdir,
68
+ ...this.config,
69
+ buildDir: process.cwd() + "/" + this.config.outdir,
86
70
  },
87
71
  null,
88
72
  2
@@ -102,7 +86,7 @@ export class ITProject {
102
86
  .join(".");
103
87
 
104
88
  const htmlFilePath = path.normalize(
105
- `${process.cwd()}/${config.outdir}/web/${sourceDir.join(
89
+ `${process.cwd()}/${this.config.outdir}/web/${sourceDir.join(
106
90
  "/"
107
91
  )}/${sourceFileNameMinusJs}.html`
108
92
  );
@@ -127,39 +111,18 @@ export class ITProject {
127
111
  `this.getSecondaryEndpointsPoints("web")`,
128
112
  this.getSecondaryEndpointsPoints("web")
129
113
  );
130
- // console.log("nodeEntryPoints", nodeEntryPoints);
131
- // console.log("webEntryPoints", webEntryPoints);
132
-
133
- // nodeEntryPoints.forEach((nep) => {
134
- // const f = `${process.cwd()}/${nep}`;
135
- // console.log("nep", f);
136
- // import(f).then((module) => {
137
- // return module.default.then((defaultModule) => {
138
- // console.log("defaultModule", defaultModule);
139
- // // defaultModule
140
- // // .receiveTestResourceConfig(argz)
141
- // // .then((x) => {
142
- // // console.log("then", x);
143
- // // return x;
144
- // // })
145
- // // .catch((e) => {
146
- // // console.log("catch", e);
147
- // // });
148
- // });
149
- // });
150
- // });
151
-
152
- glob(`./${config.outdir}/chunk-*.mjs`, { ignore: "node_modules/**" }).then(
153
- (chunks) => {
154
- chunks.forEach((chunk) => {
155
- fs.unlinkSync(chunk);
156
- });
157
- }
158
- );
114
+
115
+ glob(`./${this.config.outdir}/chunk-*.mjs`, {
116
+ ignore: "node_modules/**",
117
+ }).then((chunks) => {
118
+ chunks.forEach((chunk) => {
119
+ fs.unlinkSync(chunk);
120
+ });
121
+ });
159
122
 
160
123
  Promise.all([
161
124
  esbuild
162
- .context(esbuildNodeConfiger(config, nodeEntryPoints))
125
+ .context(esbuildNodeConfiger(this.config, nodeEntryPoints))
163
126
  .then(async (nodeContext) => {
164
127
  if (mode == "DEV") {
165
128
  await nodeContext.watch().then((v) => {
@@ -174,7 +137,7 @@ export class ITProject {
174
137
  return nodeContext;
175
138
  }),
176
139
  esbuild
177
- .context(esbuildWebConfiger(config, webEntryPoints))
140
+ .context(esbuildWebConfiger(this.config, webEntryPoints))
178
141
  .then(async (webContext) => {
179
142
  if (mode == "DEV") {
180
143
  await webContext.watch().then((v) => {