or run

tessl search
Log in

Version

Files

tile.json

task.mdevals/scenario-8/

Remote Cache Configuration Tool

Overview

Build a command-line utility that configures remote cache backends for an Nx workspace. The tool should update the workspace configuration to enable remote caching with different storage providers.

Requirements

Core Functionality

Your implementation should provide the following capabilities:

  1. Configure Remote Cache in nx.json

    • Read the existing nx.json configuration file
    • Add or update the task runner configuration to enable remote caching
    • Support configuring cache storage with custom URLs or endpoints
  2. Validate Cache Configuration

    • Check that the nx.json file exists
    • Verify that required cache parameters are provided
    • Ensure the configuration structure is valid
  3. Support Multiple Storage Providers

    • Configure cache with a custom storage URL
    • Allow specifying cache read and write permissions

Implementation Details

  • Create a main script file named setup-cache.js or setup-cache.ts
  • Create a test file named setup-cache.test.js or setup-cache.test.ts
  • The tool should read and write to nx.json in the workspace root
  • Use Nx devkit utilities for reading and updating configuration

Test Cases { .test-cases }

Test Case 1: Enable Remote Cache with Custom URL { .test-case } @test

Setup: Create a test nx.json file with basic configuration.

Action: Configure remote cache with URL: https://cache.example.com/nx-cache

Expected Result:

  • The nx.json file should have task runner options configured
  • The cache URL should be set to the provided value
  • The configuration should enable remote caching

Test Case 2: Validate Missing Cache URL { .test-case } @test

Setup: Prepare an nx.json file.

Action: Attempt to configure remote cache without providing a cache URL.

Expected Result: The tool should report an error indicating that the cache URL is required.

Test Case 3: Update Existing Cache Configuration { .test-case } @test

Setup:

  • Create an nx.json with existing remote cache configured to URL: https://old-cache.example.com

Action:

  • Update the cache configuration to new URL: https://new-cache.example.com

Expected Result:

  • The nx.json should be updated with the new cache URL
  • Other existing configuration should remain unchanged

Dependencies { .dependencies }

nx { .dependency }

Provides the build system and task execution framework with remote cache support.

Constraints

  • Use JavaScript or TypeScript for implementation
  • The solution should be testable without requiring actual cloud storage access
  • Configuration validation should be performed locally
  • Focus on configuration management rather than actual cache operations

Deliverables

  • cache-config.js or cache-config.ts: Main implementation
  • cache-config.test.js or cache-config.test.ts: Test cases demonstrating the functionality