@aleleba/create-node-ts-graphql-server 1.5.19 → 1.6.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.
package/.babelrc CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "presets": [
3
- "@babel/preset-env",
3
+ ["@babel/preset-env", {"targets": {"node": "current"}}],
4
4
  "@babel/preset-typescript"
5
5
  ]
6
6
  }
@@ -16,17 +16,17 @@ jobs:
16
16
  runs-on: ubuntu-latest
17
17
  strategy:
18
18
  matrix:
19
- node-version: [16.x]
19
+ node-version: [20.x]
20
20
  # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
21
21
  steps:
22
22
  - uses: actions/checkout@v3
23
- - name: Use Node.js 16
23
+ - name: Use Node.js 20
24
24
  uses: actions/setup-node@v3
25
25
  with:
26
- node-version: 16
26
+ node-version: 20
27
27
  cache: 'npm'
28
28
  registry-url: https://registry.npmjs.org/
29
- - run: npm ci
29
+ - run: npm ci --legacy-peer-deps
30
30
  - run: npm test
31
31
 
32
32
  # Job to build the package
@@ -38,9 +38,9 @@ jobs:
38
38
  - uses: actions/checkout@v3
39
39
  - uses: actions/setup-node@v3
40
40
  with:
41
- node-version: 16
41
+ node-version: 20
42
42
  registry-url: https://registry.npmjs.org/
43
- - run: npm ci
43
+ - run: npm ci --legacy-peer-deps
44
44
  - run: npm run build
45
45
 
46
46
  # Job to publish the package to npm
@@ -52,9 +52,9 @@ jobs:
52
52
  - uses: actions/checkout@v3
53
53
  - uses: actions/setup-node@v3
54
54
  with:
55
- node-version: 16
55
+ node-version: 20
56
56
  registry-url: https://registry.npmjs.org/
57
- - run: npm ci
57
+ - run: npm ci --legacy-peer-deps
58
58
  - run: npm publish --access=public
59
59
  env:
60
- NPM_PERSONAL_TOKEN: ${{secrets.npm_token}}
60
+ NPM_PERSONAL_TOKEN: ${{secrets.npm_token}}
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 i`;
70
+ const installDepsCommand = `cd ${repoName} && npm i --legacy-peer-deps`;
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`
@@ -0,0 +1,55 @@
1
+ import globals from 'globals';
2
+ import tseslint from 'typescript-eslint';
3
+ import js from '@eslint/js';
4
+
5
+ export default [
6
+ // Ignorar archivos y carpetas especificados en el antiguo .eslintignore
7
+ {
8
+ ignores: [
9
+ '.eslintrc.js', // Aunque se eliminará, es bueno mantenerlo por si acaso
10
+ 'build/',
11
+ 'webpack.config.ts',
12
+ 'webpack.config.dev.ts',
13
+ ],
14
+ },
15
+
16
+ // Configuración recomendada por ESLint
17
+ js.configs.recommended,
18
+
19
+ // Configuraciones recomendadas por typescript-eslint
20
+ ...tseslint.configs.recommended,
21
+
22
+ // Configuración personalizada
23
+ {
24
+ languageOptions: {
25
+ ecmaVersion: 2021,
26
+ sourceType: 'module',
27
+ globals: {
28
+ ...globals.browser,
29
+ ...globals.node,
30
+ },
31
+ // El parser ya está configurado por tseslint.configs.recommended
32
+ },
33
+ // Los plugins ya están configurados por tseslint.configs.recommended
34
+ rules: {
35
+ // Reglas personalizadas del antiguo .eslintrc.js
36
+ 'indent': [
37
+ 'error',
38
+ 'tab'
39
+ ],
40
+ 'linebreak-style': [
41
+ 'error',
42
+ 'unix'
43
+ ],
44
+ 'quotes': [
45
+ 'error',
46
+ 'single'
47
+ ],
48
+ 'semi': [
49
+ 'error',
50
+ 'always'
51
+ ],
52
+ // Puedes añadir o sobrescribir reglas de las configuraciones recomendadas aquí si es necesario
53
+ },
54
+ }
55
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aleleba/create-node-ts-graphql-server",
3
- "version": "1.5.19",
3
+ "version": "1.6.1",
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 --legacy-peer-deps"
17
17
  },
18
18
  "repository": {
19
19
  "type": "git",
@@ -33,58 +33,58 @@
33
33
  },
34
34
  "homepage": "https://github.com/aleleba/node-ts-graphql-server#readme",
