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
Hey! I've been experimenting with creating a nx plugin with @formatjs/cli's extract logic, to be able to extract messages from source code.
And while I have no issues making it work with the extract export from @formatjs/cli there are some minor issues that I think could be quite easily resolved.
The biggest one is the fact that the method does its own logging. And this becomes unreadable when you mix it with nx. Especially since there's some strange async logging going on this library (promisify(process.stderr.write)). But the logging is never "awaited". So I can't even reliably intercept stderr/stdout and do my own thing.
Then the fact that it gives back a json string. This is not crucial. But if I could get access to the raw extracted messages I could implement my own logging and warnings before formatting it into whatever I want (we want to use the keys to pick only used translations from Phrase).
My idea would be to either lift out the extract method into its own package, or at least provide a onWarn | onError config options to prevent the built-in logger. Is this a PR that you would be open to accept?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey! I've been experimenting with creating a nx plugin with @formatjs/cli's extract logic, to be able to extract messages from source code.
And while I have no issues making it work with the
extract
export from@formatjs/cli
there are some minor issues that I think could be quite easily resolved.The biggest one is the fact that the method does its own logging. And this becomes unreadable when you mix it with nx. Especially since there's some strange async logging going on this library (
promisify(process.stderr.write)
). But the logging is never "awaited". So I can't even reliably intercept stderr/stdout and do my own thing.Then the fact that it gives back a json string. This is not crucial. But if I could get access to the raw extracted messages I could implement my own logging and warnings before formatting it into whatever I want (we want to use the keys to pick only used translations from Phrase).
My idea would be to either lift out the
extract
method into its own package, or at least provide aonWarn | onError
config options to prevent the built-in logger. Is this a PR that you would be open to accept?Beta Was this translation helpful? Give feedback.
All reactions