ericcornelissen/webmangler

Use relative file paths in CLI output

Closed this issue · 0 comments

Feature Request

Description

Update the CLI to only use relative paths in outputs. For example, when using the --stats option, the output will (or may, depending on the reporter, when #271 is released) contain full file paths for all files included in the mangling process. As an example:

$ pwd
/full/path/to/webmangler


$ webmangler ./testdata --stats

/full/path/to/webmangler/testdata/sample.css -18.18% (220 -> 180)
/full/path/to/webmangler/testdata/sample.html -13.03% (468 -> 407)
/full/path/to/webmangler/testdata/sample.js -10.06% (159 -> 143)
OVERALL -13.81% (847 -> 730)

mangled 3 files in 10.21 ms

The "/full/path/to" part is 1) not useful and 2) may contain sensitive information (which could be problem if it ends up on logs or is included in e.g. a bug report). So, the proposal is to just omit it from the output.

In the context of #271, the recommendation is to omit it in the CLI base package rather than in the reporter implementation. This prevents external reporter packages from accidentally including the "/full/path/to" in their output, and also avoids having to duplicate the logic to omit it.