CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-lerna--init

Create a new Lerna repo or upgrade an existing repo to the current version of Lerna

75

1.36x
Overview
Eval results
Files

task.mdevals/scenario-9/

Monorepo Release Publisher

A Node.js tool that publishes packages from a monorepo with custom npm distribution tags for different release channels.

Problem Description

You are managing a JavaScript monorepo with multiple packages. You need to publish new versions of changed packages to npm using different distribution tags for different release channels (e.g., "beta", "next", "latest"). Distribution tags allow users to install specific release channels: npm install my-package@beta installs the beta version.

Requirements

Build a Node.js module that:

  1. Detects which packages in a monorepo have changed
  2. Publishes changed packages to npm with a specified dist-tag
  3. Supports standard npm dist-tags: "latest", "next", "beta", "canary"
  4. Returns information about which packages were published

Capabilities

Publish with Latest Tag

Publishes changed packages with the default "latest" dist-tag.

  • Calling publish with distTag "latest" publishes packages successfully @test

Publish with Custom Tag

Publishes changed packages with custom dist-tags for pre-releases or alternative channels.

  • Calling publish with distTag "beta" publishes packages with beta tag @test
  • Calling publish with distTag "next" publishes packages with next tag @test

Handle Publish Errors

Handles errors appropriately when publishing fails.

  • Returns error information when publishing fails @test

Implementation

@generates

API

/**
 * Publishes packages from a monorepo with a specified dist-tag
 * @param {Object} options - Publishing options
 * @param {string} options.distTag - The npm dist-tag to use for publishing
 * @param {string} [options.cwd] - Working directory containing the monorepo (default: process.cwd())
 * @returns {Promise<PublishResult>} Result of the publishing operation
 */
async function publishWithDistTag(options) {
  // Implementation
}

/**
 * Result of publishing operation
 * @typedef {Object} PublishResult
 * @property {boolean} success - Whether publishing succeeded
 * @property {PackageInfo[]} packages - Information about published packages
 * @property {string} [error] - Error message if publishing failed
 */

/**
 * Information about a published package
 * @typedef {Object} PackageInfo
 * @property {string} name - Package name
 * @property {string} version - Package version
 * @property {string} distTag - Dist-tag used
 */

module.exports = { publishWithDistTag };

Dependencies { .dependencies }

lerna { .dependency }

Provides monorepo package management and publishing capabilities, including support for custom dist-tags.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-lerna--init

tile.json