Socket
Socket
Sign inDemoInstall

@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.11 to 3.0.0-beta.12

20

CHANGELOG.md

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

<a name="3.0.0-beta.12"></a>
# [3.0.0-beta.12](https://github.com/lerna/lerna/compare/v3.0.0-beta.11...v3.0.0-beta.12) (2018-03-30)
### Features
* **package:** Add Map-like get/set methods, remove raw json getter ([707d1f0](https://github.com/lerna/lerna/commit/707d1f0))
* **project:** Merge `package` and `packageJson` into `manifest` ([9a47ff7](https://github.com/lerna/lerna/commit/9a47ff7))
### BREAKING CHANGES
* **package:** The `Package` class no longer provides direct access to the JSON object
used to construct the instance. Map-like `get()`/`set(val)` methods are
available to modify the internal representation.
<a name="3.0.0-beta.11"></a>

@@ -8,0 +28,0 @@ # [3.0.0-beta.11](https://github.com/lerna/lerna/compare/v3.0.0-beta.10...v3.0.0-beta.11) (2018-03-29)

44

index.js

@@ -61,7 +61,6 @@ "use strict";

this.config = loaded.config;
this.rootConfigLocation = loaded.filepath;
this.rootPath = path.dirname(loaded.filepath);
log.verbose("rootPath", this.rootPath);
this.lernaConfigLocation = loaded.filepath;
this.packageJsonLocation = path.join(this.rootPath, "package.json");
}

@@ -79,3 +78,5 @@

if (this.config.useWorkspaces) {
if (!this.packageJson.workspaces) {
const workspaces = this.manifest.get("workspaces");
if (!workspaces) {
throw new ValidationError(

@@ -90,3 +91,3 @@ "EWORKSPACES",

return this.packageJson.workspaces.packages || this.packageJson.workspaces;
return workspaces.packages || workspaces;
}

@@ -101,16 +102,20 @@

get packageJson() {
let packageJson;
get manifest() {
let manifest;
try {
packageJson = loadJsonFile.sync(this.packageJsonLocation);
const manifestLocation = path.join(this.rootPath, "package.json");
const packageJson = loadJsonFile.sync(manifestLocation);
if (!packageJson.name) {
// npm-lifecycle chokes if this is missing, so default like npm init does
packageJson.name = path.basename(path.dirname(this.packageJsonLocation));
packageJson.name = path.basename(path.dirname(manifestLocation));
}
// Encapsulate raw JSON in Package instance
manifest = new Package(packageJson, this.rootPath);
// redefine getter to lazy-loaded value
Object.defineProperty(this, "packageJson", {
value: packageJson,
Object.defineProperty(this, "manifest", {
value: manifest,
});

@@ -122,16 +127,5 @@ } catch (err) {

return packageJson;
return manifest;
}
get package() {
const pkg = new Package(this.packageJson, this.rootPath);
// redefine getter to lazy-loaded value
Object.defineProperty(this, "package", {
value: pkg,
});
return pkg;
}
isIndependent() {

@@ -143,4 +137,4 @@ return this.version === "independent";

// TODO: might be package.json prop
return writeJsonFile(this.lernaConfigLocation, this.config, { indent: 2, detectIndent: true }).then(
() => this.lernaConfigLocation
return writeJsonFile(this.rootConfigLocation, this.config, { indent: 2, detectIndent: true }).then(
() => this.rootConfigLocation
);

@@ -147,0 +141,0 @@ }

{
"name": "@lerna/project",
"version": "3.0.0-beta.11",
"version": "3.0.0-beta.12",
"description": "Lerna project configuration",

@@ -34,3 +34,3 @@ "keywords": [

"dependencies": {
"@lerna/package": "^3.0.0-beta.11",
"@lerna/package": "^3.0.0-beta.12",
"@lerna/validation-error": "^3.0.0-beta.10",

@@ -45,3 +45,3 @@ "cosmiconfig": "^4.0.0",

},
"gitHead": "197a09d58322e86f589ef7839c2438f830d72476"
"gitHead": "05dce5c0e4bca8dc894a99ed28337c85c211b37c"
}
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