From c5017deede47a0ceafb8b588da305a05b35cf72a Mon Sep 17 00:00:00 2001 From: Greg Jopa <534034+gregjopa@users.noreply.github.com> Date: Wed, 7 May 2025 09:43:11 -0500 Subject: [PATCH 01/21] chore: add github actions for linting and formatting checks --- .github/workflows/validate.yml | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/validate.yml diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..aaebd2f --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,35 @@ +name: validate +on: + # run on push but only for the main branch + push: + branches: + - main + # run for every pull request + pull_request: {} +jobs: + main: + runs-on: ubuntu-latest + steps: + - name: โฌ๏ธ Checkout repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: โ Setup node + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: ๐งน Check code formatting with Prettier + run: > + find . -name package.json -maxdepth 3 -type f | while read -r file; do + directory=$(dirname "$file") + cd "$directory" && npm run format:check && cd - + done + + - name: ๐ Lint code with ESLint + run: > + find . -name package.json -maxdepth 3 -type f | while read -r file; do + directory=$(dirname "$file") + cd "$directory" && npm run lint && cd - + done From 91a5c7ac2971568d04c465b568b4fe8bcd0ce48e Mon Sep 17 00:00:00 2001 From: Greg Jopa <534034+gregjopa@users.noreply.github.com> Date: Wed, 7 May 2025 09:45:43 -0500 Subject: [PATCH 02/21] debug --- .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 aaebd2f..770af9c 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -24,12 +24,12 @@ jobs: run: > find . -name package.json -maxdepth 3 -type f | while read -r file; do directory=$(dirname "$file") - cd "$directory" && npm run format:check && cd - + echo "$directory" && cd "$directory" && npm run format:check && cd - done - name: ๐ Lint code with ESLint run: > find . -name package.json -maxdepth 3 -type f | while read -r file; do directory=$(dirname "$file") - cd "$directory" && npm run lint && cd - + echo "$directory" && cd "$directory" && npm run lint && cd - done From 3dce5857dc868574d63a08a02ce0d64b3f4bbf8e Mon Sep 17 00:00:00 2001 From: Greg Jopa <534034+gregjopa@users.noreply.github.com> Date: Wed, 7 May 2025 09:49:23 -0500 Subject: [PATCH 03/21] more debugging --- .github/workflows/validate.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 770af9c..61b5c26 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -24,12 +24,14 @@ jobs: run: > find . -name package.json -maxdepth 3 -type f | while read -r file; do directory=$(dirname "$file") - echo "$directory" && cd "$directory" && npm run format:check && cd - + echo "package.json directory: $directory" + cd "$directory" && npm run format:check && cd - done - name: ๐ Lint code with ESLint run: > find . -name package.json -maxdepth 3 -type f | while read -r file; do directory=$(dirname "$file") - echo "$directory" && cd "$directory" && npm run lint && cd - + echo "package.json directory: $directory" + cd "$directory" && npm run lint && cd - done From b6bdf769cc40efeb385a3aaecc7618494950df6d Mon Sep 17 00:00:00 2001 From: Greg Jopa <534034+gregjopa@users.noreply.github.com> Date: Wed, 7 May 2025 09:52:34 -0500 Subject: [PATCH 04/21] test for formatting error --- .github/workflows/validate.yml | 4 ++-- server/node/package.json | 1 + server/node/src/paypalServerSdk.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 61b5c26..86bfdad 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -24,7 +24,7 @@ jobs: run: > find . -name package.json -maxdepth 3 -type f | while read -r file; do directory=$(dirname "$file") - echo "package.json directory: $directory" + echo "\"package.json directory: $directory\"" cd "$directory" && npm run format:check && cd - done @@ -32,6 +32,6 @@ jobs: run: > find . -name package.json -maxdepth 3 -type f | while read -r file; do directory=$(dirname "$file") - echo "package.json directory: $directory" + echo "\"package.json directory: $directory\"" cd "$directory" && npm run lint && cd - done diff --git a/server/node/package.json b/server/node/package.json index e05f2ee..048a794 100644 --- a/server/node/package.json +++ b/server/node/package.json @@ -9,6 +9,7 @@ "check-node-version": "tsx src/checkNodeVersion.ts", "clean": "rm -rf dist", "format": "prettier . --write", + "format:check": "npx prettier . --check", "start": "npm run check-node-version && tsx --watch src/server.ts", "start-production": "NODE_ENV=production node dist/server.js" }, diff --git a/server/node/src/paypalServerSdk.ts b/server/node/src/paypalServerSdk.ts index 809f684..fe8fadb 100644 --- a/server/node/src/paypalServerSdk.ts +++ b/server/node/src/paypalServerSdk.ts @@ -119,7 +119,7 @@ export async function createOrder(orderRequestBody: OrderRequest) { try { const { result, statusCode } = await ordersController.createOrder({ body: orderRequestBody, - prefer: "return=minimal", + prefer: 'return=minimal', }); return { From 7bb894b723a94cd2b66d717c927957d83109d607 Mon Sep 17 00:00:00 2001 From: Greg Jopa <534034+gregjopa@users.noreply.github.com> Date: Wed, 7 May 2025 09:53:44 -0500 Subject: [PATCH 05/21] moar debuggin g --- server/node/package.json | 2 +- server/node/src/paypalServerSdk.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/node/package.json b/server/node/package.json index 048a794..4b38666 100644 --- a/server/node/package.json +++ b/server/node/package.json @@ -9,7 +9,7 @@ "check-node-version": "tsx src/checkNodeVersion.ts", "clean": "rm -rf dist", "format": "prettier . --write", - "format:check": "npx prettier . --check", + "format:check": "prettier . --check", "start": "npm run check-node-version && tsx --watch src/server.ts", "start-production": "NODE_ENV=production node dist/server.js" }, diff --git a/server/node/src/paypalServerSdk.ts b/server/node/src/paypalServerSdk.ts index fe8fadb..809f684 100644 --- a/server/node/src/paypalServerSdk.ts +++ b/server/node/src/paypalServerSdk.ts @@ -119,7 +119,7 @@ export async function createOrder(orderRequestBody: OrderRequest) { try { const { result, statusCode } = await ordersController.createOrder({ body: orderRequestBody, - prefer: 'return=minimal', + prefer: "return=minimal", }); return { From d94c647f98d6c6c984ebd79978da7a62b08988d9 Mon Sep 17 00:00:00 2001 From: Greg Jopa <534034+gregjopa@users.noreply.github.com> Date: Wed, 7 May 2025 10:00:30 -0500 Subject: [PATCH 06/21] chore: install deps --- .github/workflows/{validate.yml => main.yml} | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) rename .github/workflows/{validate.yml => main.yml} (70%) diff --git a/.github/workflows/validate.yml b/.github/workflows/main.yml similarity index 70% rename from .github/workflows/validate.yml rename to .github/workflows/main.yml index 86bfdad..c4000a2 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: validate +name: main on: # run on push but only for the main branch push: @@ -15,10 +15,21 @@ jobs: with: fetch-depth: 0 + - name: ๐ค Set Node version from .nvmrc + run: echo NVMRC=`cat .nvmrc` >> $GITHUB_ENV + - name: โ Setup node uses: actions/setup-node@v4 with: - node-version: 20 + node-version: ${{ env.NVMRC }} + + - name: ๐ฅ Download deps + run: > + find . -name package.json -maxdepth 4 -type f | while read -r file; do + directory=$(dirname "$file") + echo "\"package.json directory: $directory\"" + npm ci + done - name: ๐งน Check code formatting with Prettier run: > From f3e33358b05cb10e19f492dff05ea6c87f6e2c95 Mon Sep 17 00:00:00 2001 From: Greg Jopa <534034+gregjopa@users.noreply.github.com> Date: Wed, 7 May 2025 10:02:04 -0500 Subject: [PATCH 07/21] use npm install since no package-lock --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c4000a2..165e104 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,7 @@ jobs: find . -name package.json -maxdepth 4 -type f | while read -r file; do directory=$(dirname "$file") echo "\"package.json directory: $directory\"" - npm ci + npm install done - name: ๐งน Check code formatting with Prettier From d7cb518eb84180dc98d41628429fc522274e8952 Mon Sep 17 00:00:00 2001 From: Greg Jopa <534034+gregjopa@users.noreply.github.com> Date: Wed, 7 May 2025 10:05:55 -0500 Subject: [PATCH 08/21] try again --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 165e104..a4a4282 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,7 @@ jobs: find . -name package.json -maxdepth 4 -type f | while read -r file; do directory=$(dirname "$file") echo "\"package.json directory: $directory\"" - npm install + cd "$directory" && npm install && cd - done - name: ๐งน Check code formatting with Prettier From fe0faf57143bf14c5a5052efdf94db0fcdc3dec9 Mon Sep 17 00:00:00 2001 From: Greg Jopa <534034+gregjopa@users.noreply.github.com> Date: Wed, 7 May 2025 10:12:05 -0500 Subject: [PATCH 09/21] add prettier checks --- .github/workflows/main.yml | 6 +++--- client/oneTimePayment/html/package.json | 3 ++- .../html/src/custom/sandboxedIframe/package.json | 3 ++- client/oneTimePayment/react/package.json | 1 + client/savePayment/html/package.json | 3 ++- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a4a4282..ce0fd38 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,7 +25,7 @@ jobs: - name: ๐ฅ Download deps run: > - find . -name package.json -maxdepth 4 -type f | while read -r file; do + find . -name package.json -maxdepth 6 -type f | while read -r file; do directory=$(dirname "$file") echo "\"package.json directory: $directory\"" cd "$directory" && npm install && cd - @@ -33,7 +33,7 @@ jobs: - name: ๐งน Check code formatting with Prettier run: > - find . -name package.json -maxdepth 3 -type f | while read -r file; do + find . -name package.json -maxdepth 6 -type f | while read -r file; do directory=$(dirname "$file") echo "\"package.json directory: $directory\"" cd "$directory" && npm run format:check && cd - @@ -41,7 +41,7 @@ jobs: - name: ๐ Lint code with ESLint run: > - find . -name package.json -maxdepth 3 -type f | while read -r file; do + find . -name package.json -maxdepth 6 -type f | while read -r file; do directory=$(dirname "$file") echo "\"package.json directory: $directory\"" cd "$directory" && npm run lint && cd - diff --git a/client/oneTimePayment/html/package.json b/client/oneTimePayment/html/package.json index c827c3c..925aabf 100644 --- a/client/oneTimePayment/html/package.json +++ b/client/oneTimePayment/html/package.json @@ -7,7 +7,8 @@ "build": "vite build", "preview": "vite preview", "start": "vite", - "format": "prettier . --write" + "format": "prettier . --write", + "format:check": "prettier . --check" }, "license": "Apache-2.0", "devDependencies": { diff --git a/client/oneTimePayment/html/src/custom/sandboxedIframe/package.json b/client/oneTimePayment/html/src/custom/sandboxedIframe/package.json index 843d327..b3c7671 100644 --- a/client/oneTimePayment/html/src/custom/sandboxedIframe/package.json +++ b/client/oneTimePayment/html/src/custom/sandboxedIframe/package.json @@ -6,7 +6,8 @@ "merchant-page": "vite --config vite-merchant-example.config.js", "paypal-iframe": "vite --config vite-paypal-iframe.config.js", "start": "concurrently \"npm run merchant-page\" \"npm run paypal-iframe\"", - "format": "prettier . --write" + "format": "prettier . --write", + "format:check": "prettier . --check" }, "license": "Apache-2.0", "devDependencies": { diff --git a/client/oneTimePayment/react/package.json b/client/oneTimePayment/react/package.json index 6ae6b85..9027ed1 100644 --- a/client/oneTimePayment/react/package.json +++ b/client/oneTimePayment/react/package.json @@ -9,6 +9,7 @@ "lint": "eslint .", "preview": "vite preview", "format": "prettier . --write", + "format:check": "prettier . --check", "typecheck": "tsc --build --noEmit" }, "dependencies": { diff --git a/client/savePayment/html/package.json b/client/savePayment/html/package.json index 58a2249..2c4186a 100644 --- a/client/savePayment/html/package.json +++ b/client/savePayment/html/package.json @@ -7,7 +7,8 @@ "build": "vite build", "preview": "vite preview", "start": "vite", - "format": "npx prettier . --write" + "format": "npx prettier . --write", + "format:check": "prettier . --check" }, "license": "Apache-2.0", "devDependencies": { From f228cb58cda9a27bb6f987d1a7731730568301f0 Mon Sep 17 00:00:00 2001 From: Greg Jopa <534034+gregjopa@users.noreply.github.com> Date: Wed, 7 May 2025 10:17:40 -0500 Subject: [PATCH 10/21] sneaking node_modules --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ce0fd38..df9cb22 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,7 +25,7 @@ jobs: - name: ๐ฅ Download deps run: > - find . -name package.json -maxdepth 6 -type f | while read -r file; do + find . -name package.json -maxdepth 10 -type f -not -path "*/node_modules/*" | while read -r file; do directory=$(dirname "$file") echo "\"package.json directory: $directory\"" cd "$directory" && npm install && cd - @@ -33,7 +33,7 @@ jobs: - name: ๐งน Check code formatting with Prettier run: > - find . -name package.json -maxdepth 6 -type f | while read -r file; do + find . -name package.json -maxdepth 10 -type f -not -path "*/node_modules/*" | while read -r file; do directory=$(dirname "$file") echo "\"package.json directory: $directory\"" cd "$directory" && npm run format:check && cd - @@ -41,7 +41,7 @@ jobs: - name: ๐ Lint code with ESLint run: > - find . -name package.json -maxdepth 6 -type f | while read -r file; do + find . -name package.json -maxdepth 10 -type f -not -path "*/node_modules/*" | while read -r file; do directory=$(dirname "$file") echo "\"package.json directory: $directory\"" cd "$directory" && npm run lint && cd - From 514e5e880fe501753a9b875e1ffcfe418b149982 Mon Sep 17 00:00:00 2001 From: Greg Jopa <534034+gregjopa@users.noreply.github.com> Date: Wed, 7 May 2025 10:23:50 -0500 Subject: [PATCH 11/21] fix: format code --- client/savePayment/html/src/index.html | 30 ++++++------ .../html/src/recommended/index.html | 46 ++++++++++--------- 2 files changed, 39 insertions(+), 37 deletions(-) diff --git a/client/savePayment/html/src/index.html b/client/savePayment/html/src/index.html index ed3f674..0a28e4d 100644 --- a/client/savePayment/html/src/index.html +++ b/client/savePayment/html/src/index.html @@ -1,20 +1,20 @@ +
+ +