@react-native-windows/package-utils
Advanced tools
Comparing version 0.0.0-canary.25 to 0.0.0-canary.26
@@ -56,2 +56,9 @@ /** | ||
/** | ||
* Synchronously Finds monorepo-local packages matching a given predicate. The | ||
* root package is not included. | ||
* | ||
* @param pred predicate describing whether to match a package | ||
*/ | ||
export declare function enumerateRepoPackagesSync(pred?: (pkg: NpmPackage) => boolean): WritableNpmPackage[]; | ||
/** | ||
* Finds a package with a given name (local or dependency) | ||
@@ -66,1 +73,5 @@ */ | ||
export declare function findRepoPackage(name: string): Promise<WritableNpmPackage | null>; | ||
/** | ||
* Synchronously a monorepo-local package with a given name | ||
*/ | ||
export declare function findRepoPackageSync(name: string): WritableNpmPackage | null; |
@@ -12,3 +12,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.findRepoPackage = exports.findPackage = exports.enumerateRepoPackages = exports.WritableNpmPackage = exports.NpmPackage = void 0; | ||
exports.findRepoPackageSync = exports.findRepoPackage = exports.findPackage = exports.enumerateRepoPackagesSync = exports.enumerateRepoPackages = exports.WritableNpmPackage = exports.NpmPackage = void 0; | ||
const lodash_1 = __importDefault(require("lodash")); | ||
@@ -106,2 +106,14 @@ const fs_1 = __importDefault(require("@react-native-windows/fs")); | ||
/** | ||
* Synchronously Finds monorepo-local packages matching a given predicate. The | ||
* root package is not included. | ||
* | ||
* @param pred predicate describing whether to match a package | ||
*/ | ||
function enumerateRepoPackagesSync(pred = () => true) { | ||
const repoRoot = find_repo_root_1.default.sync(); | ||
const allPackges = getMonorepoPackages(repoRoot).map((pkg) => new WritableNpmPackage(pkg.location, pkg.package)); | ||
return allPackges.filter(pred); | ||
} | ||
exports.enumerateRepoPackagesSync = enumerateRepoPackagesSync; | ||
/** | ||
* Finds a package with a given name (local or dependency) | ||
@@ -141,2 +153,15 @@ */ | ||
exports.findRepoPackage = findRepoPackage; | ||
/** | ||
* Synchronously a monorepo-local package with a given name | ||
*/ | ||
function findRepoPackageSync(name) { | ||
const packages = enumerateRepoPackagesSync((p) => p.json.name === name); | ||
if (packages.length === 0) { | ||
return null; | ||
} | ||
else { | ||
return packages[0]; | ||
} | ||
} | ||
exports.findRepoPackageSync = findRepoPackageSync; | ||
//# sourceMappingURL=packageUtils.js.map |
{ | ||
"name": "@react-native-windows/package-utils", | ||
"version": "0.0.0-canary.25", | ||
"version": "0.0.0-canary.26", | ||
"license": "MIT", | ||
@@ -19,3 +19,3 @@ "scripts": { | ||
"dependencies": { | ||
"@react-native-windows/find-repo-root": "^0.0.0-canary.28", | ||
"@react-native-windows/find-repo-root": "^0.0.0-canary.29", | ||
"@react-native-windows/fs": "^1.0.2", | ||
@@ -22,0 +22,0 @@ "get-monorepo-packages": "^1.2.0", |
Sorry, the diff of this file is not supported yet
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
18111
238