-
-
Notifications
You must be signed in to change notification settings - Fork 887
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
All in dirs #154
All in dirs #154
Conversation
CONTRIBUTING.md
Outdated
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.
Updated this to reflect new structure of the repo. Also made sure tehre is no duplicate info in top level README.
opensaas-sh/tools/dope.sh
Outdated
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.
Here is dope.sh, the main logic for diffing / patching.
It is written in such a way that it can also be used in other places, it is generic.
@@ -0,0 +1,9 @@ | |||
#!/usr/bin/env bash |
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.
Helper wrapper for patching.
@@ -0,0 +1,7 @@ | |||
#!/usr/bin/env bash |
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.
Helper wrapper for dope.sh for diffing.
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.
@vincanger take a look!
There is a lot o files in the PR that are just copies of blog or e2e-tests from deployed-version branch. SO those are not interesting, I didn't change anything there. Those are under blog/ or e2e-tests.
Also I just moved template files into template/
.
Most interesting is stuff in opensaas-sh/app_diff, also some READMEs, opensaas-sh/tools, ... . I mostly commented on files that are interesting.
Notice that I also introduced sharing of .env.server file via dotenv-vault to make it easy for us to share env files, we will be doing this also in other Wasp projects, this is first application of it. You will see .env.vault file.
@@ -0,0 +1,8 @@ | |||
# <YOUR_APP_NAME> | |||
|
|||
This project is based on [OpenSaas](https://opensaas.sh) template and consists of three main dirs: |
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.
The wording here is kind of confusing to me, after all, this is the Open SaaS template, right?
What about changing it to:
"This is the Open Saas project directory, which consists of template itself (app
), as well as two other dirs (blog
and e2e-tests1
):
1..."
?
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.
ok, I see. you're creating a template README for their future app.
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.
Ah yes! So this is the README they get when they create the new app using the template: README for that app.
|
||
Typical workflow: | ||
1. Run `./tools/patch.sh` to generate `app/` from `../template/` and `app_diff/`. | ||
2. If there are any conflicts (normally due to updates to the template), modify `app_diff/` till you resolve them. |
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.
How would we know whether there are any conflicts, who reports those and how? Is it a normal Git conflict or something else?
And how do we resolve them? By editing the diff files directly?
Also, what happens if the templates change in a way that makes the diff file outdated (e.g., the diff files says "remove this line", but the template no longer contains that line)?
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.
The patch
reports them, and then you fix them in the diffs if I am correct (I keep forgetting, but I did it already. But will try it out much more in the following days).
Yeah, in that case the conflicts happens!
Truth be told, I am not 100% sure about the details of the workflow, I am also suspicious of how will this all go. I am quite sure conflicts will be happening as they should, but how complicated the resolution will be for us, and the whole workflow, is a bit hard to say at the moment. I would say there is 60% chance that this approach will be more trouble than it is worth. But let's give it a try, we have it working now, we will try to use it a bit, and if we don't like it, we can just generate the app/
one final time, put that into separate repo and go with that. So I am looking at this as an experiment, at this point the best move is to give it a limited time try.
Even if experiment shows that this is not a good workflow for opensaas, it might still be useful for automating some of the e2e tests we will want to do for Wasp, so there is that also as a secondary use case.
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.
Ok, if you're really stoked about trying it out, we can go for it.
That said, I'll voice my concerns just sin case you haven't thought about them.
Important
If, after reading what I think, you still see a potential benefit that I don't understand, you don't need to explain it to me (I'd be happy to read it, but it's not necessary if you don't have the time).
I trust you to make a discretionary decision and go for it (assuming @vincanger is OK with it as well).
I can't see any part of the procedure this approach has a chance of improving.
It sounds like this approach has all the problems/features of just keeping a separate directory plus:
-
The added inconvenience of dealing with patch and merge conflicts in diff files which are difficult for a human to read and write.
-
Worse experience during commits and code reviews - You have to compare diff files instead of proper source files.
-
The lack of a human-readable example app in the repo - Whoever wants to see the example app must now check out the repo and construct it themselves.
-
Extra technical/arcane steps when changing the example app - Instead of updating the example app directly, now you must:
- Construct the example app using a custom script and diff files.
- Update the generated example app changes (this is the only thing you had to do before).
- Construct the diffs from the updated example app.
With updates that includes multiple iterations, this feels like a lot of pain: you update something and go through the procedure, you push it, the reviewer wants it changed, you update it again (and have to go through the procedure again), you push it again...
It's a similar problem as what we have with e2e tests, but worse. With e2e tests, you can avoid this cycle by waiting until the PR is finalized before generating the new tests. With this, you must do it every time. If you don't, the reviewer can't review your code.
All in all, since:
- All the development is done in the generated app.
- All the reviewing is done in the generated app.
- All the testing is done in the generated app (don't know if we have tests yet, but that's where it's gonna happen).
- All the reading (contributors, people wanting to use the template, etc.) is done in the generated app.
I don't think this is the way to go. We should just keep a generated app.
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.
@sodic most of these are valid concerns! But, Chesterton's fence - if you don't know why it is there, there is probably a reason you are not seeing, right? So instead of saying we should keep a generated app, you probably should be asking what is it that you are not aware of, that made me go with this approach.
So, the reason why I did this whole diff thing instead of going with the generated appis that it is very hard to figure out how to update the generated app after you do updates to the template. I also wouldn't bother with diffs otherwise and would stick to normal code, of course.
Additionally, the part with reviewing the demo app, people looking at, ... -> those I don't think are concerns in practice, demo app is intended to be minimally different than template + for people to try it out, not to look at the code primarily.
We will see how this experiment goes, and as I mentioned previously I am aware of cons it introduces, but I don't see just having an app in there as a better solution. Instead, it might be better to just go with separate repo or something like that, although that has its own issues. I would consider having just the code in the dir next to it as the very last option, if nothing else works out.
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.
I think this workflow, and its explanation, are confusing to the uninitiated.
In step 1, I run patch.sh
and generate the opensaas.sh app (aka demo app).
Then I have to generate a new app_diff/
with diff.sh
.
This is because we do not commit an app/
dir to version control. So maybe we should add this bit of info to the beginning of the workflow explanation. Something like:
"Since the demo app is just the open saas template with some small tweaks, and we want to be able to easily keep it up to date as the template changes, the demo app is defined via the diff against the template: app_diff/
.
Because we do not commit/push the generated demo app in the app/
dir to version control, the typical workflow is as follows:...
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.
Overall this good @Martinsos. I like the initiative here. The only thing is I fear we might be complicating things a bit, especially for outside contributors, just to get the demo app and the template in the same repo.
The other thing I fear is that, even though we direct people to use wasp new -t saas
we will still get many users that clone the repo and then get all this extra stuff that confuses them.
But with that said, I think it's worth trying out, because it would make the workflow a lot easier from our side, granted that everything works (I also don't expect a lot of outside contributions to the demo app, to be honest).
I made a few small grammatical changes to READMEs, and a couple suggested changes, but I'm approving it here for now. Let's goooo 🐝
Great! I did the changes you suggested above + checked the commits you did. I agree this makes direct cloning even less viable, but I also think we shouldn't be trying to make cloning work, it makes the life for us too hard if we want to be able to maintain and test the template properly. What is quite questionable is the whole diffing approach, but as you said let's give it a try and see: if it doesn't work for us I am more than happy to ditch it, it won't be hard to do. |
Fixes #133 .
I was curious about this whole situation with putting demo app next to the template and what are the diffs really, so I implemented that here.
I checked out
deployed-version
branch and put it intoopensaas-sh
directory.I also wrote a script (dope.sh) that generates a diff between the
template
andopensaas-sh
dir, and some helper tools.Then I went manually through those diffs and tried figured out with help of @vincanger which of them contains something important vs can be just dropped due to improvements in the template and would be just copied from there anyway to be the latest.
I have done all this only for app/, I didn't touch blog/ or e2e-tests/ .
I also removed retagging, because these changes will require new Wasp version (0.14) in order to pull from the
template
subdir, so either we keep this on some branch likedevelop
on the side, or we disable auto retagging. I would rather maybe we keep developing stuff onmain
with retagging disabled though, so we can keep adding other stuff on top of this. And then later we can re-enable auto-tagging and also see how we can automate more stuff in the CI (publishing demo app, releasing docs).I didn't have anything to edit in OpenSaas docs it seems, is it possible I missed something or is that really so?
I am not 100% sure that approach with diffs will be the best, but I would suggest we give it a try -> if we don't like it, we can generate the
app/
from the diffs one final time and create another repo just for opensaas-sh based on it. In any case, it might be useful in some other applications, so it is not a waste.TODO:
wasp deploy fly deploy
or not. Vince can help me figure this out.template
and also add one totemplate/app
. Maybe also totempalte/blog
ortemplate/e2e-tests
?opensaas-sh/app_diffs
, while removingopensaas-sh/app
.opensaas-sh/app
in .gitignore? That messes up our diffing, so if we do it, we need to somehow make our diff/patch scripts work around it (probably by them editing .gitignore temporarily?).