fix: get tsconfig in each pkg for monorepos#61
fix: get tsconfig in each pkg for monorepos#61RikoRodriges wants to merge 2 commits intoacrazing:masterfrom
Conversation
src/parser.ts
Outdated
| const root = findPackageRoot(context); | ||
| if (!compilerOptionsByPkg.has(root)) { | ||
| let _compilerOptions = ts.parseJsonConfigFileContent( | ||
| ts.readConfigFile(path.join(root, 'tsconfig.json'), ts.sys.readFile) |
There was a problem hiding this comment.
The tsconfig.json may not exists. If you want to do that, you may need to findTsconfigDir rather than findPackageRoot.
There was a problem hiding this comment.
If tsconfig.json does not exist readConfigFile will return:
{
config: {},
error: {
messageText: 'Cannot read file'
}
}
In this case, the code will not break, and the module will still be parsed.
If you think this is not a good approach, we can pass tsconfig.json by specifying the root directory from the current working directory (where dpdm is run).
There was a problem hiding this comment.
It will skip the existing tsconfig in root directory if there is a sub directory has package.json.
There was a problem hiding this comment.
Thank you for your feedback. I have taken your comments into account and updated the PR accordingly to ensure the root tsconfig is not skipped when there is a package.json in a subdirectory. Please let me know if there are any additional adjustments you'd like me to make.
329a624 to
5a27876
Compare
|
@acrazing ping |
Added support for retrieving individual tsconfig.json files for each package within the monorepo. Previously, a single tsconfig.json file was applied from the invoking package, resulting in a unified rule for aliases across all packages. Now, each package can use its own tsconfig.json with unique aliases, allowing for more flexible build configurations per package