7/5/2023 0 Comments Lerna vs yarn workspaces![]() ![]() Project references have a few trade-offs you should be aware of.īecause dependent projects make use of. It’s important in this situation to not prepend at each reference, because you’ll end up with two copies of A in the output of D - this can lead to unexpected results. You can also enable prepending the output of a dependency using the prepend option in a reference: If you enable declarationMap, you’ll be able to use editor features like “Go to Definition” and Rename to transparently navigate and edit code across project boundaries in supported editors. We’ve also added support for declaration source maps. If this constraint is violated, tsc will inform you which files weren’t specified All implementation files must be matched by an include pattern or listed in the files array.The rootDir setting, if not explicitly set, defaults to the directory containing the tsconfig file. ![]() This setting is needed to ensure TypeScript can quickly determine where to find the outputs of the referenced project.Įnabling the composite flag changes a few things: Referenced projects must have the new composite setting enabled. Build mode (see below) will automatically build the referenced project if neededīy separating into multiple projects, you can greatly improve the speed of typechecking and compiling, reduce memory usage when using an editor, and improve enforcement of the logical groupings of your program.d.ts file’s declarations will be visible in this project If the referenced project produces an outFile, the output file.Importing modules from a referenced project will instead load its output declaration file (.When you reference a project, new things happen: The path property of each reference can point to a directory containing a tsconfig.json file, or to the config file itself (which may have any name). It’s an array of objects that specifies projects to reference: Tsconfig.json files have a new top-level property, references. Project references can solve all of these problems and more. tsc -w can’t run on multiple config files at once.Invoking tsc twice incurs more startup time overhead.There’s no built-in up-to-date checking, so you end up always running tsc twice.You could use multiple tsconfig files to solve some of those problems, but new ones would appear: Changing just the tests required typechecking the implementation again, even if nothing changed.Changing just the internals in the implementation files required typechecking the tests again, even though this wouldn’t ever cause new errors.It wasn’t possible to build test and src at the same time without having src appear in the output folder name, which you probably don’t want.It was possible for the implementation files to import the test files.Previously, this structure was rather awkward to work with if you used a single tsconfig file: api and web) but not in the root package.json - and the default in the CRWA is to set the workspace versions to 0.0.0 with the expectation that you will manage versioning for each separately.Assert. Yarn’s docs on versioning show using versions in each “side” (workspace, e.g. Your Redwood app is a monorepo using Yarn Workspaces. yarn create redwood-app my-redwood-app) is an issue for yarn. Adding a version field to the top level package.json of an app created with CRWA (e.g. ![]()
0 Comments
Leave a Reply. |