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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
"compilerOptions": {
/* Basic Options */
"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. */,
"allowJs": false /* Allow javascript files to be compiled. */,
@ -40,7 +40,7 @@
"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). */,
//"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",
@ -48,7 +48,8 @@
"baseUrl": "./",
"paths": {
"@/*": ["./src/*"]
"@/*": ["./src/*"],
"#/*": ["./src/*"]
}
},
"files": ["src/index.ts"],

View File

@ -8,16 +8,25 @@
"build": "tsc && vite build",
"preview": "vite preview",
"lint": "eslint \"src/**/*.ts\"",
"clean": "rm -rf dist && rm -rf node_modules"
"clean": "rm -rf dist && rm -rf node_modules && rm -rf .turbo"
},
"dependencies": {
"@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-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": {
"@hookform/devtools": "^4.4.0",
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@tanstack/react-query-devtools": "^5.74.11",
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.3",
"@vitejs/plugin-react": "^4.4.1",

View File

@ -1,19 +1,37 @@
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 "@repo/ui/globals.css";
import { I18nextProvider } from "react-i18next";
import { i18n } from "./locales";
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);
return (
<div className='container mx-auto p-4'>
<h1 className='text-xl font-bold mb-2'>This is a Vite application</h1>
<p className='mb-4'>
This shadcn/ui button is shared between Vite, NextJS and any other application.
</p>
<Button onClick={() => setCount((count) => count + 1)}>Count is {count}</Button>
</div>
<I18nextProvider i18n={i18n}>
<QueryClientProvider client={queryClient}>
<div className='container mx-auto p-4'>
<h1 className='text-xl font-bold mb-2'>This is a Vite application</h1>
<p className='mb-4'>
This shadcn/ui button is shared between Vite, NextJS and any other application.
</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",
"version": "0.0.0",
"private": true,
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist/**"
],
"scripts": {
"build": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json",
"clean": "rm -rf dist && rm -rf node_modules",
"build.bak": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json",
"clean": "rm -rf dist && rm -rf node_modules && rm -rf .turbo",
"lint": "eslint src/",
"lint:fix": "eslint src/ --fix",
"typecheck": "tsc --noEmit",
"test": "jest"
},
"exports": {
"./client": "./src/client/index.ts",
"./server": "./src/server/index.ts"
},
"jest": {
"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" });
},
registerDependencies(params) {
// @ts-ignore
const { database } = params;
logger.info({ message: "🚀 Invoices module dependencies registered", label: "invoices" });
return {

View File

@ -1,57 +1,24 @@
{
"extends": "@repo/typescript-config/base.json",
"compilerOptions": {
/* Basic Options */
"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'. */,
"lib": ["ES2022", "dom"] /* Specify library files to be included in the compilation. */,
"allowJs": false /* Allow javascript files to be compiled. */,
"pretty": true,
// "checkJs": true, /* Report errors in .js files. */
"jsx": "preserve" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */,
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
"sourceMap": true /* Generates corresponding '.map' file. */,
// "outFile": "./", /* Concatenate and emit output to single file. */
"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"],
"target": "es2022",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"baseUrl": "./",
"paths": {
"#/*": ["./src/*"]
}
},
"files": ["src/index.ts"],
"include": ["src/index.ts"],
"exclude": ["node_modules", "dist", "**/*/__tests__"]
"include": ["./src"]
}

View File

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

View File

@ -10,7 +10,7 @@
],
"scripts": {
"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:fix": "eslint src/ --fix",
"typecheck": "tsc --noEmit",

View File

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

View File

@ -1,2 +1 @@
// @ts-expect-error: T is intentionally unused in this interface
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": {
"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:fix": "eslint src/ --fix",
"typecheck": "tsc --noEmit",

View File

@ -1,9 +1,10 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Node Library",
"extends": "./base.json",
"compilerOptions": {
"lib": ["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"
},
"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",
"extends": "./base.json",
"compilerOptions": {
"jsx": "react-jsx"
"jsx": "react-jsx",
"module": "ES2022",
"moduleDetection": "auto",
"moduleResolution": "node"
}
}

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff