Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lerna/project

Package Overview
Dependencies
Maintainers
4
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lerna/project - npm Package Compare versions

Comparing version 3.0.0-beta.1 to 3.0.0-beta.9

13

CHANGELOG.md

@@ -6,2 +6,15 @@ # Change Log

<a name="3.0.0-beta.9"></a>
# [3.0.0-beta.9](https://github.com/lerna/lerna/compare/v3.0.0-beta.8...v3.0.0-beta.9) (2018-03-24)
### Features
* **project:** Normalize config.commands -> config.command ([24e55e3](https://github.com/lerna/lerna/commit/24e55e3))
* **project:** Use cosmiconfig to locate and read lerna.json ([b8c2789](https://github.com/lerna/lerna/commit/b8c2789))
<a name="3.0.0-beta.1"></a>

@@ -8,0 +21,0 @@ # [3.0.0-beta.1](https://github.com/lerna/lerna/compare/v3.0.0-beta.0...v3.0.0-beta.1) (2018-03-09)

80

index.js
"use strict";
const cosmiconfig = require("cosmiconfig");
const dedent = require("dedent");
const findUp = require("find-up");
const globParent = require("glob-parent");

@@ -9,2 +9,3 @@ const loadJsonFile = require("load-json-file");

const path = require("path");
const writeJsonFile = require("write-json-file");

@@ -18,39 +19,56 @@ const ValidationError = require("@lerna/validation-error");

constructor(cwd) {
const lernaJsonLocation =
// findUp returns null when not found
findUp.sync("lerna.json", { cwd }) ||
// path.resolve(".", ...) starts from process.cwd()
path.resolve(cwd || ".", "lerna.json");
const explorer = cosmiconfig("lerna", {
js: false, // not unless we store version somewhere else...
rc: "lerna.json",
rcStrictJson: true,
sync: true,
transform: obj => {
// normalize command-specific config namespace
if (obj.config.commands) {
obj.config.command = obj.config.commands;
delete obj.config.commands;
}
this.rootPath = path.dirname(lernaJsonLocation);
log.verbose("rootPath", this.rootPath);
return obj;
},
});
this.lernaJsonLocation = lernaJsonLocation;
this.packageJsonLocation = path.join(this.rootPath, "package.json");
}
let loaded;
get lernaJson() {
if (!this._lernaJson) {
try {
this._lernaJson = loadJsonFile.sync(this.lernaJsonLocation);
} catch (err) {
// don't swallow syntax errors
if (err.name === "JSONError") {
throw new ValidationError(err.name, err.message);
}
// No need to distinguish between missing and empty,
// saves a lot of noisy guards elsewhere
this._lernaJson = {};
try {
loaded = explorer.load(cwd);
} catch (err) {
// don't swallow syntax errors
if (err.name === "JSONError") {
throw new ValidationError(err.name, err.message);
}
}
return this._lernaJson;
// cosmiconfig returns null when nothing is found
loaded = loaded || {
// No need to distinguish between missing and empty,
// saves a lot of noisy guards elsewhere
config: {},
// path.resolve(".", ...) starts from process.cwd()
filepath: path.resolve(cwd || ".", "lerna.json"),
};
this.config = loaded.config;
this.rootPath = path.dirname(loaded.filepath);
log.verbose("rootPath", this.rootPath);
this.lernaConfigLocation = loaded.filepath;
this.packageJsonLocation = path.join(this.rootPath, "package.json");
}
get version() {
return this.lernaJson.version;
return this.config.version;
}
set version(val) {
this.config.version = val;
}
get packageConfigs() {
if (this.lernaJson.useWorkspaces) {
if (this.config.useWorkspaces) {
if (!this.packageJson.workspaces) {

@@ -68,3 +86,4 @@ throw new ValidationError(

}
return this.lernaJson.packages || [DEFAULT_PACKAGE_GLOB];
return this.config.packages || [DEFAULT_PACKAGE_GLOB];
}

@@ -109,4 +128,11 @@

}
serializeConfig() {
// TODO: might be package.json prop
return writeJsonFile(this.lernaConfigLocation, this.config, { indent: 2, detectIndent: true }).then(
() => this.lernaConfigLocation
);
}
}
module.exports = Project;
{
"name": "@lerna/project",
"version": "3.0.0-beta.1",
"version": "3.0.0-beta.9",
"description": "TODO",

@@ -35,9 +35,10 @@ "keywords": [

"@lerna/validation-error": "^3.0.0-beta.0",
"cosmiconfig": "^4.0.0",
"dedent": "^0.7.0",
"find-up": "^2.1.0",
"glob-parent": "^3.1.0",
"load-json-file": "^4.0.0",
"npmlog": "^4.1.2"
"npmlog": "^4.1.2",
"write-json-file": "^2.3.0"
},
"gitHead": "5a527968bb9f7b7c3af0d5d86391d6d2650ddc7a"
"gitHead": "70528f23cad0186fdf7529fe32148cc1eff21272"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc