-
Notifications
You must be signed in to change notification settings - Fork 63
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
blueprint injection or rerendering #115
Comments
Had a thought. Most of the time injection is useful for (generically) adding a member to a collection, a new route to the router, a new reducer for combineReducers. And most of the time, the target of the injection will be something that was generated by a related blueprint. What if we rerender the target file by combining the config it used last time it was rendered and combine it with the current data. It'd have to be made clear that the file is autogenerated, and a mechanism for saving the original config would need to be established. But it's much easier than scraping the file to find the right insertion point. |
There's been some discussion related to this at #6 I'll be closing that to continue here. |
In most of my personal blueprints I actually just look for 'magic comments' or imports that I know will never get removed and do my insertions related to those. |
@SpencerCDixon would be great if you could share an example of a blueprint you use to do that. |
Sure:
It would be nice to come up with clean abstractions for how to add LOC in specific places. I think that the 'magic comment' idea would make the implementation much easier but open to discussing some potential solutions. The solution I show above is pretty flaky since if the source changes a bunch then it could break the BP. However, I depend on things that are pretty absolute. First one writing an import just does it in the beginning of the file and the one that adds the reducer looks for |
|
There are a number of cases where the ability to inject new text into an existing file would be very useful.
imports, Routes, reducers, sagas.
The trick is to figure out where this is supposed to happen, and what is to be inserted.
I think that any effort that involves parsing the file as code is too complicated and we should reach for a simpler solution. Parsing text and string matching is going to be faster and probably more reliable in the long run.
The text was updated successfully, but these errors were encountered: