-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtsinit.sh
More file actions
46 lines (41 loc) · 742 Bytes
/
tsinit.sh
File metadata and controls
46 lines (41 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/zsh
# Require init directory
function help(){
echo "- \$1 : Require project init directory."
}
# Check if parameter given
if [ -z $1 ]
then
help
exit 1
fi
# Check if directory exist. If not exist, make directory and initiate
if [ ! -d $1 ]
then
mkdir $1
fi
# Move directory
cd $1
mkdir src
# Install typescript init
npm i -D typescript tslint @types/node
# tslint.json config
./node_modules/.bin/tslint --init
# tsconfig.json
cat >> tsconfig.json <<EOF
{
"compilerOptions": {
"lib": [
"ES2020"
],
"module": "CommonJS",
"outDir": "dist",
"sourceMap": true,
"strict": true,
"target": "ES2020",
},
"include": [
"src"
]
}
EOF