{"_id":"@alveifbklsiu259/githubaction","_rev":"4-b17c204491eb717ab8bfe89240758b89","name":"@alveifbklsiu259/githubaction","dist-tags":{"latest":"1.11.0"},"versions":{"1.9.1":{"name":"@alveifbklsiu259/githubaction","version":"1.9.1","keywords":[],"author":"","license":"ISC","_id":"@alveifbklsiu259/githubaction@1.9.1","maintainers":[{"name":"alveifbklsiu259","email":"alveifbklsiu259@gmail.com"}],"homepage":"https://github.com/alveifbklsiu259/action#readme","bugs":{"url":"https://github.com/alveifbklsiu259/action/issues"},"dist":{"shasum":"fdfed387b65a7d65a6f927d8718eb6c65ee9a907","tarball":"https://registry.npmjs.org/@alveifbklsiu259/githubaction/-/githubaction-1.9.1.tgz","fileCount":13,"integrity":"sha512-kMlSmQ8C62LqYKB4BINkmxPvXkQDDGa52bqK8FdyO+BiCu44wdCUiuE1nPb4pp1w6qaJWbHor46D5k1XKcXf+w==","signatures":[{"sig":"MEUCICMNp/3WxmGNg28ktUmD1UDEIaJWRxotSA8um7fCVlXqAiEA1JUGNU53DVaQkRbcdcSqSYqQmoNqo6XVYVMKlj1F3LM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@alveifbklsiu259%2fgithubaction@1.9.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":5337},"main":"index.js","gitHead":"a59f8934a6816333378eb3ca249f61ec7fc3d23d","scripts":{"test":"echo \"Error: no test specified\" && exit 1","prepare":"husky","semantic-release":"npx semantic-release"},"_npmUser":{"name":"alveifbklsiu259","email":"alveifbklsiu259@gmail.com"},"repository":{"url":"git+https://github.com/alveifbklsiu259/action.git","type":"git"},"_npmVersion":"10.8.3","description":"","directories":{},"_nodeVersion":"20.17.0","publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"husky":"^9.1.2","typescript":"^5.5.4","@commitlint/cli":"^19.3.0","semantic-release":"^24.1.0","@semantic-release/git":"^10.0.1","@semantic-release/changelog":"^6.0.3","@commitlint/config-conventional":"^19.2.2"},"_npmOperationalInternal":{"tmp":"tmp/githubaction_1.9.1_1725957145592_0.7164841102556525","host":"s3://npm-registry-packages"}},"1.9.2":{"name":"@alveifbklsiu259/githubaction","version":"1.9.2","keywords":[],"author":"","license":"ISC","_id":"@alveifbklsiu259/githubaction@1.9.2","maintainers":[{"name":"alveifbklsiu259","email":"alveifbklsiu259@gmail.com"}],"homepage":"https://github.com/alveifbklsiu259/action#readme","bugs":{"url":"https://github.com/alveifbklsiu259/action/issues"},"dist":{"shasum":"a07cfafdba00ec0e0e8d464420fb3479516015d2","tarball":"https://registry.npmjs.org/@alveifbklsiu259/githubaction/-/githubaction-1.9.2.tgz","fileCount":14,"integrity":"sha512-Pjod8/a3nvBOB0bHDwgdveH904/tqGirdBWPh36oxPefiEAxVTu3a+ZXSyqK0jrKf79w2/b6t607jwhhtwENNw==","signatures":[{"sig":"MEQCIC4ykRntJO7hOVuvXd2jDkVqzZbz9Q+D0rVFI4W2MToFAiAClBU6p6EOv22a/j/hEF3Vj9gETtdAyX1EldX6Y9aEzQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@alveifbklsiu259%2fgithubaction@1.9.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":5339},"main":"index.js","gitHead":"2a85acd1331d2978772a7d550f0ecbab0404f55b","scripts":{"test":"echo \"Error: no test specified\" && exit 1","prepare":"husky","semantic-release":"npx semantic-release"},"_npmUser":{"name":"alveifbklsiu259","email":"alveifbklsiu259@gmail.com"},"repository":{"url":"git+https://github.com/alveifbklsiu259/action.git","type":"git"},"_npmVersion":"10.8.3","description":"","directories":{},"_nodeVersion":"20.17.0","publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"husky":"^9.1.2","typescript":"^5.5.4","@commitlint/cli":"^19.3.0","semantic-release":"^24.1.0","@semantic-release/git":"^10.0.1","@semantic-release/changelog":"^6.0.3","@commitlint/config-conventional":"^19.2.2"},"_npmOperationalInternal":{"tmp":"tmp/githubaction_1.9.2_1725957670095_0.8674164119225063","host":"s3://npm-registry-packages"}},"1.10.0":{"name":"@alveifbklsiu259/githubaction","version":"1.10.0","keywords":[],"author":"","license":"ISC","_id":"@alveifbklsiu259/githubaction@1.10.0","maintainers":[{"name":"alveifbklsiu259","email":"alveifbklsiu259@gmail.com"}],"homepage":"https://github.com/alveifbklsiu259/action#readme","bugs":{"url":"https://github.com/alveifbklsiu259/action/issues"},"dist":{"shasum":"b86f2af8b7049467f0ba3734a8cbbff123e13c1d","tarball":"https://registry.npmjs.org/@alveifbklsiu259/githubaction/-/githubaction-1.10.0.tgz","fileCount":14,"integrity":"sha512-4sS5GqxUrHkFghRcGPFuTjx7GEOH9j0uNkJELDGfCfzmhNAtWOvWg9eWYyfxaVi6hR1kNUMOnHvl3MXtvVmsPw==","signatures":[{"sig":"MEQCIEa7cxn9XBmJhhY5Y6OU42rx+Zek16nMyqzvb1xY1LdTAiBsycWEnGphTeeMEfetBd5cEzxPpynhuOQYu/iqZQow2Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@alveifbklsiu259%2fgithubaction@1.10.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":5396},"main":"index.js","gitHead":"a484d646513b5e49d8b26f7a0c70530e8e91afd9","scripts":{"test":"echo \"Error: no test specified\" && exit 1","prepare":"husky","semantic-release":"npx semantic-release"},"_npmUser":{"name":"alveifbklsiu259","email":"alveifbklsiu259@gmail.com"},"repository":{"url":"git+https://github.com/alveifbklsiu259/action.git","type":"git"},"_npmVersion":"10.8.3","description":"","directories":{},"_nodeVersion":"20.17.0","dependencies":{"pidtree":"^0.6.0"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"husky":"^9.1.2","typescript":"^5.5.4","@commitlint/cli":"^19.3.0","semantic-release":"^24.1.0","@semantic-release/git":"^10.0.1","@semantic-release/changelog":"^6.0.3","@commitlint/config-conventional":"^19.2.2"},"_npmOperationalInternal":{"tmp":"tmp/githubaction_1.10.0_1726029362938_0.8275465220091569","host":"s3://npm-registry-packages"}},"1.10.1":{"name":"@alveifbklsiu259/githubaction","version":"1.10.1","keywords":[],"author":"","license":"ISC","_id":"@alveifbklsiu259/githubaction@1.10.1","maintainers":[{"name":"alveifbklsiu259","email":"alveifbklsiu259@gmail.com"}],"homepage":"https://github.com/alveifbklsiu259/action#readme","bugs":{"url":"https://github.com/alveifbklsiu259/action/issues"},"dist":{"shasum":"28d7e89c7081007feb5cf26fb5fd254d3f900e68","tarball":"https://registry.npmjs.org/@alveifbklsiu259/githubaction/-/githubaction-1.10.1.tgz","fileCount":14,"integrity":"sha512-6V0BWG1mOOEBeEe4H7fDsux0u4SoszFLRmEFKvNvG9hoUO4rxyyE8JK192XLuJrsIrK1XAcysFdlStBLXkUNHg==","signatures":[{"sig":"MEUCIQD6m1hgcf7GQrooebqrHLOCT/eYgFrWYC/7HdY2pn1vigIgVbgIp1ZmHwq6WNEJAj6vA8HBhh0iG4Ti+4ZO0rgTJ7c=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@alveifbklsiu259%2fgithubaction@1.10.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":5394},"main":"index.js","gitHead":"9aeb779fbd8b23e4e6b348b95619153509984228","scripts":{"test":"echo \"Error: no test specified\" && exit 1","prepare":"husky","semantic-release":"npx semantic-release"},"_npmUser":{"name":"alveifbklsiu259","email":"alveifbklsiu259@gmail.com"},"repository":{"url":"git+https://github.com/alveifbklsiu259/action.git","type":"git"},"_npmVersion":"10.8.3","description":"","directories":{},"_nodeVersion":"20.17.0","dependencies":{"pidtree":"^0.6.0"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"husky":"^9.1.2","typescript":"^5.5.4","@commitlint/cli":"^19.3.0","semantic-release":"^24.1.0","@semantic-release/git":"^10.0.1","@semantic-release/changelog":"^6.0.3","@commitlint/config-conventional":"^19.2.2"},"_npmOperationalInternal":{"tmp":"tmp/githubaction_1.10.1_1726029651549_0.7632191039182477","host":"s3://npm-registry-packages"}},"1.11.0":{"name":"@alveifbklsiu259/githubaction","version":"1.11.0","author":{"name":"alveifbklsiu259","email":"https://github.com/alveifbklsiu259"},"license":"MIT","description":"A CLI tool that allows user to run tsc with files and tsconfig.json at the same time","keywords":["typescript","tsc"],"repository":{"type":"git","url":"git+https://github.com/alveifbklsiu259/action.git"},"bin":{"tscw":"dist/cli.js"},"main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"clean":"rimraf dist/ .lint-cache/.tsbuildinfo","build":"npm run clean && tsc -p tsconfig.build.json","prepublishOnly":"npm run build","test":"jest --verbose","test:unit":"jest --testPathPattern=test/unit","test:integration":"jest --testPathPattern=test/integration","test:e2e":"jest --testPathPattern=test/e2e","test:coverage":"jest --coverage --collectCoverageFrom \"src/**/*.ts\"","test:clean":"jest --clearCache","knip":"knip --config ./knip.config.mjs","check-format":"prettier . --ignore-unknown --check --cache --cache-strategy metadata --cache-location .lint-cache/.prettiercache","check-spelling":"cspell . --no-progress --show-context --cache --cache-strategy metadata --cache-location .lint-cache/.cspellcache","lint-markdown":"markdownlint \"**/*.md\"","lint":"eslint . --report-unused-disable-directives","lint-commit":"commitlint --from HEAD~1","type-check":"node ./dist/cli.js --noEmit -p tsconfig.build.json","get-eslint-config-types":"bash scripts/get_eslint_config_types.sh","validate-codecov":"curl -X POST --data-binary @.codecov.yml https://codecov.io/validate","prepare":"husky"},"peerDependencies":{"typescript":">=2.0.0"},"devDependencies":{"@commitlint/cli":"^19.4.1","@commitlint/config-conventional":"^19.4.1","@commitlint/format":"^19.3.0","@eslint/eslintrc":"^3.1.0","@eslint/js":"^9.9.1","@jest/globals":"^29.7.0","@trivago/prettier-plugin-sort-imports":"^4.3.0","@types/eslint-plugin-markdown":"^2.0.2","@types/eslint__eslintrc":"^2.1.2","@types/eslint__js":"^8.42.3","@types/node":"^22.2.0","@typescript-eslint/utils":"^8.3.0","cspell":"^8.14.2","eslint":"^9.9.1","eslint-config-prettier":"^9.1.0","eslint-plugin-import":"^2.29.1","eslint-plugin-jest":"^28.8.1","eslint-plugin-json":"^4.0.1","eslint-plugin-markdown":"^5.1.0","expect":"^29.7.0","globals":"^15.9.0","husky":"^9.1.5","jest":"^29.7.0","json-schema-to-typescript":"^15.0.2","knip":"^5.29.1","lint-staged":"^15.2.9","markdownlint-cli":"^0.41.0","pidtree":"^0.6.0","prettier":"^3.3.3","prettier-plugin-sh":"^0.14.0","rimraf":"^6.0.1","semantic-release":"^24.1.0","ts-jest":"^29.2.5","typescript":"^5.5.4","typescript-eslint":"^8.3.0"},"packageManager":"pnpm@9.9.0","publishConfig":{"access":"public","provenance":true},"pnpm":{"overrides":{"conventional-changelog-conventionalcommits":">= 8.0.0"}},"_id":"@alveifbklsiu259/githubaction@1.11.0","gitHead":"9fe56a03d7709311a64864c29906397655f524e2","bugs":{"url":"https://github.com/alveifbklsiu259/action/issues"},"homepage":"https://github.com/alveifbklsiu259/action#readme","_nodeVersion":"20.17.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-VMzbEDlNpLcA4Kx6uFADNdfvv3f9h+WCtk+/AOBPs+wdhxa34a8ZJHnifIslVeZ/A9gDrutJcxeoGUcYTgZwHw==","shasum":"a47e1bad7ba938f8d5dcef42a30880b13a266dd5","tarball":"https://registry.npmjs.org/@alveifbklsiu259/githubaction/-/githubaction-1.11.0.tgz","fileCount":18,"unpackedSize":41757,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@alveifbklsiu259%2fgithubaction@1.11.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH/xMvJSsbFc6nFPUBrOpFDLhOZRf8rslTnw20aRrFeRAiEAqqtHNlzVriH/liHeHp9l9v8Zv9LjrQxih5ipXO5CIII="}]},"_npmUser":{"name":"alveifbklsiu259","email":"alveifbklsiu259@gmail.com"},"directories":{},"maintainers":[{"name":"alveifbklsiu259","email":"alveifbklsiu259@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/githubaction_1.11.0_1726475463119_0.46677241268654557"},"_hasShrinkwrap":false}},"time":{"created":"2024-09-10T08:32:25.490Z","modified":"2024-09-16T08:31:03.770Z","1.9.1":"2024-09-10T08:32:25.762Z","1.9.2":"2024-09-10T08:41:10.287Z","1.10.0":"2024-09-11T04:36:03.112Z","1.10.1":"2024-09-11T04:40:51.730Z","1.11.0":"2024-09-16T08:31:03.362Z"},"bugs":{"url":"https://github.com/alveifbklsiu259/action/issues"},"license":"MIT","homepage":"https://github.com/alveifbklsiu259/action#readme","keywords":["typescript","tsc"],"repository":{"type":"git","url":"git+https://github.com/alveifbklsiu259/action.git"},"maintainers":[{"name":"alveifbklsiu259","email":"alveifbklsiu259@gmail.com"}],"readme":"<h1 align=\"center\">tsc-with-config</h1>\n\n<p align=\"center\"><b>Run <code>tsc</code> on files with tsconfig respected</b></p>\n\n<p align=\"center\">\n   <a href=\"https://www.npmjs.com/package/tsc-with-config\"><img src=\"https://img.shields.io/npm/v/tsc-with-config\" alt=\"NPM version\" /></a>\n   <a href=\"https://codecov.io/gh/alveifbklsiu259/action\" ><img src=\"https://codecov.io/gh/alveifbklsiu259/action/graph/badge.svg?token=SOI61L1993\" alt=\"codecov\"/></a>\n   <a href=\"https://github.com/jestjs/jest\" ><img src=\"https://jestjs.io/img/jest-badge.svg\" alt=\"jest\"/></a>\n   <a href=\"https://actions-badge.atrox.dev/alveifbklsiu259/tsc-with-config/goto?ref=main\"><img alt=\"GitHub actions\" src=\"https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Falveifbklsiu259%2Ftsc-with-config%2Fbadge%3Fref%3Dmain\" /></a>\n   <a href=\"https://github.com/semantic-release/semantic-release\"><img src=\"https://img.shields.io/badge/semantic--release-conventionalcommits-e10079?logo=semantic-release\" alt=\"semantic-release: conventionalcommits\"/></a>\n   <a href=\"https://npmcharts.com/compare/tsc-with-config?minimal=true\"><img src=\"https://img.shields.io/npm/dm/tsc-with-config.svg\" alt=\"NPM downloads\"/></a>\n   <a href=\"https://github.com/alveifbklsiu259/tsc-with-config/blob/main/LICENSE.md\"><img src=\"https://img.shields.io/npm/l/tsc-with-config.svg\" alt=\"GitHub license\"/></a>\n</p>\n\n## Motivation\n\n> Running tsc locally will compile the closest project defined by a `tsconfig.json`, or you can compile a set of TypeScript files by passing in a glob of files you want. **When input files are specified on the command line, tsconfig.json files are ignored**. - [tsc CLI Options](https://www.typescriptlang.org/docs/handbook/compiler-options.html)\n\n`tsc-with-config` lets you run `tsc` on files while keeping `tsconfig.json` respected.\n\n## Use cases\n\nA common use case for running `tsc` on certain files is when used in a pre-commit hook. e.g. [lint-staged](https://github.com/lint-staged/lint-staged).\n\nFor example, you may want to type-check staged files by running `tsc --noEmit foo.ts bar.ts`. In this case `tsc` will ignore the `tsconfig.json`, using `-p tsconfig.json` with files will result in an error.\n\nYou can explicitly pass the CLI options in. e.g. `--strict --allowSyntheticDefaultImports ...` to `tsc`, but that can be tedious.\n\nUsing `tscw` is much easier: `tscw --noEmit foo.ts bar.ts -p tsconfig.json`.\n\n## Getting Started\n\n`tscw` seamlessly integrates with most popular package managers, including:\n\n- npm\n- pnpm\n- Yarn\n- Yarn (Plug’n’Play)\n\nnpm:\n\n```sh\nnpm i -D tsc-with-config\n```\n\npnpm:\n\n```sh\npnpm add -D tsc-with-config\n```\n\nyarn:\n\n```sh\nyarn add -D tsc-with-config\n```\n\n## Usage\n\nAfter installing `tsc-with-config`, you can use `tscw` the same way you use `tsc`, but `tscw` will not ignore your `tsconfig.json` when files are specified.\n\nBy default, `tscw` uses the root `tsconfig.json` if no one is specified.\n\n```sh\n# root tsconfig.json is used\nnpx tscw foo.ts\n\n# specify a tsconfig\nnpx tscw --noEmit foo.ts -p ./config/tsconfig.json\n# or\nnpx tscw --noEmit foo.ts --project ./config/tsconfig.json\n\n# match ./foo.ts, ./bar.ts ...\nnpx tscw *.ts\n\n# match ./foo/baz.ts, ./bar/foo.ts ...\nnpx tscw **/*.ts\n\n# you can even use it without any files specified\nnpx tscw --noEmit # it is the same as npx tsc --noEmit\n```\n\nHere's an example of using it in a `.lintstagedrc.js` file. You can also check out the [.lintstagedrc.mjs in this project](/.lintstagedrc.mjs).\n\n```js\n/**\n * Passing absolute path is fine, but relative path is cleaner in console.\n * @param {string[]} files\n */\nconst typeCheck = files => {\n  const cwd = process.cwd();\n  const relativePaths = files.map(file => path.relative(cwd, file)).join(\" \");\n  return `npx tscw --noEmit ${relativePaths}`;\n};\n\nexport default {\n  \"**/*.{ts,mts,cts,tsx}\": [prettier, typeCheck, eslint],\n};\n```\n\nif your're using yarn PnP, instead of using `npx tscw`, use `yarn tscw`:\n\n```sh\nyarn tscw foo.ts\n```\n\n> [!NOTE]  \n> `tscw` supports all [CLI options](https://www.typescriptlang.org/docs/handbook/compiler-options.html) supported by `tsc`.\n\n### API\n\n`tsc-with-config` also exposes a function to run `tsc` programmatically, but in most cases you should use the CLI `tscw`:\n\n```ts\nimport tscw from 'tsc-with-config';\n\nconst result = await tscw`foo.ts --noEmit -p tsconfig.json`\n// or\nconst result = await tscw(\"foo.ts\", \"--noEmit\", \"-p\", \"tsconfig.json\");\n```\n\n#### Return type\n\n```ts\ntype Result = Promise<SpawnResult | SpawnError>;\n\ninterface SpawnResult {\n  pid: number;\n  exitCode: number;\n  stdout: string;\n  stderr: string;\n}\n\ninterface SpawnError {\n  pid: null;\n  exitCode: number;\n  stderr: string;\n  stdout: null;\n}\n```\n\nIn the following scenarios, the function returns `Promise<SpawnError>`:\n\n- No `package.json` is found in the root of your project.\n- No `tsconfig.json` is found in the root of your project if no tsconfig is passed to the function.\n- Specified files not found.\n- Missing argument for `-p` or `--project`.\n\n```ts\nimport tscw from \"tsc-with-config\";\n\nconst result = await tscw`foo.ts --noEmit -p noSuchFile.json`;\n\n/* \nresult: {\n      pid: null,\n      exitCode: 1,\n      stderr: \"Can't find noSuchFile.json\",\n      stdout: null,\n   };\n*/\n```\n\nOtherwise the function returns `Promise<SpawnResult>`, which means that the args are successfully passed to `tsc`.\n\nUnder the hood, `tscw` uses `spawn` to run `tsc`, the result from `tsc` is stored in `result.stdout` even when exitCode is not 0.\n\n```ts\n// containTypeError.ts\n\ntype A = number;\n\nconst _a: A = \"\";\n```\n\n```ts\nimport tscw from \"tsc-with-config\";\n\nconst result1 = await tscw`containTypeError.ts --noEmit -p tsconfig.json --pretty false`;\n\nconsole.log(result1.pid); // number\nconsole.log(result1.exitCode); // 1\nconsole.log(result1.stdout); // \"containTypeError.ts(3,7): error TS2322: Type 'string' is not assignable to type 'number'.\\r\\n\"\nconsole.log(result1.stderr); // \"\"\n\nconst result2 = await tscw`noTypeError.ts --noEmit -p tsconfig.json`;\n\nconsole.log(result2.pid); // number\nconsole.log(result2.exitCode); // 0\nconsole.log(result2.stdout); // \"\"\nconsole.log(result2.stderr); // \"\"\n```\n\n> [!NOTE]  \n> By default, `stdout` contains [ANSI escape code](https://en.wikipedia.org/wiki/ANSI_escape_code), if you want `stdout` to be plain text, pass `--pretty false` to the function.\n>\n> ```ts\n> /* \n> \"\\x1B[96mcontainTypeError.ts\\x1B[0m:\\x1B[93m3\\x1B[0m:\\x1B[93m7\\x1B[0m - \\x1B[91merror\\x1B[0m\\x1B[90m TS2322: \\x1B[0mType 'string' is not assignable to type 'number'.\\r\\n\" +\n>     '\\r\\n' +\n>     '\\x1B[7m3\\x1B[0m const _a: A = \"\";\\r\\n' +\n>     '\\x1B[7m \\x1B[0m \\x1B[91m      ~~\\x1B[0m\\r\\n' +\n>     '\\r\\n' +\n>     '\\r\\n' +\n>     'Found 1 error in containTypeError.ts\\x1B[90m:3\\x1B[0m\\r\\n' +\n>     '\\r\\n'\n>  */\n> ```\n>\n> Notice that when you pass a file to the function using a relative path, it is relative to the current working directory (cwd) when you run the script, **not relative to the file where this function is used**.\n\n> [!IMPORTANT]  \n> In most cases, you should use the CLI `tscw` when you want the process to fail if the compilation fails. For example in CI pipeline, [lint-staged](https://github.com/lint-staged/lint-staged), etc. Executing the function will not cause the process to fail even if the result contains type error, unless you explicitly exit the process with the returned `exitCode`, like [`tscw`](/src/cli.ts) does.\n\n## How it works\n\n1. Argument Parsing:\n   - The script processes user-specified arguments to handle flags and file paths.\n2. Finding `tsconfig.json`:\n   - If no `tsconfig.json` file is specified via the `-p` or `--project` flag, the nearest `tsconfig.json` file will be used for the current workspace.\n   - The script first looks for the current working directory, if not found, it goes all the way up until the level where `package.json` is located.\n3. Temporary File:\n   - A temporary file is created to store the content of the `tsconfig.json` file being used.\n   - It adds/replaces the `\"files\"` field with the files specified.\n   - It empties the `\"include\"` field.\n4. Running `tsc`:\n   - It runs `tsc` with the temp file and any specified flags.\n5. Cleanup:\n   - The script removes the temporary file when the script exits or receives certain signals(SIGINT, SIGHUP, SIGTERM).\n\n> [!NOTE]  \n> Windows has limited support for process signals compared to Unix-like systems, especially when `process.kill` is used to terminate a process, signal will not be caught by the process, therefore cleaning up the temp file is a problem. See [Signal events](https://nodejs.org/api/process.html#signal-events).\n>\n> Technically, to fix the cleanup problem, using [`options.detached`](https://nodejs.org/api/child_process.html#optionsdetached) for a child process would be enough, but [lint-staged](https://github.com/lint-staged/lint-staged) takes the approach of [terminating all the child processes by calling `process.kill`](https://github.com/lint-staged/lint-staged/blob/master/lib/resolveTaskFn.js#L55) on the tasks that are `KILLED`(When multiple tasks are running concurrently, if one task `FAILED`, other tasks will be `KILLED`).\n>\n> In order to properly fix this problem, `tsc-with-config` creates a [daemon](<https://en.wikipedia.org/wiki/Daemon_(computing)>) to handle the cleanup task if it is running on Windows. The daemon will exit gracefully after the temporary file is deleted or, at most, after 1 minute.\n","readmeFilename":"README.md","description":"A CLI tool that allows user to run tsc with files and tsconfig.json at the same time","author":{"name":"alveifbklsiu259","email":"https://github.com/alveifbklsiu259"}}