Skip to content

Helpers to get information about single/multi-package contexts.

License

Notifications You must be signed in to change notification settings

wixplosives/resolve-directory-context

Repository files navigation

@wixc3/resolve-directory-context

Build Status npm version

Helpers to get information about single/multi-package contexts.

Features

Supports:

  • single packages
  • "workspaces" in package.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

About

Helpers to get information about single/multi-package contexts.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •