update-ts-references
If your repository is a multi package repository (via lerna.js, yarn workspaces, pnpm workspaces or since v7 npm workspaces) in combination with project references from TypeScript, this tool will be very helpful by reading dependencies out of the package.json and applying them to the tsconfig.json as references.There's a blog post that's a good introduction to it Optimizing multi-package apps with TypeScript Project References.
Usage
You can just use it via npxnpx update-ts-references --help
Usage: update-ts-references [options]
Options:
--configName The name of the config files which needs to be updated. Default: tsconfig.json
--check Checks if updates would be necessary (without applying them)
--help Show help
--cwd Set working directory. Default: [current path]
--verbose Show verbose output. Default: false
or you add it as dev dependency and include it in the
postinstall
script in the package.jsonyarn add update-ts-references --dev -W
"scripts": {
"postinstall": "update-ts-references"
},
"husky": {
"hooks": {
"pre-push": "update-ts-references --check"
}
},
FAQ
Why is my pnpm workspace alias not working?
update-ts-references is currently not supporting Referencing workspace packages through aliases yet. See issue #13License
Copyright 2023 mobile.de
Developer: Mirko KruschkeUse of this source code is governed by an MIT-style license that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.