express-generator-typescript 1.9.0 → 1.9.1

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.
@@ -0,0 +1 @@
1
+ src/public/
@@ -0,0 +1,35 @@
1
+ {
2
+ "parser": "@typescript-eslint/parser",
3
+ "plugins": [
4
+ "@typescript-eslint"
5
+ ],
6
+ "extends": [
7
+ "eslint:recommended",
8
+ "plugin:@typescript-eslint/recommended",
9
+ "plugin:@typescript-eslint/recommended-requiring-type-checking"
10
+ ],
11
+ "parserOptions": {
12
+ "project": "./tsconfig.json"
13
+ },
14
+ "rules": {
15
+ "max-len": [
16
+ "error",
17
+ {
18
+ "code": 100
19
+ }
20
+ ],
21
+ "no-console": 1,
22
+ "no-extra-boolean-cast": 0,
23
+ "semi": 1,
24
+ "@typescript-eslint/restrict-plus-operands": 0,
25
+ "@typescript-eslint/explicit-module-boundary-types": 0,
26
+ "@typescript-eslint/no-explicit-any": 0,
27
+ "@typescript-eslint/no-floating-promises": 0,
28
+ "@typescript-eslint/no-unsafe-member-access": 0,
29
+ "@typescript-eslint/no-unsafe-assignment": 0,
30
+ "@typescript-eslint/no-misused-promises": 0,
31
+ "@typescript-eslint/no-unsafe-argument": 0,
32
+ "@typescript-eslint/no-unsafe-return": 0,
33
+ "@typescript-eslint/no-unsafe-call": 0
34
+ }
35
+ }
@@ -28,40 +28,6 @@
28
28
  "@routes": "dist/routes",
29
29
  "@util": "dist/util"
30
30
  },
31
- "eslintConfig": {
32
- "parser": "@typescript-eslint/parser",
33
- "plugins": [
34
- "@typescript-eslint"
35
- ],
36
- "extends": [
37
- "eslint:recommended",
38
- "plugin:@typescript-eslint/recommended",
39
- "plugin:@typescript-eslint/recommended-requiring-type-checking"
40
- ],
41
- "parserOptions": {
42
- "project": "./tsconfig.json"
43
- },
44
- "rules": {
45
- "max-len": [
46
- "error",
47
- {
48
- "code": 100
49
- }
50
- ],
51
- "no-console": 1,
52
- "no-extra-boolean-cast": 0,
53
- "@typescript-eslint/restrict-plus-operands": 0,
54
- "@typescript-eslint/explicit-module-boundary-types": 0,
55
- "@typescript-eslint/no-explicit-any": 0,
56
- "@typescript-eslint/no-floating-promises": 0,
57
- "@typescript-eslint/no-unsafe-member-access": 0,
58
- "@typescript-eslint/no-unsafe-assignment": 0
59
- }
60
- },
61
- "eslintIgnore": [
62
- "src/public/",
63
- "build.ts"
64
- ],
65
31
  "dependencies": {
66
32
  },
