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 came across this on my journey learning how to export my own npm module's flow types. While this module does save a lot of "hand jamming", it also copies EVERY *.{js,mjs,jsx} even if they don't have the Flow Type annotation comment (e.g. // @flow or /* @flow */) thus "bloating" the lib/ or dist/ folders. The most simplistic and elegant approach I came up with was to use a simple one-liner script in my package.json
"scripts": {
"build": "babel src/ -d lib/ && yarn copy-flow-source",
"copy-flow-source": "for f in `grep --include=\\*.js -rlw src/ -e '^//\\s*@flow'`; do cp ${f} lib/${f#*/}.flow; done;",
...
}
This would be a nice feature to add to your module, however I'm not sure kefir read contents of files like grep can. This way we follow the philosophy of keeping modules as lean as possible.
The text was updated successfully, but these errors were encountered:
Do you have many javascript files that don't use Flow? (Do you think it might be common to have many non-Flow .js files in projects using flow-copy-source?) This feature wouldn't be too hard to implement, but I'm not sure I want to add the performance or conceptual overhead for what might be a rare case.
Probably not if you are starting a project from scratch. However, I could definitely see how this "enhancement" would be beneficial if you are transitioning legacy code--especially on a large code base. You definitely don't have to commit the work since both of we both have working solutions to solve each of our point of views. Just my 2 cents.
I came across this on my journey learning how to export my own npm module's flow types. While this module does save a lot of "hand jamming", it also copies EVERY *.{js,mjs,jsx} even if they don't have the Flow Type annotation comment (e.g.
// @flow
or/* @flow */
) thus "bloating" the lib/ or dist/ folders. The most simplistic and elegant approach I came up with was to use a simple one-liner script in my package.jsonThis would be a nice feature to add to your module, however I'm not sure kefir read contents of files like grep can. This way we follow the philosophy of keeping modules as lean as possible.
The text was updated successfully, but these errors were encountered: