Helpers to get information about single/multi-package contexts.
Supports:
- single packages
"workspaces"
inpackage.json
(yarn or npm@7)lerna.json
defined workspaces
resolveDirectoryContext
import fs from 'fs';
import path from 'path';
import { resolveDirectoryContext } from '@wixc3/resolve-directory-context';
const context = resolveDirectoryContext(basePath, { ...fs, ...path });
if (context.type === 'multi') {
// context.rootPackage === {...}
// context.packages === [{...}, {...}]
} else {
// context.type === 'single'
// context.npmPackage === {...}
}
MIT