Feature request: Log replacements without requiring verbose if not silent
Unicycle77 opened this issue ยท 0 comments
Unicycle77 commented
Hi! ๐
Firstly, thanks for your work on this project! ๐
Today I used patch-package to patch grunt-replace@2.0.2
for the project I'm working on.
When upgrading from grunt-replace 0.4.0 to 2.0.2, we lost the logging of each replacement. With a large batch of replacements, it's very helpful to see these log entries, since they are the only indication of progress. Turning verbose mode on is not an option, because it applies to other modules. (in our case logging roughly 10 lines per file)
Here is the diff that solved my problem:
diff --git a/node_modules/grunt-replace/tasks/replace.js b/node_modules/grunt-replace/tasks/replace.js
index c0428b4..153fd7f 100644
--- a/node_modules/grunt-replace/tasks/replace.js
+++ b/node_modules/grunt-replace/tasks/replace.js
@@ -52,8 +52,8 @@ module.exports = function (grunt) {
result = content;
}
- if (result !== false) {
- grunt.verbose.writeln('Replace ' + chalk.cyan(source) + ' โ ' +
+ if (result !== false && options.silent !== true) {
+ grunt.log.writeln('Replace ' + chalk.cyan(source) + ' โ ' +
chalk.green(target));
}
This issue body was partially generated by patch-package.