Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ There are two ways to get help or provide feedback (and we try to always respond
1. [Open an issue](https://github.com/wasp-lang/open-saas/issues)
2. [Wasp Discord](https://discord.gg/aCamt5wCpS) -- please direct questions to the #🙋questions forum channel

## Development Tools

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

## Contributing

Note that we've tried to get as many of the core features of a SaaS app into this template as possible, but there still might be some missing features or functionality.
Expand Down
21 changes: 4 additions & 17 deletions opensaas-sh/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,12 @@ 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/`.

So because we don't version the actual demo app (`app/`) but its diffs instead (`app_diff`), the typical workflow is as follows:
**Quick Reference:**

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/` till you resolve them. Do any additional changes also if you wish.
3. Generate new `app_diff/`, based on the current updated `app/`, by running `./tools/diff.sh`.
- Generate `app/` from template and diffs: `./tools/patch.sh`
- Update diffs after modifying `app/`: `./tools/diff.sh`

**Running on MacOS**

If you're running the `patch.sh` or `diff.sh` scripts on Mac, you need to install:

- `grealpath` (packaged within `coreutils`),
- `gpatch`,
- and `diffutils`.

```sh
brew install coreutils # contains grealpath
brew install gpatch
brew install diffutils
```
For detailed information about the diff/patch workflow and MacOS setup requirements, see [../tools/README.md](../tools/README.md).
Copy link
Member

Choose a reason for hiding this comment

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

nitpick:

Suggested change
For detailed information about the diff/patch workflow and MacOS setup requirements, see [../tools/README.md](../tools/README.md).
For detailed information about the diff/patch workflow and macOS setup requirements, see [../tools/README.md](../tools/README.md).

brand name is macOS 🤪


### Blog (blog/)

Expand Down
8 changes: 5 additions & 3 deletions opensaas-sh/tools/diff.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/usr/bin/env bash

TOOLS_DIR=$(dirname "$(realpath "$0")") # Assumes this script is in `tools/`.
cd "${TOOLS_DIR}" && cd ../..
SCRIPT_DIR=$(dirname "$(realpath "$0")") # Assumes this script is in `opensaas-sh/tools/`.
Copy link
Member

Choose a reason for hiding this comment

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

This comment is not in the correct line anymore I think, I would move it to line below, since assumptions is happening there, with the "/../.."?

ROOT_DIR="${SCRIPT_DIR}/../.."

cd "${ROOT_DIR}"

rm -rf opensaas-sh/app_diff
"${TOOLS_DIR}/dope.sh" template/app opensaas-sh/app diff
"${ROOT_DIR}/tools/dope.sh" template/app opensaas-sh/app diff
8 changes: 5 additions & 3 deletions opensaas-sh/tools/patch.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/usr/bin/env bash

TOOLS_DIR=$(dirname "$(realpath "$0")") # Assumes this script is in `tools/`.
cd "${TOOLS_DIR}" && cd ../..
SCRIPT_DIR=$(dirname "$(realpath "$0")") # Assumes this script is in `opensaas-sh/tools/`.
Copy link
Member

Choose a reason for hiding this comment

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

same

ROOT_DIR="${SCRIPT_DIR}/../.."

cd "${ROOT_DIR}"

# Removes all files except for some gitignored files that we don't want to bother regenerating each time,
# like node_modules and certain .env files.
find opensaas-sh/app -mindepth 1 \( -path node_modules -o -name .env.server -o -name .env.me \) -prune -o -exec rm -rf {} +
"${TOOLS_DIR}/dope.sh" template/app opensaas-sh/app patch
"${ROOT_DIR}/tools/dope.sh" template/app opensaas-sh/app patch
53 changes: 53 additions & 0 deletions tools/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Open SaaS Tools

This directory contains utilities for managing derived projects that are built on top of the Open SaaS template.
Copy link
Member

Choose a reason for hiding this comment

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

Ha for now, it might contain any kind of tools :D! You could probably even leave this sentence out, maybe you don't need to at the moment "prescribe" what this "tools" dir is about.

raw


## dope.sh - Diff Or Patch Executor

The `dope.sh` script allows you to easily create a diff between two projects (base and derived), or to patch those diffs onto the base project to get the derived one. This is useful when a derived 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.
Copy link
Member

Choose a reason for hiding this comment

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

I'd add here a small sentence saying that having opensaas.sh be in sync with the template was the motivation for it.

Copy link
Member

Choose a reason for hiding this comment

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

+1


### Usage

```bash
./dope.sh <BASE_DIR> <DERIVED_DIR> <ACTION>
```

- `<BASE_DIR>`: The base project directory (e.g., `../template/`)
- `<DERIVED_DIR>`: The derived project directory (e.g., `app/`)
- `<ACTION>`: Either `diff` or `patch`
- `diff`: Creates a diff between the base and derived directories
- `patch`: Applies existing diffs onto the base directory to recreate the derived directory

### Workflow

Since derived apps (like opensaas-sh) 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 `app_diff/` directory.
Copy link
Member

Choose a reason for hiding this comment

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

Oh this thing here, I'd lift to the tool intro!

Copy link
Member

Choose a reason for hiding this comment

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

+1


The typical workflow is:

1. Run `dope.sh` with `patch` action to generate `app/` from `../template/` and `app_diff/`:
```bash
./dope.sh ../template app patch
```

2. If there are any conflicts (normally due to updates to the template), modify `app/` until you resolve them. Make any additional changes as needed.

3. Generate new `app_diff/` based on the current updated `app/` by running:
```bash
./dope.sh ../template app diff
```

### Running on MacOS
Copy link
Member

@cprecioso cprecioso Oct 8, 2025

Choose a reason for hiding this comment

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

IMO (feel free to disregard)

Suggested change
### Running on MacOS
### Requirements
#### macOS


If you're running the `dope.sh` script on Mac, you need to install:

- `grealpath` (packaged within `coreutils`)
- `gpatch`
- `diffutils`

```sh
brew install coreutils # contains grealpath
brew install gpatch
brew install diffutils
```

The script will automatically detect macOS and use `gpatch` instead of the default `patch` command.
File renamed without changes.