Skip to content

Conversation

@infomiho
Copy link
Collaborator

@infomiho infomiho commented Oct 7, 2025

Description

Based on #531

Fixes #524

This PR reuses the existing dope.sh to create a testable app from an app generated by wasp new app -t saas.

The changes are minimal:

  • change Dummy to SMTP and use the correct email address
  • setup Dotenv Vault

This 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.sh with all the bell and whistles for that.

Contributor Checklist

Make sure to do the following steps if they are applicable to your PR:

@infomiho infomiho force-pushed the production-template-testing branch from 744df97 to 3647c22 Compare October 7, 2025 11:47
@infomiho infomiho mentioned this pull request Oct 7, 2025
4 tasks
@infomiho infomiho changed the base branch from main to extract-dope-sh-to-top-level October 7, 2025 11:48
@infomiho infomiho force-pushed the extract-dope-sh-to-top-level branch 2 times, most recently from 8c03552 to 1159ea4 Compare October 7, 2025 11:54
@infomiho infomiho force-pushed the production-template-testing branch from 3647c22 to 8aaf842 Compare October 7, 2025 11:55
@infomiho infomiho marked this pull request as ready for review October 7, 2025 12:10
@infomiho infomiho requested a review from sodic October 7, 2025 12:28
@cprecioso
Copy link
Member

@infomiho haven't looked at anything here, but wanted to pop in; if we're going to be using dope.sh more extensively, might it make sense to migrate it to a more understandable (and less edge-casey) language? We can take advantage of the fact that node is already installed...

@infomiho infomiho force-pushed the extract-dope-sh-to-top-level branch from 1159ea4 to 01c159c Compare October 7, 2025 15:16
@infomiho infomiho force-pushed the production-template-testing branch from 6c8d6e7 to 6a51600 Compare October 7, 2025 15:17
@infomiho
Copy link
Collaborator Author

infomiho commented Oct 7, 2025

@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.

@cprecioso
Copy link
Member

@infomiho My vote is to even do that before this PR here. As you see fit.

@Martinsos
Copy link
Member

+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.

@infomiho infomiho force-pushed the production-template-testing branch 2 times, most recently from eb64c15 to 0363f98 Compare October 10, 2025 15:17
@infomiho infomiho changed the base branch from extract-dope-sh-to-top-level to main October 10, 2025 15:18
Copy link
Collaborator

@sodic sodic left a 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.

Copy link
Collaborator

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?

Copy link
Collaborator Author

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/tools script can use the template dir it has available on the disk
  • template-test/toolsscript needs to run wasp new each time to get the template

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

@infomiho infomiho Nov 5, 2025

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator

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?

Copy link
Collaborator Author

@infomiho infomiho Nov 5, 2025

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.

Copy link
Collaborator

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).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment 👍

Copy link
Collaborator

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?

Copy link
Collaborator Author

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 👍

Copy link
Collaborator Author

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!

Copy link
Collaborator

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

Copy link
Collaborator Author

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.vault

Last 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}") > deletions

With broken gitignore:

cd template-test/app
git ls-files --cached --others --exclude-standard | grep "\.env"
# Output: .env.vault
# Missing: .env.client.example, .env.server.example

The 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 files

After fix:

git ls-files --cached --others --exclude-standard | grep "\.env"
# Output:
# .env.client.example
# .env.server.example
# .env.vault

Both BASE and DERIVED now have the files, so they don't appear in deletions.

Copy link
Collaborator Author

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 👍

@@ -0,0 +1,2 @@
app/
base-app/
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator

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?

Copy link
Collaborator

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).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 28 to 31
### Workflow

- Generate `app/` from template and diffs: `./tools/patch.sh`
- Update diffs after modifying `app/`: `./tools/diff.sh`
Copy link
Collaborator

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..."

@infomiho infomiho force-pushed the production-template-testing branch from 583ae2a to ba1a968 Compare November 5, 2025 13:45
@infomiho infomiho changed the base branch from main to fix/dope-empty-deletions November 5, 2025 13:45
@infomiho infomiho force-pushed the production-template-testing branch from d8a5b73 to 6490564 Compare November 5, 2025 14:41
@infomiho infomiho changed the base branch from fix/dope-empty-deletions to main November 5, 2025 14:42
@infomiho infomiho requested a review from sodic November 5, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simplify testing the Open Saas template in build mode

5 participants