Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ There are two ways to get help or provide feedback (and we try to always respond

## Development Tools

For information about the development tools used to maintain derived projects (like opensaas.sh), see [tools/README.md](./tools/README.md).
For information about the development tools used to maintain derived projects (like opensaas.sh and template-test), see [tools/README.md](./tools/README.md).

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion opensaas-sh/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Inception :)!

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, we don't version (in git) the actual demo app code, instead we version the diffs between it and the template: `app_diff/`.

**Quick Reference:**
#### Workflow

- Generate `app/` from template and diffs: `./tools/patch.sh`
- Update diffs after modifying `app/`: `./tools/diff.sh`
Expand Down
1 change: 1 addition & 0 deletions template-test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
app/
40 changes: 40 additions & 0 deletions template-test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Template Testing

Tests the production version of the Open SaaS template that users get from `wasp new app -t saas`.

**Why this exists:** As a part of our release checklist, we want to test that the production version of the Open SaaS template works.

**How it works:** We create a new Wasp app from the production Open SaaS template, and then modify the app to be production-ready (e.g. replace `Dummy` email service with `SMTP`, add Dotenv Vault with real credentials, etc.).

## Testing a new Wasp release

When testing a new Wasp release:

```bash
cd template-test
# Create a new Wasp app and apply our patches to it.
./tools/patch.sh

cd app

# Get the environment variables from Dotenv Vault.
npm run env:pull

# Run the dev database and create migrations.
wasp db start
wasp db migrate-dev --name "init"

# You can stop the dev database after you created the migration.

# Test that the app works in dev and prod modes.
# Make sure the `@wasp.sh/wasp-app-runner` is updated to the latest version.
npx @wasp.sh/wasp-app-runner dev
npx @wasp.sh/wasp-app-runner build
```

### If you want to update the template test app

- Generate `app/` from template and diffs: `./tools/patch.sh`
- Modify the app in `app/` as needed and then update diffs: `./tools/diff.sh`

For detailed information about the diff/patch workflow and MacOS setup requirements, see [../tools/README.md](../tools/README.md).
28 changes: 28 additions & 0 deletions template-test/app_diff/.env.vault.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--- /Users/ilakovac/dev/open-saas/template-test/tools/../../template-test/base-app/app/.env.vault
+++ template-test/app/.env.vault
@@ -0,0 +1,25 @@
+#/-------------------.env.vault---------------------/
+#/ cloud-agnostic vaulting standard /
+#/ [how it works](https://dotenv.org/env-vault) /
+#/--------------------------------------------------/
+
+# development
+DOTENV_VAULT_DEVELOPMENT="dQ0x2jNApn5/MH4GgGYz744ge51whVMQaCv4PwI4NOICbl8qoG0aNkECpOylASwZy2T6qxhIaJFhTZFxh7kN4QtyERPfvlnEmbvhDqyo1fw8hsPqypQVCo1PgWx6XfdnOAHcikkXyQGvE//bPeKhyvSHy6sctxIJYYdqhI7523RF6IYJr0gfK79B4Sv60R6Y/XhH12s1A+pFpBMZlQfSbzBdyVXoSt1O9N49gzACdZPx2gvyvPbb4r1gbAJVyEkH9DXiad3npqQ+S+sR8YgR9UlUr1wdXArS3h7G7FQwgllUyX4okHeSZOyD366wRgPMPb7Ver7YOCGfYo65effQgJ+BMtQXYCVxLAygfV3csl1txhtg/qL0Uk1EblDvdEcUc0/LglBaGEwtr9/vpBzoqCs5fxxdCSN9EHjF7b1X5u7rh1PRhpS9yA9H0B9JtuU6ZpSOqoz3hulzqXijhBaz3oPaOqa+LMZ20IOvHn5vqliY8H1SQvVrVSg8XsQL4bvk3rHNR6OOFddQ0GpmNTZLHfBDMpusXQBx3+9IGLYOqSOy6/QP4SHKZ608lIbCqiQsMmc1kKU+PmmvM4xcejRK2u1dy3FPn/qRCgROuh201aunRC5tq2Pkw3g8fJ9La2Q2bhguFtZIrI8eOZoMi6q5dmOePl48s20/Yp1K1QygdVt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0fgjGaeNuWtfAB7Iku3CSdmcO8kQBtH0j+7TbW7I0cfVTUYH9ipcQCy0vjwx1GwsHWBi5IqPfj4bD/HUTPwinn7MrEBtM2cZ3uksSeWk1x+Ks7A5sQnL7XzgUxnl070TiRZJSb0TYuzXM8ILt7gq0frgKSUKRXkeH+egxjBrMAGQ7vY0ebdBHlBHPHOeF9iiFoaujWdReBitbawHYORG8Ct8pvstiTdj98w7g7WB434/Eh0L0pi8Ydepj40/8OpA3nCES9cCIi0uaFlr+arIh3w6h5FsTqaLgh+MmbpNXnRR99/r/0zzKq3/9d1wnIbc7uHkoOSEkTlD5ceEf+IO85A4jsQFOXYJpGV8ns8z4xWLTsU+3GyWIIGDkkNR0CY8PjdkBeQJPEvZNPDnn+LK9C42Clkm1eQy4aqHaagJxFGYp/j79S7Lm4kLJZMHywKi628CsHZO/moPvkfUGrEO2KmqWHvnxWDh5PggV3TAJWOMk7p2ykuFRRb26MgMf9f8oTa+CSs2Jk5W7TF10xaYZDz7fCyUBdMK+JcguPcq0mFw9eoDf9i8FLOKF26VuK7Z14+fRTZN/YHU+u75ru6WDymRpm0ZhCBDdYy80gM45089Scp2bpnKIWg6s7bLdb9R/NRUhK1PZRDEzw3SkDZBVQ=="
+DOTENV_VAULT_PRODUCTION_VERSION=2
+
+#/----------------settings/metadata-----------------/
+DOTENV_VAULT="vlt_57f67ae090fbd4c01066b1af1342a8ba518da1296c6595b9fcd233af37a5fce4"
+DOTENV_API_URL="https://vault.dotenv.org"
+DOTENV_CLI="npx dotenv-vault@latest"
27 changes: 27 additions & 0 deletions template-test/app_diff/.gitignore.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
--- /Users/ilakovac/dev/open-saas/template-test/tools/../../template-test/base-app/app/.gitignore
+++ template-test/app/.gitignore
@@ -1,2 +1,24 @@
node_modules/
.wasp/
+
+# Dotenv Vault entries
+# These are automatically added by Dotenv Vault when running `npm run env:pull`.
+# They're kept in this diff to avoid having to manually revert .gitignore changes
+# each time we test modifications. They don't cause any harm and make the process
+# less annoying.
+.env*
+.flaskenv*
+!.env.project
+!.env.vault
+
+# Don't ignore example dotenv files.
+!.env.example
+!.env.*.example
+
+# Ignore migrations dir to avoid including them in the diffs. We want to test
+# generating migrations each time.
+migrations/
+
+# Ignore package-lock.json to avoid including it in the diffs. Our users start
+# new projects without it, and we want to test the template like our users.
+package-lock.json
1 change: 1 addition & 0 deletions template-test/app_diff/deletions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

