forked from deephaven/web-client-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
packageManifest.js
38 lines (32 loc) · 1001 Bytes
/
packageManifest.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
33
34
35
36
37
38
const fs = require('fs');
const path = require('path');
/**
* Build a package manifest for the @deephaven packages.
* @returns {{
* packageNames: string[], // The package names.
* packageManifest: Map<string, string> // Map of package names to directory names.
* }}
*/
function buildPackageManifest() {
const packageDirNames = fs
.readdirSync(path.join(__dirname, 'packages'), { withFileTypes: true })
.filter(ent => ent.isDirectory())
.map(({ name }) => name);
// Map of package name to directory name
const packageManifest = new Map();
packageDirNames.forEach(dirName => {
// eslint-disable-next-line import/no-dynamic-require, global-require
const packageName = require(path.join(
__dirname,
'packages',
dirName,
'package.json'
)).name;
packageManifest.set(packageName, dirName);
});
return {
packageNames: [...packageManifest.keys()],
packageManifest,
};
}
module.exports = buildPackageManifest;