-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add support for flow prefixes in package.json keys #1459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Tests are failing, not sure what's wrong, I just see massive diff failures that look unrelated to what I changed. |
|
Woah, when did you switch to @kittens? I think I'm not quite following your use case. Can you give an example? It doesn't sound like your talking about a situation with both a {
"main": "src/transformed_index.js",
"flow:main": "src/original_index.js",
...
}since this doesn't seem to save you any build trouble. And it's not clear to me why you would have Your OCaml looks good, though! As for tests, I can look when Travis finishes. The incremental script runs this bash script which moves the various files around, making sure that Flow's incremental mode follows the changing. That's probably one source of issues. |
|
|
||
| let get_key key tokens = Ast.( | ||
| let get_key' key tokens = Ast.( | ||
| match SMap.get (spf "\"%s\"" key) tokens with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh but you should probably get rid of this spf since you're doing it in get_key. The double quoting is probably not helping the tests.
Or only do the quoting in here. Your call!
Few weeks ago 😛 It removes the confusion and accidental mentions with the other Facebook JavaScript React Sebastian.
I'm actually talking about that situation exactly. I recently published kreporters which uses Flow types and there's only a few ways I can get third party consumers to use the types and they all aren't great:
|
|
Also just want to highlight that having this ability means that libraries can provide type information without any changes to their build system. For example you just have to remove |
|
Ah ok, I get it. The requirement of putting Yeah, this makes sense to me. I'd merge this once the tests pass :) |
|
how does this compare to the an alternative would be |
You still need to point to an interface file as far as I know. This would allow you to point at your original source and have Flow point to that instead of some random location in
Not really, the only other key that's used is
Keys used like that in |
|
Actually looking into |
This was my initial thought too, but I settled on the idea that |
|
Just an update, I'm still going to work on this PR. Should have addressed all the comments and have tests passing next week. |
|
I'm gonna close this to clean up the queue since it's stale, but obviously feel free to resurrect it |
|
Shame to see this closed, we're using https://github.com/AgentME/flow-copy-source in some cases but for rollup builds et al it would be much better/easier to have a |
|
I've opened #2675 so this can be discussed and eventually fixed :) |
This PR allows you to prefix keys in
package.jsonwithflow:. This is useful as you can trivially get type checking on a Flow project published to npm by just including thesrcdirectory and adding aflow:mainfield.This is different to Flow comments as it preserves the original source and is different to the
.flowextension as it doesn't require any convoluted build system commands.Completely understand if you'd rather just have
.flowso feel free to close but I thinkflow:mainmakes things substantially easier.