{"id":19006880,"url":"https://github.com/yowainwright/merge-tsconfigs","last_synced_at":"2025-10-24T02:22:02.613Z","repository":{"id":66114066,"uuid":"596837858","full_name":"yowainwright/merge-tsconfigs","owner":"yowainwright","description":"a CLI or Node function for merging tsconfig files 🛣️","archived":false,"fork":false,"pushed_at":"2025-03-26T08:04:54.000Z","size":534,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T12:36:29.400Z","etag":null,"topics":["cli","tsconfig","tsconfig-cli","typescript"],"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/yowainwright.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-03T02:58:16.000Z","updated_at":"2025-03-26T08:04:56.000Z","dependencies_parsed_at":"2024-04-04T06:29:49.597Z","dependency_job_id":"65550fcf-25a1-48a0-8ce6-0725ba02d42a","html_url":"https://github.com/yowainwright/merge-tsconfigs","commit_stats":{"total_commits":86,"total_committers":3,"mean_commits":"28.666666666666668","dds":0.2441860465116279,"last_synced_commit":"e6911583a447c6e4d99107be9627b89c3056cb25"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yowainwright%2Fmerge-tsconfigs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yowainwright%2Fmerge-tsconfigs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yowainwright%2Fmerge-tsconfigs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yowainwright%2Fmerge-tsconfigs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yowainwright","download_url":"https://codeload.github.com/yowainwright/merge-tsconfigs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250307074,"owners_count":21409030,"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","tsconfig","tsconfig-cli","typescript"],"created_at":"2024-11-08T18:34:55.173Z","updated_at":"2025-10-24T02:22:02.560Z","avatar_url":"https://github.com/yowainwright.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Merge-Tsconfigs\n\n![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript\u0026label\u0026labelColor=blue\u0026color=555555)\n[![npm version](https://badge.fury.io/js/merge-tsconfigs.svg)](https://badge.fury.io/js/merge-tsconfigs)\n[![unpkg](https://img.shields.io/badge/unpkg-blue.svg)](https://unpkg.com/merge-tsconfigs@0.1.1/dist/index.js)\n[![skypack](https://img.shields.io/badge/skypack-blueviolet.svg)](https://cdn.skypack.dev/merge-tsconfigs?min)\n![ci](https://github.com/yowainwright/merge-tsconfigs/actions/workflows/ci.yml/badge.svg)\n[![Github](https://badgen.net/badge/icon/github?icon=github\u0026label\u0026color=grey)](https://github.com/yowainwright/merge-tsconfigs)\n![Twitter](https://img.shields.io/twitter/url?url=https%3A%2F%2Fgithub.com%2Fyowainwright%2Fmerge-tsconfigs)\n\n_Merge-tsconfigs_ is a CLI and node tool for merging tsconfig files into the exact tsconfig file you want. 💪\n\n---\n\n**[Why do I want this?](#why-do-i-want-this)** | **[Example](#for-example)** | **[How do I use this?](#how-do-i-use-this)** | **[CLI API](#cli-api)** | **[Node API](#node-api)** | **[How do I start using this?](#how-do-i-start-using-this)**\n\n---\n\n## Why do I want this?\n\nTsconfig files are copied, pasted, or left as out-of-sync widows 😥 throughout projects. _Merge-tsconfigs_ provides a CLI and node functions to merge tsconfigs files and compilerOptions into _the single tsconfig file you want at a given time_.\n\nFor example, if you have a monorepo with multiple packages and you want to deploy one of them with a single tsconfig, you might need to copy a tsconfig from root, or write another static tsconfig just for deployment. Well, with _Merge-tsconfigs_ you can run the CLI to write a temporary tsconfig to be used for deployment.\n\nBy providing an easy way to create the tsconfig you want, your everyday tsconfig code remains the same, your dockerfiles require less context into other directories, and your deployment process is dynamically more exact.\n\n---\n\n### _For example_\n\nBy running `merge-tsconfigs ./tsconfig.build.json` you'll merge `tsconfig.json`\n```ts\n{\n  \"compilerOptions\": {\n    \"allowJS\": true\n  }\n}\n```\n\nand, `tsconfig.build.json`\n```ts\n{\n  \"compilerOptions\": {\n    \"target\": \"esnext\"\n  },\n  \"extends\": \"./tsconfig.json\"\n}\n```\n\ninto `tsconfig.merged.json`\n```ts\n{\n  \"compilerOptions\": {\n    \"allowJS\": true,\n    \"target\": \"esnext\"\n  }\n}\n```\n\nWhich you can now use for deployment, dockerfiles, or any other use case. And, you don't have to worry about copying, pasting, or keeping track of multiple tsconfigs! 🎉\n\n---\n\n## How do I use this?\n\nMerge-tsconfigs is built to be uses as a CLI first and foremost. It also exports node functions which can be used to preform the same merge operation.\n\n---\n### CLI API\n\nListed below are the CLI options and arguments to execute merge-tsconfigs. To \\*_view all_ cli options in your browser, run `merge-tsconfigs --help`!\n\n```sh\nUsage: merge-tsconfigs [options] [files...]\n\nMerge-tsconfigs is a CLI and node tool for merging tsconfig files into the exact tsconfig file you want 🛣️\n\nArguments:\n  files                       files to check, matches an array pattern\n\nOptions:\n  -o, --out [out]             output file\n  -i, --include [include...]  files to include, matches a glob or array pattern\n  -e, --exclude [exclude...]  files to exclude, matches a glob or array pattern\n  -p, --path \u003cpath\u003e           a json parseable string wrapped object, e.g. {\"item/*\": [\"foo\": \"bar\"]}\n  -h, --help                  display help for command\n```\n\n\\*`compilerOptions` are not added above for readability (but they can be leveraged). To view all cli options, run `merge-tsconfigs --help`! `compilerOptions.paths` is a string wrapped object.\n\n#### Recipes\n\nMerge tsconfig files into a single tsconfig\n\n```sh\nmerge-tsconfigs ./tsconfig.json ./tsconfig.build.json\n# ./tsconfig.json + ./tsconfig.build.json =\u003e ./tsconfig.merged.json\n```\n\nMerge tsconfig files a specific tsconfig file\n\n```sh\nmerge-tsconfigs ./tsconfig.json ./tsconfig.build.json --out ./tsconfig.out.json\n# ./tsconfig.json + ./tsconfig.build.json =\u003e ./tsconfig.out.json\n```\n\nMerge tsconfig files with unique `include` and `exclude` strings\n\n```sh\nmerge-tsconfigs ./tsconfig.json ./tsconfig.build.json --include 'src/**.ts' --exclude 'test/**.ts'\n# ./tsconfig.json + ./tsconfig.build.json =\u003e ./tsconfig.merged.json\n```\n\n```ts\n// tsconfig.merged.json\n{\n  \"compilerOptions\": {\n    // ...options\n  },\n  \"include\": [\"src/**.ts\"],\n  \"exclude\": [\"test/**.ts\", \"config/*.ts\"]\n}\n```\n\nMerge tsconfig files with unique `include` and `exclude` or by using arrays\n\n```sh\nmerge-tsconfigs ./tsconfig.json ./tsconfig.build.json --include 'src/**.ts' --exclude 'test/**.ts' 'config/*.ts'\n# ./tsconfig.json + ./tsconfig.build.json =\u003e ./tsconfig.merged.json\n```\n\n```ts\n// tsconfig.merged.json\n{\n  \"compilerOptions\": {\n    // ...options\n  },\n  \"include\": [\"src/**.ts\"],\n  \"exclude\": [\"test/**.ts\", \"config/*.ts\"]\n}\n```\n\nSprinkle in some `compilerOptions` to the mix\n\n```sh\nmerge-tsconfigs ./tsconfig.json ./tsconfig.build.json --out ./tsconfig.out.json --allowJs true --noEmit true\n# ./tsconfig.json + ./tsconfig.build.json =\u003e ./tsconfig.out.json\n```\n\n```ts\n// tsconfig.out.json\n{\n  \"compilerOptions\": {\n    \"allowJS\": true,\n    \"noEmit\": true,\n  }\n}\n```\n\nDelete a compiler option\n\n```sh\nmerge-tsconfigs ./tsconfig.json ./tsconfig.build.json --allowJS --noEmit 'delete'\n# ./tsconfig.json + ./tsconfig.build.json =\u003e ./tsconfig.merged.json\n```\n\n```ts\n// tsconfig.merged.json\n{\n  \"compilerOptions\": {\n    \"allowJS\": true,\n    // \"noEmit\": true, // deleted\n  }\n}\n```\n\nAdd a path to `compilerOptions.paths`\n\n```sh\nmerge-tsconfigs ./tsconfig.json ./tsconfig.build.json --path '{\"item/*\": [\"foo\": \"bar\"]}'\n# ./tsconfig.json + ./tsconfig.build.json =\u003e ./tsconfig.merged.json\n```\n\n```ts\n// tsconfig.merged.json\n{\n  \"compilerOptions\": {\n    \"paths\": {\n      \"item/*\": [\"foo\": \"bar\"]\n    }\n  }\n}\n```\n\n---\n\n### Node API\n\nThe node API works exactly the same as the CLI API.\n\n```ts\nimport mergeTsconfigs from 'merge-tsconfigs';\n\nmergeTsconfigs({\n  files: ['./tsconfig.json', './tsconfig.build.json'],\n  out: './tsconfig.out.json',\n  include: ['src/**.ts'],\n  exclude: ['test/**.ts'],\n  compilerOptions: {\n    allowJs: true,\n    noEmit: true,\n  },\n});\n\n```\n\nYou can use any compiler options provided by [Typescript](https://www.typescriptlang.org/docs/handbook/compiler-options.html). Object keys aren't currently implemented but can be upon feature request.\n\n#### Recipes\n\nMerge tsconfig files into a single tsconfig\n\n```ts\nconst config = mergeTsconfigs({\n  files: ['./tsconfig.json', './tsconfig.build.json'],\n});\n// ./tsconfig.json + ./tsconfig.build.json =\u003e ./tsconfig.merged.json\n```\n\nMerge tsconfig files into a custom output file\n\n```ts\nconst config = mergeTsconfigs({\n  files: ['./tsconfig.json', './tsconfig.build.json'],\n  out: './new-dir/tsconfig.out.json',\n});\n// ./tsconfig.json + ./tsconfig.build.json =\u003e ./tsconfig.out.json\n```\n\n---\n\n## How do I start using this?\n\nInstall merge-tsconfigs with your preferred package manager.\n\n```sh\nnpm install merge-tsconfigs --save-dev\n```\n\n\\*_Untested_: In, Deno, Snowpack, or other options, you can import merge-tsconfigs directly into your project.\n```ts\nimport mergeTsconfigs from 'npm:merge-tsconfigs';\n// or\nimport mergeTsconfigs from \"https://cdn.skypack.dev/merge-tsconfigs@latest\";\n// or\nimport mergeTsconfigs from \"https://unpkg.com/merge-tsconfigs@latest/dist/index.js\";\n```\n\n---\n\nMade by [@yowainwright](https://github.com/yowainwright), MIT 2023\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyowainwright%2Fmerge-tsconfigs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyowainwright%2Fmerge-tsconfigs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyowainwright%2Fmerge-tsconfigs/lists"}