diff --git a/.gitattributes b/.gitattributes index 7eb5a835e..d65c6002c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,3 +4,4 @@ tests export-ignore docs export-ignore phpunit export-ignore phpunit.xml.dist export-ignore +utils export-ignore \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 713df545d..ca87e3533 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,3 +7,8 @@ updates: directory: "/" schedule: interval: "weekly" + - package-ecosystem: "npm" + directory: "/utils" + schedule: + interval: "daily" + versioning-strategy: increase \ No newline at end of file diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml new file mode 100644 index 000000000..759c3aa1f --- /dev/null +++ b/.github/workflows/dependabot.yml @@ -0,0 +1,33 @@ +name: Dependabot update UI files + +on: pull_request + +jobs: + dependabot: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./utils + + permissions: + contents: write + + if: github.event.pull_request.user.login == 'dependabot[bot]' + steps: + - name: "Checkout" + uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} + - uses: actions/setup-node@v4 + with: + node-version: '20.x' + - run: yarn install + - name: Swagger UI + run: yarn run swagger + - name: Redocly + run: yarn run redoc + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "[dependabot-skip] Update UI files" + branch: ${{ github.head_ref }} \ No newline at end of file diff --git a/update-js.sh b/update-js.sh deleted file mode 100755 index 2fb371a99..000000000 --- a/update-js.sh +++ /dev/null @@ -1,24 +0,0 @@ -# This file is part of the API Platform project. -# -# (c) Kévin Dunglas -# -# For the full copyright and license information, please view the LICENSE -# file that was distributed with this source code. - -#!/bin/sh - -dest=public/swagger-ui/ - -yarn add --production --no-lockfile swagger-ui-dist -if [ -d $dest ]; then - rm -Rf $dest -fi -mkdir -p $dest - -cp node_modules/swagger-ui-dist/swagger-ui-bundle.js $dest -cp node_modules/swagger-ui-dist/swagger-ui-bundle.js.map $dest -cp node_modules/swagger-ui-dist/swagger-ui-standalone-preset.js $dest -cp node_modules/swagger-ui-dist/swagger-ui-standalone-preset.js.map $dest -cp node_modules/swagger-ui-dist/swagger-ui.css $dest -cp node_modules/swagger-ui-dist/swagger-ui.css.map $dest -rm -Rf package.json node_modules/ diff --git a/utils/.gitignore b/utils/.gitignore new file mode 100644 index 000000000..97008e5b8 --- /dev/null +++ b/utils/.gitignore @@ -0,0 +1,2 @@ +node_modules +yarn.lock \ No newline at end of file diff --git a/utils/package.json b/utils/package.json new file mode 100644 index 000000000..e097e8c9c --- /dev/null +++ b/utils/package.json @@ -0,0 +1,21 @@ +{ + "description": "Script utils for nelmio/api-doc-bundle UI", + "license": "MIT", + "dependencies": { + "redoc": "2.0.0", + "swagger-ui-dist": "5.18.1" + }, + "scripts": { + "swagger": "yarn run swagger:bundle && yarn run swagger:standalone && yarn run swagger:css", + "swagger:bundle": "cp node_modules/swagger-ui-dist/swagger-ui-bundle.js* $npm_package_config_destination_swagger", + "swagger:standalone": "cp node_modules/swagger-ui-dist/swagger-ui-standalone-preset.js* $npm_package_config_destinationswagger", + "swagger:css": "cp node_modules/swagger-ui-dist/swagger-ui.css* $npm_package_config_destination_swagger", + "redoc": "cp node_modules/redoc/bundles/redoc.standalone.js $npm_package_config_destination_redoc" + }, + "config": { + "destination": { + "swagger": "../public/swagger-ui", + "redoc": "../public/redocly" + } + } +}