From 536d3ee70d83a970a48530d1c49b1d33384a4bae Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Sun, 2 Mar 2025 17:57:52 +0100 Subject: [PATCH] feat(formatting): add prettier --- .github/dependabot.yml | 2 +- .github/stale.yml | 2 +- .github/workflows/continuous-integration.yml | 34 ++--- .gitignore | 1 + .prettierignore | 0 .prettierrc | 3 + Makefile | 10 ++ README.md | 2 +- SECURITY.md | 30 ++--- package-lock.json | 129 +++++++++++++++++++ package.json | 6 + 11 files changed, 184 insertions(+), 35 deletions(-) create mode 100644 .prettierignore create mode 100644 .prettierrc create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3bad94f9..6fddca0d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,4 +4,4 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "weekly" \ No newline at end of file + interval: "weekly" diff --git a/.github/stale.yml b/.github/stale.yml index 8cdadff1..fa039851 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -15,4 +15,4 @@ markComment: > recent activity. It will be closed if no further activity occurs. Thank you for your contributions. # Comment to post when closing a stale issue. Set to `false` to disable -closeComment: false \ No newline at end of file +closeComment: false diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index bc2d55fa..75980b6b 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -64,7 +64,7 @@ jobs: snapshot_amd64: if: github.event_name == 'pull_request' needs: - - tests + - tests name: Snapshot linux/amd64 runs-on: ubuntu-latest outputs: @@ -73,7 +73,7 @@ jobs: steps: - name: Checkout source code uses: actions/checkout@v4 - + - name: Build and push id: build_push uses: ./.github/actions/build-push @@ -87,7 +87,7 @@ jobs: snapshot_386: if: github.event_name == 'pull_request' needs: - - tests + - tests name: Snapshot linux/386 runs-on: ubuntu-latest outputs: @@ -96,7 +96,7 @@ jobs: steps: - name: Checkout source code uses: actions/checkout@v4 - + - name: Build and push id: build_push uses: ./.github/actions/build-push @@ -110,7 +110,7 @@ jobs: snapshot_arm64: if: github.event_name == 'pull_request' needs: - - tests + - tests name: Snapshot linux/arm64 runs-on: ubuntu-24.04-arm outputs: @@ -119,7 +119,7 @@ jobs: steps: - name: Checkout source code uses: actions/checkout@v4 - + - name: Build and push id: build_push uses: ./.github/actions/build-push @@ -133,7 +133,7 @@ jobs: snapshot_arm_v7: if: github.event_name == 'pull_request' needs: - - tests + - tests name: Snapshot linux/arm/v7 runs-on: ubuntu-24.04-arm outputs: @@ -142,7 +142,7 @@ jobs: steps: - name: Checkout source code uses: actions/checkout@v4 - + - name: Build and push id: build_push uses: ./.github/actions/build-push @@ -164,7 +164,7 @@ jobs: steps: - name: Checkout source code uses: actions/checkout@v4 - + - name: Merge uses: ./.github/actions/merge with: @@ -182,7 +182,7 @@ jobs: edge_amd64: if: github.event_name == 'push' && github.ref == 'refs/heads/main' needs: - - tests + - tests name: Edge linux/amd64 runs-on: ubuntu-latest outputs: @@ -191,7 +191,7 @@ jobs: steps: - name: Checkout source code uses: actions/checkout@v4 - + - name: Build and push id: build_push uses: ./.github/actions/build-push @@ -213,7 +213,7 @@ jobs: steps: - name: Checkout source code uses: actions/checkout@v4 - + - name: Build and push id: build_push uses: ./.github/actions/build-push @@ -226,7 +226,7 @@ jobs: edge_arm64: if: github.event_name == 'push' && github.ref == 'refs/heads/main' needs: - - tests + - tests name: Edge linux/arm64 runs-on: ubuntu-24.04-arm outputs: @@ -235,7 +235,7 @@ jobs: steps: - name: Checkout source code uses: actions/checkout@v4 - + - name: Build and push id: build_push uses: ./.github/actions/build-push @@ -248,7 +248,7 @@ jobs: edge_arm_v7: if: github.event_name == 'push' && github.ref == 'refs/heads/main' needs: - - tests + - tests name: Edge linux/arm/v7 runs-on: ubuntu-24.04-arm outputs: @@ -257,7 +257,7 @@ jobs: steps: - name: Checkout source code uses: actions/checkout@v4 - + - name: Build and push id: build_push uses: ./.github/actions/build-push @@ -278,7 +278,7 @@ jobs: steps: - name: Checkout source code uses: actions/checkout@v4 - + - name: Merge uses: ./.github/actions/merge with: diff --git a/.gitignore b/.gitignore index 8c9b840c..219dc66f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .idea .vscode .DS_Store +/node_modules/ diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..e69de29b diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..8046bd73 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,3 @@ +{ + "plugins": ["prettier-plugin-gherkin"] +} diff --git a/Makefile b/Makefile index 334d1ad0..9906a508 100644 --- a/Makefile +++ b/Makefile @@ -183,12 +183,22 @@ tests-once: ## Run the tests once (prefer the "tests" command while developing) $(DOCKER_REGISTRY)/$(DOCKER_REPOSITORY):$(GOTENBERG_VERSION)-tests \ gotest +.PHONY: tests-integration +tests-integration: ## Run integration tests + go test -tags=integration -v github.com/gotenberg/gotenberg/v8/test/integration + +.PHONY: lint +lint: ## Lint the code. + #golangci-lint run + npx prettier --check . + # go install mvdan.cc/gofumpt@latest # go install github.com/daixiang0/gci@latest .PHONY: fmt fmt: ## Format the code and "optimize" the dependencies gofumpt -l -w . gci write -s standard -s default -s "prefix(github.com/gotenberg/gotenberg/v8)" --skip-generated --skip-vendor --custom-order . + npx prettier --write . go mod tidy # go install golang.org/x/tools/cmd/godoc@latest diff --git a/README.md b/README.md index 7b29f535..2ae1eb06 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ --- -**Gotenberg** provides a developer-friendly API to interact with powerful tools like Chromium and LibreOffice for converting +**Gotenberg** provides a developer-friendly API to interact with powerful tools like Chromium and LibreOffice for converting numerous document formats (HTML, Markdown, Word, Excel, etc.) into PDF files, and more! ## Quick Start diff --git a/SECURITY.md b/SECURITY.md index 43b1ab4f..d624b849 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,25 +2,25 @@ ## Supported Versions -Please ensure to keep your environment up-to-date and use only the latest version of Gotenberg. +Please ensure to keep your environment up-to-date and use only the latest version of Gotenberg. Security updates and patches will be applied only to the most recent version. ## Reporting a Vulnerability -Your help in identifying vulnerabilities in our project is much appreciated. +Your help in identifying vulnerabilities in our project is much appreciated. We take all reports regarding security seriously. -If you discover a security vulnerability, please refrain from publishing it publicly. -Instead, kindly send us the details via email to *neuhart [dot] julien [at] gmail [dot] com*. +If you discover a security vulnerability, please refrain from publishing it publicly. +Instead, kindly send us the details via email to _neuhart [dot] julien [at] gmail [dot] com_. -In the subject of your email, please indicate that it's a security vulnerability report for Gotenberg. +In the subject of your email, please indicate that it's a security vulnerability report for Gotenberg. In your message, please include: -* A detailed description of the vulnerability. -* The steps to reproduce the issue. -* Any potential impact of the vulnerability on the users or system. +- A detailed description of the vulnerability. +- The steps to reproduce the issue. +- Any potential impact of the vulnerability on the users or system. -Please remember that this process is done in a *'best-effort'* manner. +Please remember that this process is done in a _'best-effort'_ manner. This means we strive to respond and act as quickly as possible, but the speed may vary depending on the severity of the issue and our resources. @@ -28,14 +28,14 @@ Thank you in advance for helping to keep our project safe! ## Disclosure Policy -Once we have received your vulnerability report, we will work to validate and reproduce the issue. +Once we have received your vulnerability report, we will work to validate and reproduce the issue. If we can confirm the vulnerability, we will proceed to: -* Work on a fix and a release timeline. -* Notify you when the fix has been implemented and released. -* Credit you for discovering the vulnerability (unless you request anonymity). -* Please note that we will do our best to keep you informed about the progress towards resolving the issue. +- Work on a fix and a release timeline. +- Notify you when the fix has been implemented and released. +- Credit you for discovering the vulnerability (unless you request anonymity). +- Please note that we will do our best to keep you informed about the progress towards resolving the issue. ## Comments on this Policy -If you have suggestions on how this process could be improved, please submit a pull request. \ No newline at end of file +If you have suggestions on how this process could be improved, please submit a pull request. diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..52398fe4 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,129 @@ +{ + "name": "gotenberg", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "devDependencies": { + "prettier": "3.5.2", + "prettier-plugin-gherkin": "^3.1.1" + } + }, + "node_modules/@cucumber/gherkin": { + "version": "27.0.0", + "resolved": "https://registry.npmjs.org/@cucumber/gherkin/-/gherkin-27.0.0.tgz", + "integrity": "sha512-j5rCsjqzRiC3iVTier3sa0kzyNbkcAmF7xr7jKnyO7qDeK3Z8Ye1P3KSVpeQRMY+KCDJ3WbTDdyxH0FwfA/fIw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cucumber/messages": ">=19.1.4 <=22" + } + }, + "node_modules/@cucumber/gherkin/node_modules/@cucumber/messages": { + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/@cucumber/messages/-/messages-22.0.0.tgz", + "integrity": "sha512-EuaUtYte9ilkxcKmfqGF9pJsHRUU0jwie5ukuZ/1NPTuHS1LxHPsGEODK17RPRbZHOFhqybNzG2rHAwThxEymg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/uuid": "9.0.1", + "class-transformer": "0.5.1", + "reflect-metadata": "0.1.13", + "uuid": "9.0.0" + } + }, + "node_modules/@cucumber/gherkin/node_modules/@types/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-rFT3ak0/2trgvp4yYZo5iKFEPsET7vKydKF+VRCxlQ9bpheehyAJH89dAkaLEq/j/RZXJIqcgsmPJKUP1Z28HA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@cucumber/gherkin/node_modules/uuid": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", + "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", + "dev": true, + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/@cucumber/messages": { + "version": "23.0.0", + "resolved": "https://registry.npmjs.org/@cucumber/messages/-/messages-23.0.0.tgz", + "integrity": "sha512-2ZWKNnikNMBnle3P3cgy+fgzhABrY4oBbiWp9wcI8ANdT4LlYRN6jQ6j/9CQGTDGRfkyRtr/5VkYq7q24XCsuA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/uuid": "9.0.6", + "class-transformer": "0.5.1", + "reflect-metadata": "0.1.13", + "uuid": "9.0.1" + } + }, + "node_modules/@types/uuid": { + "version": "9.0.6", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.6.tgz", + "integrity": "sha512-BT2Krtx4xaO6iwzwMFUYvWBWkV2pr37zD68Vmp1CDV196MzczBRxuEpD6Pr395HAgebC/co7hOphs53r8V7jew==", + "dev": true, + "license": "MIT" + }, + "node_modules/class-transformer": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/class-transformer/-/class-transformer-0.5.1.tgz", + "integrity": "sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw==", + "dev": true, + "license": "MIT" + }, + "node_modules/prettier": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.2.tgz", + "integrity": "sha512-lc6npv5PH7hVqozBR7lkBNOGXV9vMwROAPlumdBkX0wTbbzPu/U1hk5yL8p2pt4Xoc+2mkT8t/sow2YrV/M5qg==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-plugin-gherkin": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/prettier-plugin-gherkin/-/prettier-plugin-gherkin-3.1.1.tgz", + "integrity": "sha512-cCfjqKMdR2a8jOf8yKg32iUfRq0Dfmx+K2qTMOD/ixJJq0Rp7QS8BaoABWC7CDGXbvOkVeWOvzhxWvYcEbjglw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cucumber/gherkin": "^27.0.0", + "@cucumber/messages": "^23.0.0", + "prettier": "^3.0.0" + } + }, + "node_modules/reflect-metadata": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", + "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "dev": true, + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..69805b72 --- /dev/null +++ b/package.json @@ -0,0 +1,6 @@ +{ + "devDependencies": { + "prettier": "3.5.2", + "prettier-plugin-gherkin": "^3.1.1" + } +}