1. Project setup
Let's go step-by-step into initializing the project for this tutorial.ng bo
Initialize repository
Create working directory
Let's start from scratch from an empty directory:
# create folder & jump into it
mkdir vault-bot && cd vault-bot
# init your git repository
git initMark un-needed files as ignored for Git
Create a .gitignore file with this content to ignore the node_modules folder & the env file (we will create it on next steps):
node_modules
.envInitialize Typescript package
Create the Node.js package
This command will create the package.json with default content:
# using `-y` option will make the init use all the defaults options
npm init -yInstall dependencies
Install the production dependencies:
Then install the development dependencies:
Initialize Typescript configuration
Run this init command to create the tsconfig.json with default values:
If everything worked correctly, you should have now a tsconfig.json file at the root of the repo.
Setup the main script
Create the script file
Let's create a main.ts file that will contain our code:
Add a npm script to run it
Edit the package.json file to add a new script entry. Let's remove the test script and add a dev script:
Verify that the setup works
Now, you can run this command to check that everything is OK:
bash
That should output:
Congratulations 🎉, we are ready to move to next step.
Last updated