-
mkdir src
-
npm init -y
-
npm install typings typescript --global
-
set PATH=%USERPROFILE%\AppData\Roaming\npm;%PATH%
-
typings init -y
-
tsc --init
-
change in tsconfig.json
{ "compilerOptions": { "module": "commonjs", "target": "es5", "noImplicitAny": false, "sourceMap": true, "watch": true }, "exclude": [ "node_modules" ] }
-
npm install typings --save
-
create tasks.json by (ctrl+shift+p) Configure Task Runner - > TypeScript – tsconfig.json
-
for windows change in tasks.json command and args attribute
{ // See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "node",
"isShellCommand": true,
"args": ["${workspaceRoot}\\node_modules\\typescript\\bin\\tsc"],
"showOutput": "silent",
"problemMatcher": "$tsc"
}
- Add a .typingsrc to setup proxy at the root of the project folder with below two lines
proxy=http://proxy.threatpulse.net:8080 rejectUnauthorized=false
- execute the below commands
typings install dt~node --save --global
typings search node
-
stop and start compiler in visual stuio code
-
Add a index.ts under src folder
-
Add a launch.json by (ctrl+shift+p) Open launch.json, update with below content
{ "version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/src/index.ts",
"stopOnEntry": false,
"args": [],
"cwd": "${workspaceRoot}",
"preLaunchTask": null,
"runtimeExecutable": null,
"runtimeArgs": [
"--nolazy"
],
"env": {
"NODE_ENV": "development"
},
"console": "internalConsole",
"sourceMaps": true,
"outFiles": [ ]
},
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 5858,
"address": "localhost",
"restart": false,
"sourceMaps": false,
"localRoot": "${workspaceRoot}",
"remoteRoot": null
}
]
}
- npm install eslint --save-dev
- npm install eslint-plugin-import --save-dev
- npm install eslint-plugin-node --save-dev
- npm install eslint-plugin-promise --save-dev
- npm install eslint-plugin-standard --save-dev