@alexaegis/workspace-tools
Version:
Tools for working with javascript workspaces
45 lines • 2.07 kB
TypeScript
import { Defined } from '@alexaegis/common';
import { JsonMatcherFrom } from '@alexaegis/match';
import { PackageJson } from '../index.js';
import { GetRootPackageJsonOptions, NormalizedGetRootPackageJsonOptions } from '../npm/get-root-package-json.function.options.js';
interface CollectWorkspaceOnlyOptions {
/**
* Only return the root workspace package
*
* @defaultValue false
*/
onlyWorkspaceRoot?: boolean;
/**
* Skip the root workspace package itself. Has no effect if the repo is
* not a monorepo!
*
* @defaultValue false
*/
skipWorkspaceRoot?: boolean;
/**
* When defined only the packages where the package.json file is matching
* to this matcher are returned.
*/
packageJsonMatcher?: JsonMatcherFrom<PackageJson> | undefined;
/**
* Return only those packages that list these dependencies among either
* `dependencies` or `devDependencies`. When it's not
* defined or is an empty array, it will not perform such filtering.
*
* Note that while the `packageJsonMatcher` can also match dependencies,
* matching across multiple fields at the top level means that you're
* limited to only use a single function based matcher, or writing
* needlessly complicated boilerplate. So this field is here to trivialize
* this usecase.
*
* @defaultValue []
*/
dependencyCriteria?: (string | RegExp)[];
}
export type CollectWorkspacePackagesOptions = CollectWorkspaceOnlyOptions & GetRootPackageJsonOptions;
export type NormalizedCollectWorkspacePackagesOptions = Defined<Omit<CollectWorkspaceOnlyOptions, 'dependencyCriteria' | 'packageJsonMatcher'>> & {
dependencyCriteria: RegExp[];
} & Pick<CollectWorkspaceOnlyOptions, 'packageJsonMatcher'> & NormalizedGetRootPackageJsonOptions;
export declare const normalizeCollectWorkspacePackagesOptions: (options?: CollectWorkspacePackagesOptions) => NormalizedCollectWorkspacePackagesOptions;
export {};
//# sourceMappingURL=collect-workspace-packages.function.options.d.ts.map