Skip to content

Instantly share code, notes, and snippets.

@mckernanin mckernanin/setup.sh
Created Aug 31, 2018

Embed
What would you like to do?
Scaffold a typescript project quickly
#!/bin/bash
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
cat > tsconfig.json <<EOL
{
"compilerOptions": {
"module": "commonjs",
"target": "es2016",
"noImplicitAny": false,
"strictNullChecks": true,
"moduleResolution": "node",
"sourceMap": true,
"outDir": "dist",
"baseUrl": ".",
"paths": {
"*": [
"node_modules/*",
"src/*"
]
},
"typeRoots": [
"./node_modules/@types",
"./src/typings"
],
"rootDirs": [
"src/"
],
"types": [
"node"
]
},
"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
You can’t perform that action at this time.