create-tsready
v1.0.6
Published
CLI to initialize a Node.js project with a TypeScript template
Downloads
2
Maintainers
Readme
Project Overview
Reason for Creating the Project
- (Emphasis) When trying to configure
ts-node
as mentioned, I continuously encountered insurmountable errors that required about two hours of troubleshooting. - I set up the project using
tsx
to ensure that others do not face similar issues and can execute the configuration smoothly.
Advantages of the Project Template
- Utilizes TypeScript by default.
- Allows the use of
await
at the top-level of the code (outside functions). - Operates based on ESNext standards for TypeScript.
- Enables writing code in the style of
import ~ from "./util.ts"
(similar to Python). - Offers the benefit of using
await
at the top-level. - Includes ESLint for maintaining code quality and consistency.
How to Run the Program
Execute the following command to run main.ts
located under the src
directory. The code makes a simple request stored inside util
and outputs the result as a string.
npm run main
How to Run the Program With NPM
You can install create-tsready
globally to use it anywhere.
npm install -g create-tsready
Usage
Create a New Project
Use the following command to create a new project:
npm init tsready my-new-project
This command will create a new directory called my-new-project, copy the TypeScript template files, and install the necessary dependencies.
Project Directory Structure
After creating a new project, the directory structure will be as follows:
my-new-project/
├── src/
│ └── main.ts
├── tsconfig.json
├── .eslintrc.json
├── .eslintignore
└── package.json
- src/main.ts: The main TypeScript entry file.
- tsconfig.json: TypeScript compiler configuration file.
- .eslintrc.json: ESLint configuration file.
- .eslintignore: Files and directories to ignore for ESLint.
- package.json: Project's npm configuration file.
Start the Project
Once the project is set up, you can start it with:
npm run main
Running EsLint
To check for code quality and consistency using ESLint, run the following command:
npx eslint src/**/*.ts
To automatically fix issues that can be resolved, run:
npx eslint src/**/*.ts --fix
Contributing
If you would like to contribute, please submit a PR or open an issue.
License
This project is licensed under the MIT License. See the LICENSE file for more details.