Socket
Socket
Sign inDemoInstall

lerna-update-wizard

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lerna-update-wizard - npm Package Compare versions

Comparing version 0.11.1 to 0.12.0

src/utils/lines.js

2

package.json

@@ -6,3 +6,3 @@ {

},
"version": "0.11.1",
"version": "0.12.0",
"main": "index.js",

@@ -9,0 +9,0 @@ "license": "MIT",

@@ -43,8 +43,24 @@ const path = require("path");

const { name: projectName } = require(projectPackageJsonPath);
ui.logBottom("Resolving package locations...");
// Read `lerna.json` config file
let lernaConfig = {};
let packagesConfig = ["packages/*"];
const { name: projectName, workspaces } = require(projectPackageJsonPath);
// Attempt to get `packages` config from project package.json
if (workspaces && Array.isArray(workspaces.packages)) {
packagesConfig = workspaces.packages;
ui.logBottom(
"Found `packages` config in `package.json['workspaces']['packages']`"
);
}
// Attempt to get `packages` config from lerna.json
try {
lernaConfig = require(resolve(projectDir, "lerna.json"));
const lernaConfig = require(resolve(projectDir, "lerna.json"));
if (Array.isArray(lernaConfig.packages)) {
packagesConfig = lernaConfig.packages;
ui.logBottom("Found `packages` config in `lerna.json['packages']`");
}
} catch (e) {}

@@ -62,3 +78,3 @@

? flags.packages.split(",")
: lernaConfig.packages || ["packages/*"];
: packagesConfig;

@@ -78,3 +94,10 @@ const packagesRead = await globby(

invariant(packages.length > 0, "No packages found. Is this a Lerna project?");
invariant(
packages.length > 0,
"No packages found. Please specify via:",
"",
" package.json: ['workspaces']['packages']",
" lerna.json: ['packages']",
" --packages (CLI flag. See --help)"
);

@@ -81,0 +104,0 @@ ui.logBottom("");

@@ -1,5 +0,7 @@

module.exports = (condition, ...lines) => {
const lines = require("./lines");
module.exports = (condition, ...textLines) => {
if (!condition) {
throw new Error(lines.join("\n"));
throw new Error(lines(...textLines));
}
};

@@ -27,3 +27,3 @@ const { default: runProgram } = require("./utils/runProgram");

projectPath,
"No packages found. Is this a Lerna project?"
"Error: No packages found. Please specify via:"
);

@@ -33,2 +33,29 @@ });

describe("but given a package.json `packages` configuration", () => {
it("uses the package.json `packages` configuration", async () => {
// eslint-disable-next-line
jest.setTimeout(100000);
const projectPath = await generateProject({
...projectConfig,
workspaces: { packages: ["fooPackages/*"] },
packages: [
{
name: "sub-package-myPackages",
dependencies: { lodash: "0.1.0" },
moduleDirName: "fooPackages",
},
],
});
await runProgram(
projectPath,
`? Select a dependency to upgrade: (Use arrow keys or type to search)
❯ lodash (1 version)
>>> input CTRL+C`
);
});
});
describe("when given a single non-standard packages location", () => {

@@ -35,0 +62,0 @@ it("reads and installs correctly from/to that directory", async () => {

@@ -8,3 +8,10 @@ const fs = require("fs-extra");

const generateProject = async (options, log) => {
const { name, packages, dependencies, prefixPath, lernaJson } = options;
const {
name,
packages,
dependencies,
prefixPath,
lernaJson,
workspaces,
} = options;

@@ -28,3 +35,4 @@ const p = path.resolve(prefixPath, name);

"author": "",
"license": "ISC"
"license": "ISC",
"workspaces": ${workspaces ? JSON.stringify(workspaces) : "{}"}
}`),

@@ -31,0 +39,0 @@ null,

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