Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check currently connected Stripe account during pnpm dev:stripe #1433

Merged
merged 3 commits into from Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/epic-react/package.json
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
@@ -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
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
@@ -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/testing-javascript/package.json
Expand Up @@ -11,7 +11,7 @@
"db:studio": "prisma studio",
"dev": "next dev -p 3018",
"dev:sanity": "sanity dev",
"dev:stripe": "stripe listen --forward-to localhost:3018/api/skill/webhook/stripe",
"dev:stripe": "./scripts/check-stripe && stripe listen --forward-to localhost:3018/api/skill/webhook/stripe",
"lint": "eslint src/**/*.{ts,tsx} --fix && tsc --noEmit",
"start": "next start -p 3018"
},
Expand Down
17 changes: 17 additions & 0 deletions apps/testing-javascript/scripts/check-stripe
@@ -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
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
@@ -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