testeranto 0.79.67 → 0.79.69

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.67",
4
+ "version": "0.79.69",
5
5
  "engines": {
6
6
  "node": "18.18.0"
7
7
  },
@@ -23,6 +23,8 @@ import { IBaseConfig } from "./lib/types";
23
23
  console.log("hello TaskMan Backend", process.env);
24
24
 
25
25
  const port = process.env.PORT || "8080";
26
+ const mongoConnect =
27
+ process.env.MONGO_CONNECTION || "mongodb://127.0.0.1:27017";
26
28
 
27
29
  function findTextFiles(dir: string, fileList: string[] = []) {
28
30
  const files = fs.readdirSync(dir);
@@ -77,62 +79,131 @@ export default (partialConfig: IBaseConfig) => {
77
79
 
78
80
  const app = express();
79
81
 
80
- new MongoClient(`mongodb://${process.env.MONGO_HOST || "127.0.0.1"}:27017`)
81
- .connect()
82
- .then(async (conn) => {
83
- const db = conn.db("taskman");
84
- await mongoose.connect(
85
- `mongodb://${process.env.MONGO_HOST || "127.0.0.1"}:27017/taskman`
86
- );
87
-
88
- const usersModel = mongoose.model<IUser>("User", userSchema);
89
- const kanbanModel = mongoose.model<IKanban>("Kanban", kanbanSchema);
90
- const ganttModel = mongoose.model<IGantt>("Gantt", ganttSchema);
91
- const featuresModel = mongoose.model<any>("Features", featuresSchema);
92
- // const roomsModel = mongoose.model<any>("Rooms", RoomSchema);
93
- // const huddleModdle = mongoose.model<any>("Huddles", HuddleSchema);
94
-
95
- const MessagesModel = mongoose.model<any>(
96
- "Messages",
97
- chatCatMessageSchema
98
- );
99
-
100
- const ChatChannel = mongoose.model("ChatChannel", channelsFeature);
101
- const huddleModdle = ChatChannel.discriminator("Huddle", HuddleSchema);
102
- const roomsModel = ChatChannel.discriminator("Room", RoomSchema);
103
-
104
- app.get("/TaskManFrontend.js", (req, res) => {
105
- res.sendFile(`${process.cwd()}/docs/TaskManFrontEnd.js`);
82
+ new MongoClient(mongoConnect).connect().then(async (conn) => {
83
+ const db = conn.db("taskman");
84
+ await mongoose.connect(`${mongoConnect}/taskman`);
85
+ // await mongoose.connect(
86
+ // `mongodb://${process.env.MONGO_HOST || "127.0.0.1"}:27017/taskman`
87
+ // );
88
+
89
+ const usersModel = mongoose.model<IUser>("User", userSchema);
90
+ const kanbanModel = mongoose.model<IKanban>("Kanban", kanbanSchema);
91
+ const ganttModel = mongoose.model<IGantt>("Gantt", ganttSchema);
92
+ const featuresModel = mongoose.model<any>("Features", featuresSchema);
93
+ // const roomsModel = mongoose.model<any>("Rooms", RoomSchema);
94
+ // const huddleModdle = mongoose.model<any>("Huddles", HuddleSchema);
95
+
96
+ const MessagesModel = mongoose.model<any>("Messages", chatCatMessageSchema);
97
+
98
+ const ChatChannel = mongoose.model("ChatChannel", channelsFeature);
99
+ const huddleModdle = ChatChannel.discriminator("Huddle", HuddleSchema);
100
+ const roomsModel = ChatChannel.discriminator("Room", RoomSchema);
101
+
102
+ app.get("/TaskManFrontend.js", (req, res) => {
103
+ res.sendFile(`${process.cwd()}/docs/TaskManFrontEnd.js`);
104
+ });
105
+
106
+ app.get("/TaskManFrontEnd.css", (req, res) => {
107
+ res.sendFile(`${process.cwd()}/docs/TaskManFrontEnd.css`);
108
+ });
109
+
110
+ // app.get(`/preMergeCheck`, async (req, res) => {
111
+ // const commit = req.params["commit"];
112
+ // // res.json(await keyedModels[key].find({}));
113
+ // });
114
+
115
+ // app.get("/TaskManFrontend.js", (req, res) => {
116
+ // res.sendFile(
117
+ // `${process.cwd()}/node_modules/testeranto/dist/prebuild/TaskManFrontEnd.js`
118
+ // );
119
+ // });
120
+
121
+ // app.get("/TaskManFrontEnd.css", (req, res) => {
122
+ // res.sendFile(
123
+ // `${process.cwd()}/node_modules/testeranto/dist/prebuild/TaskManFrontEnd.css`
124
+ // );
125
+ // });
126
+
127
+ // app.get("/testeranto.json", (req, res) => {
128
+ // // res.sendFile(`${process.cwd()}/docs/testeranto.json`);
129
+ // res.json(config);
130
+ // });
131
+
132
+ // app.get("/", (req, res) => {
133
+ // res.send(`<!DOCTYPE html>
134
+ // <html lang="en">
135
+
136
+ // <head>
137
+ // <meta name="description" content="Webpage description goes here" />
138
+ // <meta charset="utf-8" />
139
+ // <meta name="viewport" content="width=device-width, initial-scale=1" />
140
+ // <meta name="author" content="" />
141
+
142
+ // <title>TaskMan</title>
143
+
144
+ // <link rel="stylesheet" href="/TaskManFrontEnd.css" />
145
+ // <script type="module" src="/TaskManFrontEnd.js"></script>
146
+ // </head>
147
+
148
+ // <body><div id="root">react is loading</div></body>
149
+
150
+ // </html>`);
151
+ // });
152
+
153
+ app.listen(port, () => {
154
+ console.log(`Example app listening on port ${port}`);
155
+ });
156
+
157
+ ///////////////////////////////////////////////
158
+
159
+ const keyedModels = {
160
+ users: usersModel,
161
+ kanbans: kanbanModel,
162
+ features: featuresModel,
163
+ gantts: ganttModel,
164
+ rooms: roomsModel,
165
+ huddles: huddleModdle,
166
+ messages: MessagesModel,
167
+ };
168
+
169
+ Object.keys(keyedModels).forEach((key) => {
170
+ app.get(`/${key}.json`, async (req, res) => {
171
+ console.log("GET", key, keyedModels[key]);
172
+ res.json(await keyedModels[key].find({}));
173
+ });
174
+
175
+ app.get(`/${key}/:id.json`, async (req, res) => {
176
+ res.json(
177
+ await keyedModels[key]
178
+ .find({ id: { $eq: req.params["id"] } })
179
+ .toArray()
180
+ );
181
+ });
182
+
183
+ app.post(`/${key}/:id.json`, async (req, res) => {
184
+ res.json(
185
+ await keyedModels[key]
186
+ .find({ id: { $eq: req.params["id"] } })
187
+ .toArray()
188
+ );
106
189
  });
107
190
 
108
- app.get("/TaskManFrontEnd.css", (req, res) => {
109
- res.sendFile(`${process.cwd()}/docs/TaskManFrontEnd.css`);
191
+ app.post(`/${key}.json`, async (req, res) => {
192
+ res.json(
193
+ await keyedModels[key]
194
+ .find({ id: { $eq: req.params["id"] } })
195
+ .toArray()
196
+ );
110
197
  });
198
+ });
199
+
200
+ app.use("/", express.static(path.join(process.cwd())));
111
201
 
112
- // app.get(`/preMergeCheck`, async (req, res) => {
113
- // const commit = req.params["commit"];
114
- // // res.json(await keyedModels[key].find({}));
115
- // });
116
-
117
- // app.get("/TaskManFrontend.js", (req, res) => {
118
- // res.sendFile(
119
- // `${process.cwd()}/node_modules/testeranto/dist/prebuild/TaskManFrontEnd.js`
120
- // );
121
- // });
122
-
123
- // app.get("/TaskManFrontEnd.css", (req, res) => {
124
- // res.sendFile(
125
- // `${process.cwd()}/node_modules/testeranto/dist/prebuild/TaskManFrontEnd.css`
126
- // );
127
- // });
128
-
129
- // app.get("/testeranto.json", (req, res) => {
130
- // // res.sendFile(`${process.cwd()}/docs/testeranto.json`);
131
- // res.json(config);
132
- // });
133
-
134
- // app.get("/", (req, res) => {
135
- // res.send(`<!DOCTYPE html>
202
+ app.get("/docGal/fs.json", (req, res) => {
203
+ const directoryPath = "./"; // Replace with the desired directory path
204
+ // const textFiles = findTextFiles(directoryPath);
205
+ res.json(listToTree(findTextFiles(directoryPath)));
206
+ // res.send(`<!DOCTYPE html>
136
207
  // <html lang="en">
137
208
 
138
209
  // <head>
@@ -150,79 +221,6 @@ export default (partialConfig: IBaseConfig) => {
150
221
  // <body><div id="root">react is loading</div></body>
151
222
 
152
223
  // </html>`);
153
- // });
154
-
155
- app.listen(port, () => {
156
- console.log(`Example app listening on port ${port}`);
157
- });
158
-
159
- ///////////////////////////////////////////////
160
-
161
- const keyedModels = {
162
- users: usersModel,
163
- kanbans: kanbanModel,
164
- features: featuresModel,
165
- gantts: ganttModel,
166
- rooms: roomsModel,
167
- huddles: huddleModdle,
168
- messages: MessagesModel,
169
- };
170
-
171
- Object.keys(keyedModels).forEach((key) => {
172
- app.get(`/${key}.json`, async (req, res) => {
173
- console.log("GET", key, keyedModels[key]);
174
- res.json(await keyedModels[key].find({}));
175
- });
176
-
177
- app.get(`/${key}/:id.json`, async (req, res) => {
178
- res.json(
179
- await keyedModels[key]
180
- .find({ id: { $eq: req.params["id"] } })
181
- .toArray()
182
- );
183
- });
184
-
185
- app.post(`/${key}/:id.json`, async (req, res) => {
186
- res.json(
187
- await keyedModels[key]
188
- .find({ id: { $eq: req.params["id"] } })
189
- .toArray()
190
- );
191
- });
192
-
193
- app.post(`/${key}.json`, async (req, res) => {
194
- res.json(
195
- await keyedModels[key]
196
- .find({ id: { $eq: req.params["id"] } })
197
- .toArray()
198
- );
199
- });
200
- });
201
-
202
- app.use("/", express.static(path.join(process.cwd())));
203
-
204
- app.get("/docGal/fs.json", (req, res) => {
205
- const directoryPath = "./"; // Replace with the desired directory path
206
- // const textFiles = findTextFiles(directoryPath);
207
- res.json(listToTree(findTextFiles(directoryPath)));
208
- // res.send(`<!DOCTYPE html>
209
- // <html lang="en">
210
-
211
- // <head>
212
- // <meta name="description" content="Webpage description goes here" />
213
- // <meta charset="utf-8" />
214
- // <meta name="viewport" content="width=device-width, initial-scale=1" />
215
- // <meta name="author" content="" />
216
-
217
- // <title>TaskMan</title>
218
-
219
- // <link rel="stylesheet" href="/TaskManFrontEnd.css" />
220
- // <script type="module" src="/TaskManFrontEnd.js"></script>
221
- // </head>
222
-
223
- // <body><div id="root">react is loading</div></body>
224
-
225
- // </html>`);
226
- });
227
224
  });
225
+ });
228
226
  };
@@ -231,36 +231,68 @@ const Features = ({ features, tests, results, adminMode }) => {
231
231
  };
232
232
 
233
233
  const Tests = ({ tests, results, features, adminMode }) => {
234
- if (!adminMode) return <Tab.Container id="left-tabs-example5" defaultActiveKey="feature-0">
235
- <Row>
236
- <Col sm={4}>
237
- <Nav variant="pills" className="flex-column">
238
- {
239
- tests.tests.map((t, ndx) =>
240
- <Nav.Item key={ndx}>
241
- <Nav.Link eventKey={`test-${ndx}`}>
242
- {t[0]} - {t[1]}
243
- </Nav.Link>
244
- </Nav.Item>
245
- )
246
- }
247
- </Nav>
248
- </Col>
234
+ return <div>
235
+ <Navbar expand="md" className="bg-body-tertiary">
236
+ <Container fluid>
237
+ <NavDropdown align="end" title="User" id="basic-nav-dropdown">
238
+ {/* {
239
+ users.map((user) => {
240
+ return <NavDropdown.Item href="#action/3.1">
241
+ {user.email}
242
+ </NavDropdown.Item>
243
+ })
244
+ } */}
245
+ {/* <NavDropdown.Item href="#action/3.1">Action</NavDropdown.Item>
246
+ <NavDropdown.Item href="#action/3.2">
247
+ Another action
248
+ </NavDropdown.Item>
249
+ <NavDropdown.Item href="#action/3.3">Something</NavDropdown.Item> */}
249
250
 
250
- <Col sm={4}>
251
- <Tab.Content>
251
+ <NavDropdown.Item href="#action/3.4">
252
+ localhost:8080
253
+ </NavDropdown.Item>
254
+ <NavDropdown.Divider />
255
+ <NavDropdown.Item href="#action/3.4">
256
+ origin/master
257
+ </NavDropdown.Item>
258
+ <NavDropdown.Item href="#action/3.4">
259
+ origin/feature
260
+ </NavDropdown.Item>
261
+ </NavDropdown>
252
262
 
253
- {
254
- tests.tests.map((t, ndx) =>
255
- <Tab.Pane eventKey={`test-${ndx}`}>
256
- {/* <pre>{JSON.stringify(t, null, 2)}</pre> */}
257
- {/* <pre>{JSON.stringify(state.results, null, 2)}</pre> */}
258
- <pre>{JSON.stringify(Object.entries(results).filter(([k, v]: [string, { src: string }]) => {
259
- console.log(v.src, tests.tests[ndx][0])
260
- return v.src === tests.tests[ndx][0]
261
- }), null, 2)}</pre>
262
-
263
- {/* {tests.tests.map((t, ndx) => {
263
+ </Container>
264
+ </Navbar>
265
+
266
+ <Tab.Container id="left-tabs-example5" defaultActiveKey="feature-0">
267
+ <Row>
268
+ <Col sm={4}>
269
+ <Nav variant="pills" className="flex-column">
270
+ {
271
+ tests.tests.map((t, ndx) =>
272
+ <Nav.Item key={ndx}>
273
+ <Nav.Link eventKey={`test-${ndx}`}>
274
+ {t[0]} - {t[1]}
275
+ </Nav.Link>
276
+ </Nav.Item>
277
+ )
278
+ }
279
+ </Nav>
280
+ </Col>
281
+
282
+ <Col sm={4}>
283
+ <Tab.Content>
284
+
285
+ {
286
+ tests.tests.map((t, ndx) =>
287
+ <Tab.Pane eventKey={`test-${ndx}`}>
288
+ {/* <pre>{JSON.stringify(t, null, 2)}</pre> */}
289
+ {/* <pre>{JSON.stringify(state.results, null, 2)}</pre> */}
290
+ <pre>{JSON.stringify(Object.entries(results).filter(([k, v]: [string, { src: string }]) => {
291
+ console.log(v.src, tests.tests[ndx][0])
292
+ return v.src === tests.tests[ndx][0]
293
+ }), null, 2)}</pre>
294
+
295
+ {/* {tests.tests.map((t, ndx) => {
264
296
  return (
265
297
  <Tab.Pane eventKey={`feature-${ndx}`} key={ndx}>
266
298
  <pre>{JSON.stringify(t, null, 2)}</pre>
@@ -269,23 +301,23 @@ const Tests = ({ tests, results, features, adminMode }) => {
269
301
  }
270
302
  )} */}
271
303
 
272
- </Tab.Pane>
304
+ </Tab.Pane>
273
305
 
274
- )
275
- }
306
+ )
307
+ }
276
308
 
277
309
 
278
310
 
279
311
 
280
- </Tab.Content>
281
- </Col>
312
+ </Tab.Content>
313
+ </Col>
282
314
 
283
315
 
284
- </Row>
285
- </Tab.Container>
316
+ </Row>
317
+ </Tab.Container>
318
+
319
+ </div>
286
320
 
287
- // return <Crud collectionName="features" collection={features}></Crud>
288
- return <div></div>
289
321
 
290
322
  };
291
323