@wixc3/resolve-directory-context
v4.0.0
Published
Helpers to get information about single/multi-package contexts
Downloads
4,477
Maintainers
Readme
@wixc3/resolve-directory-context
Helpers to get information about single/multi-package contexts.
Features
Supports:
- single packages
"workspaces"
inpackage.json
(yarn or npm@7)lerna.json
defined workspaces
API
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 === {...}
}
License
MIT