Skip to content

Commit

Permalink
feat: add stripe-checks for other kcd products
Browse files Browse the repository at this point in the history
  • Loading branch information
jbranchaud authored and kodiakhq[bot] committed Mar 12, 2024
1 parent b82b2c6 commit 2cf030c
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/epic-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"scripts": {
"dev": "next dev -p 3024",
"dev:sanity": "sanity dev",
"dev:stripe": "stripe listen --forward-to localhost:3024/api/skill/webhook/stripe",
"dev:stripe": "./scripts/check-stripe && stripe listen --forward-to localhost:3024/api/skill/webhook/stripe",
"build": "next build",
"postbuild": "NODE_ENV=production next-sitemap",
"start": "next start -p 3024",
Expand Down
17 changes: 17 additions & 0 deletions apps/epic-react/scripts/check-stripe
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Expected stripe display name
EXPECTED_STRING="KCD Training"

# Currently connected stripe display name
COMMAND_OUTPUT=$(
stripe config --list | grep '^display_name' | awk -F'=' '{print $2}' | xargs
)

# Compare the expected string with the command output
if [ "$EXPECTED_STRING" = "$COMMAND_OUTPUT" ]; then
exit 0 # exit with status 0, indicating success/match
else
echo "Mismatched Stripe accounts, expected $EXPECTED_STRING, got $COMMAND_OUTPUT."
exit 1 # exit with status 1, indicating failure/no match
fi
2 changes: 1 addition & 1 deletion apps/epic-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"db:schema": "prisma migrate dev --create-only",
"db:start": "docker compose up -d",
"db:studio": "prisma studio",
"dev:stripe": "stripe listen --forward-to localhost:3021/api/skill/webhook/stripe",
"dev:stripe": "./scripts/check-stripe && stripe listen --forward-to localhost:3021/api/skill/webhook/stripe",
"dev": "concurrently \"npm:dev:*\"",
"dev:next": "next dev -p 3021",
"dev:inngest": "pnpx inngest-cli@latest dev -u http://localhost:3021/api/inngest",
Expand Down
17 changes: 17 additions & 0 deletions apps/epic-web/scripts/check-stripe
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Expected stripe display name
EXPECTED_STRING="KCD Training"

# Currently connected stripe display name
COMMAND_OUTPUT=$(
stripe config --list | grep '^display_name' | awk -F'=' '{print $2}' | xargs
)

# Compare the expected string with the command output
if [ "$EXPECTED_STRING" = "$COMMAND_OUTPUT" ]; then
exit 0 # exit with status 0, indicating success/match
else
echo "Mismatched Stripe accounts, expected $EXPECTED_STRING, got $COMMAND_OUTPUT."
exit 1 # exit with status 1, indicating failure/no match
fi
2 changes: 1 addition & 1 deletion apps/total-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dev": "next dev -p 3016",
"dev:sanity": "sanity dev",
"dev:setup": "vercel env pull .env.local && sed -i.bak '/^VERCEL/d' .env.local",
"dev:stripe": "stripe listen --forward-to localhost:3016/api/skill/webhook/stripe",
"dev:stripe": "./scripts/check-stripe && stripe listen --forward-to localhost:3016/api/skill/webhook/stripe",
"lint": "eslint src/**/*.{ts,tsx} --fix && tsc --noEmit",
"start": "next start -p 3016",
"test": "jest"
Expand Down
17 changes: 17 additions & 0 deletions apps/total-typescript/scripts/check-stripe
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Expected stripe display name
EXPECTED_STRING="Total TypeScript"

# Currently connected stripe display name
COMMAND_OUTPUT=$(
stripe config --list | grep '^display_name' | awk -F'=' '{print $2}' | xargs
)

# Compare the expected string with the command output
if [ "$EXPECTED_STRING" = "$COMMAND_OUTPUT" ]; then
exit 0 # exit with status 0, indicating success/match
else
echo "Mismatched Stripe accounts, expected $EXPECTED_STRING, got $COMMAND_OUTPUT."
exit 1 # exit with status 1, indicating failure/no match
fi

0 comments on commit 2cf030c

Please sign in to comment.