Skip to content

Instantly share code, notes, and snippets.

@nolawnchairs
Last active July 29, 2020 13:49
Show Gist options
  • Save nolawnchairs/258d2affb201f1d08921b6057123994c to your computer and use it in GitHub Desktop.
Save nolawnchairs/258d2affb201f1d08921b6057123994c to your computer and use it in GitHub Desktop.
Builds an Node project with TS and Git
#!/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