CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-lerna--init

tessl install tessl/npm-lerna--init@6.6.0

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

Agent Success

Agent success rate when using this tile

75%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.36x

Baseline

Agent success rate without this tile

55%

task.mdevals/scenario-7/

Monorepo Watch-Based Build System

Build a watch-based development system for a monorepo that automatically rebuilds packages when source files change.

Requirements

Your task is to create a small monorepo with multiple packages and set up a watch system that automatically triggers builds when files change. The system should leverage the monorepo tool's file watching capabilities to provide real-time feedback during development.

Project Structure

Create a monorepo with the following packages:

  1. core - A utility package with basic functions
  2. ui - A UI package that depends on core

Package Implementations

core package should export a simple function:

// packages/core/src/index.js
export function greet(name) {
  return `Hello, ${name}!`;
}

ui package should use the core package:

// packages/ui/src/index.js
import { greet } from '@myapp/core';

export function renderGreeting(name) {
  return `<div>${greet(name)}</div>`;
}

Build System

Each package should have a build script in its package.json that:

  • Creates a dist directory
  • Copies the source files to the dist directory with a .built extension

Example build script:

{
  "scripts": {
    "build": "mkdir -p dist && cp src/index.js dist/index.built.js"
  }
}

Watch System Requirements

Set up a watch system that:

  1. Monitors source file changes - Watches for changes in src/**/*.js files within packages
  2. Triggers automatic builds - When a source file changes, automatically runs the build script for that package
  3. Logs package information - When a build is triggered, logs which package is being rebuilt

The watch command should be configured in the root package.json under a watch script.

Test Cases

Test 1: Watch detects single package changes

  • When a source file packages/core/src/index.js is modified, the watch system detects the change and triggers the build script, creating packages/core/dist/index.built.js @test

Test 2: Watch detects multiple package changes

  • When source files in both core and ui packages are modified, the watch system detects changes in both packages and triggers their respective build scripts, creating both packages/core/dist/index.built.js and packages/ui/dist/index.built.js @test

Implementation

@generates

Expected Outputs

When running the watch command and modifying files:

  • Changes should be detected within a reasonable time (a few seconds)
  • Build commands should execute automatically
  • Built files should appear in the dist directories

Dependencies { .dependencies }

lerna { .dependency }

Provides monorepo management and file watching capabilities.

@satisfied-by

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@lerna/init@6.6.x
tile.json