Skip to content

πŸ› οΈ TypeScript Project Files (Config Generator Script)

License

Notifications You must be signed in to change notification settings

sixertoy/tsproject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ› οΈ TypeScript Project Files (Config Generator Script)

A convenient Node.js script that simplifies the process of managing TypeScript configurations by generating separate configuration files.

πŸ“¦ Install

Install the script as a development dependency using yarn:

yarn add tsproject --dev

Or, if you prefer Npm:

npm install tsproject --save-dev

πŸ“œ Configuration File

Create a JSON configuration file with the following structure:

{
  "options": {
    "extends": "path/to/base/tsconfig.json",
    "compilerOptions": {
      // ... any compiler options
    },
    "include": [...],
    "exclude": [...]
  },
  "projects": {
    "main": {
      "compilerOptions": {
        // main project-specific compiler options
      },
      "include": [],
      "exclude": [],
      "files": []
    },
    "<dev-project>": {
      ...
    }
    // ... other project configurations
  }
}

projects.main is mandatory
Replace with the appropriate path for your TypeScript configuration.

πŸš€ Run

Execute the script with the following command, specifying the path to your configuration file:

yarn tsproject <tsproject.config>.json

Or in a package.json

"scripts": {
  "prepare": "tsproject <tsproject.config>.json"
}

This will generate individual TypeScript configuration files for each project.

πŸ“ Generated Files

The script will generate TypeScript configuration files based on the provided configuration.
The output files will be named as follows:

The script generates one TypeScript configuration file for each project specified in the "projects" property. The files are named according to the project names, e.g., tsconfig.project1.json, tsconfig.project2..json, etc.

  • tsconfig.json for the main project.
  • tsconfig.<project-name>.json for other projects.

πŸ“Œ Notes

The script verifies the existence of the "projects" property in the configuration file and displays an error message if it's missing.

TSConfig implemented properties

  • extends
  • compilerOptions
  • include
  • exclude
  • files

Feel free to reach out for any questions or improvements! πŸš€πŸŒˆ

About

πŸ› οΈ TypeScript Project Files (Config Generator Script)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published