@appsemble/node-utils
Version:
NodeJS utilities used by Appsemble internally.
22 lines • 675 B
JavaScript
import { readFile } from 'node:fs/promises';
import { join } from 'node:path';
import fg from 'fast-glob';
/**
* Discover Appsemble blocks based on workspaces in a monorepo.
*
* npm workspaces are supported.
*
* @param cwd The project root in which to find workspaces.
* @returns Discovered Appsemble blocks.
*/
export async function getWorkspaces(cwd) {
const { workspaces = [] } = JSON.parse(await readFile(join(cwd, 'package.json'), 'utf8'));
const dirs = await fg(workspaces, {
cwd,
absolute: true,
followSymbolicLinks: true,
onlyDirectories: true,
});
return dirs.sort();
}
//# sourceMappingURL=getWorkspaces.js.map