35
35
  "dependencies": {
36
- "@graphql-tools/schema": "^10.0.8",
37
- "body-parser": "^1.20.3",
38
- "class-validator": "^0.14.1",
36
+ "@graphql-tools/schema": "^10.0.25",
37
+ "body-parser": "^2.2.0",
38
+ "class-validator": "^0.14.2",
39
39
  "cookie-parse": "^0.4.0",
40
40
  "cookie-parser": "^1.4.7",
41
41
  "cors": "^2.8.5",
42
- "dotenv": "^16.4.5",
43
- "express": "^4.21.1",
44
- "graphql": "^16.9.0",
45
- "graphql-http": "^1.22.2",
42
+ "dotenv": "^17.2.0",
43
+ "express": "^5.1.0",
44
+ "graphql": "^16.11.0",
45
+ "graphql-http": "^1.22.4",
46
46
  "graphql-playground-middleware-express": "^1.7.23",
47
- "graphql-scalars": "^1.23.0",
47
+ "graphql-scalars": "^1.24.2",
48
48
  "graphql-subscriptions": "^3.0.0",
49
- "graphql-tools": "^9.0.3",
50
- "graphql-ws": "^5.16.0",
49
+ "graphql-tools": "^9.0.20",
50
+ "graphql-ws": "^6.0.6",
51
51
  "reflect-metadata": "^0.2.2",
52
52
  "type-graphql": "^2.0.0-rc.2",
53
53
  "web-push": "^3.6.7",
54
- "ws": "^8.18.0"
54
+ "ws": "^8.18.3"
55
55
  },
56
56
  "devDependencies": {
57
- "@babel/core": "^7.26.0",
58
- "@babel/preset-env": "^7.26.0",
59
- "@babel/preset-typescript": "^7.26.0",
60
- "@babel/register": "^7.25.9",
61
- "@types/body-parser": "^1.19.5",
62
- "@types/cookie-parser": "^1.4.7",
63
- "@types/cors": "^2.8.17",
64
- "@types/express": "^5.0.0",
65
- "@types/jest": "^29.5.14",
66
- "@types/node": "^22.9.0",
67
- "@types/supertest": "^6.0.2",
57
+ "@babel/core": "^7.28.0",
58
+ "@babel/preset-env": "^7.28.0",
59
+ "@babel/preset-typescript": "^7.27.1",
60
+ "@babel/register": "^7.27.1",
61
+ "@types/body-parser": "^1.19.6",
62
+ "@types/cookie-parser": "^1.4.9",
63
+ "@types/cors": "^2.8.19",
64
+ "@types/express": "^5.0.3",
65
+ "@types/jest": "^30.0.0",
66
+ "@types/node": "^24.0.15",
67
+ "@types/supertest": "^6.0.3",
68
68
  "@types/webpack": "^5.28.5",
69
69
  "@types/webpack-node-externals": "^3.0.4",
70
- "@types/ws": "^8.5.13",
71
- "@typescript-eslint/eslint-plugin": "^8.14.0",
72
- "@typescript-eslint/parser": "^8.14.0",
73
- "babel-loader": "^9.2.1",
70
+ "@types/ws": "^8.18.1",
71
+ "@typescript-eslint/eslint-plugin": "^8.38.0",
72
+ "@typescript-eslint/parser": "^8.38.0",
73
+ "babel-loader": "^10.0.0",
74
74
  "clean-webpack-plugin": "^4.0.0",
75
75
  "compression-webpack-plugin": "^11.1.0",
76
- "eslint": "^9.14.0",
77
- "eslint-webpack-plugin": "^4.2.0",
78
- "jest": "^29.7.0",
79
- "nodemon": "^3.1.7",
76
+ "eslint": "^9.31.0",
77
+ "eslint-webpack-plugin": "^5.0.2",
78
+ "jest": "^30.0.4",
79
+ "nodemon": "^3.1.10",
80
80
  "resolve-ts-aliases": "^1.0.1",
81
- "supertest": "^7.0.0",
82
- "ts-jest": "^29.2.5",
83
- "ts-loader": "^9.5.1",
84
- "typescript": "^5.6.3",
85
- "webpack": "^5.96.1",
86
- "webpack-cli": "^5.1.4",
87
- "webpack-manifest-plugin": "^5.0.0",
81
+ "supertest": "^7.1.3",
82
+ "ts-jest": "^29.4.0",
83
+ "ts-loader": "^9.5.2",
84
+ "typescript": "^5.8.3",
85
+ "webpack": "^5.100.2",
86
+ "webpack-cli": "^6.0.1",
87
+ "webpack-manifest-plugin": "^5.0.1",
88
88
  "webpack-node-externals": "^3.0.0",
89
89
  "webpack-shell-plugin-next": "^2.3.2"
90
90
  }
