forked from pixijs/pixijs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackages.js
32 lines (27 loc) · 853 Bytes
/
packages.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const path = require('path');
const fs = require('fs');
const batchPackages = require('@lerna/batch-packages');
const { getPackages } = require('@lerna/project');
/**
* Get a list of the non-private sorted packages with Lerna v3
* @see https://github.com/lerna/lerna/issues/1848
* @return {Promise<Package[]>} List of packages
*/
async function getSortedPackages()
{
// Standard Lerna plumbing getting packages
const packages = await getPackages(path.dirname(__dirname));
return batchPackages(packages)
.reduce((arr, batch) => arr.concat(batch), []);
}
async function main()
{
const buffer = [];
(await getSortedPackages()).forEach((pkg) =>
{
buffer.push(`${pkg.location}/test`);
});
// eslint-disable-next-line no-console
console.log(JSON.stringify(buffer.filter(fs.existsSync)));
}
main();