From a9777de405469502fcc7bdb26dc87b770a527b74 Mon Sep 17 00:00:00 2001 From: Jinhyung Lee Date: Mon, 5 Aug 2024 15:47:15 +0900 Subject: [PATCH 1/9] Update image-legacy.mdx --- pages/docs/pages/api-reference/components/image-legacy.mdx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pages/docs/pages/api-reference/components/image-legacy.mdx b/pages/docs/pages/api-reference/components/image-legacy.mdx index 8337612..1576fc8 100644 --- a/pages/docs/pages/api-reference/components/image-legacy.mdx +++ b/pages/docs/pages/api-reference/components/image-legacy.mdx @@ -7,6 +7,9 @@ description: Backwards compatible Image Optimization with the Legacy Image compo # `` (Legacy) + + +
Examples From 99755a34835bf2d2e06ef3e67a1e5b356261f32e Mon Sep 17 00:00:00 2001 From: Jinhyung Lee Date: Mon, 5 Aug 2024 15:57:07 +0900 Subject: [PATCH 2/9] Update prettier-check.yml --- .github/workflows/prettier-check.yml | 44 +++++++++++++++++++++------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/.github/workflows/prettier-check.yml b/.github/workflows/prettier-check.yml index 2105694..6ba5ccf 100644 --- a/.github/workflows/prettier-check.yml +++ b/.github/workflows/prettier-check.yml @@ -14,18 +14,40 @@ jobs: - name: Checkout Repository uses: actions/checkout@v2 + - name: Install Prettier + run: npm install --global prettier@latest + - name: Run Prettier id: prettier-run - uses: rutajdash/prettier-cli-action@v1.0.0 - with: - config_path: './.prettierrc' - file_pattern: '**/*' + run: | + npx prettier --check "**/*" --config ./.prettierrc --ignore-path ./.prettierignore || true - # This step only runs if prettier finds errors causing the previous step to fail - # This steps lists the files where errors were found - - name: Prettier Output - if: ${{ failure() }} - shell: bash + - name: Collect Prettier Output + id: prettier-output run: | - echo "The following files are not formatted:" - echo "${{steps.prettier-run.outputs.prettier_output}}" + echo "## Prettier Report" > prettier_report.md + echo "The following files are not formatted:" >> prettier_report.md + npx prettier --list-different "**/*" --config ./.prettierrc --ignore-path ./.prettierignore >> prettier_report.md + echo "" >> prettier_report.md + echo "Detailed formatting differences:" >> prettier_report.md + for file in $(npx prettier --list-different "**/*" --config ./.prettierrc --ignore-path ./.prettierignore); do + echo "Differences in $file:" >> prettier_report.md + npx prettier --write "$file" --config ./.prettierrc --ignore-path ./.prettierignore --loglevel debug >> prettier_report.md + echo "" >> prettier_report.md + done + continue-on-error: true + + - name: Create Pull Request Comment + if: ${{ failure() }} + uses: actions/github-script@v6 + with: + script: | + const fs = require('fs'); + const prettierReport = fs.readFileSync('prettier_report.md', 'utf8'); + const { context } = require('@actions/github'); + + github.rest.issues.createComment({ + ...context.repo, + issue_number: context.issue.number, + body: prettierReport + }); From ae646da3de46c3300e4ac5f001943bb2a21867db Mon Sep 17 00:00:00 2001 From: Jinhyung Lee Date: Mon, 5 Aug 2024 16:00:09 +0900 Subject: [PATCH 3/9] Update prettier-check.yml --- .github/workflows/prettier-check.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/prettier-check.yml b/.github/workflows/prettier-check.yml index 6ba5ccf..97ed927 100644 --- a/.github/workflows/prettier-check.yml +++ b/.github/workflows/prettier-check.yml @@ -20,17 +20,17 @@ jobs: - name: Run Prettier id: prettier-run run: | - npx prettier --check "**/*" --config ./.prettierrc --ignore-path ./.prettierignore || true + npx prettier --check "**/*.{js,jsx,ts,tsx,css,scss,mdx}" --config ./.prettierrc --ignore-path ./.prettierignore || true - name: Collect Prettier Output id: prettier-output run: | echo "## Prettier Report" > prettier_report.md echo "The following files are not formatted:" >> prettier_report.md - npx prettier --list-different "**/*" --config ./.prettierrc --ignore-path ./.prettierignore >> prettier_report.md + npx prettier --list-different "**/*.{js,jsx,ts,tsx,css,scss,mdx}" --config ./.prettierrc --ignore-path ./.prettierignore >> prettier_report.md echo "" >> prettier_report.md echo "Detailed formatting differences:" >> prettier_report.md - for file in $(npx prettier --list-different "**/*" --config ./.prettierrc --ignore-path ./.prettierignore); do + for file in $(npx prettier --list-different "**/*.{js,jsx,ts,tsx,css,scss,mdx}" --config ./.prettierrc --ignore-path ./.prettierignore); do echo "Differences in $file:" >> prettier_report.md npx prettier --write "$file" --config ./.prettierrc --ignore-path ./.prettierignore --loglevel debug >> prettier_report.md echo "" >> prettier_report.md From 37739a0e29a4b1907aa2be79bd05bcb0de8e76f7 Mon Sep 17 00:00:00 2001 From: Jinhyung Lee Date: Mon, 5 Aug 2024 16:02:17 +0900 Subject: [PATCH 4/9] Update prettier-check.yml [skip ci] --- .github/workflows/prettier-check.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/prettier-check.yml b/.github/workflows/prettier-check.yml index 97ed927..d789c4f 100644 --- a/.github/workflows/prettier-check.yml +++ b/.github/workflows/prettier-check.yml @@ -17,8 +17,8 @@ jobs: - name: Install Prettier run: npm install --global prettier@latest - - name: Run Prettier - id: prettier-run + - name: Run Prettier Check + id: prettier-check run: | npx prettier --check "**/*.{js,jsx,ts,tsx,css,scss,mdx}" --config ./.prettierrc --ignore-path ./.prettierignore || true @@ -32,7 +32,7 @@ jobs: echo "Detailed formatting differences:" >> prettier_report.md for file in $(npx prettier --list-different "**/*.{js,jsx,ts,tsx,css,scss,mdx}" --config ./.prettierrc --ignore-path ./.prettierignore); do echo "Differences in $file:" >> prettier_report.md - npx prettier --write "$file" --config ./.prettierrc --ignore-path ./.prettierignore --loglevel debug >> prettier_report.md + git diff --color=always --word-diff "$file" >> prettier_report.md echo "" >> prettier_report.md done continue-on-error: true From 241d80da07f1895a0f7af7aea05363feb5eeff28 Mon Sep 17 00:00:00 2001 From: Jinhyung Lee Date: Mon, 5 Aug 2024 16:07:51 +0900 Subject: [PATCH 5/9] Update image-legacy.mdx --- pages/docs/pages/api-reference/components/image-legacy.mdx | 1 - 1 file changed, 1 deletion(-) diff --git a/pages/docs/pages/api-reference/components/image-legacy.mdx b/pages/docs/pages/api-reference/components/image-legacy.mdx index 1576fc8..05394fc 100644 --- a/pages/docs/pages/api-reference/components/image-legacy.mdx +++ b/pages/docs/pages/api-reference/components/image-legacy.mdx @@ -9,7 +9,6 @@ description: Backwards compatible Image Optimization with the Legacy Image compo -
Examples From 0f8c9aa51526c6a1494259321756cceaa710e510 Mon Sep 17 00:00:00 2001 From: Jinhyung Lee Date: Mon, 5 Aug 2024 16:09:57 +0900 Subject: [PATCH 6/9] Update prettier-check.yml --- .github/workflows/prettier-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prettier-check.yml b/.github/workflows/prettier-check.yml index d789c4f..82424ef 100644 --- a/.github/workflows/prettier-check.yml +++ b/.github/workflows/prettier-check.yml @@ -32,7 +32,7 @@ jobs: echo "Detailed formatting differences:" >> prettier_report.md for file in $(npx prettier --list-different "**/*.{js,jsx,ts,tsx,css,scss,mdx}" --config ./.prettierrc --ignore-path ./.prettierignore); do echo "Differences in $file:" >> prettier_report.md - git diff --color=always --word-diff "$file" >> prettier_report.md + npx prettier --write "$file" --config ./.prettierrc --ignore-path ./.prettierignore --loglevel debug || true echo "" >> prettier_report.md done continue-on-error: true From 56801428051bfcc88d675e0c973cdd665e349788 Mon Sep 17 00:00:00 2001 From: Jinhyung Lee Date: Mon, 5 Aug 2024 16:14:28 +0900 Subject: [PATCH 7/9] Update prettier-check.yml --- .github/workflows/prettier-check.yml | 35 +++++++++++++++++----------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/.github/workflows/prettier-check.yml b/.github/workflows/prettier-check.yml index 82424ef..4b9755f 100644 --- a/.github/workflows/prettier-check.yml +++ b/.github/workflows/prettier-check.yml @@ -1,6 +1,5 @@ name: Continuous Integration -# This action works with pull requests and pushes on the main branch on: pull_request: push: @@ -14,40 +13,50 @@ jobs: - name: Checkout Repository uses: actions/checkout@v2 + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '14' + - name: Install Prettier - run: npm install --global prettier@latest + run: npm install prettier@latest - name: Run Prettier Check id: prettier-check run: | - npx prettier --check "**/*.{js,jsx,ts,tsx,css,scss,mdx}" --config ./.prettierrc --ignore-path ./.prettierignore || true + npx prettier --check "**/*.{js,jsx,ts,tsx,css,scss,mdx}" --config ./.prettierrc --ignore-path ./.prettierignore + continue-on-error: true - name: Collect Prettier Output + if: steps.prettier-check.outcome == 'failure' id: prettier-output run: | echo "## Prettier Report" > prettier_report.md echo "The following files are not formatted:" >> prettier_report.md - npx prettier --list-different "**/*.{js,jsx,ts,tsx,css,scss,mdx}" --config ./.prettierrc --ignore-path ./.prettierignore >> prettier_report.md + npx prettier --list-different "**/*.{js,jsx,ts,tsx,css,scss,mdx}" --config ./.prettierrc --ignore-path ./.prettierignore >> prettier_report.md || true echo "" >> prettier_report.md echo "Detailed formatting differences:" >> prettier_report.md - for file in $(npx prettier --list-different "**/*.{js,jsx,ts,tsx,css,scss,mdx}" --config ./.prettierrc --ignore-path ./.prettierignore); do - echo "Differences in $file:" >> prettier_report.md - npx prettier --write "$file" --config ./.prettierrc --ignore-path ./.prettierignore --loglevel debug || true - echo "" >> prettier_report.md - done + while IFS= read -r file; do + if [ -n "$file" ]; then + echo "Differences in $file:" >> prettier_report.md + npx prettier "$file" --config ./.prettierrc --ignore-path ./.prettierignore > formatted_file.tmp 2>/dev/null || true + diff -u "$file" formatted_file.tmp >> prettier_report.md 2>/dev/null || true + echo "" >> prettier_report.md + fi + done < <(npx prettier --list-different "**/*.{js,jsx,ts,tsx,css,scss,mdx}" --config ./.prettierrc --ignore-path ./.prettierignore) continue-on-error: true - name: Create Pull Request Comment - if: ${{ failure() }} + if: steps.prettier-check.outcome == 'failure' && github.event_name == 'pull_request' uses: actions/github-script@v6 with: + github-token: ${{secrets.ACTION_PAT}} script: | const fs = require('fs'); const prettierReport = fs.readFileSync('prettier_report.md', 'utf8'); - const { context } = require('@actions/github'); - github.rest.issues.createComment({ - ...context.repo, issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, body: prettierReport }); From d2294f006cfb498022c87129b6765ea41a2f07d7 Mon Sep 17 00:00:00 2001 From: Jinhyung Lee Date: Mon, 5 Aug 2024 16:18:32 +0900 Subject: [PATCH 8/9] Update prettier-check.yml --- .github/workflows/prettier-check.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/prettier-check.yml b/.github/workflows/prettier-check.yml index 4b9755f..d5ca5fb 100644 --- a/.github/workflows/prettier-check.yml +++ b/.github/workflows/prettier-check.yml @@ -60,3 +60,9 @@ jobs: repo: context.repo.repo, body: prettierReport }); + + - name: Fail if Prettier found issues + if: steps.prettier-check.outcome == 'failure' + run: | + echo "Prettier found formatting issues. Please fix them and try again." + exit 1 From cd104dad8637a5521fac2cd291f966ab53681c96 Mon Sep 17 00:00:00 2001 From: Jinhyung Lee Date: Mon, 5 Aug 2024 16:23:53 +0900 Subject: [PATCH 9/9] =?UTF-8?q?[no-issue]=20docs:=20=EB=AC=B8=EC=84=9C=20?= =?UTF-8?q?=ED=8F=AC=EB=A7=A4=ED=8C=85=20=EC=9B=90=EB=B3=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 ++-- pages/docs/pages/api-reference/components/image-legacy.mdx | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 5175dbf..34663d8 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,8 @@ "build:local": "pnpm run generate-sitemap && next build", "start": "next start", "lint": "next lint --cache", - "format": "prettier --cache --check .", - "format:fix": "prettier --cache --write --log-level warn . --ignore-path .prettierignore", + "format": "prettier --cache --check \"**/*.{js,jsx,ts,tsx,css,scss,mdx}\"", + "format:fix": "prettier --cache --write --ignore-path .prettierignore \"**/*.{js,jsx,ts,tsx,css,scss,mdx}\"", "prepare": "husky", "lint-staged": "pnpm format:fix && pnpm lint", "generate-sitemap": "node scripts/generate-sitemap.mjs" diff --git a/pages/docs/pages/api-reference/components/image-legacy.mdx b/pages/docs/pages/api-reference/components/image-legacy.mdx index 05394fc..36b0854 100644 --- a/pages/docs/pages/api-reference/components/image-legacy.mdx +++ b/pages/docs/pages/api-reference/components/image-legacy.mdx @@ -5,9 +5,7 @@ description: Backwards compatible Image Optimization with the Legacy Image compo {/* TODO: 번역이 필요합니다. */} -# `` (Legacy) - - +`` (Legacy)
Examples