Created
March 3, 2024 00:59
-
-
Save M8-Babbage/807078acf8070ca9bf770e80115d2500 to your computer and use it in GitHub Desktop.
Node Project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Crear archivo de NPM | |
pnpm init | |
// Instalación de paquetes | |
pnpm add -D typescript @types/node ts-node nodemon rimraf | |
// Crear archivo de configuración de typescript | |
npx tsc --init --outDir dist/ --rootDir src | |
// Crear archivo de nodemon con la siguiente configuración "nodemon.json" | |
{ | |
"watch": ["src"], | |
"ext": "ts,json", | |
"ignore": ["src/**/*.spec.ts"], | |
"exec": "npx ts-node ./src/app.ts" | |
} | |
// Añadimos los scripts al package | |
"dev": "nodemon", | |
"build": "rimraf ./dist && tsc", | |
"start": "npm run build && node ./dist/app.js", | |
// Dentro del archivo tsconfig.json | |
"include": ["src/**/*, tests/**/*"], | |
"exclude": ["node_modules", "dist", "**/*.spec.ts", "**/*.test.ts"], | |
// Crear el archivo .nvmrc | |
v20.11.1 | |
// Crear la carpeta src con su archivo app.ts | |
mkdir src | |
touch src/app.ts | |
// Lanzar nodemon para escuchar cambios | |
npx nodemon |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment