CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-snowpack

A lightning-fast frontend build tool designed to leverage JavaScript's native ESM system for unbundled development with instant browser updates.

82

1.22x
Overview
Eval results
Files

task.mdevals/scenario-9/

Build Watcher

Create a command-line tool that builds a web application project for production and monitors files for changes, rebuilding automatically when changes are detected.

Requirements

Build Execution

The tool should execute a production build when started. It should output the build directory location to the console upon successful build completion.

Watch Mode

After the initial build completes, the tool should enter watch mode to monitor for file changes. When a file changes, the tool should:

  • Log the path of the changed file to the console
  • Log a message indicating a rebuild is occurring

Build Configuration

The tool must configure the build system with these settings:

  • Output directory: build
  • Clean the output directory before building
  • Enable watch mode
  • Enable inline source maps
  • Use /app/ as the base URL for all assets

The tool should load or create appropriate configuration to apply these settings.

Graceful Shutdown

The tool should handle termination signals (SIGINT) gracefully by shutting down the build process cleanly before exiting.

Test Cases

  • When the tool is executed, it performs an initial production build and creates output in the build directory @test
  • When a file changes during watch mode, the tool logs the changed file path and initiates a rebuild @test
  • When the process receives SIGINT, it shuts down the build process gracefully @test

Implementation

@generates

API

/**
 * Main entry point for the build watcher tool
 */
async function main() {
  // Implementation here
}

main().catch((error) => {
  console.error('Build failed:', error.message);
  process.exit(1);
});

Dependencies { .dependencies }

snowpack { .dependency }

Provides the build system and configuration management capabilities.

Install with Tessl CLI

npx tessl i tessl/npm-snowpack

tile.json