Closed alexanderwallin closed 6 years ago
@alexanderwallin Do we change any default behavior for narp by merging this PR?
I tried to think of a scenario where we would, but couldn't come up with any. I guess if you've done some wacko stuff like:
// .narprc
{
"extract": {
"componentPropsMap": {
"crayCray": "That is magically added to react-gettext-parser's defaults"
}
}
}
// my-script.js
const narp = require('narp')
const { GETTEXT_COMPONENT_PROPS_MAP } = require('react-gettext-parser')
// Run narp here
narp.push()
// Then depend on the contents of the react-gettext-parser defaults
for (const componentName in Object.keys(GETTEXT_COMPONENT_PROPS_MAP)) {
// This will try to require path/to/components/crayCray.js
const ComponentClass = require(`path/to/components/${componentName}.js`)
}
then it's gonna blow. But then you also had it coming. :)
@alexanderwallin Cool, do we need to do something in package.json
to use the new version of react-gettext-parser
that supports these features?
Yes, good catch! It's been updated now.
It's now possible to specify the
trim
,trimLines
andtrimNewlines
configs in.narprc
.If you fancy an example of the mighty evil of mutability, https://github.com/laget-se/narp/commit/3e853d4f9a287c372c545d175dadb8130c2338fb is a treat.