Socket
Socket
Sign inDemoInstall

@lerna/project

Package Overview
Dependencies
Maintainers
2
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.18.0 to 3.21.0

11

CHANGELOG.md

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

# [3.21.0](https://github.com/lerna/lerna/compare/v3.20.2...v3.21.0) (2020-05-13)
### Features
* **project:** Add `getPackagesSync()` export ([068bdd7](https://github.com/lerna/lerna/commit/068bdd75683ca9687a420523e4ba007bd8b3b220))
# [3.18.0](https://github.com/lerna/lerna/compare/v3.17.0...v3.18.0) (2019-10-15)

@@ -8,0 +19,0 @@

13

index.js

@@ -17,3 +17,3 @@ "use strict";

const deprecateConfig = require("./lib/deprecate-config");
const makeFileFinder = require("./lib/make-file-finder");
const { makeFileFinder, makeSyncFileFinder } = require("./lib/make-file-finder");

@@ -179,2 +179,12 @@ class Project {

getPackagesSync() {
return makeSyncFileFinder(this.rootPath, this.packageConfigs)("package.json", packageConfigPath => {
return new Package(
loadJsonFile.sync(packageConfigPath),
path.dirname(packageConfigPath),
this.rootPath
);
});
}
getPackageLicensePaths() {

@@ -201,1 +211,2 @@ return this.fileFinder(Project.LICENSE_GLOB, null, { case: false });

module.exports.getPackages = cwd => new Project(cwd).getPackages();
module.exports.getPackagesSync = cwd => new Project(cwd).getPackagesSync();

@@ -8,8 +8,10 @@ "use strict";

module.exports = makeFileFinder;
module.exports.makeFileFinder = makeFileFinder;
module.exports.makeSyncFileFinder = makeSyncFileFinder;
function makeFileFinder(rootPath, packageConfigs) {
function getGlobOpts(rootPath, packageConfigs) {
const globOpts = {
cwd: rootPath,
absolute: true,
expandDirectories: false,
followSymlinkedDirectories: false,

@@ -35,6 +37,12 @@ // POSIX results always need to be normalized

return globOpts;
}
function makeFileFinder(rootPath, packageConfigs) {
const globOpts = getGlobOpts(rootPath, packageConfigs);
return (fileName, fileMapper, customGlobOpts) => {
const options = Object.assign({}, customGlobOpts, globOpts);
const promise = pMap(
packageConfigs.sort(),
Array.from(packageConfigs).sort(),
globPath => {

@@ -56,8 +64,22 @@ let chain = globby(path.join(globPath, fileName), options);

// always flatten the results
return promise.then(flattenResults);
return promise.then(results => results.reduce((acc, result) => acc.concat(result), []));
};
}
function flattenResults(results) {
return results.reduce((acc, result) => acc.concat(result), []);
function makeSyncFileFinder(rootPath, packageConfigs) {
const globOpts = getGlobOpts(rootPath, packageConfigs);
return (fileName, fileMapper, customGlobOpts) => {
const options = Object.assign({}, customGlobOpts, globOpts);
const patterns = packageConfigs.map(globPath => path.join(globPath, fileName)).sort();
let results = globby.sync(patterns, options);
/* istanbul ignore else */
if (fileMapper) {
results = results.map(fileMapper);
}
return results;
};
}

4

package.json
{
"name": "@lerna/project",
"version": "3.18.0",
"version": "3.21.0",
"description": "Lerna project configuration",

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

},
"gitHead": "0ea8fb136f408fb4de3fd39bb7069d976235d53d"
"gitHead": "3367257cabe1540a3b9468acbfa0d01ba391077d"
}
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