Fastest way to bootstrap a TS node project
TLDR
1. Create a new folder for your project (mkdir my-ts-app + cd my-ts-app)
2. Run npm init ts-node-project
3. Install dependencies with npm install (or npm i)
4. You’re ready to go! Run npm start or npm test to check that everything is working 🚀
Explanation
If you want to quickly start a typescript project using ts-node, you’ll find that you often have to create the same files over and over.
Having tools like create-react-app, npm init or eslint — init really helps to quickly get coding, but there doesn’t seem to be a conventional way to do so for ts-node.
That’s why I’ve decided to create a small npm package called create-ts-node-project that allows you to quickly bootstrap a working Typescript project that runs with ts-node.
Requirements
To get started, you only need npm installed on your machine. To download it, use the Node Version manager and follow the instructions.
When you’re done, open a terminal in the directory you want to start your project. Run the following commands:
npm init ts-node-project
npm i
npm start
Features
Your new project comes fully configured to run as a ts-node project. It also initializes a git repository and installs jest to quickly test your code.
Planned development
The package is available on Github, and on npmjs.com ;)
This package was mostly intended for personal use, but if it gets enough traction I think it might be worth it to add a few features, such as:
• Customization (project name, TS version…)
• Quick dependencies (jest, eslint…)
• Immediate dependencies installation
Let me know in the comments which of these you would like to see implemented, and whether you find this small util useful!
Thanks!
Still reading? You must be pretty good at paying attention!
I would love to hear your feedback on my other projects, so feel free to look at my GitHub ;)
Thanks for reading and happy coding!