@manypkg/get-packages
Advanced tools
Comparing version 2.0.0 to 2.1.0
# @manypkg/get-packages | ||
## 2.1.0 | ||
### Minor Changes | ||
- [#167](https://github.com/Thinkmill/manypkg/pull/167) [`bf586f5`](https://github.com/Thinkmill/manypkg/commit/bf586f56f14f213ac7d3e4c1ee85ef8456872c3c) Thanks [@elliot-nelson](https://github.com/elliot-nelson)! - The `getPackages` and `getPackagesSync` methods now take an optional list of `Tool` implementations, allowing the caller to restrict the desired types of monorepo discovered, or provide a custom monorepo tool implementation. | ||
### Patch Changes | ||
- Updated dependencies [[`bf586f5`](https://github.com/Thinkmill/manypkg/commit/bf586f56f14f213ac7d3e4c1ee85ef8456872c3c)]: | ||
- @manypkg/find-root@2.1.0 | ||
## 2.0.0 | ||
@@ -4,0 +15,0 @@ |
@@ -0,1 +1,2 @@ | ||
import { FindRootOptions } from "@manypkg/find-root"; | ||
import { Packages } from "@manypkg/tools"; | ||
@@ -7,3 +8,20 @@ export type { Tool, Package, Packages } from "@manypkg/tools"; | ||
} | ||
export declare function getPackages(dir: string): Promise<Packages>; | ||
export declare function getPackagesSync(dir: string): Packages; | ||
/** | ||
* Configuration options for `getPackages` and `getPackagesSync` functions. | ||
*/ | ||
export interface GetPackagesOptions extends FindRootOptions { | ||
} | ||
/** | ||
* Given a starting folder, search that folder and its parents until a supported monorepo | ||
* is found, and return the collection of packages and a corresponding monorepo `Tool` | ||
* object. | ||
* | ||
* By default, all predefined `Tool` implementations are included in the search -- the | ||
* caller can provide a list of desired tools to restrict the types of monorepos discovered, | ||
* or to provide a custom tool implementation. | ||
*/ | ||
export declare function getPackages(dir: string, options?: GetPackagesOptions): Promise<Packages>; | ||
/** | ||
* A synchronous version of {@link getPackages}. | ||
*/ | ||
export declare function getPackagesSync(dir: string, options?: GetPackagesOptions): Packages; |
@@ -18,4 +18,18 @@ 'use strict'; | ||
} | ||
async function getPackages(dir) { | ||
const monorepoRoot = await findRoot.findRoot(dir); | ||
/** | ||
* Configuration options for `getPackages` and `getPackagesSync` functions. | ||
*/ | ||
/** | ||
* Given a starting folder, search that folder and its parents until a supported monorepo | ||
* is found, and return the collection of packages and a corresponding monorepo `Tool` | ||
* object. | ||
* | ||
* By default, all predefined `Tool` implementations are included in the search -- the | ||
* caller can provide a list of desired tools to restrict the types of monorepos discovered, | ||
* or to provide a custom tool implementation. | ||
*/ | ||
async function getPackages(dir, options) { | ||
const monorepoRoot = await findRoot.findRoot(dir, options); | ||
const packages = await monorepoRoot.tool.getPackages(dir); | ||
@@ -25,4 +39,8 @@ validatePackages(packages); | ||
} | ||
function getPackagesSync(dir) { | ||
const monorepoRoot = findRoot.findRootSync(dir); | ||
/** | ||
* A synchronous version of {@link getPackages}. | ||
*/ | ||
function getPackagesSync(dir, options) { | ||
const monorepoRoot = findRoot.findRootSync(dir, options); | ||
const packages = monorepoRoot.tool.getPackagesSync(dir); | ||
@@ -29,0 +47,0 @@ validatePackages(packages); |
@@ -18,4 +18,18 @@ 'use strict'; | ||
} | ||
async function getPackages(dir) { | ||
const monorepoRoot = await findRoot.findRoot(dir); | ||
/** | ||
* Configuration options for `getPackages` and `getPackagesSync` functions. | ||
*/ | ||
/** | ||
* Given a starting folder, search that folder and its parents until a supported monorepo | ||
* is found, and return the collection of packages and a corresponding monorepo `Tool` | ||
* object. | ||
* | ||
* By default, all predefined `Tool` implementations are included in the search -- the | ||
* caller can provide a list of desired tools to restrict the types of monorepos discovered, | ||
* or to provide a custom tool implementation. | ||
*/ | ||
async function getPackages(dir, options) { | ||
const monorepoRoot = await findRoot.findRoot(dir, options); | ||
const packages = await monorepoRoot.tool.getPackages(dir); | ||
@@ -25,4 +39,8 @@ validatePackages(packages); | ||
} | ||
function getPackagesSync(dir) { | ||
const monorepoRoot = findRoot.findRootSync(dir); | ||
/** | ||
* A synchronous version of {@link getPackages}. | ||
*/ | ||
function getPackagesSync(dir, options) { | ||
const monorepoRoot = findRoot.findRootSync(dir, options); | ||
const packages = monorepoRoot.tool.getPackagesSync(dir); | ||
@@ -29,0 +47,0 @@ validatePackages(packages); |
{ | ||
"name": "@manypkg/get-packages", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"license": "MIT", | ||
"main": "dist/manypkg-get-packages.cjs.js", | ||
"dependencies": { | ||
"@manypkg/find-root": "^2.0.0", | ||
"@manypkg/find-root": "^2.1.0", | ||
"@manypkg/tools": "^1.0.0" | ||
@@ -9,0 +9,0 @@ }, |
import path from "path"; | ||
import { findRoot, findRootSync } from "@manypkg/find-root"; | ||
import { Packages, MonorepoRoot } from "@manypkg/tools"; | ||
import { findRoot, findRootSync, FindRootOptions } from "@manypkg/find-root"; | ||
import { Packages, MonorepoRoot, Tool } from "@manypkg/tools"; | ||
@@ -19,4 +19,21 @@ export type { Tool, Package, Packages } from "@manypkg/tools"; | ||
export async function getPackages(dir: string): Promise<Packages> { | ||
const monorepoRoot: MonorepoRoot = await findRoot(dir); | ||
/** | ||
* Configuration options for `getPackages` and `getPackagesSync` functions. | ||
*/ | ||
export interface GetPackagesOptions extends FindRootOptions {} | ||
/** | ||
* Given a starting folder, search that folder and its parents until a supported monorepo | ||
* is found, and return the collection of packages and a corresponding monorepo `Tool` | ||
* object. | ||
* | ||
* By default, all predefined `Tool` implementations are included in the search -- the | ||
* caller can provide a list of desired tools to restrict the types of monorepos discovered, | ||
* or to provide a custom tool implementation. | ||
*/ | ||
export async function getPackages( | ||
dir: string, | ||
options?: GetPackagesOptions | ||
): Promise<Packages> { | ||
const monorepoRoot: MonorepoRoot = await findRoot(dir, options); | ||
const packages: Packages = await monorepoRoot.tool.getPackages(dir); | ||
@@ -29,4 +46,10 @@ | ||
export function getPackagesSync(dir: string): Packages { | ||
const monorepoRoot: MonorepoRoot = findRootSync(dir); | ||
/** | ||
* A synchronous version of {@link getPackages}. | ||
*/ | ||
export function getPackagesSync( | ||
dir: string, | ||
options?: GetPackagesOptions | ||
): Packages { | ||
const monorepoRoot: MonorepoRoot = findRootSync(dir, options); | ||
const packages: Packages = monorepoRoot.tool.getPackagesSync(dir); | ||
@@ -33,0 +56,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
18917
323
0
Updated@manypkg/find-root@^2.1.0