28 changes: 28 additions & 0 deletions template-test/app_diff/main.wasp.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--- /Users/ilakovac/dev/open-saas/template-test/tools/../../template-test/base-app/app/main.wasp
+++ template-test/app/main.wasp
@@ -39,7 +39,7 @@
email: {
fromField: {
name: "Open SaaS App",
- email: "me@example.com"
+ email: "opensaastemplate@mg.wasp.sh"
},
emailVerification: {
clientRoute: EmailVerificationRoute,
@@ -84,14 +84,11 @@
},

emailSender: {
- // NOTE: "Dummy" provider is just for local development purposes.
- // Make sure to check the server logs for the email confirmation url (it will not be sent to an address)!
- // Once you are ready for production, switch to e.g. "SendGrid" or "Mailgun" providers. Check out https://docs.opensaas.sh/guides/email-sending/ .
- provider: Dummy,
+ provider: SMTP,
defaultFrom: {
name: "Open SaaS App",
// When using a real provider, e.g. SendGrid, you must use the same email address that you configured your account to send out emails with!
- email: "me@example.com"
+ email: "opensaastemplate@mg.wasp.sh"
},
},
}
13 changes: 13 additions & 0 deletions template-test/app_diff/package.json.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- /Users/ilakovac/dev/open-saas/template-test/tools/../../template-test/base-app/app/package.json
+++ template-test/app/package.json
@@ -1,6 +1,10 @@
{
"name": "opensaas",
"type": "module",
+ "scripts": {
+ "env:pull": "npx dotenv-vault@latest pull development .env.server",
+ "env:push": "npx dotenv-vault@latest push development .env.server"
+ },
"workspaces": [
".wasp/build/*",
".wasp/out/*"
21 changes: 21 additions & 0 deletions template-test/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.

We have a very similar thing in opensaas-sh/tools. Can we consolidate them and somehow?

Copy link
Member 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
Member 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.

Ok, fair enough.

I thought the differences were maybe coming from us forgetting to do some stuff in one of the scripts (e.g., the trap thing). But if they're that different because they really are different, then all good.

RAW.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

set -e

command -v wasp >/dev/null || { echo "Error: Wasp CLI not found"; exit 1; }

SCRIPT_DIR=$(dirname "$(realpath "$0")")
ROOT_DIR="${SCRIPT_DIR}/../.."
BASE_DIR="${ROOT_DIR}/template-test/base-app"

# Clean up the temporary base app directory on exit.
trap 'rm -rf "${BASE_DIR}"' EXIT

cd "${ROOT_DIR}"

rm -rf "${BASE_DIR}"
(cd "${ROOT_DIR}/template-test" && wasp new -t saas base-app)
(cd "${BASE_DIR}/app" && git init -b main -q && git add .)

rm -rf template-test/app_diff
"${ROOT_DIR}/tools/dope.sh" "${BASE_DIR}/app" template-test/app diff
23 changes: 23 additions & 0 deletions template-test/tools/patch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -e

command -v wasp >/dev/null || { echo "Error: Wasp CLI not found"; exit 1; }

SCRIPT_DIR=$(dirname "$(realpath "$0")")
ROOT_DIR="${SCRIPT_DIR}/../.."
BASE_DIR="${ROOT_DIR}/template-test/base-app"

# Clean up the temporary base app directory on exit.
trap 'rm -rf "${BASE_DIR}"' EXIT

cd "${ROOT_DIR}"

rm -rf "${BASE_DIR}"
(cd "${ROOT_DIR}/template-test" && wasp new -t saas base-app)
(cd "${BASE_DIR}/app" && git init -b main -q && git add .)

# Clean up existing derived app directory if it exists.
rm -rf template-test/app

"${ROOT_DIR}/tools/dope.sh" "${BASE_DIR}/app" template-test/app patch
2 changes: 1 addition & 1 deletion tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ or to patch those diffs onto the base project to get the derived one. This is us
project has only small changes on top of the base project and you want to keep it in a directory
in the same repo as the main project.

Since derived apps (like `opensaas-sh`) are just the Open SaaS template with some small tweaks,
Since derived apps (like `opensaas-sh` and `template-test`) are just the Open SaaS template with some small tweaks,
and we want to keep them up to date as the template changes, we don't version the actual app code in git.
Instead, we version the diffs between it and the template in an `opensaas-sh/app_diff/` directory.

Expand Down