From 490c82d61ab4d165799adea33dae7a64963f4770 Mon Sep 17 00:00:00 2001 From: Greg Jopa <534034+gregjopa@users.noreply.github.com> Date: Mon, 21 Aug 2023 11:10:24 -0500 Subject: [PATCH 1/4] Respect exit codes with bash commands --- .github/workflows/validate.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index ca6da048..400412f1 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -21,7 +21,7 @@ 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 -execdir npm run format:check ';+' - name: ๐Ÿ‘• Lint Node.js code with ESLint - run: find . -name package.json -maxdepth 2 -type f -execdir npm run lint ';' + run: find . -name package.json -maxdepth 2 -type f -execdir npm run lint ';+' From 59d306625fc6efc4b971727ce423f5d48bb81846 Mon Sep 17 00:00:00 2001 From: Greg Jopa <534034+gregjopa@users.noreply.github.com> Date: Mon, 21 Aug 2023 11:22:47 -0500 Subject: [PATCH 2/4] test multiple line approach --- .github/workflows/validate.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 400412f1..06715a00 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -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 ';+' + run: > + find . -name package.json -maxdepth 2 -type f | while read -r file; do + directory=$(dirname "$file") + cd "$directory" && npm run lint && cd - + done From e1911087138c15e063ecdcf25f2f029ae2f6bb22 Mon Sep 17 00:00:00 2001 From: Greg Jopa <534034+gregjopa@users.noreply.github.com> Date: Mon, 21 Aug 2023 11:30:40 -0500 Subject: [PATCH 3/4] fix linting errors --- advanced-integration/client/app.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/advanced-integration/client/app.js b/advanced-integration/client/app.js index 43fb25d9..65f048d7 100644 --- a/advanced-integration/client/app.js +++ b/advanced-integration/client/app.js @@ -96,7 +96,7 @@ async function onApproveCallback(data, actions) { } } -paypal +window.paypal .Buttons({ createOrder: createOrderCallback, onApprove: onApproveCallback, @@ -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: { @@ -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...

${JSON.stringify( - errorMessageData, + orderData, )}`, ); }); From dd90140de7fa2560488b36ebf004aa9f298d9d92 Mon Sep 17 00:00:00 2001 From: Greg Jopa <534034+gregjopa@users.noreply.github.com> Date: Mon, 21 Aug 2023 11:35:18 -0500 Subject: [PATCH 4/4] Code formatting --- .../advanced-integration/devcontainer.json | 80 +++++++++---------- .../standard-integration/devcontainer.json | 80 +++++++++---------- .github/workflows/validate.yml | 2 +- 3 files changed, 77 insertions(+), 85 deletions(-) diff --git a/.devcontainer/advanced-integration/devcontainer.json b/.devcontainer/advanced-integration/devcontainer.json index 7eb20bdd..2e840f6f 100644 --- a/.devcontainer/advanced-integration/devcontainer.json +++ b/.devcontainer/advanced-integration/devcontainer.json @@ -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" - } - } - } -} \ No newline at end of file + "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" + } + } + } +} diff --git a/.devcontainer/standard-integration/devcontainer.json b/.devcontainer/standard-integration/devcontainer.json index 742d6534..846dd982 100644 --- a/.devcontainer/standard-integration/devcontainer.json +++ b/.devcontainer/standard-integration/devcontainer.json @@ -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" - } - } - } -} \ No newline at end of file + "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" + } + } + } +} diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 06715a00..ba842418 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -27,7 +27,7 @@ jobs: cd "$directory" && npm run format:check && cd - done - - name: ๐Ÿ‘• Lint Node.js code with ESLint + - name: ๐Ÿ‘• Lint code with ESLint run: > find . -name package.json -maxdepth 2 -type f | while read -r file; do directory=$(dirname "$file")