@lerna/project
Advanced tools
Comparing version 5.4.3 to 5.5.0
52
index.js
@@ -10,4 +10,6 @@ "use strict"; | ||
const pMap = require("p-map"); | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const writeJsonFile = require("write-json-file"); | ||
const { load } = require("js-yaml"); | ||
@@ -26,5 +28,11 @@ const { ValidationError } = require("@lerna/validation-error"); | ||
* @property {string} version | ||
* @property {string} npmClient | ||
*/ | ||
/** | ||
* @typedef {object} PnpmWorkspaceConfig | ||
* @property {string[]} packages | ||
*/ | ||
/** | ||
* A representation of the entire project managed by Lerna. | ||
@@ -108,2 +116,20 @@ * | ||
get packageConfigs() { | ||
if (this.config.npmClient === "pnpm") { | ||
log.verbose( | ||
"packageConfigs", | ||
"Package manager 'pnpm' detected. Resolving packages using 'pnpm-workspace.yaml'." | ||
); | ||
const workspaces = this.pnpmWorkspaceConfig.packages; | ||
if (!workspaces) { | ||
throw new ValidationError( | ||
"EWORKSPACES", | ||
"No 'packages' property found in pnpm-workspace.yaml. See https://pnpm.io/workspaces for help configuring workspaces in pnpm." | ||
); | ||
} | ||
return workspaces; | ||
} | ||
if (this.config.useWorkspaces) { | ||
@@ -181,2 +207,28 @@ const workspaces = this.manifest.get("workspaces"); | ||
/** @type {PnpmWorkspaceConfig} */ | ||
get pnpmWorkspaceConfig() { | ||
let config; | ||
try { | ||
const configLocation = path.join(this.rootPath, "pnpm-workspace.yaml"); | ||
const configContent = fs.readFileSync(configLocation); | ||
config = load(configContent); | ||
Object.defineProperty(this, "pnpmWorkspaceConfig", { | ||
value: config, | ||
}); | ||
} catch (err) { | ||
if (err.message.includes("ENOENT: no such file or directory")) { | ||
throw new ValidationError( | ||
"ENOENT", | ||
"No pnpm-workspace.yaml found. See https://pnpm.io/workspaces for help configuring workspaces in pnpm." | ||
); | ||
} | ||
throw new ValidationError(err.name, err.message); | ||
} | ||
return config; | ||
} | ||
get licensePath() { | ||
@@ -183,0 +235,0 @@ let licensePath; |
{ | ||
"name": "@lerna/project", | ||
"version": "5.4.3", | ||
"version": "5.5.0", | ||
"description": "Lerna project configuration", | ||
@@ -35,4 +35,4 @@ "keywords": [ | ||
"dependencies": { | ||
"@lerna/package": "5.4.3", | ||
"@lerna/validation-error": "5.4.3", | ||
"@lerna/package": "5.5.0", | ||
"@lerna/validation-error": "5.5.0", | ||
"cosmiconfig": "^7.0.0", | ||
@@ -43,2 +43,3 @@ "dedent": "^0.7.0", | ||
"globby": "^11.0.2", | ||
"js-yaml": "^4.1.0", | ||
"load-json-file": "^6.2.0", | ||
@@ -50,3 +51,3 @@ "npmlog": "^6.0.2", | ||
}, | ||
"gitHead": "225a451071a741179c9173082822bc9918a2933e" | ||
"gitHead": "bc3eb9911070325d7ceb310bc3e89e3777150560" | ||
} |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
20864
479
13
2
+ Addedjs-yaml@^4.1.0
+ Added@lerna/package@5.5.0(transitive)
+ Added@lerna/validation-error@5.5.0(transitive)
+ Addedargparse@2.0.1(transitive)
+ Addedjs-yaml@4.1.0(transitive)
- Removed@lerna/package@5.4.3(transitive)
- Removed@lerna/validation-error@5.4.3(transitive)
Updated@lerna/package@5.5.0