workspaces-utils

1.2.1 • Public • Published

workspaces-utils

TODO: description

Usage

const workspacesUtils = require('workspaces-utils');

// TODO: DEMONSTRATE API

Documentation

Table of Contents

getWorkSpaceDirPaths

getWorkspaceDirPaths gets you concatenated list of dir paths in workspace

Parameters

  • pathToRoot String path to root dir with default as app root in node project

Returns Array array of paths in workspace using npm-link-extras getDirectories

getWorkSpacePackages

getWorkSpacePackages gets you concatenated list of package.jsons in workspace

Parameters

  • pathToRoot String path to root dir with default as app root in node project

Returns Array array of paths in workspace using npm-link-extras getPackages

getWorkspaces

returns the defined workspace as patterns in a yarn monorepo. It accounts for yarn 1.5.1 when workspaces became an object or array.

Parameters

  • pathToRoot String path to root dir with package.json

Returns Array array of patterns (eg: packages/*)

getWorkspaceDirNames

gets you the dir names in workspace instead of globs It can optionally take a path to root with default as appRoot inside a node project

Parameters

  • pathToRoot String path to root dir

Returns Array names of dirs in workspace

getWorkspaceAbsPaths

can get you absolute paths to directories or files in workspace

Parameters

  • pathToRoot String path to root dir with default as app root in node project
  • pathTo String path to file or dir in workspace

Returns Array array of paths

getWorkSpacePathTo

is a curried fn that takes a file or dir path as the first fn arg and a root path as the second fn arg to return workspace relative paths

Parameters

  • pathToRoot String relative path to root
  • pathTo String path to file or dir in workspace

Returns Array array of paths

getPathsInWorkspace

takes an array of paths/filenames and returns workspace relative paths to them

Parameters

  • paths Array array of file names or paths
  • appRoot String root path to start from, usually application root

Returns Array array of paths mapped to workspace packages

Package Sidebar

Install

npm i workspaces-utils

Weekly Downloads

50

Version

1.2.1

License

MIT

Unpacked Size

16.6 kB

Total Files

10

Last publish

Collaborators

  • davidedaniel