@aleleba/create-node-ts-graphql-server 1.4.2 → 1.4.3
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/.env.example +0 -2
- package/README.md +1 -3
- package/bin/cli.js +2 -2
- package/config/index.ts +0 -2
- package/package.json +11 -11
- package/src/GraphQL/server.ts +6 -9
package/.env.example
CHANGED
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ This project aims to have a starter kit for creating a new Node with typescript,
|
|
|
5
5
|
Tech(Library or Framework) | Version |
|
|
6
6
|
--- | --- |
|
|
7
7
|
Jest (Testing) | 29.5.0
|
|
8
|
-
Typescript |
|
|
8
|
+
Typescript | 5.0.2
|
|
9
9
|
GraphQL | 16.6.0
|
|
10
10
|
Type GraphQL | 2.0.0-beta.1
|
|
11
11
|
|
|
@@ -25,8 +25,6 @@ This is an example of config.
|
|
|
25
25
|
ENVIRONMENT=development
|
|
26
26
|
#WHITELIST URLS Default to http://localhost
|
|
27
27
|
WHITELIST_URLS=https://someurl.com
|
|
28
|
-
#GRAPHIQL Default to "false"
|
|
29
|
-
GRAPHIQL=true
|
|
30
28
|
#PLAYGROUND GRAPHQL Default to "false"
|
|
31
29
|
PLAYGROUND_GRAPHQL=true
|
|
32
30
|
# PORT EXPOSE APP Default to 4000
|
package/bin/cli.js
CHANGED
|
@@ -67,7 +67,7 @@ if(!checkedOut) process.exit(-1);
|
|
|
67
67
|
|
|
68
68
|
const actualVersion = runCommandWithOutput(`cd ${repoName} && node -p "require('./package.json').version"`).toString().trim()
|
|
69
69
|
|
|
70
|
-
const installDepsCommand = `cd ${repoName} && npm install
|
|
70
|
+
const installDepsCommand = `cd ${repoName} && npm install`;
|
|
71
71
|
const cleanGitHistoryCommand = `cd ${repoName} && rm -rf .git && git init && git add --all -- ":!.github" ":!bin" && git commit -m "Initial commit"`
|
|
72
72
|
const cleanGitHistoryCommandWindows = `cd ${repoName} && rmdir .git /s /q && git init && git add --all -- ":!.github" ":!bin" && git commit -m "Initial commit"`
|
|
73
73
|
const deleteFoldersCommand = `cd ${repoName} && rm -rf .github && rm -rf bin`
|
|
@@ -102,7 +102,7 @@ if(!cleanGitHistory) process.exit(-1);
|
|
|
102
102
|
|
|
103
103
|
console.log("Congratulations! You are ready. Follow the following commands to start");
|
|
104
104
|
console.log(`cd ${repoName}`);
|
|
105
|
-
console.log('Create a .env file with ENV=development(defauld: production), PORT=4000 (default: 4000), WHITELIST_URLS=your_url(default: http://localhost)
|
|
105
|
+
console.log('Create a .env file with ENV=development(defauld: production), PORT=4000 (default: 4000), WHITELIST_URLS=your_url(default: http://localhost)');
|
|
106
106
|
console.log(`Then you can run: npm start:dev`);
|
|
107
107
|
|
|
108
108
|
const deleteFolders = isWin ? runCommand(deleteFoldersCommandWindows) : runCommand(deleteFoldersCommand);
|
package/config/index.ts
CHANGED
|
@@ -4,7 +4,6 @@ dotenv.config();
|
|
|
4
4
|
|
|
5
5
|
export const deFaultValues = {
|
|
6
6
|
ENV: 'production',
|
|
7
|
-
GRAPHIQL: 'false',
|
|
8
7
|
PLAYGROUND_GRAPHQL: 'false',
|
|
9
8
|
WHITELIST_URLS: 'http://localhost',
|
|
10
9
|
PORT: 4000,
|
|
@@ -12,7 +11,6 @@ export const deFaultValues = {
|
|
|
12
11
|
|
|
13
12
|
export const config = {
|
|
14
13
|
ENV: process.env.ENV,
|
|
15
|
-
GRAPHIQL: process.env.GRAPHIQL === 'true' ? true : false,
|
|
16
14
|
PLAYGROUND_GRAPHQL: process.env.PLAYGROUND_GRAPHQL === 'true' ? true : false,
|
|
17
15
|
WHITELIST_URLS: process.env.WHITELIST_URLS ? process.env.WHITELIST_URLS.split(',') : deFaultValues.WHITELIST_URLS,
|
|
18
16
|
PORT: process.env.PORT,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aleleba/create-node-ts-graphql-server",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"description": "Node with Typescript and GraphQL Server",
|
|
5
5
|
"bin": "./bin/cli.js",
|
|
6
6
|
"main": "index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"lint:fix": "eslint ./ --ext .js --ext .ts --fix",
|
|
14
14
|
"test": "jest",
|
|
15
15
|
"test:watch": "jest --watch",
|
|
16
|
-
"check-updates": "npx npm-check-updates -u && npm i
|
|
16
|
+
"check-updates": "npx npm-check-updates -u && npm i"
|
|
17
17
|
},
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"cors": "^2.8.5",
|
|
41
41
|
"dotenv": "^16.0.3",
|
|
42
42
|
"express": "^4.18.2",
|
|
43
|
-
"express-graphql": "^0.12.0",
|
|
44
43
|
"graphql": "^16.6.0",
|
|
44
|
+
"graphql-http": "^1.16.0",
|
|
45
45
|
"graphql-playground-middleware-express": "^1.7.23",
|
|
46
46
|
"graphql-subscriptions": "^2.0.0",
|
|
47
47
|
"graphql-tools": "^8.3.19",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"ws": "^8.13.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@babel/core": "^7.21.
|
|
55
|
+
"@babel/core": "^7.21.3",
|
|
56
56
|
"@babel/preset-env": "^7.20.2",
|
|
57
57
|
"@babel/preset-typescript": "^7.21.0",
|
|
58
58
|
"@babel/register": "^7.21.0",
|
|
@@ -60,27 +60,27 @@
|
|
|
60
60
|
"@types/cookie-parser": "^1.4.3",
|
|
61
61
|
"@types/cors": "^2.8.13",
|
|
62
62
|
"@types/express": "^4.17.17",
|
|
63
|
-
"@types/jest": "^29.
|
|
64
|
-
"@types/node": "^18.15.
|
|
63
|
+
"@types/jest": "^29.5.0",
|
|
64
|
+
"@types/node": "^18.15.5",
|
|
65
65
|
"@types/supertest": "^2.0.12",
|
|
66
66
|
"@types/webpack": "^5.28.0",
|
|
67
67
|
"@types/webpack-node-externals": "^3.0.0",
|
|
68
68
|
"@types/ws": "^8.5.4",
|
|
69
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
70
|
-
"@typescript-eslint/parser": "^5.
|
|
69
|
+
"@typescript-eslint/eslint-plugin": "^5.56.0",
|
|
70
|
+
"@typescript-eslint/parser": "^5.56.0",
|
|
71
71
|
"babel-loader": "^9.1.2",
|
|
72
72
|
"clean-webpack-plugin": "^4.0.0",
|
|
73
73
|
"compression-webpack-plugin": "^10.0.0",
|
|
74
74
|
"eslint": "^8.36.0",
|
|
75
75
|
"eslint-webpack-plugin": "^4.0.0",
|
|
76
76
|
"jest": "^29.5.0",
|
|
77
|
-
"nodemon": "^2.0.
|
|
77
|
+
"nodemon": "^2.0.22",
|
|
78
78
|
"resolve-ts-aliases": "^1.0.1",
|
|
79
79
|
"supertest": "^6.3.3",
|
|
80
80
|
"ts-jest": "^29.0.5",
|
|
81
81
|
"ts-loader": "^9.4.2",
|
|
82
|
-
"typescript": "^
|
|
83
|
-
"webpack": "^5.76.
|
|
82
|
+
"typescript": "^5.0.2",
|
|
83
|
+
"webpack": "^5.76.3",
|
|
84
84
|
"webpack-cli": "^5.0.1",
|
|
85
85
|
"webpack-manifest-plugin": "^5.0.0",
|
|
86
86
|
"webpack-node-externals": "^3.0.0",
|
package/src/GraphQL/server.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
import express from 'express'; //express
|
|
4
|
-
import { graphqlHTTP } from 'express-graphql';
|
|
5
|
-
import {
|
|
4
|
+
// import { graphqlHTTP } from 'express-graphql';
|
|
5
|
+
import { createHandler } from 'graphql-http/lib/use/express';
|
|
6
6
|
import schema from '@src/GraphQL/schema';
|
|
7
7
|
|
|
8
8
|
|
|
@@ -10,13 +10,10 @@ const server = express.Router();//Router de Express
|
|
|
10
10
|
|
|
11
11
|
server.use(
|
|
12
12
|
'/',
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
context: { req, res }
|
|
18
|
-
};
|
|
19
|
-
}),
|
|
13
|
+
createHandler({
|
|
14
|
+
schema,
|
|
15
|
+
context: (req, res) => ({ req, res })
|
|
16
|
+
})
|
|
20
17
|
);
|
|
21
18
|
|
|
22
19
|
// DO NOT DO app.listen() unless we're testing this directly
|