This is a skeleton app for people who want to use TypeScript. A Vagrantfile is included for those who want to run it in a virtual machine.
You don't have to use the Vagrantfile if you're fine with installing NodeJS and NPM locally. Feel free to delete it if that's the case.
- Clone this repository to your pc
- Make sure you have NodeJS installed (preferably the LTS version). This will also install
npm
. - Open a terminal window (command prompt, git bash, powershell)
- Check if NodeJS is installed by typing
node --version
into the terminal. It should print a line with something likev8.12.0
. - Check if NPM is installed by typing
npm --version
into the terminal. It should print a line with something like6.4.1
. - As an alternative to NPM, you could use the Yarn npm client from Google and Facebook (it works slightly better and faster than NPM). Install by running
npm install -g yarn
- Install de dependencies by running
npm install
oryarn install
from the project directory. - Compile the project by running
npm run build
oryarn run build
. If you want to run the build script everytime you make changes automatically, you can usenpm run watch
oryarn run watch
. To check out how this works, you can open thepackage.json
. - Open the
tsconfig.json
file in this project. - Search the TypeScript documentation and try to explain every line in the json file. Don't understand something? That's fine! Just don't copy stuff for the sake of filling up your answers.
If you're like me and you dislike NodeJS and NPM piling up heaps of folders on your pc, run TypeScript in a virtual machine!
- Install a virtual machine host, Virtualbox is fine: https://www.virtualbox.org/wiki/Downloads
- Probably restart
- Install Vagrant: https://www.vagrantup.com/downloads.html
- Probably restart (sorry!)
- Open a terminal window (Administrator Powershell on Windows)
- Clone this repository
- Move to this folder inside the terminal
- If on Virtualbox: install Vagrant VB-Guest (Only if you're using Virtualbox. If you're using a different host, it's up to you to set up shared folders)
- Open the Vagrantfile and set up your directory paths. Defaults are fine if you don't know what you're doing.
- Install the VM by typing
vagrant up
- Wait until done. This can take up to 15 minutes, depending on internet and HDD speed. Sometimes the provision will fail because of firewalls. This should mostly be fine, as long as you can see that NodeJS and NPM are installed.
- Enter the VM by typing
vagrant ssh
- In the VM, enter the correct folder for your project (default:
cd /code
) - Proceed from step 7 in the non-VM installation instructions
- IMPORTANT: When you're done in the VM, exit it by typing
exit
and thenvagrant halt
into the terminal. This makes sure the VM shuts down cleanly. If you don't need the VM anymore, typeexit
and thenvagrant destroy
. Never close the terminal without shutting down the VM, unless you know what you're doing.