https://github.com/damianravindupeiris/typescript-bootstrapper
This script automates the process of setting up a new TypeScript project with a Node.js environment. It handles the initialization of a Git repository, installs necessary dependencies, configures TypeScript, and sets up a development environment with nodemon and ts-node for live reloading.
https://github.com/damianravindupeiris/typescript-bootstrapper
automated development-environment script typescript
Last synced: 7 months ago
JSON representation
This script automates the process of setting up a new TypeScript project with a Node.js environment. It handles the initialization of a Git repository, installs necessary dependencies, configures TypeScript, and sets up a development environment with nodemon and ts-node for live reloading.
- Host: GitHub
- URL: https://github.com/damianravindupeiris/typescript-bootstrapper
- Owner: DamianRavinduPeiris
- Created: 2025-01-11T08:49:31.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-01-11T09:05:43.000Z (about 1 year ago)
- Last Synced: 2025-01-20T15:41:22.234Z (about 1 year ago)
- Topics: automated, development-environment, script, typescript
- Language: PowerShell
- Homepage: https://www.typescriptlang.org/
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TypeScript Bootstrapper 🚀

This script automates the process of setting up a new TypeScript project with a Node.js environment. It handles the initialization of a Git repository, installs necessary dependencies, configures TypeScript, and sets up a development environment with `nodemon` and `ts-node` for live reloading.
## Features:
- Initializes a Git repository.
- Installs and configures TypeScript.
- Creates a `tsconfig.json` file with the proper setup.
- Installs necessary development dependencies like `nodemon` and `ts-node`.
- Sets up `npm` scripts for development and production.
- Creates a basic `index.ts` file with a sample message.
- Configures `nodemon` to watch TypeScript files.
## Prerequisites:
Ensure you have the following installed:
- **Node.js** (version 16 or higher recommended)
- **Git** (for initializing the repository)
- **npm** (Node Package Manager)
## How to Use:
1. **Clone the Git repository** (if you don't already have it):
```bash
git clone https://github.com/DamianRavinduPeiris/typescript-bootstrapper.git
cd typescript-bootstrapper
```
2. **Run the script using Windows Powershell.**:
Open up a new Powershell window and execute the below command in the above project location.
```bash
./setup-typescript.ps1
```
You will be prompted to enter the name of your project folder. The script will:
- Create the project folder.
- Initialize a Git repository inside the folder.
- Set up `npm` and install the required dependencies.
- Generate a `tsconfig.json` file for TypeScript.
- Install `nodemon` for live reloading and `ts-node` for running TypeScript files directly.
- Create an initial `index.ts` file and a `nodemon.json` configuration file.
3. **Run the development environment**:
After the script finishes setting up the project, you can start the development server using `npm run dev`:
```bash
npm run dev
```
This will start `nodemon` and run your `index.ts` file using `ts-node`. Any changes made to the `.ts` files will automatically trigger a reload.
â›” **PS - Since the git initializing project is done by the script iteslf,you will get an error when interacting with `git`. To avoid it simply run the below command in your project folder.**
`git config --global --add safe.directory C:/Example/Your-project`
5. **Run the production environment**:
To run the compiled JavaScript code in the `dist` folder, use:
```bash
npm run start
```
6. **Modify your TypeScript code**:
You can now start coding in TypeScript! Your TypeScript files should be placed in the `src` folder. When you're ready to compile, the TypeScript compiler will output JavaScript files to the `dist` folder.
## File Structure:
Once the script is executed, the following file structure will be created:
```
your-project-folder/
│
├── dist/ # Compiled JavaScript files
├── node_modules/ # Installed dependencies
├── src/ # TypeScript source files
│ └── index.ts # Sample TypeScript file
├── package.json # Project configuration file
├── tsconfig.json # TypeScript configuration file
├── nodemon.json # Nodemon configuration for development
└── .git/ # Git repository initialization
```
## Contributing:
If you would like to contribute to this project or improve the script, feel free to open a pull request.