Skip to content

Instantly share code, notes, and snippets.

@mmahadevan-okta
Last active March 25, 2017 19:35
Show Gist options
  • Save mmahadevan-okta/e2d19ae3668b8c571a419772eb7f97ec to your computer and use it in GitHub Desktop.
Save mmahadevan-okta/e2d19ae3668b8c571a419772eb7f97ec to your computer and use it in GitHub Desktop.
Setup Typescript with VS Code.
#!/usr/bin/env sh
if [ "$1" != "" ]; then
mkdir "$1" && cd "$1"
if [ "$(type -t curl)" == "file" ]; then
curl -L -s https://www.gitignore.io/api/node,macos >> .gitignore
else
echo "curl not found."
fi
cat << EOT >> tsconfig.json
{
"compilerOptions": {
"target": "es5",
"outDir": "out/",
"sourceMap": true
}
}
EOT
mkdir src && cd src
cat <<EOT >> app.ts
class Startup {
public static main(): number {
console.log('Hello World');
return 0;
}
}
Startup.main();
EOT
echo "code .\n Press Cmd-Shift-B\nChoose Typescript with Watch-mode"
else
echo "$0 directory_name"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment