Last active
July 29, 2020 13:49
-
-
Save nolawnchairs/258d2affb201f1d08921b6057123994c to your computer and use it in GitHub Desktop.
Builds an Node project with TS and Git
This file contains 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/sh | |
if [ -z $1 ]; then | |
echo "Must provide a location" | |
exit 1 | |
fi | |
DIR="$(realpath "$1")" | |
echo "Creating project at $DIR" | |
mkdir -p $DIR | |
cd $DIR | |
mkdir src build | |
touch .env tslint.json tsconfig.json nodemon.json index.js | |
cat > tslint.json << TSLINT | |
{ | |
"rules": { | |
"jsx-wrap-multiline": false, | |
"semicolon": [true, "never"], | |
"class-name": true, | |
"import-spacing": true, | |
"new-parens": true, | |
"eofline": true, | |
"no-boolean-literal-compare": [true], | |
"no-consecutive-blank-lines": true, | |
"no-trailing-whitespace": true, | |
"quotemark": [true, "single", "jsx-double"] | |
} | |
} | |
TSLINT | |
cat > tsconfig.json << TSCONFIG | |
{ | |
"compilerOptions": { | |
"target": "es6", | |
"module": "commonjs", | |
"moduleResolution": "node", | |
"typeRoots": [ | |
"./node_modules/@types" | |
], | |
"lib": [ | |
"es2015", | |
"esnext" | |
], | |
"outDir": "./build", | |
"emitDecoratorMetadata": false, | |
"experimentalDecorators": true, | |
"esModuleInterop": true, | |
"allowSyntheticDefaultImports": true, | |
"strict": false, | |
"noUnusedLocals": false, | |
"strictPropertyInitialization": false | |
}, | |
"include": [ | |
"./src/**/*" | |
] | |
} | |
TSCONFIG | |
cat > nodemon.json << NODEMON | |
{ | |
"watch": ["./build"], | |
"ext": "js", | |
"exec": "node .iain.js", | |
"delay": "500" | |
} | |
NODEMON | |
cat > .gitignore << EOF | |
.vscode | |
.env | |
build | |
node_modules | |
EOF | |
git init > /dev/null | |
npm init -y > /dev/null | |
echo "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment