This commit is contained in:
David Arranz 2025-05-01 19:14:48 +02:00
parent 08b2ecaf78
commit b78b924151
27 changed files with 602 additions and 519 deletions

View File

@ -24,6 +24,7 @@ export function createApp(): Application {
app.use(helmet()); app.use(helmet());
// Middleware global para desactivar la caché en todas las rutas // Middleware global para desactivar la caché en todas las rutas
// @ts-ignore
app.use((req, res, next) => { app.use((req, res, next) => {
res.setHeader("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0"); res.setHeader("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0");
res.setHeader("Pragma", "no-cache"); res.setHeader("Pragma", "no-cache");
@ -33,6 +34,7 @@ export function createApp(): Application {
}); });
// Inicializar Auth Provider // Inicializar Auth Provider
// @ts-ignore
app.use((req, res, next) => { app.use((req, res, next) => {
//authProvider.initialize(); //authProvider.initialize();
next(); next();

View File

@ -6,6 +6,7 @@ const registeredModels: { [key: string]: any } = {};
/** /**
* 🔹 Registra todos los modelos en Sequelize * 🔹 Registra todos los modelos en Sequelize
*/ */
// @ts-ignore
export const registerModels = (models: any[], params?: ModuleParams) => { export const registerModels = (models: any[], params?: ModuleParams) => {
allModelInitializers.push(...models); allModelInitializers.push(...models);
}; };

View File

@ -1,5 +1,5 @@
//import { ContactsPackage } from '@modules/contacts/server'; //import { ContactsPackage } from '@modules/contacts/server';
import { invoicesModule } from "@modules/invoices"; import { invoicesModule } from "@modules/invoices/server";
import { registerModule } from "./core/helpers"; import { registerModule } from "./core/helpers";
export const registerModules = () => { export const registerModules = () => {

View File

@ -3,7 +3,7 @@
"compilerOptions": { "compilerOptions": {
/* Basic Options */ /* Basic Options */
"target": "ES2022" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */, "target": "ES2022" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, //"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"lib": ["ES2022", "dom"] /* Specify library files to be included in the compilation. */, "lib": ["ES2022", "dom"] /* Specify library files to be included in the compilation. */,
"allowJs": false /* Allow javascript files to be compiled. */, "allowJs": false /* Allow javascript files to be compiled. */,
@ -40,7 +40,7 @@
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */, "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
/* Module Resolution Options */ /* Module Resolution Options */
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */, //"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
//"baseUrl": "./" /* Base directory to resolve non-absolute module names. */, //"baseUrl": "./" /* Base directory to resolve non-absolute module names. */,
"rootDir": "./src", "rootDir": "./src",
@ -48,7 +48,8 @@
"baseUrl": "./", "baseUrl": "./",
"paths": { "paths": {
"@/*": ["./src/*"] "@/*": ["./src/*"],
"#/*": ["./src/*"]
} }
}, },
"files": ["src/index.ts"], "files": ["src/index.ts"],

View File

@ -8,16 +8,25 @@
"build": "tsc && vite build", "build": "tsc && vite build",
"preview": "vite preview", "preview": "vite preview",
"lint": "eslint \"src/**/*.ts\"", "lint": "eslint \"src/**/*.ts\"",
"clean": "rm -rf dist && rm -rf node_modules" "clean": "rm -rf dist && rm -rf node_modules && rm -rf .turbo"
}, },
"dependencies": { "dependencies": {
"@repo/ui": "workspace:*", "@repo/ui": "workspace:*",
"@tanstack/react-query": "^5.74.11",
"axios": "^1.7.3",
"i18next": "^25.0.2",
"i18next-browser-languagedetector": "^8.1.0",
"react": "^19.1.0", "react": "^19.1.0",
"react-dom": "^19.1.0" "react-dom": "^19.1.0",
"react-hook-form": "^7.55.0",
"react-hook-form-persist": "^3.0.0",
"react-i18next": "^15.0.1"
}, },
"devDependencies": { "devDependencies": {
"@hookform/devtools": "^4.4.0",
"@repo/eslint-config": "workspace:*", "@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*", "@repo/typescript-config": "workspace:*",
"@tanstack/react-query-devtools": "^5.74.11",
"@types/react": "^19.1.2", "@types/react": "^19.1.2",
"@types/react-dom": "^19.1.3", "@types/react-dom": "^19.1.3",
"@vitejs/plugin-react": "^4.4.1", "@vitejs/plugin-react": "^4.4.1",

View File

@ -1,19 +1,37 @@
import { Button } from "@repo/ui/components/button"; import { Button } from "@repo/ui/components/button";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import { useState } from "react"; import { useState } from "react";
import "@repo/ui/globals.css"; import "@repo/ui/globals.css";
import { I18nextProvider } from "react-i18next";
import { i18n } from "./locales";
function App() { function App() {
const queryClient = new QueryClient({
defaultOptions: {
queries: {
retry: false,
staleTime: 10000, // Specify a staleTime to only fetch when the data is older than a certain amount of time
},
},
});
const [count, setCount] = useState(0); const [count, setCount] = useState(0);
return ( return (
<div className='container mx-auto p-4'> <I18nextProvider i18n={i18n}>
<h1 className='text-xl font-bold mb-2'>This is a Vite application</h1> <QueryClientProvider client={queryClient}>
<p className='mb-4'> <div className='container mx-auto p-4'>
This shadcn/ui button is shared between Vite, NextJS and any other application. <h1 className='text-xl font-bold mb-2'>This is a Vite application</h1>
</p> <p className='mb-4'>
<Button onClick={() => setCount((count) => count + 1)}>Count is {count}</Button> This shadcn/ui button is shared between Vite, NextJS and any other application.
</div> </p>
<Button onClick={() => setCount((count) => count + 1)}>Count is {count}</Button>
</div>
{import.meta.env.MODE === "development" && <ReactQueryDevtools initialIsOpen={false} />}
</QueryClientProvider>
</I18nextProvider>
); );
} }

View File

@ -0,0 +1,3 @@
{
"translation": {}
}

View File

@ -0,0 +1,3 @@
{
"translation": {}
}

View File

@ -0,0 +1,30 @@
import i18n from "i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import { initReactI18next } from "react-i18next";
import enResources from "./en.json";
import esResources from "./es.json";
i18n
// detect user language
// learn more: https://github.com/i18next/i18next-browser-languageDetector
.use(LanguageDetector)
// pass the i18n instance to react-i18next.
.use(initReactI18next)
// init i18next
// for all options read: https://www.i18next.com/overview/configuration-options
.init({
detection: {
order: ["navigator"],
},
debug: import.meta.env.MODE === "development",
fallbackLng: "es",
interpolation: {
escapeValue: false,
},
resources: {
en: enResources,
es: esResources,
},
});
export { i18n };

View File

@ -0,0 +1 @@
export * from "./i18n";

View File

@ -2,19 +2,18 @@
"name": "@modules/invoices", "name": "@modules/invoices",
"version": "0.0.0", "version": "0.0.0",
"private": true, "private": true,
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist/**"
],
"scripts": { "scripts": {
"build": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json", "build.bak": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json",
"clean": "rm -rf dist && rm -rf node_modules", "clean": "rm -rf dist && rm -rf node_modules && rm -rf .turbo",
"lint": "eslint src/", "lint": "eslint src/",
"lint:fix": "eslint src/ --fix", "lint:fix": "eslint src/ --fix",
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",
"test": "jest" "test": "jest"
}, },
"exports": {
"./client": "./src/client/index.ts",
"./server": "./src/server/index.ts"
},
"jest": { "jest": {
"preset": "@repo/jest-presets/node" "preset": "@repo/jest-presets/node"
}, },

View File

@ -1,2 +0,0 @@
//export * from "./client";
export * from "./server";

View File

@ -14,6 +14,7 @@ export const invoicesModule: IModuleServer = {
logger.info({ message: "🚀 Invoices module initialized", label: "invoices" }); logger.info({ message: "🚀 Invoices module initialized", label: "invoices" });
}, },
registerDependencies(params) { registerDependencies(params) {
// @ts-ignore
const { database } = params; const { database } = params;
logger.info({ message: "🚀 Invoices module dependencies registered", label: "invoices" }); logger.info({ message: "🚀 Invoices module dependencies registered", label: "invoices" });
return { return {

View File

@ -1,57 +1,24 @@
{ {
"extends": "@repo/typescript-config/base.json",
"compilerOptions": { "compilerOptions": {
/* Basic Options */ "target": "es2022",
"target": "ES2022" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */, "lib": ["dom", "dom.iterable", "esnext"],
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, "allowJs": true,
"lib": ["ES2022", "dom"] /* Specify library files to be included in the compilation. */, "skipLibCheck": true,
"strict": true,
"allowJs": false /* Allow javascript files to be compiled. */, "forceConsistentCasingInFileNames": true,
"pretty": true, "noEmit": true,
// "checkJs": true, /* Report errors in .js files. */ "esModuleInterop": true,
"jsx": "preserve" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */, "module": "esnext",
// "declaration": true, /* Generates corresponding '.d.ts' file. */ "moduleResolution": "node",
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ "resolveJsonModule": true,
"sourceMap": true /* Generates corresponding '.map' file. */, "isolatedModules": true,
// "outFile": "./", /* Concatenate and emit output to single file. */ "jsx": "preserve",
"outDir": "./dist/" /* Redirect output structure to the directory. */,
//"rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
// "composite": true, /* Enable project compilation */
"removeComments": true /* Do not emit comments to output. */,
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"skipLibCheck": false /* Skip type checking of declaration files. */,
"strict": true /* Enable all strict type-checking options. */,
"noImplicitAny": false /* Raise error on expressions and declarations with an implied 'any' type. */,
"strictNullChecks": true /* Enable strict null checks. */,
"strictFunctionTypes": true /* Enable strict checking of function types. */,
"strictPropertyInitialization": false /* Enable strict checking of property initialization in classes. */,
"noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
"noUnusedLocals": false /* Report errors on unused locals. */,
"noUnusedParameters": false /* Report errors on unused parameters. */,
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
/* Module Resolution Options */
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
//"baseUrl": "./" /* Base directory to resolve non-absolute module names. */,
"rootDir": "./src",
//"types": ["node", "jest"],
"baseUrl": "./", "baseUrl": "./",
"paths": { "paths": {
"#/*": ["./src/*"] "#/*": ["./src/*"]
} }
}, },
"files": ["src/index.ts"],
"include": ["src/index.ts"], "include": ["./src"]
"exclude": ["node_modules", "dist", "**/*/__tests__"]
} }

View File

@ -7,7 +7,7 @@
"node/jest-preset.ts" "node/jest-preset.ts"
], ],
"scripts": { "scripts": {
"clean": "rm -rf dist && rm -rf node_modules" "clean": "rm -rf dist && rm -rf node_modules && rm -rf .turbo"
}, },
"dependencies": { "dependencies": {
"jest": "^29.7.0", "jest": "^29.7.0",

View File

@ -10,7 +10,7 @@
], ],
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"clean": "rm -rf dist && rm -rf node_modules", "clean": "rm -rf dist && rm -rf node_modules && rm -rf .turbo",
"lint": "eslint src/", "lint": "eslint src/",
"lint:fix": "eslint src/ --fix", "lint:fix": "eslint src/ --fix",
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",

View File

@ -2,15 +2,11 @@
"name": "@rdx/core", "name": "@rdx/core",
"version": "0.0.0", "version": "0.0.0",
"private": true, "private": true,
"main": "dist/index.js", "main": "./src/index.ts",
"module": "dist/index.mjs", "types": "./src/index.ts",
"types": "dist/index.d.ts",
"files": [
"dist/**"
],
"scripts": { "scripts": {
"build": "tsc", "build.bak": "tsc",
"clean": "rm -rf dist && rm -rf node_modules", "clean": "rm -rf dist && rm -rf node_modules && rm -rf .turbo",
"lint": "eslint src/", "lint": "eslint src/",
"lint:fix": "eslint src/ --fix", "lint:fix": "eslint src/ --fix",
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",

View File

@ -1,2 +1 @@
// @ts-expect-error: T is intentionally unused in this interface
export interface IAggregateRootRepository<T> {} export interface IAggregateRootRepository<T> {}

View File

@ -1,12 +0,0 @@
{
"extends": "@repo/typescript-config/base.json",
"compilerOptions": {
"sourceMap": true,
"outDir": "./dist",
"rootDir": "./src",
"types": ["node"]
},
"files": ["src/index.ts"],
"include": ["src/index.ts"],
"exclude": ["node_modules", "dist", "**/*/__tests__"]
}

View File

@ -10,7 +10,7 @@
], ],
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"clean": "rm -rf dist && rm -rf node_modules", "clean": "rm -rf dist && rm -rf node_modules && rm -rf .turbo",
"lint": "eslint src/", "lint": "eslint src/",
"lint:fix": "eslint src/ --fix", "lint:fix": "eslint src/ --fix",
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",

View File

@ -1,9 +1,10 @@
{ {
"$schema": "https://json.schemastore.org/tsconfig", "$schema": "https://json.schemastore.org/tsconfig",
"display": "Node Library",
"extends": "./base.json", "extends": "./base.json",
"compilerOptions": { "compilerOptions": {
"lib": ["ES2022"], "lib": ["ES2022"],
"target": "ES2022" "target": "ES2022"
}, },
"exclude": ["node_modules", "dist", "**/*.spec.ts", "**/*.test.ts"] "exclude": ["node_modules", "dist", "**/*.spec.ts", "**/*.test.ts", "**/*/__tests__"]
} }

View File

@ -7,6 +7,6 @@
"access": "public" "access": "public"
}, },
"scripts": { "scripts": {
"clean": "rm -rf dist && rm -rf node_modules" "clean": "rm -rf dist && rm -rf node_modules && rm -rf .turbo"
} }
} }

View File

@ -3,6 +3,9 @@
"display": "React Library", "display": "React Library",
"extends": "./base.json", "extends": "./base.json",
"compilerOptions": { "compilerOptions": {
"jsx": "react-jsx" "jsx": "react-jsx",
"module": "ES2022",
"moduleDetection": "auto",
"moduleResolution": "node"
} }
} }

View File

@ -4,6 +4,7 @@
"type": "module", "type": "module",
"private": true, "private": true,
"scripts": { "scripts": {
"clean": "rm -rf dist && rm -rf node_modules && rm -rf .turbo",
"lint": "eslint . --max-warnings 0", "lint": "eslint . --max-warnings 0",
"ui": "pnpm dlx shadcn@latest add" "ui": "pnpm dlx shadcn@latest add"
}, },

View File

@ -0,0 +1 @@
export * from "./button";

View File

@ -3,6 +3,6 @@
"compilerOptions": { "compilerOptions": {
"outDir": "dist" "outDir": "dist"
}, },
"include": ["src", "turbo"], "include": ["src"],
"exclude": ["node_modules", "dist"] "exclude": ["node_modules", "dist"]
} }

File diff suppressed because it is too large Load Diff