1 | 'use strict';
|
2 |
|
3 | var _ = require('lodash');
|
4 | var globby = require('globby');
|
5 | var readPackageJson = require('./read-package-json');
|
6 | var path = require('path');
|
7 |
|
8 | module.exports = function (cwd) {
|
9 | var GLOBBY_PACKAGE_JSON = '{*/package.json,@*/*/package.json}';
|
10 | var installedPackages = globby.sync(GLOBBY_PACKAGE_JSON, { cwd: cwd });
|
11 |
|
12 | return _(installedPackages).map(function (pkgPath) {
|
13 | var pkg = readPackageJson(path.resolve(cwd, pkgPath));
|
14 | return [pkg.name, pkg.version];
|
15 | }).fromPairs().valueOf();
|
16 | }; |
\ | No newline at end of file |