express-generator-typescript 2.5.4 → 2.5.6
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.
|
@@ -17,23 +17,11 @@ function apiCb(
|
|
|
17
17
|
if (printErr) {
|
|
18
18
|
logger.err(err);
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
_iterate(res.body, dateParam);
|
|
21
21
|
return cb(res);
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
/**
|
|
26
|
-
* When date objects get sent through supertest they are converted to
|
|
27
|
-
* iso-strings. This will cause "toEqual()"" tests to fail, so we need to
|
|
28
|
-
* convert them back to Date objects.
|
|
29
|
-
*/
|
|
30
|
-
function _strToDate(
|
|
31
|
-
param: unknown,
|
|
32
|
-
prop: string,
|
|
33
|
-
): void {
|
|
34
|
-
return _iterate(param, prop);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
25
|
/**
|
|
38
26
|
* Interate object recursively and convert string-dates to "Date" objects.
|
|
39
27
|
*/
|
|
@@ -52,7 +40,7 @@ function _iterate(param: unknown, prop: string): void {
|
|
|
52
40
|
// Check valid string or Date object. If undefined just skip
|
|
53
41
|
const val = paramF[prop];
|
|
54
42
|
if (val !== undefined && !_isValidDate(val)) {
|
|
55
|
-
throw new Error('Property must be a valid date-string or Date
|
|
43
|
+
throw new Error('Property must be a valid date-string or Date object.');
|
|
56
44
|
}
|
|
57
45
|
// Convert and iterate
|
|
58
46
|
if (typeof val !== 'undefined') {
|
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
// **** Types **** //
|
|
10
10
|
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
-
type TFunc = (...args: any[]) => any;
|
|
13
11
|
type TBasicObj = Record<string, unknown>;
|
|
14
12
|
type TEnum = Record<string, string | number>;
|
|
15
13
|
|
|
@@ -229,13 +227,13 @@ function _parseObj<
|
|
|
229
227
|
/**
|
|
230
228
|
* Validate the schema.
|
|
231
229
|
*/
|
|
232
|
-
function _parseObjCore(
|
|
230
|
+
function _parseObjCore<A>(
|
|
233
231
|
optional: boolean,
|
|
234
232
|
nullable: boolean,
|
|
235
|
-
isArr:
|
|
233
|
+
isArr: A,
|
|
236
234
|
schema: TSchema,
|
|
237
235
|
arg: unknown,
|
|
238
|
-
onError?:
|
|
236
|
+
onError?: TParseOnError<A>,
|
|
239
237
|
) {
|
|
240
238
|
// Check "undefined"
|
|
241
239
|
if (arg === undefined) {
|
|
@@ -272,9 +270,10 @@ function _parseObjCore(
|
|
|
272
270
|
}
|
|
273
271
|
}
|
|
274
272
|
return resp;
|
|
275
|
-
}
|
|
276
273
|
// Default
|
|
277
|
-
|
|
274
|
+
} else {
|
|
275
|
+
return _parseObjCoreHelper(schema, arg, onError as TParseOnError<false>);
|
|
276
|
+
}
|
|
278
277
|
}
|
|
279
278
|
|
|
280
279
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express-generator-typescript",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.6",
|
|
4
4
|
"description": "Generate new Express applications similar to express-generate which but sets it up to use TypeScript instead",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"express-generator-typescript": "node bin/cli.js",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const dotenv_1 = __importDefault(require("dotenv"));
|
|
8
|
-
const module_alias_1 = __importDefault(require("module-alias"));
|
|
9
|
-
const NODE_ENV = (process.env.NODE_ENV ?? 'development');
|
|
10
|
-
const result2 = dotenv_1.default.config({
|
|
11
|
-
path: path_1.default.join(__dirname, `./config/.env.${NODE_ENV}`),
|
|
12
|
-
});
|
|
13
|
-
if (result2.error) {
|
|
14
|
-
throw result2.error;
|
|
15
|
-
}
|
|
16
|
-
if (__filename.endsWith('js')) {
|
|
17
|
-
module_alias_1.default.addAlias('@src', __dirname + '/dist');
|
|
18
|
-
}
|