You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@monorepo-utils/package-utils

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@monorepo-utils/package-utils - npm Package Compare versions

Comparing version
2.9.0
to
2.10.2
+17
-11
lib/get-packages.js

@@ -38,14 +38,4 @@ "use strict";

var getPackages = function (rootDirectory) {
var lernaJsonPath = path.join(rootDirectory, "lerna.json");
// prefer to use yarn workspace instead of lerna.json
if (fs.existsSync(lernaJsonPath)) {
var lernaJson = loadJsonFile.sync(lernaJsonPath);
var hasNotWorkspacesInLernaJson = function (v) {
return !("useWorkspaces" in v);
};
if (hasNotWorkspacesInLernaJson(lernaJson)) {
return (0, exports.findPackages)(lernaJson.packages, rootDirectory);
}
}
var pkgJsonPath = path.join(rootDirectory, "package.json");
// npm 7+/yarn workspaces support
if (fs.existsSync(pkgJsonPath)) {

@@ -67,2 +57,3 @@ var pkgJson = loadJsonFile.sync(pkgJsonPath);

}
// pnpm workspaces support
var pnpmYamlPath = path.join(rootDirectory, "pnpm-workspace.yaml");

@@ -76,2 +67,17 @@ if (fs.existsSync(pnpmYamlPath)) {

}
// legacy lerna(pre workspaces) support
// leran 7+ does not have "useWorkspaces" option
// if non-useWorkspaces and packages is defined, use it
var lernaJsonPath = path.join(rootDirectory, "lerna.json");
// prefer to use yarn workspace instead of lerna.json
if (fs.existsSync(lernaJsonPath)) {
var lernaJson = loadJsonFile.sync(lernaJsonPath);
// useWorkspaces is removed in lerna 7
var hasNotWorkspacesInLernaJson = function (v) {
return !("useWorkspaces" in v);
};
if (hasNotWorkspacesInLernaJson(lernaJson) && lernaJson.packages) {
return (0, exports.findPackages)(lernaJson.packages, rootDirectory);
}
}
// Bail if we don't find any packages

@@ -78,0 +84,0 @@ return [];

{
"name": "@monorepo-utils/package-utils",
"version": "2.9.0",
"version": "2.10.2",
"description": "Package utility for monorepo.",

@@ -70,11 +70,11 @@ "keywords": [

"devDependencies": {
"@types/jest": "^26.0.10",
"@types/jest": "^29.5.2",
"@types/load-json-file": "^5.1.0",
"@types/node": "^14.6.2",
"cross-env": "^7.0.2",
"jest": "^26.4.2",
"prettier": "^2.1.1",
"rimraf": "^3.0.2",
"ts-jest": "^26.3.0",
"typescript": "^4.4.4"
"@types/node": "^20.4.0",
"cross-env": "^7.0.3",
"jest": "^29.6.1",
"prettier": "^2.8.8",
"rimraf": "^5.0.1",
"ts-jest": "^29.1.1",
"typescript": "^5.1.6"
},

@@ -84,3 +84,3 @@ "publishConfig": {

},
"gitHead": "77d7d3a5daf5a67dbc8de45017b8898100945b16"
"gitHead": "103ae872df1b4ce67e3819e29b43d0b4dfc2c101"
}

@@ -45,19 +45,8 @@ "use strict";

export const getPackages = (rootDirectory: string): PackageResult[] => {
const lernaJsonPath = path.join(rootDirectory, "lerna.json");
// prefer to use yarn workspace instead of lerna.json
if (fs.existsSync(lernaJsonPath)) {
const lernaJson = loadJsonFile.sync(lernaJsonPath);
const hasNotWorkspacesInLernaJson = (v: any): v is { packages: string[] } => {
return !("useWorkspaces" in v);
};
if (hasNotWorkspacesInLernaJson(lernaJson)) {
return findPackages(lernaJson.packages, rootDirectory);
}
}
const pkgJsonPath = path.join(rootDirectory, "package.json");
// npm 7+/yarn workspaces support
if (fs.existsSync(pkgJsonPath)) {
const pkgJson = loadJsonFile.sync(pkgJsonPath);
const hasWorkspacesInPackageJson = (
v: any
v: any,
): v is {

@@ -79,2 +68,3 @@ workspaces: { packages: string[] } | string[];

// pnpm workspaces support
const pnpmYamlPath = path.join(rootDirectory, "pnpm-workspace.yaml");

@@ -90,4 +80,20 @@ if (fs.existsSync(pnpmYamlPath)) {

// legacy lerna(pre workspaces) support
// leran 7+ does not have "useWorkspaces" option
// if non-useWorkspaces and packages is defined, use it
const lernaJsonPath = path.join(rootDirectory, "lerna.json");
// prefer to use yarn workspace instead of lerna.json
if (fs.existsSync(lernaJsonPath)) {
const lernaJson = loadJsonFile.sync(lernaJsonPath);
// useWorkspaces is removed in lerna 7
const hasNotWorkspacesInLernaJson = (v: any): v is { packages: string[] } => {
return !("useWorkspaces" in v);
};
if (hasNotWorkspacesInLernaJson(lernaJson) && lernaJson.packages) {
return findPackages(lernaJson.packages, rootDirectory);
}
}
// Bail if we don't find any packages
return [];
};

Sorry, the diff of this file is not supported yet