You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using replace-in-files-cli (specifically, the programmatic API) to prepend a banner to a bunch of files.
There are myriad packages to do this sort of thing, but they either a) expect the data to be in package.json, b) are plugins for a task runner like grunt, c) unmaintained, or d) hopelessly broken and overengineered. If you have written a standalone tool to do this, please let me know!
This isn't quite obvious. I had to play around with regexes to arrive at "append", which works opposite of how I'd expect--I'd expect a banner after every line (which can be accomplished with /$/gm). Anyway.
I'm thinking supporting append and prepend flags would be more user-friendly.
But since it's not really a "replace" operation, maybe it's out-of-scope for this module?
Providing sugar functions like append() or prepend() might be OK, except that a user may want to append/prepend and find/replace in a single operation--find accepts an array, after all.
The text was updated successfully, but these errors were encountered:
I'm using
replace-in-files-cli
(specifically, the programmatic API) to prepend a banner to a bunch of files.There are myriad packages to do this sort of thing, but they either a) expect the data to be in
package.json
, b) are plugins for a task runner likegrunt
, c) unmaintained, or d) hopelessly broken and overengineered. If you have written a standalone tool to do this, please let me know!This is what "prepend to file" looks like:
Whereas "append to file" looks like this:
This isn't quite obvious. I had to play around with regexes to arrive at "append", which works opposite of how I'd expect--I'd expect a banner after every line (which can be accomplished with
/$/gm
). Anyway.append
andprepend
flags would be more user-friendly.append()
orprepend()
might be OK, except that a user may want to append/prepend and find/replace in a single operation--find
accepts an array, after all.The text was updated successfully, but these errors were encountered: