@aleleba/create-node-ts-graphql-server 1.5.19 → 1.6.0
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 +1 -1
- package/.github/workflows/main-workflow.yml +3 -3
- package/bin/cli.js +1 -1
- package/eslint.config.js +55 -0
- package/package.json +33 -33
- package/src/@types/custom.d.ts +4 -0
- package/src/GraphQL/resolvers/index.ts +1 -0
- package/src/GraphQL/resolvers/test.resolver.ts +20 -6
- package/src/GraphQL/schema/index.ts +10 -2
- package/src/GraphQL/schema/test.schema.ts +3 -8
- package/src/index.ts +1 -1
- package/tsconfig.json +1 -1
- package/.eslintignore +0 -7
- package/.eslintrc.js +0 -37
package/.babelrc
CHANGED
|
@@ -26,7 +26,7 @@ jobs:
|
|
|
26
26
|
node-version: 16
|
|
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
|
|
@@ -40,7 +40,7 @@ jobs:
|
|
|
40
40
|
with:
|
|
41
41
|
node-version: 16
|
|
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
|
|
@@ -54,7 +54,7 @@ jobs:
|
|
|
54
54
|
with:
|
|
55
55
|
node-version: 16
|
|
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
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`
|
package/eslint.config.js
ADDED
|
@@ -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.
|
|
3
|
+
"version": "1.6.0",
|
|
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.
|
|
37
|
-
"body-parser": "^
|
|
36
|
+
"@graphql-tools/schema": "^10.0.23",
|
|
37
|
+
"body-parser": "^2.2.0",
|
|
38
38
|
"class-validator": "^0.14.1",
|
|
39
39
|
"cookie-parse": "^0.4.0",
|
|
40
40
|
"cookie-parser": "^1.4.7",
|
|
41
41
|
"cors": "^2.8.5",
|
|
42
|
-
"dotenv": "^16.
|
|
43
|
-
"express": "^
|
|
44
|
-
"graphql": "^16.
|
|
45
|
-
"graphql-http": "^1.22.
|
|
42
|
+
"dotenv": "^16.5.0",
|
|
43
|
+
"express": "^5.1.0",
|
|
44
|
+
"graphql": "^16.10.0",
|
|
45
|
+
"graphql-http": "^1.22.4",
|
|
46
46
|
"graphql-playground-middleware-express": "^1.7.23",
|
|
47
|
-
"graphql-scalars": "^1.
|
|
47
|
+
"graphql-scalars": "^1.24.2",
|
|
48
48
|
"graphql-subscriptions": "^3.0.0",
|
|
49
|
-
"graphql-tools": "^9.0.
|
|
50
|
-
"graphql-ws": "^
|
|
49
|
+
"graphql-tools": "^9.0.18",
|
|
50
|
+
"graphql-ws": "^6.0.4",
|
|
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.
|
|
54
|
+
"ws": "^8.18.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@babel/core": "^7.26.
|
|
58
|
-
"@babel/preset-env": "^7.26.
|
|
59
|
-
"@babel/preset-typescript": "^7.
|
|
57
|
+
"@babel/core": "^7.26.10",
|
|
58
|
+
"@babel/preset-env": "^7.26.9",
|
|
59
|
+
"@babel/preset-typescript": "^7.27.0",
|
|
60
60
|
"@babel/register": "^7.25.9",
|
|
61
61
|
"@types/body-parser": "^1.19.5",
|
|
62
|
-
"@types/cookie-parser": "^1.4.
|
|
62
|
+
"@types/cookie-parser": "^1.4.8",
|
|
63
63
|
"@types/cors": "^2.8.17",
|
|
64
|
-
"@types/express": "^5.0.
|
|
64
|
+
"@types/express": "^5.0.1",
|
|
65
65
|
"@types/jest": "^29.5.14",
|
|
66
|
-
"@types/node": "^22.
|
|
67
|
-
"@types/supertest": "^6.0.
|
|
66
|
+
"@types/node": "^22.14.1",
|
|
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.
|
|
71
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
72
|
-
"@typescript-eslint/parser": "^8.
|
|
73
|
-
"babel-loader": "^
|
|
70
|
+
"@types/ws": "^8.18.1",
|
|
71
|
+
"@typescript-eslint/eslint-plugin": "^8.30.1",
|
|
72
|
+
"@typescript-eslint/parser": "^8.30.1",
|
|
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.
|
|
77
|
-
"eslint-webpack-plugin": "^
|
|
76
|
+
"eslint": "^9.25.0",
|
|
77
|
+
"eslint-webpack-plugin": "^5.0.1",
|
|
78
78
|
"jest": "^29.7.0",
|
|
79
|
-
"nodemon": "^3.1.
|
|
79
|
+
"nodemon": "^3.1.9",
|
|
80
80
|
"resolve-ts-aliases": "^1.0.1",
|
|
81
|
-
"supertest": "^7.
|
|
82
|
-
"ts-jest": "^29.2
|
|
83
|
-
"ts-loader": "^9.5.
|
|
84
|
-
"typescript": "^5.
|
|
85
|
-
"webpack": "^5.
|
|
86
|
-
"webpack-cli": "^
|
|
87
|
-
"webpack-manifest-plugin": "^5.0.
|
|
81
|
+
"supertest": "^7.1.0",
|
|
82
|
+
"ts-jest": "^29.3.2",
|
|
83
|
+
"ts-loader": "^9.5.2",
|
|
84
|
+
"typescript": "^5.8.3",
|
|
85
|
+
"webpack": "^5.99.6",
|
|
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
|
}
|
package/src/@types/custom.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
9
|
+
export class TestResolverQuery {
|
|
9
10
|
@Query(() => Test)
|
|
10
11
|
async test() {
|
|
11
|
-
return
|
|
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
|
-
|
|
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 {
|
|
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: [
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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/
|
|
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
package/.eslintignore
DELETED
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
|
-
};
|