Skip to content

Commit 5dd4bce

Browse files
authored
feat: add support for GitHub Codespaces (#52)
1 parent b15a936 commit 5dd4bce

File tree

4 files changed

+146
-0
lines changed

4 files changed

+146
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// For more details, see https://aka.ms/devcontainer.json.
2+
{
3+
"name": "PayPal Advanced Integration",
4+
"image": "mcr.microsoft.com/devcontainers/universal:2",
5+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}/advanced-integration",
6+
7+
// Use 'onCreateCommand' to run commands when creating the container.
8+
"onCreateCommand": "bash ../.devcontainer/advanced-integration/welcome-message.sh",
9+
10+
// Use 'postCreateCommand' to run commands after the container is created.
11+
"postCreateCommand": "npm install",
12+
13+
// Use 'postAttachCommand' to run commands when attaching to the container.
14+
"postAttachCommand": {
15+
"Start server": "npm start"
16+
},
17+
18+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
19+
"forwardPorts": [
20+
8888
21+
],
22+
"portsAttributes": {
23+
"8888": {
24+
"label": "Preview of Advanced Checkout Flow",
25+
"onAutoForward": "openBrowserOnce"
26+
}
27+
},
28+
29+
"secrets": {
30+
"CLIENT_ID": {
31+
"description": "Sandbox client ID of the application.",
32+
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
33+
},
34+
"APP_SECRET": {
35+
"description": "Sandbox secret of the application.",
36+
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
37+
}
38+
},
39+
40+
"customizations": {
41+
"vscode": {
42+
"extensions": [
43+
"vsls-contrib.codetour"
44+
],
45+
"settings": {
46+
"git.openRepositoryInParentFolders": "always"
47+
}
48+
}
49+
}
50+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
WELCOME_MESSAGE="
6+
👋 Welcome to the \"PayPal Advanced Checkout Integration Example\"
7+
8+
🛠️ Your environment is fully setup with all the required software.
9+
10+
🚀 Once you rename the \".env.example\" file to \".env\" and update \"CLIENT_ID\" and \"APP_SECRET\", the checkout page will automatically open in the browser after the server is restarted."
11+
12+
ALTERNATE_WELCOME_MESSAGE="
13+
👋 Welcome to the \"PayPal Advanced Checkout Integration Example\"
14+
15+
🛠️ Your environment is fully setup with all the required software.
16+
17+
🚀 The checkout page will automatically open in the browser after the server is started."
18+
19+
if [ -n "$CLIENT_ID" ] && [ -n "$APP_SECRET" ]; then
20+
WELCOME_MESSAGE="${ALTERNATE_WELCOME_MESSAGE}"
21+
fi
22+
23+
sudo bash -c "echo \"${WELCOME_MESSAGE}\" > /usr/local/etc/vscode-dev-containers/first-run-notice.txt"
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// For more details, see https://aka.ms/devcontainer.json.
2+
{
3+
"name": "PayPal Standard Integration",
4+
"image": "mcr.microsoft.com/devcontainers/universal:2",
5+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}/advanced-integration",
6+
7+
// Use 'onCreateCommand' to run commands when creating the container.
8+
"onCreateCommand": "bash ../.devcontainer/standard-integration/welcome-message.sh",
9+
10+
// Use 'postCreateCommand' to run commands after the container is created.
11+
"postCreateCommand": "npm install",
12+
13+
// Use 'postAttachCommand' to run commands when attaching to the container.
14+
"postAttachCommand": {
15+
"Start server": "npm start"
16+
},
17+
18+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
19+
"forwardPorts": [
20+
8888
21+
],
22+
"portsAttributes": {
23+
"8888": {
24+
"label": "Preview of Advanced Checkout Flow",
25+
"onAutoForward": "openBrowserOnce"
26+
}
27+
},
28+
29+
"secrets": {
30+
"CLIENT_ID": {
31+
"description": "Sandbox client ID of the application.",
32+
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
33+
},
34+
"APP_SECRET": {
35+
"description": "Sandbox secret of the application.",
36+
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
37+
}
38+
},
39+
40+
"customizations": {
41+
"vscode": {
42+
"extensions": [
43+
"vsls-contrib.codetour"
44+
],
45+
"settings": {
46+
"git.openRepositoryInParentFolders": "always"
47+
}
48+
}
49+
}
50+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
WELCOME_MESSAGE="
6+
👋 Welcome to the \"PayPal Standard Checkout Integration Example\"
7+
8+
🛠️ Your environment is fully setup with all the required software.
9+
10+
🚀 Once you rename the \".env.example\" file to \".env\" and update \"CLIENT_ID\" and \"APP_SECRET\", the checkout page will automatically open in the browser after the server is restarted."
11+
12+
ALTERNATE_WELCOME_MESSAGE="
13+
👋 Welcome to the \"PayPal Standard Checkout Integration Example\"
14+
15+
🛠️ Your environment is fully setup with all the required software.
16+
17+
🚀 The checkout page will automatically open in the browser after the server is started."
18+
19+
if [ -n "$CLIENT_ID" ] && [ -n "$APP_SECRET" ]; then
20+
WELCOME_MESSAGE="${ALTERNATE_WELCOME_MESSAGE}"
21+
fi
22+
23+
sudo bash -c "echo \"${WELCOME_MESSAGE}\" > /usr/local/etc/vscode-dev-containers/first-run-notice.txt"

0 commit comments

Comments
 (0)