workspace-info

yarn workspace info implementation for yarn v2 berry, lerna and npm workspaces

Usage no npm install needed!

<script type="module">
  import workspaceInfo from 'https://cdn.skypack.dev/workspace-info';
</script>

README

workspace-info

yarn workspace info --json implementation for yarn v2 berry, lerna and npm workspaces

yarn add workspace-info

Usage as cli

workspace-info --cwd tests/example-workspace

by default peer dependencies are not included, use --peer to include them

workspace-info --peer

Usage as lib

import { getWorkspaceInfo } from 'workspace-info'

console.log(
    await getWorkspaceInfo({
        cwd,
        useLerna: false,
    }),
)

// {
//     a: {
//         location: '.../tests/example-workspace/packages/a',
//         mismatchedWorkspaceDependencies: [],
//         workspaceDependencies: ['b', 'd'],
//     },
//     b: {
//         location: '.../tests/example-workspace/packages/b',
//         mismatchedWorkspaceDependencies: [],
//         workspaceDependencies: ['d'],
//     },
//     c: {
//         location: '.../tests/example-workspace/packages/c',
//         mismatchedWorkspaceDependencies: [],
//         workspaceDependencies: ['b'],
//     },
//     d: {
//         location: '.../tests/example-workspace/packages/d',
//         mismatchedWorkspaceDependencies: [],
//         workspaceDependencies: ['c'],
//     },
// }