-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Use dope.sh to generate a testable app from production template
#530
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
base: main
Are you sure you want to change the base?
Conversation
744df97 to
3647c22
Compare
8c03552 to
1159ea4
Compare
3647c22 to
8aaf842
Compare
|
@infomiho haven't looked at anything here, but wanted to pop in; if we're going to be using |
1159ea4 to
01c159c
Compare
6c8d6e7 to
6a51600
Compare
|
@cprecioso I think that the natural journey of all of our scripts -> inline -> bash -> Node.js I wouldn't do it in this PR though, I'd create an issue if we agree that we want to do it. |
|
@infomiho My vote is to even do that before this PR here. As you see fit. |
|
+1 for the idea of rewrite at some point but also big +1 for not doing it now, priorities again, dope.sh works fine and is tested through use, no need to shake that tree at the moment. |
eb64c15 to
0363f98
Compare
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.
This is great! It solves the most annoying and the longest part of release testing (at least to me).
I do have some questions and suggestions, check the comments.
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.
We have a very similar thing in opensaas-sh/tools. Can we consolidate them and somehow?
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.
They are actually quite different:
opensaas-sh/toolsscript can use thetemplatedir it has available on the disktemplate-test/toolsscript needs to runwasp neweach time to get the template
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.
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'm not sure about the migration stuff. Shouldn't wasp db migrate-dev be part of testing too?
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.
Fair point! I'll remove the migrations from the diff since the tester needs to run wasp db migrate-dev.
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.
Good thing is that wasp-app-runner runs the wasp db migrate-dev command 😄
Again the trouble is - every time you test the app and you tweak something, the new diff will include the migrations again. So you'll need to delete the diff files manually. What do we think about that?
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've now removed migrations dir (our users start without them) so we can test wasp db migrate-dev. I've also removed the package-lock.json (our users start without it) so we can see test the template as our users would use it.
Added extra lines in the .gitignore diff with explanations.
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.
Why does this file have diffs. I'd expect it to be the same (apart maybe from !.env.valut):
- Shouldn't
.env*be ignored in the template too? - Why is .flaskenv in there?
- Why is env.project in there?
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.
We had this problem in different example apps - this is what Dotenv Vault automatically adds each time when you run npm run env:pull.
So if you are testing something and decide to modify the app e.g. you found some tweak that would help and run ./tools/diff.sh you'll end up with the .gitignore changes again. You now you have to revert the .gitignore changes manually if you want to keep it out of the diff.
So I decided to keep them in - they don't any harm and make the process less annoying.
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, fair enough, but can you put in a comment that explains this in the gitignore (basically what you said here).
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.
Added a comment 👍
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.
Do we need to delete these?
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 I did by accident - I was probably cleaning up stuff I thought we didn't need or something like that. I'll remove this 👍
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.
Correction - it looks like a bug with the dope.sh script, I'll investigate!
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.
You might find this helpful: #523
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.
False alarm, it looks the Dotenv Vault addition of .env* below the !.env.*.example overrode the exception not to ignore those files - so it looked like the files were deleted when dope.sh ran.
I've asked Claude to explain with code:
Explanation by Claude
Root Cause: .gitignore Rule Ordering
In template-test/app/.gitignore, negation rules were placed before broader ignore patterns:
.env.*
!.env.*.example # Un-ignores .env.*.example
.env* # Re-ignores everything starting with .env (including .env.*.example)
!.env.vault # Un-ignores .env.vaultLast matching pattern wins in gitignore.
How dope.sh Detects Deletions
# dope.sh uses git ls-files to list files
git ls-files --cached --others --exclude-standard
# Files in BASE but not in DERIVED go into deletions
comm -23 <(echo "${BASE_FILES}") <(echo "${DERIVED_FILES}") > deletionsWith broken gitignore:
cd template-test/app
git ls-files --cached --others --exclude-standard | grep "\.env"
# Output: .env.vault
# Missing: .env.client.example, .env.server.exampleThe Fix
Reorder gitignore so negations come after broader patterns:
.env.*
.env* # Ignores everything
!.env.vault # Un-ignores specific files
!.env.*.example # Un-ignores .env.*.example filesAfter fix:
git ls-files --cached --others --exclude-standard | grep "\.env"
# Output:
# .env.client.example
# .env.server.example
# .env.vaultBoth BASE and DERIVED now have the files, so they don't appear in deletions.
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.
Now the file is empty - after I fixed the order in .gitignore 👍
template-test/.gitignore
Outdated
| @@ -0,0 +1,2 @@ | |||
| app/ | |||
| base-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.
Why is this here? How would the base-app end up in this folder?
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.
It's the side-effect of running wasp new to generate a new app based on the released Open Saas template. We decided to create the app in the base-app dir which we extract the app dir from. We clean it up - but just in case, I've gitignored it.
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.
Hm, I don't think we should ignore it then.
If it doesn't get cleaned up, we want to see problems at their true source?
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.
We should point the releaser to thsi from somwhere global (like the README.md or the release checklist).
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.
Linked to the README from the checklist https://www.notion.so/wasp-lang/0-X-Y-26818a74854c8094b1fdf42b3e9d25b8?source=copy_link#26818a74854c80439e0ae8bdd709b4d6
template-test/README.md
Outdated
| ### Workflow | ||
|
|
||
| - Generate `app/` from template and diffs: `./tools/patch.sh` | ||
| - Update diffs after modifying `app/`: `./tools/diff.sh` |
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 guess this is workflow for updating/migrating.
Since the dope.sh README is now in a different place, can we elaborate that here? You can put it under the title: "If you need to update/migrate..."
583ae2a to
ba1a968
Compare
d8a5b73 to
6490564
Compare

Description
Based on #531
Fixes #524
This PR reuses the existing
dope.shto create a testable app from an app generated bywasp new app -t saas.The changes are minimal:
DummytoSMTPand use the correct email addressThis allows for testing the app in production mode e.g.
npx @wasp.sh/wasp-app-runner build.This PR doesn't setup Stripe, analytics or similar. I think it's not really needed to smoke test the template. We have
opensaas.shwith all the bell and whistles for that.Contributor Checklist