@manypkg/get-packages
Advanced tools
Comparing version 1.0.0 to 1.0.1
# @manypkg/get-packages | ||
## 1.0.1 | ||
### Patch Changes | ||
- [`596d821`](https://github.com/Thinkmill/manypkg/commit/596d82108bfb2debdfd6c82569ae5efb5b5ed587) [#55](https://github.com/Thinkmill/manypkg/pull/55) Thanks [@Andarist](https://github.com/Andarist)! - Ignore `node_modules` when glob searching for packages. This fixes an issue with package cycles. | ||
## 1.0.0 | ||
### Major Changes | ||
- [`72a0112`](https://github.com/Thinkmill/manypkg/commit/72a01127a5804cc8b881ab1a67e83a6149944ade) [#47](https://github.com/Thinkmill/manypkg/pull/47) Thanks [@tarang9211](https://github.com/tarang9211)! - Initial release of `@manypkg/get-packages`. If you're migrating from `get-workspaces`, the most important changes are: | ||
- [`72a0112`](https://github.com/Thinkmill/manypkg/commit/72a01127a5804cc8b881ab1a67e83a6149944ade) [#47](https://github.com/Thinkmill/manypkg/pull/47) Thanks [@tarang9211](https://github.com/tarang9211)! - Initial release of `@manypkg/get-packages`. If you're migrating from `get-workspaces`, the most important changes are: | ||
- getPackages is a named export | ||
@@ -15,3 +20,3 @@ - getPackages only accepts a single argument which is the directory to search from | ||
- the package objects no longer have a `name` field and the `config` property has been renamed to `packageJson` | ||
See the README for more information on the new API | ||
@@ -18,0 +23,0 @@ |
@@ -47,3 +47,3 @@ 'use strict'; | ||
_regeneratorRuntime.mark(function _callee(dir) { | ||
var cwd, pkg, tool, manifest, root, folders, pkgJsonsMissingNameField, results; | ||
var cwd, pkg, tool, manifest, root, directories, pkgJsonsMissingNameField, results; | ||
return _regeneratorRuntime.wrap(function _callee$(_context) { | ||
@@ -157,10 +157,11 @@ while (1) { | ||
absolute: true, | ||
expandDirectories: false | ||
expandDirectories: false, | ||
ignore: ["**/node_modules"] | ||
}); | ||
case 32: | ||
folders = _context.sent; | ||
directories = _context.sent; | ||
pkgJsonsMissingNameField = []; | ||
_context.next = 36; | ||
return Promise.all(folders.sort().map(function (dir) { | ||
return Promise.all(directories.sort().map(function (dir) { | ||
return fs.readJson(path.join(dir, "package.json")).then(function (packageJson) { | ||
@@ -275,10 +276,11 @@ if (!packageJson.name) { | ||
var folders = globby.sync(tool.packageGlobs, { | ||
var directories = globby.sync(tool.packageGlobs, { | ||
cwd: cwd, | ||
onlyDirectories: true, | ||
absolute: true, | ||
expandDirectories: false | ||
expandDirectories: false, | ||
ignore: ["**/node_modules"] | ||
}); | ||
var pkgJsonsMissingNameField = []; | ||
var results = folders.sort().map(function (dir) { | ||
var results = directories.sort().map(function (dir) { | ||
try { | ||
@@ -285,0 +287,0 @@ var packageJson = fs.readJsonSync(path.join(dir, "package.json")); |
@@ -26,3 +26,3 @@ "use strict"; | ||
return (_getPackages = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(dir) { | ||
var cwd, pkg, tool, manifest, root, folders, pkgJsonsMissingNameField, results; | ||
var cwd, pkg, tool, manifest, root, directories, pkgJsonsMissingNameField, results; | ||
return _regeneratorRuntime.wrap(function(_context) { | ||
@@ -104,8 +104,9 @@ for (;;) switch (_context.prev = _context.next) { | ||
absolute: !0, | ||
expandDirectories: !1 | ||
expandDirectories: !1, | ||
ignore: [ "**/node_modules" ] | ||
}); | ||
case 32: | ||
return folders = _context.sent, pkgJsonsMissingNameField = [], _context.next = 36, | ||
Promise.all(folders.sort().map(function(dir) { | ||
return directories = _context.sent, pkgJsonsMissingNameField = [], _context.next = 36, | ||
Promise.all(directories.sort().map(function(dir) { | ||
return fs.readJson(path.join(dir, "package.json")).then(function(packageJson) { | ||
@@ -182,8 +183,9 @@ return packageJson.name || pkgJsonsMissingNameField.push(path.relative(cwd, path.join(dir, "package.json"))), | ||
} | ||
var folders = globby.sync(tool.packageGlobs, { | ||
var directories = globby.sync(tool.packageGlobs, { | ||
cwd: cwd, | ||
onlyDirectories: !0, | ||
absolute: !0, | ||
expandDirectories: !1 | ||
}), pkgJsonsMissingNameField = [], results = folders.sort().map(function(dir) { | ||
expandDirectories: !1, | ||
ignore: [ "**/node_modules" ] | ||
}), pkgJsonsMissingNameField = [], results = directories.sort().map(function(dir) { | ||
try { | ||
@@ -190,0 +192,0 @@ var packageJson = fs.readJsonSync(path.join(dir, "package.json")); |
{ | ||
"name": "@manypkg/get-packages", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"main": "dist/get-packages.cjs.js", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -94,2 +94,15 @@ import fixturez from "fixturez"; | ||
}); | ||
it("should not crash on cyclic deps", async () => { | ||
const allPackages = await getPackages(f.copy("local-deps-cycle")); | ||
if (allPackages.packages === null) { | ||
return expect(allPackages.packages).not.toBeNull(); | ||
} | ||
expect(allPackages.packages[0].packageJson.name).toEqual( | ||
"@manypkg/cyclic-dep" | ||
); | ||
expect(allPackages.tool).toEqual("yarn"); | ||
}); | ||
}; | ||
@@ -96,0 +109,0 @@ |
@@ -95,7 +95,8 @@ // This is a modified version of the package-getting in bolt | ||
const folders = await globby(tool.packageGlobs, { | ||
const directories = await globby(tool.packageGlobs, { | ||
cwd, | ||
onlyDirectories: true, | ||
absolute: true, | ||
expandDirectories: false | ||
expandDirectories: false, | ||
ignore: ["**/node_modules"] | ||
}); | ||
@@ -107,3 +108,3 @@ | ||
await Promise.all( | ||
folders.sort().map(dir => | ||
directories.sort().map(dir => | ||
fs | ||
@@ -202,7 +203,8 @@ .readJson(path.join(dir, "package.json")) | ||
} | ||
const folders = globbySync(tool.packageGlobs, { | ||
const directories = globbySync(tool.packageGlobs, { | ||
cwd, | ||
onlyDirectories: true, | ||
absolute: true, | ||
expandDirectories: false | ||
expandDirectories: false, | ||
ignore: ["**/node_modules"] | ||
}); | ||
@@ -212,3 +214,3 @@ | ||
const results = folders | ||
const results = directories | ||
.sort() | ||
@@ -215,0 +217,0 @@ .map(dir => { |
28910
807