yarn-workspaces-utils

0.0.2 • Public • Published

Yarn Workspaces Utils

Util commands for yarn workspaces. For now, working with flow and yarn workspaces is especially expected.

Features

  • ywu link: create symlinks to modules into packages' node_modules.
  • ywu unlink: unlink modules.
  • ywu clean: remove all modules under node_modules.

To see possible options, run like ywu link --help.

Installation

In project root,

yarn add -D yarn-workspaces-utils -W

Using -W option to supress the error below.

error Running this command will add the dependency to the workspace root rather than workspace itself, which might not be what you want - if you really meant it, make it explicit by running this command again with the -W flag (or --ignore-workspace-root-check).

Example

See /example in detail.

{
    "scripts": {
        "utils": "ywu",
        "link": "ywu link",
        "unlink": "ywu unlink",
        "clean": "ywu clean",
        // hooks scripts
        "postinstall": "yarn link",
        "preuninstall": "yarn unlink && yarn clean"
    }
}

Programatic Usage

const ywu = require('yarn-workspaces-utils')
 
const cmdName = 'link'
const rootDir = process.cwd()
 
ywu(cmdName, {
    rootDir,
    destPath,  // Optional with 'link' & 'unlink'
    ignorePaths,  // Optional
    verbose,  // Optional
    silent,  // Optional
    workspaces,  // Optional
})

Readme

Keywords

none

Package Sidebar

Install

npm i yarn-workspaces-utils

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

21.1 kB

Total Files

21

Last publish

Collaborators

  • shqld