PR-736133: Update dependencies and bump version to 1.6.6

Run check-updates and keep majors that are incompatible with
type-graphql 2.0.0-rc.3 or the current tooling (typescript 6, graphql 16,
graphql-scalars 1, Babel 7). Declare previously transitive imports
(terser-webpack-plugin, globals, typescript-eslint, @eslint/js) as
devDependencies so build and lint work again. Fix lint errors and update
the versions listed in the README.
This commit is contained in:
2026-12-02 06:45:46 +00:00
parent 2d43472d2a
commit a5d7b2bebc
11 changed files with 4597 additions and 2542 deletions
+2 -2
View File
@@ -4,9 +4,9 @@ This project aims to have a starter kit for creating a new Node with typescript,
Tech(Library or Framework) | Version |
--- | --- |
Jest (Testing) | 30.4.2
Jest (Testing) | 30.5.2
Typescript | 6.0.3
GraphQL | 16.14.1
GraphQL | 16.15.0
Type GraphQL | 2.0.0-rc.3
## Setup
+71 -70
View File
@@ -1,63 +1,64 @@
#!/usr/bin/env node
/* eslint-disable @typescript-eslint/no-require-imports */
const { execSync } = require('child_process');
var fs = require('fs');
const isWin = process.platform === "win32";
const isWin = process.platform === 'win32';
const runCommand = command => {
try{
execSync(`${command}`, {stdio: 'inherit'});
} catch (e) {
console.error(`Failed to execute ${command}`, e);
return false;
}
return true;
}
try{
execSync(`${command}`, {stdio: 'inherit'});
} catch (e) {
console.error(`Failed to execute ${command}`, e);
return false;
}
return true;
};
const runCommandWithOutput = command => {
try{
return execSync(`${command}`);
} catch (e) {
console.error(`Failed to execute ${command}`, e);
return false;
}
}
try{
return execSync(`${command}`);
} catch (e) {
console.error(`Failed to execute ${command}`, e);
return false;
}
};
const replaceTextOnFile = ({
file,
textToBeReplaced,
textReplace,
arrOfObjectsBeReplaced
file,
textToBeReplaced,
textReplace,
arrOfObjectsBeReplaced
}) => {
let data
try{
data = fs.readFileSync(file, 'utf8');
} catch (e) {
console.error(`Failed to read file ${file}`, e);
return false;
}
let data;
try{
data = fs.readFileSync(file, 'utf8');
} catch (e) {
console.error(`Failed to read file ${file}`, e);
return false;
}
let result
if(arrOfObjectsBeReplaced){
arrOfObjectsBeReplaced.forEach( obj => {
if(result){
result = result.replace(obj.textToBeReplaced, obj.textReplace).replace(/^\s*[\r\n]/gm, ' ');
}else{
result = data.replace(obj.textToBeReplaced, obj.textReplace).replace(/^\s*[\r\n]/gm, ' ');
}
})
}else{
result = data.replace(textToBeReplaced, textReplace).replace(/^\s*[\r\n]/gm, ' ');
}
let result;
if(arrOfObjectsBeReplaced){
arrOfObjectsBeReplaced.forEach( obj => {
if(result){
result = result.replace(obj.textToBeReplaced, obj.textReplace).replace(/^\s*[\r\n]/gm, ' ');
}else{
result = data.replace(obj.textToBeReplaced, obj.textReplace).replace(/^\s*[\r\n]/gm, ' ');
}
});
}else{
result = data.replace(textToBeReplaced, textReplace).replace(/^\s*[\r\n]/gm, ' ');
}
try{
console.log('text changed')
fs.writeFileSync(file, result, 'utf8');
} catch (e) {
console.error(`Failed to read file ${file}`, e);
return false;
}
}
try{
console.log('text changed');
fs.writeFileSync(file, result, 'utf8');
} catch (e) {
console.error(`Failed to read file ${file}`, e);
return false;
}
};
const repoName = process.argv[2];
const gitCheckoutCommand = `git clone --depth 1 https://github.com/aleleba/create-node-ts-graphql-server ${repoName}`;
@@ -65,13 +66,13 @@ console.log(`Cloning the repository with name ${repoName}`);
const checkedOut = runCommand(gitCheckoutCommand);
if(!checkedOut) process.exit(-1);
const actualVersion = runCommandWithOutput(`cd ${repoName} && node -p "require('./package.json').version"`).toString().trim()
const actualVersion = runCommandWithOutput(`cd ${repoName} && node -p "require('./package.json').version"`).toString().trim();
const installDepsCommand = `cd ${repoName} && npm i`;
const cleanGitHistoryCommand = `cd ${repoName} && rm -rf .git && git init && git add --all -- ":!.github" ":!bin" && git commit -m "Initial commit"`
const cleanGitHistoryCommandWindows = `cd ${repoName} && rmdir .git /s /q && git init && git add --all -- ":!.github" ":!bin" && git commit -m "Initial commit"`
const deleteFoldersCommand = `cd ${repoName} && rm -rf .github && rm -rf bin`
const deleteFoldersCommandWindows = `cd ${repoName} && rmdir .github /s /q && rmdir bin /s /q`
const cleanGitHistoryCommand = `cd ${repoName} && rm -rf .git && git init && git add --all -- ":!.github" ":!bin" && git commit -m "Initial commit"`;
const cleanGitHistoryCommandWindows = `cd ${repoName} && rmdir .git /s /q && git init && git add --all -- ":!.github" ":!bin" && git commit -m "Initial commit"`;
const deleteFoldersCommand = `cd ${repoName} && rm -rf .github && rm -rf bin`;
const deleteFoldersCommandWindows = `cd ${repoName} && rmdir .github /s /q && rmdir bin /s /q`;
console.log(`Installing dependencies for ${repoName}`);
const installedDeps = runCommand(installDepsCommand);
@@ -79,31 +80,31 @@ if(!installedDeps) process.exit(-1);
console.log(`Replacing Json data for ${repoName}`);
replaceTextOnFile({
file: `./${repoName}/package.json`,
arrOfObjectsBeReplaced: [
{
textToBeReplaced: `"bin": "./bin/cli.js",`,
textReplace: ``
},
{
textToBeReplaced: `"version": "${actualVersion}",`,
textReplace: `"version": "0.0.1",`
},
{
textToBeReplaced: `"name": "@aleleba/create-node-ts-graphql-server",`,
textReplace: `"name": "${repoName}",`
}
]
})
file: `./${repoName}/package.json`,
arrOfObjectsBeReplaced: [
{
textToBeReplaced: '"bin": "./bin/cli.js",',
textReplace: ''
},
{
textToBeReplaced: `"version": "${actualVersion}",`,
textReplace: '"version": "0.0.1",'
},
{
textToBeReplaced: '"name": "@aleleba/create-node-ts-graphql-server",',
textReplace: `"name": "${repoName}",`
}
]
});
console.log(`Cleaning History of Git for ${repoName}`);
const cleanGitHistory = isWin ? runCommand(cleanGitHistoryCommandWindows) : runCommand(cleanGitHistoryCommand);
if(!cleanGitHistory) process.exit(-1);
console.log("Congratulations! You are ready. Follow the following commands to start");
console.log('Congratulations! You are ready. Follow the following commands to start');
console.log(`cd ${repoName}`);
console.log('Create a .env file with ENV=development(defauld: production), PORT=4000 (default: 4000), WHITELIST_URLS=your_url(default: http://localhost)');
console.log(`Then you can run: npm start:dev`);
console.log('Then you can run: npm start:dev');
const deleteFolders = isWin ? runCommand(deleteFoldersCommandWindows) : runCommand(deleteFoldersCommand);
if(!deleteFolders) process.exit(-1);
+7 -6
View File
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-require-imports */
const { pathsToModuleNameMapper } = require('ts-jest');
const { compilerOptions } = require('./tsconfig');
@@ -6,10 +7,10 @@ const aliases = pathsToModuleNameMapper(compilerOptions.paths, {
});
module.exports = {
testEnvironment: 'node',
transform: {
"^.+\\.ts$": "ts-jest"
},moduleNameMapper: {
...aliases,
},
testEnvironment: 'node',
transform: {
'^.+\\.ts$': 'ts-jest'
},moduleNameMapper: {
...aliases,
},
};
+4459 -2411
View File
File diff suppressed because it is too large Load Diff
+29 -25
View File
@@ -1,6 +1,6 @@
{
"name": "@aleleba/create-node-ts-graphql-server",
"version": "1.6.5",
"version": "1.6.6",
"description": "Node with Typescript and GraphQL Server",
"bin": "./bin/cli.js",
"main": "index.js",
@@ -33,57 +33,61 @@
},
"homepage": "https://github.com/aleleba/node-ts-graphql-server#readme",
"dependencies": {
"@graphql-tools/schema": "^10.0.33",
"body-parser": "^2.2.2",
"@graphql-tools/schema": "^11.0.10",
"body-parser": "^2.4.0",
"class-validator": "^0.15.1",
"cookie-parse": "^0.4.0",
"cookie-parser": "^1.4.7",
"cors": "^2.8.6",
"dotenv": "^17.4.2",
"express": "^5.2.1",
"dotenv": "^18.0.10",
"express": "^5.3.0",
"graphql": "^16.14.1",
"graphql-http": "^1.22.4",
"graphql-http": "^1.23.1",
"graphql-scalars": "^1.25.0",
"ruru": "^2.0.0",
"graphql-subscriptions": "^3.0.0",
"graphql-tools": "^9.0.28",
"graphql-ws": "^6.0.8",
"graphql-subscriptions": "^3.1.0",
"graphql-tools": "^10.0.10",
"graphql-ws": "^6.4.3",
"reflect-metadata": "^0.2.2",
"ruru": "^2.0.4",
"type-graphql": "^2.0.0-rc.3",
"web-push": "^3.6.7",
"ws": "^8.21.0"
"web-push": "^4.0.0",
"ws": "^8.23.1"
},
"devDependencies": {
"@babel/core": "^7.29.7",
"@babel/preset-env": "^7.29.7",
"@babel/preset-typescript": "^7.29.7",
"@babel/register": "^7.29.7",
"@types/body-parser": "^1.19.6",
"@eslint/js": "^10.0.1",
"@types/body-parser": "^2.2.0",
"@types/cookie-parser": "^1.4.10",
"@types/cors": "^2.8.19",
"@types/express": "^5.0.6",
"@types/jest": "^30.0.0",
"@types/node": "^25.9.1",
"@types/supertest": "^7.2.0",
"@types/node": "^26.6.11",
"@types/supertest": "^7.2.1",
"@types/webpack": "^5.28.5",
"@types/webpack-node-externals": "^3.0.4",
"@types/ws": "^8.18.1",
"@typescript-eslint/eslint-plugin": "^8.60.1",
"@typescript-eslint/parser": "^8.60.1",
"@types/ws": "^8.18.2",
"@typescript-eslint/eslint-plugin": "^8.74.0",
"@typescript-eslint/parser": "^8.74.0",
"babel-loader": "^10.1.1",
"clean-webpack-plugin": "^4.0.0",
"compression-webpack-plugin": "^12.0.0",
"eslint": "^10.4.1",
"eslint": "^10.16.0",
"eslint-webpack-plugin": "^6.0.0",
"jest": "^30.4.2",
"globals": "^17.15.0",
"jest": "^30.5.2",
"nodemon": "^3.1.14",
"resolve-ts-aliases": "^1.0.1",
"supertest": "^7.2.2",
"ts-jest": "^29.4.11",
"ts-loader": "^9.6.0",
"supertest": "^7.3.2",
"terser-webpack-plugin": "^5.6.1",
"ts-jest": "^29.4.15",
"ts-loader": "^9.6.2",
"typescript": "^6.0.3",
"webpack": "^5.107.2",
"webpack-cli": "^7.0.3",
"typescript-eslint": "^8.74.0",
"webpack": "^5.113.0",
"webpack-cli": "^7.3.1",
"webpack-manifest-plugin": "^6.0.1",
"webpack-node-externals": "^3.0.0",
"webpack-shell-plugin-next": "^2.3.3"
+2 -1
View File
@@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
// index.d.ts
declare module "*.gql" {
declare module '*.gql' {
const content: any;
export default content;
}
+8 -8
View File
@@ -1,7 +1,7 @@
/* eslint-disable no-mixed-spaces-and-tabs */
'use strict';
import { Query, Resolver, Mutation, FieldResolver, Root, Arg } from 'type-graphql';
import { Query, Resolver, Mutation, FieldResolver, Arg } from 'type-graphql';
import { Test, TestMutation } from '@GraphQL/schema';
import { getTest, addText } from '@controllerGraphQL';
@@ -14,20 +14,20 @@ export class TestResolverQuery {
@FieldResolver(() => String)
async text() {
return await getTest({});
return await getTest({});
}
}
@Resolver(() => TestMutation)
export class TestResolverMutation {
@Mutation(() => TestMutation)
async testMutation() {
return {};
}
async testMutation() {
return {};
}
@FieldResolver(() => String)
async text(@Arg('text') text?: string){
return await addText({text});
}
return await addText({text});
}
}
+13 -13
View File
@@ -1,18 +1,18 @@
'use strict'
'use strict';
import { buildSchemaSync } from "type-graphql"
import { buildSchemaSync } from 'type-graphql';
import {
TestResolverQuery,
TestResolverMutation
} from "@GraphQL/resolvers";
TestResolverQuery,
TestResolverMutation
} from '@GraphQL/resolvers';
export * from './test.schema'
export * from './test.schema';
const schema = buildSchemaSync({
resolvers: [
TestResolverQuery,
TestResolverMutation,
],
emitSchemaFile: true,
})
export default schema
resolvers: [
TestResolverQuery,
TestResolverMutation,
],
emitSchemaFile: true,
});
export default schema;
+3 -3
View File
@@ -1,4 +1,4 @@
/* eslint-disable no-mixed-spaces-and-tabs */
'use strict';
import { Field, ObjectType } from 'type-graphql';
@@ -6,11 +6,11 @@ import { Field, ObjectType } from 'type-graphql';
@ObjectType()
export class Test {
@Field(() => String)
text?: string;
text?: string;
}
@ObjectType()
export class TestMutation {
@Field(() => String)
text?: string;
text?: string;
}
+2 -2
View File
@@ -12,7 +12,7 @@ server.use(
createHandler({
schema,
context(req) {
const res = req.context.res
const res = req.context.res;
return {req, res};
},
})
@@ -22,7 +22,7 @@ server.use(
if (require.main === module) {
const app = express();
app.listen((process.env.PORT || 4000), () => {
console.log(`Iniciando Express en el puerto 4000`); /*${app.get('port')}*/
console.log('Iniciando Express en el puerto 4000'); /*${app.get('port')}*/
});
}
+1 -1
View File
@@ -7,7 +7,7 @@ export const getTest = async ({}) => {
return getTestModel();
};
// eslint-disable-next-line
export const addText = async ({ text }: {text?: string}) => {
return addTextModel({ text });
};