express-generator-typescript 2.1.6 → 2.1.8

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.
@@ -15,8 +15,6 @@ import childProcess from 'child_process';
15
15
  // Copy front-end files
16
16
  await copy('./src/public', './dist/public');
17
17
  await copy('./src/views', './dist/views');
18
- // Copy production env file
19
- await copy('./src/pre-start/env/production.env', './dist/pre-start/env/production.env');
20
18
  // Copy back-end files
21
19
  await exec('tsc --build tsconfig.prod.json', './');
22
20
  } catch (err) {
@@ -23,7 +23,7 @@
23
23
  "_moduleAliases": {
24
24
  "@services": "dist/services",
25
25
  "@repos": "dist/repos",
26
- "@entities": "dist/entities",
26
+ "@models": "dist/models",
27
27
  "@shared": "dist/shared",
28
28
  "@server": "dist/server",
29
29
  "@routes": "dist/routes",
@@ -1,12 +1,13 @@
1
1
  /* eslint-disable @typescript-eslint/no-unsafe-return */
2
2
 
3
3
  import jsonfile from 'jsonfile';
4
+
4
5
  import { IUser } from '@models/user-model';
5
6
 
6
7
 
7
8
  // **** Variables **** //
8
9
 
9
- const dbFilePath = 'src/repos/database.json';
10
+ const dbFileName = 'database.json';
10
11
 
11
12
 
12
13
  // **** Types **** //
@@ -22,14 +23,14 @@ interface IDb {
22
23
  * Fetch the json from the file.
23
24
  */
24
25
  function openDb(): Promise<IDb> {
25
- return jsonfile.readFile(dbFilePath);
26
+ return jsonfile.readFile(__dirname + '/' + dbFileName);
26
27
  }
27
28
 
28
29
  /**
29
30
  * Update the file.
30
31
  */
31
32
  function saveDb(db: IDb): Promise<void> {
32
- return jsonfile.writeFile(dbFilePath, db);
33
+ return jsonfile.writeFile((__dirname + '/' + dbFileName), db);
33
34
  }
34
35
 
35
36
 
@@ -1,7 +1,7 @@
1
1
  import StatusCodes from 'http-status-codes';
2
2
 
3
3
  import authService from '@services/auth-service';
4
- import envVars from 'src/shared/env-vars';
4
+ import envVars from '@shared/env-vars';
5
5
  import { IReq, IRes } from '@shared/types';
6
6
 
7
7
 
@@ -2,7 +2,7 @@ import StatusCodes from 'http-status-codes';
2
2
  import { Request, Response, NextFunction, RequestHandler } from 'express';
3
3
  import { JwtPayload } from 'jsonwebtoken';
4
4
 
5
- import envVars from 'src/shared/env-vars';
5
+ import envVars from '@shared/env-vars';
6
6
  import jwtUtil from '@util/jwt-util';
7
7
  import { IUser, UserRoles } from '@models/user-model';
8
8
  import { ParamInvalidError, ValidatorFnError } from '@shared/errors';
@@ -127,7 +127,7 @@ export function validate(...params: Array<string | TParamArr>): RequestHandler {
127
127
  reqObjProp !== 'params' &&
128
128
  reqObjProp !== 'query'
129
129
  ) {
130
- throw Error('param[1] must be "body", "query", or "params"');
130
+ throw Error('param[2] must be "body", "query", or "params"');
131
131
  }
132
132
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
133
133
  const toValidate = req[reqObjProp][paramName] as TAll;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-generator-typescript",
3
- "version": "2.1.6",
3
+ "version": "2.1.8",
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",