Currently, I am in the process of setting up my very first monorepo for a Deno-based application. In this monorepo, the workspaces will be referred to as "modules" that the API code can import from, with each module having its own test suite, among other things.
According to the Deno documentation, it is recommended to create a deps.ts
file that handles the importing and exporting of all dependencies in one central location. This allows for easy tracking and review of the versions being used.
Given the modular structure of the workspaces, the question arises: where should the deps.ts
file be located - in each individual workspace, or in the root folder of the monorepo?
Having a "global" deps.ts
file would result in a file structure similar to the following:
src/modules/first/
withindex.ts
anddeno.jsonc
src/modules/second/
withindex.ts
anddeno.jsonc
src/deps.ts
to be shared across all modules.
All import statements would then resemble something like this:
import {jose} from "../../deps.ts";
However, this approach could potentially compromise the "modularity" of the workspaces, as dependencies are being imported from outside the workspace directory. On the other hand, having multiple deps.ts
files scattered throughout the tree could defeat the purpose of centralizing dependencies.