CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-uglify-save-license

License detector for UglifyJS that identifies and preserves license comments during minification

Overall
score

98%

Overview
Eval results
Files

task.mdevals/scenario-9/

License Comment Preservation

Build a command-line minification tool that preserves license comments during JavaScript code compression.

Requirements

Create a Node.js CLI tool that:

  1. Accepts a JavaScript file path as a command-line argument
  2. Minifies the JavaScript code while preserving license-related comments
  3. Outputs the minified result to stdout

The tool should preserve comments that contain license information (such as copyright notices, license types, and legal text) while removing other comments during minification.

Implementation

@generates

Test Cases

  • Given a JavaScript file with a copyright comment and a regular comment, the tool preserves only the copyright comment @test
  • Given a JavaScript file with a MIT license comment, the tool preserves the license comment @test
  • Given a JavaScript file with only regular comments, the tool removes all comments @test

API

// Command-line interface
// Usage: node minify-cli.js <input-file>

Dependencies { .dependencies }

uglify-js { .dependency }

Provides JavaScript minification capabilities.

uglify-save-license { .dependency }

Provides license comment detection and preservation logic.

Install with Tessl CLI

npx tessl i tessl/npm-uglify-save-license

tile.json