mirror of
https://github.com/wasp-lang/open-saas.git
synced 2025-11-19 06:46:52 +01:00
start
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
--- template/app/src/payment/paymentProcessor.ts
|
||||
+++ opensaas-sh/app/src/payment/paymentProcessor.ts
|
||||
@@ -28,9 +28,4 @@
|
||||
@@ -29,9 +29,4 @@
|
||||
webhookMiddlewareConfigFn: MiddlewareConfigFn;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- template/app/src/payment/stripe/user.ts
|
||||
+++ opensaas-sh/app/src/payment/stripe/user.ts
|
||||
@@ -3,7 +3,7 @@
|
||||
@@ -4,7 +4,7 @@
|
||||
import type { SubscriptionStatus } from "../plans";
|
||||
import { PaymentPlanId } from "../plans";
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
userId: User["id"],
|
||||
prismaUserDelegate: PrismaClient["user"],
|
||||
): Promise<string | null> {
|
||||
@@ -12,20 +12,20 @@
|
||||
@@ -13,20 +13,20 @@
|
||||
id: userId,
|
||||
},
|
||||
select: {
|
||||
@@ -36,7 +36,7 @@
|
||||
prismaUserDelegate: PrismaClient["user"],
|
||||
): Promise<User> {
|
||||
return prismaUserDelegate.update({
|
||||
@@ -33,7 +33,7 @@
|
||||
@@ -34,7 +34,7 @@
|
||||
id: userId,
|
||||
},
|
||||
data: {
|
||||
@@ -45,7 +45,7 @@
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -54,7 +54,7 @@
|
||||
@@ -55,7 +55,7 @@
|
||||
): Promise<User> {
|
||||
return userDelegate.update({
|
||||
where: {
|
||||
@@ -54,7 +54,7 @@
|
||||
},
|
||||
data: {
|
||||
datePaid,
|
||||
@@ -81,7 +81,7 @@
|
||||
@@ -82,7 +82,7 @@
|
||||
): Promise<User> {
|
||||
return userDelegate.update({
|
||||
where: {
|
||||
|
||||
@@ -7,18 +7,18 @@ 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, 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.
|
||||
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 `opensaas-sh/app_diff/` directory.
|
||||
|
||||
### Usage
|
||||
|
||||
```bash
|
||||
```sh
|
||||
./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/`)
|
||||
- `<BASE_DIR>`: The base project directory (e.g., `template/app/`)
|
||||
- `<DERIVED_DIR>`: The derived project directory (e.g., `opensaas-sh/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
|
||||
@@ -35,18 +35,19 @@ and `.copy` files to copy files directly from the diff directory to the derived
|
||||
|
||||
The typical workflow is:
|
||||
|
||||
1. Run `dope.sh` with the `patch` action to generate `app/` from `../template/` and `app_diff/`:
|
||||
1. Run `dope.sh` with the `patch` action to generate `opensaas-sh/app/` from `template/app/` and `opensaash-sh/app_diff/`:
|
||||
|
||||
```bash
|
||||
./dope.sh ../template app patch
|
||||
```
|
||||
```bash
|
||||
./dope.sh ../template app patch
|
||||
```
|
||||
|
||||
2. If there are any conflicts (usually due to updates to the template), modify `app/` until you resolve them. Make any additional changes as needed.
|
||||
2. If there are any conflicts (usually due to updates to the template), modify `opensaas-sh/app/` until you resolve them. Make any additional changes as needed.
|
||||
|
||||
3. Generate a new `app_diff/` based on the updated `app/` by running:
|
||||
```bash
|
||||
./dope.sh ../template app diff
|
||||
```
|
||||
3. Generate a new `opensaas-sh/app_diff/` based on the updated `opensaas-sh/app/` by running:
|
||||
|
||||
```bash
|
||||
./dope.sh ../template app diff
|
||||
```
|
||||
|
||||
### Requirements
|
||||
|
||||
@@ -58,6 +59,8 @@ If you're running the `dope.sh` script on macOS, install:
|
||||
- `gpatch`
|
||||
- `diffutils`
|
||||
|
||||
You can easily install them through `brew`:
|
||||
|
||||
```sh
|
||||
brew install coreutils # contains grealpath
|
||||
brew install gpatch
|
||||
|
||||
@@ -60,8 +60,8 @@ recreate_diff_dir() {
|
||||
# For each source file in the derived dir, generate a .diff file between it and the
|
||||
# corresponding source file in the base dir.
|
||||
while IFS= read -r filepath; do
|
||||
local derivedFilepath="${DERIVED_DIR}/${filepath}"
|
||||
local baseFilepath="${BASE_DIR}/${filepath}"
|
||||
local derivedFilepath="${DERIVED_DIR}/${filepath}"
|
||||
|
||||
local filepathToBeUsedAsBase="${baseFilepath}"
|
||||
# If the file is not one of the source files in base dir (e.g. is gitignored or doesn't exist),
|
||||
@@ -80,7 +80,8 @@ recreate_diff_dir() {
|
||||
cp "${derivedFilepath}" "${DIFF_DIR}/${filepath}.copy"
|
||||
echo "Generated ${DIFF_DIR}/${filepath}.copy"
|
||||
else
|
||||
diff -Nu --label "${baseFilepath}" --label "${derivedFilepath}" "${filepathToBeUsedAsBase}" "${derivedFilepath}" > "${DIFF_DIR}/${filepath}.diff"
|
||||
diff -Nu --label "${baseFilepath}" --label "${derivedFilepath}" \
|
||||
"${filepathToBeUsedAsBase}" "${derivedFilepath}" > "${DIFF_DIR}/${filepath}.diff"
|
||||
echo "Generated ${DIFF_DIR}/${filepath}.diff"
|
||||
fi
|
||||
done <<< "${DERIVED_FILES}"
|
||||
|
||||
Reference in New Issue
Block a user