express-generator-typescript 2.7.11 → 2.7.14
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/LICENSE +0 -0
- package/README.md +0 -0
- package/lib/cli.js +0 -0
- package/lib/express-generator-typescript.js +44 -11
- package/lib/project-files/.prettierignore +12 -0
- package/lib/project-files/.prettierrc.json +15 -0
- package/lib/project-files/README.md +54 -65
- package/lib/project-files/config/.env.development +0 -0
- package/lib/project-files/config/.env.production +0 -0
- package/lib/project-files/config/.env.test +0 -0
- package/lib/project-files/eslint.config.ts +46 -100
- package/lib/project-files/gitignore +0 -2
- package/lib/project-files/package.json +62 -56
- package/lib/project-files/src/common/constants/HttpStatusCodes.ts +393 -394
- package/lib/project-files/src/common/constants/Paths.ts +15 -15
- package/lib/project-files/src/common/constants/{EnvVars.ts → env.ts} +28 -19
- package/lib/project-files/src/common/utils/{misc.ts → number-utils.ts} +10 -11
- package/lib/project-files/src/common/utils/route-errors.ts +35 -36
- package/lib/project-files/src/common/utils/validators.ts +14 -14
- package/lib/project-files/src/{index.ts → main.ts} +24 -27
- package/lib/project-files/src/models/User.ts +73 -72
- package/lib/project-files/src/models/common/IModel.ts +4 -0
- package/lib/project-files/src/public/stylesheets/users.css +50 -48
- package/lib/project-files/src/repos/MockOrm.ts +57 -63
- package/lib/project-files/src/repos/UserRepo.ts +131 -133
- package/lib/project-files/src/repos/{database.json → common/database.json} +0 -0
- package/lib/project-files/src/repos/common/database.test.json +1 -0
- package/lib/project-files/src/routes/UserRoutes.ts +77 -69
- package/lib/project-files/src/routes/{index.ts → apiRouter.ts} +28 -28
- package/lib/project-files/src/routes/common/{types.ts → express-types.ts} +9 -10
- package/lib/project-files/src/routes/common/{utils.ts → parseReq.ts} +19 -16
- package/lib/project-files/src/server.ts +79 -84
- package/lib/project-files/src/services/{UserService/index.ts → UserService.ts} +64 -58
- package/lib/project-files/src/views/users.html +118 -132
- package/lib/project-files/tests/common/{utils.ts → comparators.ts} +38 -55
- package/lib/project-files/tests/common/error-utils.ts +25 -0
- package/lib/project-files/tests/common/{types.ts → supertest-types.ts} +15 -16
- package/lib/project-files/tests/{aux/setup.ts → support/agent.ts} +23 -26
- package/lib/project-files/tests/users.test.ts +131 -123
- package/lib/project-files/tsconfig.json +29 -35
- package/lib/project-files/tsconfig.prod.json +27 -30
- package/lib/project-files/vitest.config.mts +21 -18
- package/package.json +1 -1
- package/lib/project-files/config.ts +0 -22
- package/lib/project-files/scripts/build.ts +0 -28
- package/lib/project-files/scripts/common/utils.ts +0 -93
- package/lib/project-files/src/common/constants/index.ts +0 -11
- package/lib/project-files/src/models/common/types.ts +0 -5
- package/lib/project-files/src/repos/database.test.json +0 -1
- package/lib/project-files/src/services/UserService/constants.ts +0 -5
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import logger from 'jet-logger';
|
|
3
|
-
import childProcess from 'child_process';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
|
|
6
|
-
/******************************************************************************
|
|
7
|
-
Functions
|
|
8
|
-
*******************************************************************************
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Copy file.
|
|
12
|
-
*/
|
|
13
|
-
export function copy(src: string, dest: string): Promise<void> {
|
|
14
|
-
return new Promise((res, rej) => {
|
|
15
|
-
return fs.copy(src, dest, err => {
|
|
16
|
-
return (!!err ? rej(err) : res());
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Remove file
|
|
23
|
-
*/
|
|
24
|
-
export function remove(loc: string): Promise<void> {
|
|
25
|
-
return new Promise((res, rej) => {
|
|
26
|
-
return fs.remove(loc, err => {
|
|
27
|
-
return (!!err ? rej(err) : res());
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Run command-line command.
|
|
34
|
-
*/
|
|
35
|
-
export function exec(cmd: string, loc = './'): Promise<string> {
|
|
36
|
-
// Setup directory
|
|
37
|
-
const callingDir = path.dirname(require.main?.filename ?? './'),
|
|
38
|
-
cwd = path.join(callingDir, loc);
|
|
39
|
-
// Wrap in promise
|
|
40
|
-
return new Promise((res, rej) =>
|
|
41
|
-
childProcess.exec(cmd, { cwd }, (err, stdout, stderr) => {
|
|
42
|
-
if (!!stdout) {
|
|
43
|
-
logger.info(stdout);
|
|
44
|
-
}
|
|
45
|
-
if (!!stderr) {
|
|
46
|
-
logger.err(stderr);
|
|
47
|
-
}
|
|
48
|
-
if (!!err) {
|
|
49
|
-
return rej(err);
|
|
50
|
-
} else if (!!stderr) {
|
|
51
|
-
return rej(new Error(stderr));
|
|
52
|
-
} else {
|
|
53
|
-
return res(stdout);
|
|
54
|
-
}
|
|
55
|
-
}),
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Recursively search for a folder for all files and copy them to the new
|
|
61
|
-
* destination keeping their paths relative to the "src" param.
|
|
62
|
-
*
|
|
63
|
-
* Example:
|
|
64
|
-
* If file "./src/foo/bar.txt" exists then:
|
|
65
|
-
* copyFilesRec('./src', './dest') => ["./dest/foo/bar.txt"]
|
|
66
|
-
*
|
|
67
|
-
* @param excludeExt Exlude a list of file extensions.
|
|
68
|
-
*/
|
|
69
|
-
export async function copyFilesRec(
|
|
70
|
-
src: string,
|
|
71
|
-
dest: string,
|
|
72
|
-
excludeExt?: string[],
|
|
73
|
-
): Promise<void> {
|
|
74
|
-
const copyReqs: Promise<void>[] = [];
|
|
75
|
-
try {
|
|
76
|
-
const entries = await fs.readdir(src, { withFileTypes: true });
|
|
77
|
-
for (const entry of entries) {
|
|
78
|
-
const currPath = src + '/' + entry.name,
|
|
79
|
-
currDest = dest + '/' + entry.name,
|
|
80
|
-
ext = path.extname(entry.name);
|
|
81
|
-
if (entry.isFile() && !excludeExt?.includes(ext)) {
|
|
82
|
-
const req = fs.copy(currPath, currDest);
|
|
83
|
-
copyReqs.push(req);
|
|
84
|
-
} else if (entry.isDirectory()) {
|
|
85
|
-
const req = copyFilesRec(currPath, currDest, excludeExt);
|
|
86
|
-
copyReqs.push(req);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
} catch (error) {
|
|
90
|
-
logger.err(`Error searching in ${src}: ` + String(error));
|
|
91
|
-
}
|
|
92
|
-
await Promise.all(copyReqs);
|
|
93
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/******************************************************************************
|
|
3
|
-
Constants
|
|
4
|
-
******************************************************************************/
|
|
5
|
-
|
|
6
|
-
// NOTE: These need to match the names of your ".env" files
|
|
7
|
-
export const NodeEnvs = {
|
|
8
|
-
DEV: 'development',
|
|
9
|
-
TEST: 'test',
|
|
10
|
-
PRODUCTION: 'production',
|
|
11
|
-
} as const;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"users":[{"id":547317739445,"name":"Bill","email":"sean.maxwell@gmail.com","created":"2026-01-10T04:06:20.291Z"},{"id":332906029656,"name":"John Smith","email":"john.smith@gmail.com","created":"2026-01-10T04:06:20.291Z"},{"id":421195709596,"name":"Gordan Freeman","email":"gordan.freeman@gmail.com","created":"2026-01-10T04:06:20.291Z"}]}
|