67
33
  "devDependencies": {
@@ -1,14 +1,14 @@
1
1
  import './pre-start'; // Must be the first import
2
- import envVars from './shared/env-vars';
3
2
  import logger from 'jet-logger';
3
+
4
+ import envVars from '@shared/env-vars';
4
5
  import server from './server';
5
6
 
6
7
 
7
8
  // Constants
8
- const serverStartMsg = 'Express server started on port: ',
9
- port = (envVars.port || 3000);
9
+ const serverStartMsg = 'Express server started on port: ';
10
10
 
11
11
  // Start server
12
- server.listen(port, () => {
13
- logger.info(serverStartMsg + port);
12
+ server.listen(envVars.port, () => {
13
+ logger.info(serverStartMsg + envVars.port);
14
14
  });
@@ -1,9 +1,9 @@
1
1
  export default {
2
- nodeEnv: process.env.NODE_ENV ?? '',
3
- port: process.env.PORT ?? 0,
2
+ nodeEnv: (process.env.NODE_ENV ?? ''),
3
+ port: (process.env.PORT ?? 0),
4
4
  cookieProps: {
5
5
  key: 'ExpressGeneratorTs',
6
- secret: process.env.COOKIE_SECRET ?? '',
6
+ secret: (process.env.COOKIE_SECRET ?? ''),
7
7
  options: {
8
8
  httpOnly: true,
9
9
  signed: true,
@@ -14,7 +14,7 @@ export default {
14
14
  },
15
15
  },
16
16
  jwt: {
17
- secret: process.env.JWT_SECRET ?? '',
18
- exp: process.env.COOKIE_EXP ?? '', // exp at the same time as the cookie
17
+ secret: (process.env.JWT_SECRET ?? ''),
18
+ exp: (process.env.COOKIE_EXP ?? ''), // exp at the same time as the cookie
19
19
  },
20
- };
20
+ } as const;
@@ -10,7 +10,6 @@ const childProcess = require('child_process');
10
10
  const ncp = require('ncp').ncp;
11
11
 
12
12
 
13
-
14
13
  /**
15
14
  * Entry point
16
15
  */
@@ -102,5 +101,6 @@ function downloadNodeModules(destination, depStrings, useYarn) {
102
101
  }
103
102
 
104
103
 
105
- // Export entry point
104
+ // **** Export entry point **** //
105
+
106
106
  module.exports = expressGenTs;
@@ -0,0 +1 @@
1
+ src/public/
@@ -0,0 +1,35 @@
1
+ {
2
+ "parser": "@typescript-eslint/parser",
3
+ "plugins": [
4
+ "@typescript-eslint"
5
+ ],
6
+ "extends": [
7
+ "eslint:recommended",
8
+ "plugin:@typescript-eslint/recommended",
9
+ "plugin:@typescript-eslint/recommended-requiring-type-checking"
10
+ ],
11
+ "parserOptions": {
12
+ "project": "./tsconfig.json"
13
+ },
14
+ "rules": {
15
+ "max-len": [
16
+ "error",
17
+ {
18
+ "code": 100
19
+ }
20
+ ],
21
+ "no-console": 1,
22
+ "no-extra-boolean-cast": 0,
23
+ "semi": 1,
24
+ "@typescript-eslint/restrict-plus-operands": 0,
25
+ "@typescript-eslint/explicit-module-boundary-types": 0,
26
+ "@typescript-eslint/no-explicit-any": 0,
27
+ "@typescript-eslint/no-floating-promises": 0,
28
+ "@typescript-eslint/no-unsafe-member-access": 0,
29
+ "@typescript-eslint/no-unsafe-assignment": 0,
30
+ "@typescript-eslint/no-misused-promises": 0,
31
+ "@typescript-eslint/no-unsafe-argument": 0,
32
+ "@typescript-eslint/no-unsafe-return": 0,
33
+ "@typescript-eslint/no-unsafe-call": 0
34
+ }
35
+ }
@@ -27,40 +27,6 @@
27
27
  "@server": "dist/server",
28
28
  "@routes": "dist/routes"
29
29
  },
30
- "eslintConfig": {
31
- "parser": "@typescript-eslint/parser",
32
- "plugins": [
33
- "@typescript-eslint"
34
- ],
35
- "extends": [
36
- "eslint:recommended",
37
- "plugin:@typescript-eslint/recommended",
38
- "plugin:@typescript-eslint/recommended-requiring-type-checking"
39
- ],
40
- "parserOptions": {
41
- "project": "./tsconfig.json"
42
- },
43
- "rules": {
44
- "max-len": [
45
- "error",
46
- {
47
- "code": 100
48
- }
49
- ],
50
- "no-console": 1,
51
- "no-extra-boolean-cast": 0,
52
- "@typescript-eslint/restrict-plus-operands": 0,
53
- "@typescript-eslint/explicit-module-boundary-types": 0,
54
- "@typescript-eslint/no-explicit-any": 0,
55
- "@typescript-eslint/no-floating-promises": 0,
56
- "@typescript-eslint/no-unsafe-member-access": 0,
57
- "@typescript-eslint/no-unsafe-assignment": 0
58
- }
59
- },
60
- "eslintIgnore": [
61
- "src/public/",
62
- "build.ts"
63
- ],
64
30
  "dependencies": {
65
31
  },
66
32
  "devDependencies": {
@@ -1,13 +1,14 @@
1
1
  import './pre-start'; // Must be the first import
2
2
  import logger from 'jet-logger';
3
+
4
+ import envVars from '@shared/env-vars';
3
5
  import server from './server';
4
6
 
5
7
 
6
8
  // Constants
7
- const serverStartMsg = 'Express server started on port: ',
8
- port = (process.env.PORT || 3000);
9
+ const serverStartMsg = 'Express server started on port: ';
9
10
 
10
11
  // Start server
11
- server.listen(port, () => {
12
- logger.info(serverStartMsg + port);
12
+ server.listen(envVars.port, () => {
13
+ logger.info(serverStartMsg + envVars.port);
13
14
  });
@@ -2,13 +2,14 @@ import cookieParser from 'cookie-parser';
2
2
  import morgan from 'morgan';
3
3
  import path from 'path';
4
4
  import helmet from 'helmet';
5
+ import logger from 'jet-logger';
5
6
 
6
7
  import express, { NextFunction, Request, Response } from 'express';
7
8
  import StatusCodes from 'http-status-codes';
8
9
  import 'express-async-errors';
9
10
 
10
- import apiRouter from './routes/api';
11
- import logger from 'jet-logger';
11
+ import apiRouter from '@routes/api';
12
+ import envVars from '@shared/env-vars';
12
13
  import { CustomError } from '@shared/errors';
13
14
 
14
15
 
@@ -25,12 +26,12 @@ app.use(express.urlencoded({extended: true}));
25
26
  app.use(cookieParser());
26
27
 
27
28
  // Show routes called in console during development
28
- if (process.env.NODE_ENV === 'development') {
29
+ if (envVars.nodeEnv === 'development') {
29
30
  app.use(morgan('dev'));
30
31
  }
31
32
 
32
33
  // Security (helmet recommended in express docs)
33
- if (process.env.NODE_ENV === 'production') {
34
+ if (envVars.nodeEnv === 'production') {
34
35
  app.use(helmet());
35
36
  }
36
37
 
@@ -0,0 +1,4 @@
1
+ export default {
2
+ nodeEnv: (process.env.NODE_ENV ?? ''),
3
+ port: (process.env.PORT ?? 0),
4
+ } as const;
@@ -0,0 +1 @@
1
+ src/public/
@@ -0,0 +1,35 @@
1
+ {
2
+ "parser": "@typescript-eslint/parser",
3
+ "plugins": [
4
+ "@typescript-eslint"
5
+ ],
6
+ "extends": [
7
+ "eslint:recommended",
8
+ "plugin:@typescript-eslint/recommended",
9
+ "plugin:@typescript-eslint/recommended-requiring-type-checking"
10
+ ],
11
+ "parserOptions": {
12
+ "project": "./tsconfig.json"
13
+ },
14
+ "rules": {
15
+ "max-len": [
16
+ "error",
17
+ {
18
+ "code": 100
19
+ }
20
+ ],
21
+ "no-console": 1,
22
+ "no-extra-boolean-cast": 0,
23
+ "semi": 1,
24
+ "@typescript-eslint/restrict-plus-operands": 0,
25
+ "@typescript-eslint/explicit-module-boundary-types": 0,
26
+ "@typescript-eslint/no-explicit-any": 0,
27
+ "@typescript-eslint/no-floating-promises": 0,
28
+ "@typescript-eslint/no-unsafe-member-access": 0,
29
+ "@typescript-eslint/no-unsafe-assignment": 0,
30
+ "@typescript-eslint/no-misused-promises": 0,
31
+ "@typescript-eslint/no-unsafe-argument": 0,
32
+ "@typescript-eslint/no-unsafe-return": 0,
33
+ "@typescript-eslint/no-unsafe-call": 0
34
+ }
35
+ }
@@ -28,82 +28,8 @@
28
28
  "@routes": "dist/routes",
29
29
  "@util": "dist/util"
30
30
  },
31
- "eslintConfig": {
32
- "parser": "@typescript-eslint/parser",
33
- "plugins": [
34
- "@typescript-eslint"
35
- ],
36
- "extends": [
37
- "eslint:recommended",
38
- "plugin:@typescript-eslint/recommended",
39
- "plugin:@typescript-eslint/recommended-requiring-type-checking"
40
- ],
41
- "parserOptions": {
42
- "project": "./tsconfig.json"
43
- },
44
- "rules": {
45
- "max-len": [
46
- "error",
47
- {
48
- "code": 100
49
- }
50
- ],
51
- "no-console": 1,
52
- "no-extra-boolean-cast": 0,
53
- "@typescript-eslint/restrict-plus-operands": 0,
54
- "@typescript-eslint/explicit-module-boundary-types": 0,
55
- "@typescript-eslint/no-explicit-any": 0,
56
- "@typescript-eslint/no-floating-promises": 0,
57
- "@typescript-eslint/no-unsafe-member-access": 0,
58
- "@typescript-eslint/no-unsafe-assignment": 0
59
- }
60
- },
61
- "eslintIgnore": [
62
- "src/public/",
63
- "build.ts"
64
- ],
65
31
  "dependencies": {
66
- "bcrypt": "^5.0.1",
67
- "command-line-args": "^5.2.1",
68
- "cookie-parser": "^1.4.6",
69
- "dotenv": "^16.0.0",
70
- "express": "^4.17.2",
71
- "express-async-errors": "^3.1.1",
72
- "helmet": "^5.0.2",
73
- "http-status-codes": "^2.2.0",
74
- "jet-logger": "^1.1.5",
75
- "jsonfile": "^6.1.0",
76
- "jsonwebtoken": "^8.5.1",
77
- "module-alias": "^2.2.2",
78
- "morgan": "^1.10.0",
79
- "randomstring": "^1.2.2",
80
- "socket.io": "^4.4.1"
81
32
  },
82
33
  "devDependencies": {
83
- "@types/bcrypt": "^5.0.0",
84
- "@types/command-line-args": "^5.2.0",
85
- "@types/cookie-parser": "^1.4.2",
86
- "@types/express": "^4.17.13",
87
- "@types/find": "^0.2.1",
88
- "@types/fs-extra": "^9.0.13",
89
- "@types/jasmine": "^3.10.3",
90
- "@types/jsonfile": "^6.0.1",
91
- "@types/jsonwebtoken": "^8.5.8",
92
- "@types/morgan": "^1.9.3",
93
- "@types/node": "^17.0.15",
94
- "@types/randomstring": "^1.1.8",
95
- "@types/supertest": "^2.0.11",
96
- "@typescript-eslint/eslint-plugin": "^5.10.2",
97
- "@typescript-eslint/parser": "^5.10.2",
98
- "eslint": "^8.8.0",
99
- "find": "^0.3.0",
100
- "fs-extra": "^10.0.0",
101
- "jasmine": "^4.0.2",
102
- "nodemon": "^2.0.15",
103
- "socket.io-client": "^4.4.1",
104
- "supertest": "^6.2.2",
105
- "ts-node": "^10.4.0",
106
- "tsconfig-paths": "^3.12.0",
107
- "typescript": "^4.5.5"
108
34
  }
109
35
  }
@@ -1,13 +1,14 @@
1
1
  import './pre-start'; // Must be the first import
2
2
  import logger from 'jet-logger';
3
+
3
4
  import server from './server';
5
+ import envVars from '@shared/env-vars';
4
6
 
5
7
 
6
8
  // Constants
7
- const serverStartMsg = 'Express server started on port: ',
8
- port = (process.env.PORT || 3000);
9
+ const serverStartMsg = 'Express server started on port: ';
9
10
 
10
11
  // Start server
11
- server.listen(port, () => {
12
- logger.info(serverStartMsg + port);
12
+ server.listen(envVars.port, () => {
13
+ logger.info(serverStartMsg + envVars.port);
13
14
  });
@@ -1,9 +1,9 @@
1
1
  export default {
2
- nodeEnv: process.env.NODE_ENV ?? '',
3
- port: process.env.PORT ?? 0,
2
+ nodeEnv: (process.env.NODE_ENV ?? ''),
3
+ port: (process.env.PORT ?? 0),
4
4
  cookieProps: {
5
5
  key: 'ExpressGeneratorTs',
6
- secret: process.env.COOKIE_SECRET ?? '',
6
+ secret: (process.env.COOKIE_SECRET ?? ''),
7
7
  options: {
8
8
  httpOnly: true,
9
9
  signed: true,
@@ -14,7 +14,7 @@ export default {
14
14
  },
15
15
  },
16
16
  jwt: {
17
- secret: process.env.JWT_SECRET ?? '',
18
- exp: process.env.COOKIE_EXP ?? '', // exp at the same time as the cookie
17
+ secret: (process.env.JWT_SECRET ?? ''),
18
+ exp: (process.env.COOKIE_EXP ?? ''), // exp at the same time as the cookie
19
19
  },
20
- };
20
+ } as const;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-generator-typescript",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
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",