Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Microsoft Playwright Workspace

From Leeroopedia

Template:Implementation Page

Overview

Workspace is a build utility that manages the Playwright monorepo workspace, handling version bumps, package publishing, dependency synchronization, and alpha release management.

Description

The module provides two classes:

  • PWPackage -- represents a single package in the monorepo with its package.json, file lists, and publishing metadata
  • Workspace -- manages the collection of packages with operations including:
 * Version management -- reads and sets versions across all packages
 * Alpha releases -- creates alpha version suffixes with timestamps
 * Dependency synchronization -- ensures internal package dependencies use consistent versions
 * Publishing -- orchestrates npm publish with proper ordering and canary/next/latest tag support
 * Package linking -- sets up local development linking between packages

The script supports multiple CLI commands: --get-version, --set-version, --ensure-consistent, --publish, and more.

Usage

Run as a CLI tool during development and CI for managing the monorepo workspace.

Code Reference

Source Location

utils/workspace.js (271 lines)

Class Signatures

class PWPackage {
  constructor(descriptor)
  // name, path, files, packageJSON, isPrivate
}

class Workspace {
  constructor(rootDir, packages)
  packages()
  async version()
  async setVersion(version)
  async ensureConsistent()
  async publish(options)
}

Execution

node utils/workspace.js --get-version
node utils/workspace.js --set-version 1.40.0
node utils/workspace.js --ensure-consistent
node utils/workspace.js --publish

I/O Contract

Inputs

  • CLI arguments for the operation to perform
  • Package.json files from all workspace packages
  • Root package.json for version source of truth

Outputs

  • Updated package.json files across the monorepo
  • Published npm packages with appropriate tags
  • Console output of version information

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment