Monorepo
Helper functions for working with monorepos.
Functions
copyToMonorepoNodeModules()
function copyToMonorepoNodeModules(packageRoot): void
Helper function to copy a package's build output to the "node_modules" folder at the root of the monorepo. This obviates the need for the monorepo to consume the actual npm package. (This is useful for ESLint plugins inside of a monorepo, for example.)
This function assumes that the monorepo root is two directories above the provided package root.
Parameters
Parameter | Type |
---|---|
packageRoot | string |
Returns
void
Defined in
packages/complete-node/src/functions/monorepo.ts:26
fixMonorepoPackageDistDirectory()
function fixMonorepoPackageDistDirectory(packageRoot): void
In a monorepo without project references, tsc
will compile parent projects and include it in
the build output, making a weird directory structure. Since build output for a single package
should not be include other monorepo dependencies inside of it, all of the output needs to be
deleted except for the actual package output.
This function will assume an "outDir" of "dist".
Parameters
Parameter | Type |
---|---|
packageRoot | string |
Returns
void
Defined in
packages/complete-node/src/functions/monorepo.ts:50
getMonorepoPackageNames()
function getMonorepoPackageNames(monorepoRoot, scriptName?): Promise<readonly string[]>
Helper function to asynchronously get the package names in a monorepo by looking at all of the subdirectories in the "packages" directory.
Parameters
Parameter | Type | Description |
---|---|---|
monorepoRoot | string | The full path to the root of the monorepo. |
scriptName ? | string | Optional. If specified, the package names will be filtered to only include those that include scripts with the given name. |
Returns
Promise
<readonly string
[]>