Skip to content

Commit

Permalink
Merge pull request #143 from chrisvdm/simple-store-example
Browse files Browse the repository at this point in the history
Simple store example
  • Loading branch information
chrisvdm authored Oct 31, 2024
2 parents f30f009 + 975785b commit 5143dc5
Show file tree
Hide file tree
Showing 80 changed files with 24,547 additions and 891 deletions.
4 changes: 2 additions & 2 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
"@redwoodjs/testing": "^7.7.2",
"stripe": ">=11.18.0"
},
"gitHead": "dc236d24165114a18811fe36e62482ff4ae75d36",
"gitHead": "f30f009c17691fe08b04a3fe67a00efdddea8c4b",
"peerDependencies": {
"@redwoodjs/api": ">=7.7.2"
},
"devDependencies": {
"@redwoodjs/api": "^7.7.2"
"@redwoodjs/api": "^8.4.0"
}
}
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
"stripe": "^11.9.1",
"yargs": "^17.7.2"
},
"gitHead": "dc236d24165114a18811fe36e62482ff4ae75d36"
"gitHead": "f30f009c17691fe08b04a3fe67a00efdddea8c4b"
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,10 @@ const StripeCustomerPortalButton = ({ isLoggedIn }) => {
subscription_cancel: {
enabled: true,
mode: "immediately",
},
subscription_pause: {
enabled: true,
cancellation_reason: {
enabled: true,
options: ['other', 'unused', 'too_expensive', ]
}
},
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,11 @@ const StripeCustomerPortalButton = ({ isLoggedIn }) => {
subscription_cancel: {
enabled: true,
mode: "immediately",
},
subscription_pause: {
enabled: true,
},
cancellation_reason: {
enabled: true,
options: ['other', 'unused', 'too_expensive', ]
}
}
},
});
await redirectToStripeCustomerPortal(
Expand Down
10 changes: 10 additions & 0 deletions examples/simple-store/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
19 changes: 19 additions & 0 deletions examples/simple-store/.env.defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# These environment variables will be used by default if you do not create any
# yourself in .env. This file should be safe to check into your version control
# system. Any custom values should go in .env and .env should *not* be checked
# into version control.

# schema.prisma defaults
DATABASE_URL=file:./dev.db

# location of the test database for api service scenarios (defaults to ./.redwood/test.db if not set)
# TEST_DATABASE_URL=file:./.redwood/test.db

# disables Prisma CLI update notifier
PRISMA_HIDE_UPDATE_MESSAGE=true

# Option to override the current environment's default api-side log level
# See: https://redwoodjs.com/docs/logger for level options, defaults to "trace" otherwise.
# Most applications want "debug" or "info" during dev, "trace" when you have issues and "warn" in production.
# Ordered by how verbose they are: trace | debug | info | warn | error | silent
# LOG_LEVEL=debug
4 changes: 4 additions & 0 deletions examples/simple-store/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# DATABASE_URL=file:./dev.db
# TEST_DATABASE_URL=file:./.redwood/test.db
# PRISMA_HIDE_UPDATE_MESSAGE=true
# LOG_LEVEL=trace
24 changes: 24 additions & 0 deletions examples/simple-store/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.idea
.DS_Store
.env*
!.env.example
!.env.defaults
.netlify
.redwood/*
!.redwood/README.md
dev.db*
dist
dist-babel
node_modules
yarn-error.log
web/public/mockServiceWorker.js
web/types/graphql.d.ts
api/types/graphql.d.ts
api/src/lib/generateGraphiQLHeader.*
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
44 changes: 44 additions & 0 deletions examples/simple-store/.redwood/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# .redwood

## What is this directory?

Redwood uses this `.redwood` directory to store transitory data that aids in the smooth and convenient operation of your Redwood project.

## Do I need to do anything with this directory?

No. You shouldn't have to create, edit or delete anything in this directory in your day-to-day work with Redwood.

You don't need to commit any other contents of this directory to your version control system. It's ignored by default.

## What's in this directory?

### Files

| Name | Description |
| :---------------- | :------- |
| commandCache.json | This file contains mappings to assist the Redwood CLI in efficiently executing commands. |
| schema.graphql | This is the GraphQL schema which has been automatically generated from your Redwood project. |
| telemetry.txt | Contains a unique ID used for telemetry. This value is rotated every 24 hours to protect your project's anonymity. |
| test.db | The sqlite database used when running tests. |

### Directories

| Name | Description |
| :---------- | :------- |
| locks | Stores temporary files that Redwood uses to keep track of the execution of async/background tasks between processes. |
| logs | Stores log files for background tasks such as update checking. |
| prebuild | Stores transpiled JavaScript that is generated as part of Redwood's build process. |
| telemetry | Stores the recent telemetry that the Redwood CLI has generated. You may inspect these files to see everything Redwood is anonymously collecting. |
| types | Stores the results of type generation. |
| updateCheck | Stores a file which contains the results of checking for Redwood updates. |
| studio | Used to store data for `rw studio` |

We try to keep this README up to date but you may, from time to time, find other files or directories in this `.redwood` directory that have not yet been documented here. This is likely nothing to worry about but feel free to let us know and we'll update this list.

### Telemetry

RedwoodJS collects completely anonymous telemetry data about general usage. For transparency, that data is viewable in the respective directories and files. To learn more and manage your project's settings, visit [telemetry.redwoodjs.com](https://telemetry.redwoodjs.com).

### Have any questions?

Feel free to reach out to us in the [RedwoodJS Community](https://community.redwoodjs.com/) forum if you have any questions.
14 changes: 14 additions & 0 deletions examples/simple-store/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"eamodio.gitlens",
"ofhumanbondage.react-proptypes-intellisense",
"mgmcdermott.vscode-language-babel",
"wix.vscode-import-cost",
"pflannery.vscode-versionlens",
"editorconfig.editorconfig",
"prisma.prisma",
"graphql.vscode-graphql"
],
"unwantedRecommendations": []
}
56 changes: 56 additions & 0 deletions examples/simple-store/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"version": "0.3.0",
"configurations": [
{
"command": "yarn redwood dev --apiDebugPort 18911", // you can add --fwd='--open=false' to prevent the browser from opening
"name": "Run Dev Server",
"request": "launch",
"type": "node-terminal"
},
{
"name": "Attach API debugger",
"port": 18911, // you can change this port, see https://redwoodjs.com/docs/project-configuration-dev-test-build#debugger-configuration
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"localRoot": "${workspaceFolder}/node_modules/@redwoodjs/api-server/dist",
"remoteRoot": "${workspaceFolder}/node_modules/@redwoodjs/api-server/dist",
"sourceMaps": true,
"restart": true,
"preLaunchTask": "WaitForDevServer",
},
{
"name": "Launch Web debugger",
"type": "chrome",
"request": "launch",
"url": "http://localhost:8910",
"webRoot": "${workspaceRoot}/web/src",
"preLaunchTask": "WaitForDevServer",
},
{
"command": "yarn redwood test api",
"name": "Test api",
"request": "launch",
"type": "node-terminal"
},
{
"command": "yarn redwood test web",
"name": "Test web",
"request": "launch",
"type": "node-terminal"
},
],
"compounds": [
{
"name": "Start Debug",
"configurations": [
"Run Dev Server",
"Attach API debugger",
"Launch Web debugger"
],
"stopAll": true
}
]
}
11 changes: 11 additions & 0 deletions examples/simple-store/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"editor.tabSize": 2,
"files.trimTrailingWhitespace": true,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"[prisma]": {
"editor.formatOnSave": true
}
}
29 changes: 29 additions & 0 deletions examples/simple-store/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "WaitForDevServer",
"group": "none",
"type": "shell",
"command": "bash",
"args": [
"-c",
"while ! echo -n > /dev/tcp/localhost/18911; do sleep 1; done;"
],
"windows": {
"command": "powershell",
"args": [
"-NoProfile",
"-ExecutionPolicy", "Bypass",
"while (-not (Test-NetConnection -ComputerName localhost -Port 18911)) { Start-Sleep -Seconds 1 };"
]
},
"presentation": {
"reveal": "silent",
"revealProblems": "onProblem",
"panel": "shared",
"close": true
}
},
]
}
15 changes: 15 additions & 0 deletions examples/simple-store/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Yarn's manifest file. You can configure yarn here.
# See https://yarnpkg.com/configuration/yarnrc.

# For `node_modules` (see `nodeLinker` below), this is almost always the preferred option.
compressionLevel: 0

enableGlobalCache: true

# Lets yarn use hardlinks inside `node_modules` to dedupe packages.
# For a more pnpm-like experience, consider `hardlinks-global` where hardlinks point to a global store.
nmMode: hardlinks-local

# How to install Node packages.
# Heads up: right now, Redwood expects this to be `node-modules`.
nodeLinker: node-modules
Loading

0 comments on commit 5143dc5

Please sign in to comment.