express-generator-typescript 2.8.1 → 2.9.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 (71) hide show
  1. package/README.md +6 -7
  2. package/bin/cli.js +91 -32
  3. package/lib/express-generator-typescript.js +125 -151
  4. package/lib/{project-files → template}/.prettierignore +2 -4
  5. package/lib/template/README.md +50 -0
  6. package/lib/template/bs-config.js +8 -0
  7. package/lib/{project-files → template}/config/.env.development +4 -6
  8. package/lib/{project-files → template}/config/.env.production +4 -5
  9. package/lib/{project-files → template}/config/.env.test +4 -5
  10. package/lib/{project-files → template}/eslint.config.ts +4 -0
  11. package/lib/template/gitignore +10 -0
  12. package/lib/{project-files → template}/package.json +31 -35
  13. package/lib/{project-files → template}/src/common/constants/HttpStatusCodes.ts +7 -8
  14. package/lib/template/src/common/constants/Paths.ts +22 -0
  15. package/lib/template/src/common/constants/env.ts +28 -0
  16. package/lib/template/src/common/types/utility-types.ts +5 -0
  17. package/lib/template/src/common/utils/date-utils.ts +29 -0
  18. package/lib/template/src/common/utils/route-errors.ts +37 -0
  19. package/lib/template/src/main.ts +24 -0
  20. package/lib/template/src/models/User.model.ts +95 -0
  21. package/lib/template/src/models/common/types.ts +10 -0
  22. package/lib/template/src/public/scripts/http.js +25 -0
  23. package/lib/template/src/public/scripts/lib/bootstrap.bundle.min.js +4229 -0
  24. package/lib/template/src/public/scripts/renderUsers.js +90 -0
  25. package/lib/template/src/public/scripts/users.js +142 -0
  26. package/lib/template/src/public/stylesheets/lib/bootstrap.min.css +11798 -0
  27. package/lib/template/src/repos/MockOrm.ts +71 -0
  28. package/lib/{project-files → template}/src/repos/UserRepo.ts +21 -35
  29. package/lib/template/src/repos/common/database.json +28 -0
  30. package/lib/{project-files → template}/src/routes/UserRoutes.ts +15 -18
  31. package/lib/template/src/routes/apiRouter.ts +28 -0
  32. package/lib/template/src/routes/common/express-types.ts +9 -0
  33. package/lib/template/src/routes/common/parseReq.ts +23 -0
  34. package/lib/{project-files → template}/src/server.ts +23 -18
  35. package/lib/template/src/services/UserService.ts +66 -0
  36. package/lib/{project-files → template}/src/views/users.html +13 -6
  37. package/lib/{project-files → template}/tests/common/comparators.ts +6 -6
  38. package/lib/template/tests/common/supertest-types.ts +11 -0
  39. package/lib/template/tests/frontend.test.ts +33 -0
  40. package/lib/template/tests/support/agent.ts +23 -0
  41. package/lib/template/tests/users.test.ts +205 -0
  42. package/lib/{project-files → template}/tsconfig.json +1 -3
  43. package/lib/{project-files → template}/tsconfig.prod.json +3 -9
  44. package/lib/{project-files → template}/vitest.config.mts +2 -0
  45. package/package.json +69 -52
  46. package/lib/cli.js +0 -33
  47. package/lib/project-files/README.md +0 -39
  48. package/lib/project-files/gitignore +0 -4
  49. package/lib/project-files/src/common/constants/Paths.ts +0 -15
  50. package/lib/project-files/src/common/constants/env.ts +0 -28
  51. package/lib/project-files/src/common/types/structure-utils.ts +0 -2
  52. package/lib/project-files/src/common/utils/number-utils.ts +0 -10
  53. package/lib/project-files/src/common/utils/route-errors.ts +0 -35
  54. package/lib/project-files/src/common/utils/validators.ts +0 -14
  55. package/lib/project-files/src/main.ts +0 -24
  56. package/lib/project-files/src/models/User.model.ts +0 -72
  57. package/lib/project-files/src/models/common/types.ts +0 -4
  58. package/lib/project-files/src/public/stylesheets/lib/bootstrap.min.css +0 -6
  59. package/lib/project-files/src/repos/MockOrm.ts +0 -63
  60. package/lib/project-files/src/repos/common/database.json +0 -1
  61. package/lib/project-files/src/repos/common/database.test.json +0 -1
  62. package/lib/project-files/src/routes/apiRouter.ts +0 -28
  63. package/lib/project-files/src/routes/common/express-types.ts +0 -8
  64. package/lib/project-files/src/routes/common/parseReq.ts +0 -19
  65. package/lib/project-files/src/services/UserService.ts +0 -64
  66. package/lib/project-files/tests/common/error-utils.ts +0 -25
  67. package/lib/project-files/tests/common/supertest-types.ts +0 -15
  68. package/lib/project-files/tests/support/agent.ts +0 -23
  69. package/lib/project-files/tests/users.test.ts +0 -131
  70. /package/lib/{project-files → template}/.prettierrc.json +0 -0
  71. /package/lib/{project-files → template}/src/public/stylesheets/users.css +0 -0
@@ -1,72 +0,0 @@
1
- import { isNonEmptyString, isString, isUnsignedInteger } from 'jet-validators';
2
- import { parseObject, Schema, testObject } from 'jet-validators/utils';
3
-
4
- import { transformIsDate } from '@src/common/utils/validators';
5
-
6
- import { Entity } from './common/types';
7
-
8
- /******************************************************************************
9
- Constants
10
- ******************************************************************************/
11
-
12
- const GetDefaults = (): IUser => ({
13
- id: 0,
14
- name: '',
15
- email: '',
16
- created: new Date(),
17
- });
18
-
19
- const schema: Schema<IUser> = {
20
- id: isUnsignedInteger,
21
- name: isString,
22
- email: isString,
23
- created: transformIsDate,
24
- };
25
-
26
- /******************************************************************************
27
- Types
28
- ******************************************************************************/
29
-
30
- /**
31
- * @entity users
32
- */
33
- export interface IUser extends Entity {
34
- name: string;
35
- email: string;
36
- }
37
-
38
- /******************************************************************************
39
- Setup
40
- ******************************************************************************/
41
-
42
- // Set the "parseUser" function
43
- const parseUser = parseObject<IUser>(schema);
44
-
45
- // For the APIs make sure the right fields are complete
46
- const isCompleteUser = testObject<IUser>({
47
- ...schema,
48
- name: isNonEmptyString,
49
- email: isNonEmptyString,
50
- });
51
-
52
- /******************************************************************************
53
- Functions
54
- ******************************************************************************/
55
-
56
- /**
57
- * New user object.
58
- */
59
- function new_(user?: Partial<IUser>): IUser {
60
- return parseUser({ ...GetDefaults(), ...user }, (errors) => {
61
- throw new Error('Setup new user failed ' + JSON.stringify(errors, null, 2));
62
- });
63
- }
64
-
65
- /******************************************************************************
66
- Export default
67
- ******************************************************************************/
68
-
69
- export default {
70
- new: new_,
71
- isComplete: isCompleteUser,
72
- } as const;
@@ -1,4 +0,0 @@
1
- export interface Entity {
2
- id: number; // @PK
3
- created: Date | string; // @audit
4
- }