@@ -7,4 +7,8 @@ declare module "*.gql" {
7
7
  declare module 'cookie-parse' {
8
8
  const content: any;
9
9
  export default content;
10
+ }
11
+
12
+ declare module 'graphql-ws/use/ws' {
13
+ export * from 'graphql-ws/dist/use/ws';
10
14
  }
@@ -0,0 +1 @@
1
+ export * from './test.resolver';
@@ -1,19 +1,33 @@
1
1
  /* eslint-disable no-mixed-spaces-and-tabs */
2
2
  'use strict';
3
3
 
4
- import { Query, Resolver, Mutation } from 'type-graphql';
5
- import { Test, TestMutation } from '@GraphQL/schema/test.schema';
4
+ import { Query, Resolver, Mutation, FieldResolver, Root, Arg } from 'type-graphql';
5
+ import { Test, TestMutation } from '@GraphQL/schema';
6
+ import { getTest, addText } from '@controllerGraphQL';
6
7
 
7
8
  @Resolver(() => Test)
8
- export class TestResolver {
9
+ export class TestResolverQuery {
9
10
  @Query(() => Test)
10
11
  async test() {
11
- return Test;
12
+ return {};
12
13
  }
13
14
 
15
+ @FieldResolver(() => String)
16
+ async text() {
17
+ return await getTest({});
18
+ }
19
+ }
20
+
21
+ @Resolver(() => TestMutation)
22
+ export class TestResolverMutation {
14
23
  @Mutation(() => TestMutation)
15
24
  async testMutation() {
16
- return TestMutation;
17
- }
25
+ return {};
26
+ }
27
+
28
+ @FieldResolver(() => String)
29
+ async text(@Arg('text') text?: string){
30
+ return await addText({text});
31
+ }
18
32
  }
19
33
 
@@ -1,10 +1,18 @@
1
1
  'use strict'
2
2
 
3
3
  import { buildSchemaSync } from "type-graphql"
4
- import { TestResolver } from "@GraphQL/resolvers/test.resolver";
4
+ import {
5
+ TestResolverQuery,
6
+ TestResolverMutation
7
+ } from "@GraphQL/resolvers";
8
+
9
+ export * from './test.schema'
5
10
 
6
11
  const schema = buildSchemaSync({
7
- resolvers: [TestResolver],
12
+ resolvers: [
13
+ TestResolverQuery,
14
+ TestResolverMutation,
15
+ ],
8
16
  emitSchemaFile: true,
9
17
  })
10
18
  export default schema
@@ -1,21 +1,16 @@
1
1
  /* eslint-disable no-mixed-spaces-and-tabs */
2
2
  'use strict';
3
3
 
4
- import { Field, ObjectType, Arg } from 'type-graphql';
5
- import { getTest, addText } from '@controllerGraphQL';
4
+ import { Field, ObjectType } from 'type-graphql';
6
5
 
7
6
  @ObjectType()
8
7
  export class Test {
9
8
  @Field(() => String)
10
- async text(){
11
- return await getTest({});
12
- }
9
+ text?: string;
13
10
  }
14
11
 
15
12
  @ObjectType()
16
13
  export class TestMutation {
17
14
  @Field(() => String)
18
- async text(@Arg('text') text?: string){
19
- return await addText({text});
20
- }
15
+ text?: string;
21
16
  }
package/src/index.ts CHANGED
@@ -5,7 +5,7 @@ import ws from 'ws'; // yarn add ws
5
5
  import express from 'express'; //express
6
6
  import cors from 'cors';
7
7
  import cookieParser from 'cookie-parser';
8
- import { useServer } from 'graphql-ws/lib/use/ws';
8
+ import { useServer } from 'graphql-ws/use/ws';
9
9
  import { execute, subscribe } from 'graphql';
10
10
  import GraphQLserver from '@GraphQL/server';// Server of GraphQL,
11
11
  import expressPlayground from 'graphql-playground-middleware-express';
package/tsconfig.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "compilerOptions": {
3
3
  "module": "commonjs",
4
4
  "esModuleInterop": true,
5
- "target": "es2018",
5
+ "target": "es2021",
6
6
  "moduleResolution": "node",
7
7
  "sourceMap": true,
8
8
  "typeRoots" : ["./src/@types", "./node_modules/@types"],
package/.eslintignore DELETED
@@ -1,7 +0,0 @@
1
- #Eslint
2
- .eslintrc.js
3
- #Build
4
- build
5
- #Webpack
6
- webpack.config.ts
7
- webpack.config.dev.ts
package/.eslintrc.js DELETED
@@ -1,37 +0,0 @@
1
- module.exports = {
2
- 'env': {
3
- 'browser': true,
4
- 'es2021': true,
5
- 'node': true,
6
- },
7
- 'extends': [
8
- 'eslint:recommended',
9
- 'plugin:@typescript-eslint/recommended'
10
- ],
11
- 'parser': '@typescript-eslint/parser',
12
- 'parserOptions': {
13
- 'ecmaVersion': 'latest',
14
- 'sourceType': 'module'
15
- },
16
- 'plugins': [
17
- '@typescript-eslint'
18
- ],
19
- 'rules': {
20
- 'indent': [
21
- 'error',
22
- 'tab'
23
- ],
24
- 'linebreak-style': [
25
- 'error',
26
- 'unix'
27
- ],
28
- 'quotes': [
29
- 'error',
30
- 'single'
31
- ],
32
- 'semi': [
33
- 'error',
34
- 'always'
35
- ]
36
- }
37
- };