workspace-builder

1.0.2 • Public • Published

workspace-builder

CLI tool that run builds for every yarn workspace in your monorepo

Overview

When run, this tool will:

  • Read your monorepo's package.json
  • Use the 'workspaces' key to find all the yarn workspaces in your repo
  • For each workspace...
  • Read the package.json in the workspace dir
  • Load the module or file that the "workspace-builder" key in the workspace's package.json refers to
  • Run the function exported from that file with an object with the following shape:
    interface Workspace {
      name: string;
      path: string; // absolute path to the workspace directory
      packageJson: Object; // The package.json for the workspace
      srcDir: string | null; // absolute path to the workspace's src directory, if it exists
      dependsOn: Array<Workspace>; // array of workspace packages that this workspace has in its package.json dependencies
    }

It also has a watch mode where it does the same thing, but watches each workspace directory's src dir for changes and re-runs the build when a change occurs.

Usage

  • Create a monorepo using yarn workspaces
  • Add a "workspace-builder" key to the package.json of each workspace that needs to be built. The value of this key should be the path to/name of a "builder module" or an array of paths to/names of "builder modules".
  • Put all your source code for each workspace in its src dir. The build output will be written to its dist dir.

Official builder modules

Here is a list of all the official builder modules available on npm:

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    6
    • latest

Version History

Package Sidebar

Install

npm i workspace-builder

Weekly Downloads

8

Version

1.0.2

License

MIT

Unpacked Size

12.5 kB

Total Files

9

Last publish

Collaborators

  • suchipi