Last active
April 18, 2023 13:18
-
-
Save skapxd/b6224ed1b71fac301c53546fb65cbf63 to your computer and use it in GitHub Desktop.
Scaffold a typescript project quickly
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
#!/bin/bash | |
yarn init -y | |
yarn add dotenv express joi lodash morgan | |
yarn add -D nodemon ts-node types-installer typescript add-npm-scripts | |
yarn add-npm-scripts start "nodemon" | |
yarn add-npm-scripts build "tsc" | |
yarn types-installer | |
cat > nodemon.json <<EOL | |
{ | |
"watch": ["src"], | |
"ext": "ts", | |
"ignore": ["src/**/*.spec.ts"], | |
"exec": "node --inspect -r ts-node/register ./src/index.ts" | |
} | |
EOL | |
git init | |
cat > .gitignore <<EOL | |
node_modules | |
dist | |
yarn-error.log | |
init-ts-proyect.sh | |
EOL | |
cat > tsconfig.json <<EOL | |
{ | |
"compilerOptions": { | |
"module": "CommonJS", | |
"target": "ES2020", | |
"noImplicitAny": false, | |
"strictNullChecks": true, | |
"moduleResolution": "node", | |
"sourceMap": true, | |
"outDir": "dist", | |
"baseUrl": ".", | |
"paths": { | |
"#/*": [ | |
"*" | |
] | |
}, | |
}, | |
"include": [ | |
"src/**/*" | |
] | |
} | |
EOL | |
mkdir -p src | |
cat > src/index.ts <<EOL | |
console.log('hello world!'); | |
EOL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment