testeranto 0.79.36 → 0.79.38

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.
@@ -11,7 +11,6 @@ const readline_1 = __importDefault(require("readline"));
11
11
  const glob_1 = require("glob");
12
12
  const node_js_1 = __importDefault(require("./esbuildConfigs/node.js"));
13
13
  const web_js_1 = __importDefault(require("./esbuildConfigs/web.js"));
14
- // import esbuildFeaturesConfiger from "./esbuildConfigs/features.js";
15
14
  const web_html_js_1 = __importDefault(require("./web.html.js"));
16
15
  var mode = process.argv[2] === "-dev" ? "DEV" : "PROD";
17
16
  readline_1.default.emitKeypressEvents(process.stdin);
@@ -24,15 +23,7 @@ process.stdin.on("keypress", (str, key) => {
24
23
  onDone();
25
24
  }
26
25
  });
27
- // setInterval(() => {
28
- // const memoryUsage = process.memoryUsage();
29
- // console.log("Memory usage:", memoryUsage);
30
- // }, 10000); // Check every 10 seconds
31
26
  let nodeDone, webDone = false;
32
- const onFeaturesDone = () => {
33
- // featuresDone = true;
34
- onDone();
35
- };
36
27
  const onNodeDone = () => {
37
28
  nodeDone = true;
38
29
  onDone();
@@ -43,7 +34,6 @@ const onWebDone = () => {
43
34
  };
44
35
  const onDone = () => {
45
36
  console.log(JSON.stringify({
46
- // featuresDone,
47
37
  nodeDone,
48
38
  webDone,
49
39
  mode,
@@ -57,10 +47,10 @@ const onDone = () => {
57
47
  }
58
48
  };
59
49
  class ITProject {
60
- constructor(config) {
50
+ constructor(configs) {
61
51
  this.mode = `up`;
62
- this.config = config;
63
- fs_1.default.writeFileSync(`${config.outdir}/testeranto.json`, JSON.stringify(Object.assign(Object.assign({}, config), { buildDir: process.cwd() + "/" + config.outdir }), null, 2));
52
+ this.config = configs;
53
+ fs_1.default.writeFileSync(`${this.config.outdir}/testeranto.json`, JSON.stringify(Object.assign(Object.assign({}, this.config), { buildDir: process.cwd() + "/" + this.config.outdir }), null, 2));
64
54
  Promise.resolve(Promise.all([...this.getSecondaryEndpointsPoints("web")].map(async (sourceFilePath) => {
65
55
  const sourceFileSplit = sourceFilePath.split("/");
66
56
  const sourceDir = sourceFileSplit.slice(0, -1);
@@ -69,7 +59,7 @@ class ITProject {
69
59
  .split(".")
70
60
  .slice(0, -1)
71
61
  .join(".");
72
- const htmlFilePath = path_1.default.normalize(`${process.cwd()}/${config.outdir}/web/${sourceDir.join("/")}/${sourceFileNameMinusJs}.html`);
62
+ const htmlFilePath = path_1.default.normalize(`${process.cwd()}/${this.config.outdir}/web/${sourceDir.join("/")}/${sourceFileNameMinusJs}.html`);
73
63
  const jsfilePath = `./${sourceFileNameMinusJs}.mjs`;
74
64
  return fs_1.default.promises
75
65
  .mkdir(path_1.default.dirname(htmlFilePath), { recursive: true })
@@ -97,14 +87,16 @@ class ITProject {
97
87
  // });
98
88
  // });
99
89
  // });
100
- (0, glob_1.glob)(`./${config.outdir}/chunk-*.mjs`, { ignore: "node_modules/**" }).then((chunks) => {
90
+ (0, glob_1.glob)(`./${this.config.outdir}/chunk-*.mjs`, {
91
+ ignore: "node_modules/**",
92
+ }).then((chunks) => {
101
93
  chunks.forEach((chunk) => {
102
94
  fs_1.default.unlinkSync(chunk);
103
95
  });
104
96
  });
105
97
  Promise.all([
106
98
  esbuild_1.default
107
- .context((0, node_js_1.default)(config, nodeEntryPoints))
99
+ .context((0, node_js_1.default)(this.config, nodeEntryPoints))
108
100
  .then(async (nodeContext) => {
109
101
  if (mode == "DEV") {
110
102
  await nodeContext.watch().then((v) => {
@@ -119,7 +111,7 @@ class ITProject {
119
111
  return nodeContext;
120
112
  }),
121
113
  esbuild_1.default
122
- .context((0, web_js_1.default)(config, webEntryPoints))
114
+ .context((0, web_js_1.default)(this.config, webEntryPoints))
123
115
  .then(async (webContext) => {
124
116
  if (mode == "DEV") {
125
117
  await webContext.watch().then((v) => {
@@ -20,12 +20,10 @@ process.stdin.on("keypress", (str, key) => {
20
20
  process.exit();
21
21
  }
22
22
  });
23
- exports.default = async (configs) => {
24
- fs_1.default.writeFileSync(`${configs.outdir}/testeranto.json`, JSON.stringify(Object.assign(Object.assign({}, configs), { buildDir: process.cwd() + "/" + configs.outdir }), null, 2));
25
- // const configs = jsonc.parse(
26
- // (await fs.readFileSync("./docs/testeranto.json")).toString()
27
- // ) as IBuiltConfig;
28
- const pm = new main_js_1.PM_Main(configs);
23
+ exports.default = async (partialConfig) => {
24
+ const config = Object.assign(Object.assign({}, partialConfig), { buildDir: process.cwd() + "/" + partialConfig.outdir });
25
+ fs_1.default.writeFileSync(`${config.outdir}/testeranto.json`, JSON.stringify(Object.assign(Object.assign({}, config), { buildDir: process.cwd() + "/" + config.outdir }), null, 2));
26
+ const pm = new main_js_1.PM_Main(config);
29
27
  await pm.startPuppeteer({
30
28
  waitForInitialPage: false,
31
29
  executablePath: "/opt/homebrew/bin/chromium",
@@ -62,23 +60,23 @@ exports.default = async (configs) => {
62
60
  // "--start-maximized",
63
61
  ],
64
62
  }, ".");
65
- configs.tests.forEach(([test, runtime, tr, sidecars]) => {
63
+ config.tests.forEach(([test, runtime, tr, sidecars]) => {
66
64
  if (runtime === "node") {
67
- pm.launchNode(test, (0, utils_js_1.destinationOfRuntime)(test, "node", configs));
65
+ pm.launchNode(test, (0, utils_js_1.destinationOfRuntime)(test, "node", config));
68
66
  }
69
67
  else if (runtime === "web") {
70
- pm.launchWeb(test, (0, utils_js_1.destinationOfRuntime)(test, "web", configs), sidecars);
68
+ pm.launchWeb(test, (0, utils_js_1.destinationOfRuntime)(test, "web", config), sidecars);
71
69
  }
72
70
  else {
73
71
  console.error("runtime makes no sense", runtime);
74
72
  }
75
73
  });
76
- console.log("ready and watching for changes...", configs.buildDir);
77
- fs_1.default.watch(configs.buildDir, {
74
+ console.log("ready and watching for changes...", config.buildDir);
75
+ fs_1.default.watch(config.buildDir, {
78
76
  recursive: true,
79
77
  }, (eventType, changedFile) => {
80
78
  if (changedFile) {
81
- configs.tests.forEach(([test, runtime, tr, sidecars]) => {
79
+ config.tests.forEach(([test, runtime, tr, sidecars]) => {
82
80
  if (eventType === "change" || eventType === "rename") {
83
81
  if (changedFile ===
84
82
  test
@@ -87,7 +85,7 @@ exports.default = async (configs) => {
87
85
  .slice(0, -1)
88
86
  .concat("mjs")
89
87
  .join(".")) {
90
- pm.launchNode(test, (0, utils_js_1.destinationOfRuntime)(test, "node", configs));
88
+ pm.launchNode(test, (0, utils_js_1.destinationOfRuntime)(test, "node", config));
91
89
  }
92
90
  if (changedFile ===
93
91
  test
@@ -96,7 +94,7 @@ exports.default = async (configs) => {
96
94
  .slice(0, -1)
97
95
  .concat("mjs")
98
96
  .join(".")) {
99
- pm.launchWeb(test, (0, utils_js_1.destinationOfRuntime)(test, "web", configs), sidecars);
97
+ pm.launchWeb(test, (0, utils_js_1.destinationOfRuntime)(test, "web", config), sidecars);
100
98
  }
101
99
  }
102
100
  });
@@ -59,8 +59,9 @@ function listToTree(fileList) {
59
59
  }
60
60
  return root.children;
61
61
  }
62
- exports.default = (config) => {
63
- fs_1.default.writeFileSync(`${config.outdir}/testeranto.json`, JSON.stringify(Object.assign(Object.assign({}, config), { buildDir: process.cwd() + "/" + config.outdir }), null, 2));
62
+ exports.default = (partialConfig) => {
63
+ const config = Object.assign(Object.assign({}, partialConfig), { buildDir: process.cwd() + "/" + partialConfig.outdir });
64
+ fs_1.default.writeFileSync(`${config.outdir}/testeranto.json`, JSON.stringify(config, null, 2));
64
65
  const app = (0, express_1.default)();
65
66
  new mongodb_1.MongoClient(`mongodb://${process.env.MONGO_HOST || "127.0.0.1"}:27017`)
66
67
  .connect()
@@ -97,10 +98,10 @@ exports.default = (config) => {
97
98
  // `${process.cwd()}/node_modules/testeranto/dist/prebuild/TaskManFrontEnd.css`
98
99
  // );
99
100
  // });
100
- app.get("/testeranto.json", (req, res) => {
101
- res.sendFile(`${process.cwd()}/docs/testeranto.json`);
102
- // res.json(config);
103
- });
101
+ // app.get("/testeranto.json", (req, res) => {
102
+ // // res.sendFile(`${process.cwd()}/docs/testeranto.json`);
103
+ // res.json(config);
104
+ // });
104
105
  app.get("/", (req, res) => {
105
106
  res.send(`<!DOCTYPE html>
106
107
  <html lang="en">
@@ -155,7 +156,7 @@ exports.default = (config) => {
155
156
  .toArray());
156
157
  });
157
158
  });
158
- app.use("/docs", express_1.default.static(path_1.default.join(process.cwd(), "docs")));
159
+ app.use("/", express_1.default.static(path_1.default.join(process.cwd())));
159
160
  app.get("/docGal/fs.json", (req, res) => {
160
161
  const directoryPath = "./"; // Replace with the desired directory path
161
162
  // const textFiles = findTextFiles(directoryPath);