{"id":16299448,"url":"https://github.com/tommy351/tsc-multi","last_synced_at":"2025-03-15T11:32:01.274Z","repository":{"id":38426368,"uuid":"315076263","full_name":"tommy351/tsc-multi","owner":"tommy351","description":"Compile multiple TypeScript projects into multiple targets.","archived":false,"fork":false,"pushed_at":"2024-02-14T18:17:32.000Z","size":2284,"stargazers_count":43,"open_issues_count":20,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-10-24T16:51:38.395Z","etag":null,"topics":["cli","typescript","typescript-compiler"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tommy351.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-22T16:02:35.000Z","updated_at":"2024-09-22T12:56:04.000Z","dependencies_parsed_at":"2024-06-18T17:08:43.592Z","dependency_job_id":"d5913669-a794-4b77-819d-64cfcf04fead","html_url":"https://github.com/tommy351/tsc-multi","commit_stats":{"total_commits":61,"total_committers":2,"mean_commits":30.5,"dds":0.1311475409836066,"last_synced_commit":"39a737a38871bd8ebc00ed6124ccfa6ae779896b"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommy351%2Ftsc-multi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommy351%2Ftsc-multi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommy351%2Ftsc-multi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommy351%2Ftsc-multi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tommy351","download_url":"https://codeload.github.com/tommy351/tsc-multi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221572749,"owners_count":16845712,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","typescript","typescript-compiler"],"created_at":"2024-10-10T20:48:01.859Z","updated_at":"2024-10-26T19:37:52.104Z","avatar_url":"https://github.com/tommy351.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tsc-multi\n\n[![](https://img.shields.io/npm/v/tsc-multi.svg)](https://www.npmjs.com/package/tsc-multi) ![Test](https://github.com/tommy351/tsc-multi/workflows/Test/badge.svg)\n\nCompile multiple TypeScript projects into multiple targets.\n\n## Features\n\n### Multiple targets\n\ntsc-multi can compile your TypeScript projects into multiple modules (e.g. CommonJS, ESM) or targets (e.g. ES6, ES2018) in parallel.\n\n### Project references\n\ntsc-multi supports [project references](https://www.typescriptlang.org/docs/handbook/project-references.html), which are very useful for monorepo. It works just like `tsc --build`. File watching is also supported.\n\n### Rewrite import paths\n\ntsc-multi rewrites all import paths in output files to maximize the compatibility across different platforms such as Node.js, web browser and Deno, because import paths are more strict in ESM.\n\nExample:\n\n```ts\n// Input\nimport dir from \"./dir\";\nimport file from \"./file\";\n\n// Output\nimport dir from \"./dir/index.js\";\nimport file from \"./file.js\";\n```\n\n## Installation\n\n```sh\nnpm install tsc-multi --save-dev\n```\n\n## Usage\n\nCreate a `tsc-multi.json` in the folder.\n\n```json\n{\n  \"targets\": [\n    { \"extname\": \".cjs\", \"module\": \"commonjs\" },\n    { \"extname\": \".mjs\", \"module\": \"esnext\" }\n  ],\n  \"projects\": [\"packages/*/tsconfig.json\"]\n}\n```\n\nBuild TypeScript files.\n\n```sh\ntsc-multi\n```\n\nWatch changes and rebuild TypeScript files.\n\n```sh\ntsc-multi --watch\n```\n\nDelete built files.\n\n```sh\ntsc-multi --clean\n```\n\n## Configuration\n\n### `targets`\n\nBuild targets. All options except `extname` will override `compilerOptions` in `tsconfig.json`.\n\n```js\n{\n  // Rename the extension of output files\n  extname: \".js\",\n  // Skip type-checking (Experimental)\n  transpileOnly: false,\n  // Compiler options\n  module: \"esnext\",\n  target: \"es2018\",\n}\n```\n\n### `projects`\n\nPath to TypeScript projects. It can be either a folder which contains `tsconfig.json`, or the path to `tsconfig.json`. This option can be set in either config file or CLI.\n\n```js\n[\n  // CWD\n  \".\",\n  // Folder\n  \"pkg-a\",\n  // tsconfig.json path\n  \"tsconfig.custom.json\",\n  // Glob\n  \"packages/*/tsconfig.json\",\n];\n```\n\n### `compiler`\n\nSpecify a custom TypeScript compiler (e.g. [ttypescript]).\n\n### `maxWorkers`\n\nSpecify the maximum number of concurrent workers.\n\n## CLI Options\n\n### `--watch`\n\nWatch input files and rebuild when they are changed.\n\n### `--clean`\n\nDelete built files. Only available when `compilerOptions.rootDir` is specified in `tsconfig.json`.\n\n### `--verbose`\n\nPrint debug logs.\n\n### `--cwd`\n\nSpecify the current working directory (CWD).\n\n### `--config`\n\nSpecify the path of the config file. The path can be either a relative path or an absolute path. Default to `$CWD/tsc-multi.json`.\n\n### `--compiler`\n\nSpecify a custom TypeScript compiler.\n\n### `--dry`\n\nShow what would be done but doesn't actually build anything.\n\n### `--force`\n\nRebuild all projects.\n\n### `--maxWorkers`\n\nSpecify the maximum number of concurrent workers.\n\n## Caveats\n\n- Only file extension can be renamed currently.\n- Only CommonJS and ESM are tested currently, AMD, UMD or SystemJS modules may have issues.\n- When workers read/write type declaration files (`.d.ts`), there are few chances that TypeScript compiler might read files that is writing by other workers. This usually only happens on machines with poor IO performance. Set `maxWorkers` to `1` may help.\n\n## License\n\nMIT\n\n[ttypescript]: https://github.com/cevek/ttypescript\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftommy351%2Ftsc-multi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftommy351%2Ftsc-multi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftommy351%2Ftsc-multi/lists"}