Skip to content

Commit

Permalink
Respect exit codes in CI and format json (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregjopa authored Aug 21, 2023
1 parent 9c9ed82 commit bb8bab4
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 92 deletions.
80 changes: 38 additions & 42 deletions .devcontainer/advanced-integration/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,40 @@
// For more details, see https://aka.ms/devcontainer.json.
{
"name": "PayPal Advanced Integration",
"image": "mcr.microsoft.com/devcontainers/javascript-node:20",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}/advanced-integration",
// Use 'onCreateCommand' to run commands when creating the container.
"onCreateCommand": "bash ../.devcontainer/advanced-integration/welcome-message.sh",
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "npm install",
// Use 'postAttachCommand' to run commands when attaching to the container.
"postAttachCommand": {
"Start server": "npm start"
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
8888
],
"portsAttributes": {
"8888": {
"label": "Preview of Advanced Checkout Flow",
"onAutoForward": "openBrowserOnce"
}
},
"secrets": {
"PAYPAL_CLIENT_ID": {
"description": "Sandbox client ID of the application.",
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
},
"PAYPAL_CLIENT_SECRET": {
"description": "Sandbox secret of the application.",
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
}
},
"customizations": {
"vscode": {
"extensions": [
"vsls-contrib.codetour"
],
"settings": {
"git.openRepositoryInParentFolders": "always"
}
}
}
}
"name": "PayPal Advanced Integration",
"image": "mcr.microsoft.com/devcontainers/javascript-node:20",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}/advanced-integration",
// Use 'onCreateCommand' to run commands when creating the container.
"onCreateCommand": "bash ../.devcontainer/advanced-integration/welcome-message.sh",
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "npm install",
// Use 'postAttachCommand' to run commands when attaching to the container.
"postAttachCommand": {
"Start server": "npm start"
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [8888],
"portsAttributes": {
"8888": {
"label": "Preview of Advanced Checkout Flow",
"onAutoForward": "openBrowserOnce"
}
},
"secrets": {
"PAYPAL_CLIENT_ID": {
"description": "Sandbox client ID of the application.",
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
},
"PAYPAL_CLIENT_SECRET": {
"description": "Sandbox secret of the application.",
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
}
},
"customizations": {
"vscode": {
"extensions": ["vsls-contrib.codetour"],
"settings": {
"git.openRepositoryInParentFolders": "always"
}
}
}
}
80 changes: 38 additions & 42 deletions .devcontainer/standard-integration/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,40 @@
// For more details, see https://aka.ms/devcontainer.json.
{
"name": "PayPal Standard Integration",
"image": "mcr.microsoft.com/devcontainers/javascript-node:20",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}/standard-integration",
// Use 'onCreateCommand' to run commands when creating the container.
"onCreateCommand": "bash ../.devcontainer/standard-integration/welcome-message.sh",
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "npm install",
// Use 'postAttachCommand' to run commands when attaching to the container.
"postAttachCommand": {
"Start server": "npm start"
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
8888
],
"portsAttributes": {
"8888": {
"label": "Preview of Standard Checkout Flow",
"onAutoForward": "openBrowserOnce"
}
},
"secrets": {
"PAYPAL_CLIENT_ID": {
"description": "Sandbox client ID of the application.",
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
},
"PAYPAL_CLIENT_SECRET": {
"description": "Sandbox secret of the application.",
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
}
},
"customizations": {
"vscode": {
"extensions": [
"vsls-contrib.codetour"
],
"settings": {
"git.openRepositoryInParentFolders": "always"
}
}
}
}
"name": "PayPal Standard Integration",
"image": "mcr.microsoft.com/devcontainers/javascript-node:20",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}/standard-integration",
// Use 'onCreateCommand' to run commands when creating the container.
"onCreateCommand": "bash ../.devcontainer/standard-integration/welcome-message.sh",
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "npm install",
// Use 'postAttachCommand' to run commands when attaching to the container.
"postAttachCommand": {
"Start server": "npm start"
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [8888],
"portsAttributes": {
"8888": {
"label": "Preview of Standard Checkout Flow",
"onAutoForward": "openBrowserOnce"
}
},
"secrets": {
"PAYPAL_CLIENT_ID": {
"description": "Sandbox client ID of the application.",
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
},
"PAYPAL_CLIENT_SECRET": {
"description": "Sandbox secret of the application.",
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
}
},
"customizations": {
"vscode": {
"extensions": ["vsls-contrib.codetour"],
"settings": {
"git.openRepositoryInParentFolders": "always"
}
}
}
}
14 changes: 11 additions & 3 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@ jobs:
node-version: 18

- name: 🧹 Check code formatting with Prettier
run: find . -name package.json -maxdepth 2 -type f -execdir npm run format:check ';'
run: >
find . -name package.json -maxdepth 2 -type f | while read -r file; do
directory=$(dirname "$file")
cd "$directory" && npm run format:check && cd -
done
- name: 👕 Lint Node.js code with ESLint
run: find . -name package.json -maxdepth 2 -type f -execdir npm run lint ';'
- name: 👕 Lint code with ESLint
run: >
find . -name package.json -maxdepth 2 -type f | while read -r file; do
directory=$(dirname "$file")
cd "$directory" && npm run lint && cd -
done
9 changes: 4 additions & 5 deletions advanced-integration/client/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async function onApproveCallback(data, actions) {
}
}

paypal
window.paypal
.Buttons({
createOrder: createOrderCallback,
onApprove: onApproveCallback,
Expand All @@ -110,9 +110,9 @@ function resultMessage(message) {
}

// If this returns false or the card fields aren't visible, see Step #1.
if (paypal.HostedFields.isEligible()) {
if (window.paypal.HostedFields.isEligible()) {
// Renders card fields
paypal.HostedFields.render({
window.paypal.HostedFields.render({
// Call your server to set up the transaction
createOrder: createOrderCallback,
styles: {
Expand Down Expand Up @@ -172,10 +172,9 @@ if (paypal.HostedFields.isEligible()) {
return onApproveCallback(data);
})
.catch((orderData) => {
const { links, ...errorMessageData } = orderData;
resultMessage(
`Sorry, your transaction could not be processed...<br><br>${JSON.stringify(
errorMessageData,
orderData,
)}`,
);
});
Expand Down

0 comments on commit bb8bab4

Please sign in to comment.