Project class provides workspace and package metadata for a project. A project is denoted by a
package.json file and abides the NPM and Node.js module pattern. To begin, import and
Project class with a path to the project's root.
Root defaults to
process.cwd()if not provided.
The primary feature of this class is to extract metadata about a project's workspaces. Workspaces are used to support multi-package architectures known as monorepos, typically through Yarn, PNPM, or Lerna. In Boost, our implementation of workspaces aligns with:
- Project - Typically a repository with a root
package.json. Can either be a collection of packages, or a package itself.
- Package - A folder with a
package.jsonfile that represents an NPM package. Contains source and test files specific to the package.
- Workspace - A folder that houses one or many packages.
Project#getPackage<T extends PackageStructure>(): T
Return the contents of the
package.json found in the defined root path.
Project#getWorkspaceGlobs(options?: ProjectSearchOptions): FilePath
Returns a list of all workspaces globs as they are defined in
Project#getWorkspacePackages<T extends PackageStructure>(): WorkspacePackage<T>
package.jsons from all workspace packages. Once loaded, append workspace path metadata.
Project#getWorkspacePackagePaths(options?: ProjectSearchOptions): FilePath
Returns a list of file system paths for all workspaces packages.