@aleleba/create-node-ts-graphql-server 1.0.7 → 1.0.10

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 CHANGED
@@ -4,5 +4,7 @@ ENVIRONMENT=
4
4
  WHITELIST_URLS=
5
5
  #GRAPHIQL Default to "false"
6
6
  GRAPHIQL=
7
+ #PLAYGROUND GRAPHQL Default to "false"
8
+ PLAYGROUND_GRAPHQL=
7
9
  # PORT EXPOSE APP Default to 4000
8
10
  PORT=
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) | 28.1.0
8
- Typescript | 4.7.2
8
+ Typescript | 4.7.3
9
9
  GraphQL | 16.5.0
10
10
 
11
11
  ## Setup
@@ -26,6 +26,8 @@ ENVIRONMENT=development
26
26
  WHITELIST_URLS=https://someurl.com
27
27
  #GRAPHIQL Default to "false"
28
28
  GRAPHIQL=true
29
+ #PLAYGROUND GRAPHQL Default to "false"
30
+ PLAYGROUND_GRAPHQL=true
29
31
  # PORT EXPOSE APP Default to 4000
30
32
  PORT=4000
31
33
  ```
package/bin/cli.js CHANGED
@@ -13,7 +13,7 @@ const runCommand = command => {
13
13
 
14
14
  const repoName = process.argv[2];
15
15
  const gitCheckoutCommand = `git clone --depth 1 https://github.com/aleleba/create-node-ts-graphql-server ${repoName}`;
16
- const installDepsCommand = `cd ${repoName} && rm -rf .git && git init && git add . && git commit -m "Initial commit" && npm install`;
16
+ const installDepsCommand = `cd ${repoName} && rm -rf .git && git init && git add . && git commit -m "Initial commit" && npm install --legacy-peer-deps`;
17
17
 
18
18
  console.log(`Cloning the repository with name ${repoName}`);
19
19
  const checkedOut = runCommand(gitCheckoutCommand);
package/config/index.ts CHANGED
@@ -5,6 +5,7 @@ dotenv.config();
5
5
  export const config = {
6
6
  env: process.env.ENVIRONMENT ? process.env.ENVIRONMENT : 'production',
7
7
  graphiQL: process.env.GRAPHIQL === 'true' ? true : false,
8
+ playgroundGraphQL: process.env.PLAYGROUND_GRAPHQL === 'true' ? true : false,
8
9
  whiteList: process.env.WHITELIST_URLS ? process.env.WHITELIST_URLS.split(',') : [
9
10
  'http://localhost'
10
11
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aleleba/create-node-ts-graphql-server",
3
- "version": "1.0.7",
3
+ "version": "1.0.10",
4
4
  "description": "Node with Typescript and GraphQL Server",
5
5
  "bin": "./bin/cli.js",
6
6
  "main": "index.js",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "homepage": "https://github.com/aleleba/node-ts-graphql-server#readme",
34
34
  "dependencies": {
35
- "@graphql-tools/schema": "^8.3.13",
35
+ "@graphql-tools/schema": "^8.3.14",
36
36
  "body-parser": "^1.20.0",
37
37
  "cookie-parser": "^1.4.6",
38
38
  "cors": "^2.8.5",
@@ -40,35 +40,36 @@
40
40
  "express": "^4.18.1",
41
41
  "express-graphql": "^0.12.0",
42
42
  "graphql": "^16.5.0",
43
+ "graphql-playground-middleware-express": "^1.7.23",
43
44
  "graphql-subscriptions": "^2.0.0",
44
- "graphql-tools": "^8.2.11",
45
- "graphql-ws": "^5.8.2",
45
+ "graphql-tools": "^8.2.12",
46
+ "graphql-ws": "^5.9.0",
46
47
  "web-push": "^3.5.0",
47
- "ws": "^8.7.0"
48
+ "ws": "^8.8.0"
48
49
  },
49
50
  "devDependencies": {
50
51
  "@babel/core": "^7.18.2",
51
52
  "@babel/preset-env": "^7.18.2",
52
53
  "@babel/preset-typescript": "^7.17.12",
53
54
  "@babel/register": "^7.17.7",
54
- "@types/jest": "^27.5.1",
55
- "@types/node": "^17.0.36",
55
+ "@types/jest": "^28.1.1",
56
+ "@types/node": "^17.0.41",
56
57
  "@types/webpack": "^5.28.0",
57
58
  "@types/webpack-node-externals": "^2.5.3",
58
- "@typescript-eslint/eslint-plugin": "^5.27.0",
59
- "@typescript-eslint/parser": "^5.27.0",
59
+ "@typescript-eslint/eslint-plugin": "^5.27.1",
60
+ "@typescript-eslint/parser": "^5.27.1",
60
61
  "babel-loader": "^8.2.5",
61
62
  "clean-webpack-plugin": "^4.0.0",
62
63
  "compression-webpack-plugin": "^10.0.0",
63
- "eslint": "^8.16.0",
64
+ "eslint": "^8.17.0",
64
65
  "eslint-webpack-plugin": "^3.1.1",
65
- "jest": "^28.1.0",
66
+ "jest": "^28.1.1",
66
67
  "nodemon": "^2.0.16",
67
68
  "supertest": "^6.2.3",
68
- "ts-jest": "^28.0.3",
69
+ "ts-jest": "^28.0.4",
69
70
  "ts-loader": "^9.3.0",
70
- "typescript": "^4.7.2",
71
- "webpack": "^5.72.1",
71
+ "typescript": "^4.7.3",
72
+ "webpack": "^5.73.0",
72
73
  "webpack-cli": "^4.9.2",
73
74
  "webpack-manifest-plugin": "^5.0.0",
74
75
  "webpack-node-externals": "^3.0.0",
package/src/index.ts CHANGED
@@ -7,11 +7,11 @@ import cookieParser from 'cookie-parser';
7
7
  import { useServer } from 'graphql-ws/lib/use/ws';
8
8
  import { execute, subscribe } from 'graphql';
9
9
  import GraphQLserver from './GraphQL/server';// Server of GraphQL,
10
+ import expressPlayground from 'graphql-playground-middleware-express';
10
11
  import schema from './GraphQL/schema';
11
12
  import { config } from '../config';
12
13
  import apiRouter from './routes';
13
14
 
14
-
15
15
  const app = express(), //creating app
16
16
  whitelist = config.whiteList,
17
17
  corsOptions = {
@@ -34,6 +34,10 @@ app
34
34
  .use(apiRouter)//Routes de App
35
35
  .use('/graphql', GraphQLserver);//Server of Graphql
36
36
 
37
+ if(config.playgroundGraphQL === true){
38
+ app.get('/playground', expressPlayground({ endpoint: '/graphql' }));
39
+ }
40
+
37
41
  // DO NOT DO app.listen() unless we're testing this directly
38
42
  if (require.main === module) {
39
43