From 4692ea95d7aeaed2df74348402bfeb2065bfbf17 Mon Sep 17 00:00:00 2001 From: Kevin Batdorf Date: Sun, 28 Jul 2024 22:35:22 +0700 Subject: [PATCH 1/3] Update packages --- .distignore | 5 +- .editorconfig | 17 - .eslintignore | 2 - .eslintrc | 58 - .github/dependabot.yml | 2 +- .github/workflows/build-production-zip.yml | 102 +- .github/workflows/cypress-main.yml | 16 +- .github/workflows/cypress-push.yml | 14 +- .github/workflows/release-to-wp-org.yml | 2 +- .github/workflows/update-wordpress-readme.yml | 2 +- .prettierignore | 5 - .prettierrc.js | 17 - Cargo.lock | 67 +- Cargo.toml | 4 +- README.md | 44 - biome.json | 16 + cypress/constants.js | 4 +- cypress/e2e/sanity-checks.cy.js | 8 +- cypress/fixtures/example.json | 5 - cypress/plugins/index.js | 3 - cypress/support/commands.js | 58 +- cypress/support/e2e.js | 6 +- cypress/support/gutenberg.js | 61 +- cypress/support/helpers.js | 6 +- cypress/support/login-logout.js | 12 +- cypress/support/navigate-pages.js | 16 +- cypress/support/plugins.js | 12 +- cypress/support/wp-cli.js | 2 +- package-lock.json | 24250 ++++++++++------ package.json | 48 +- rust-starter.php | 4 +- scripts/eject.mjs | 75 - scripts/rename.mjs | 16 +- scripts/utils.mjs | 16 - src/editor/Controls.tsx | 26 +- src/front/TheBlock.tsx | 4 +- src/front/style.css | 11 +- src/hooks/useServer.ts | 4 +- src/index.tsx | 20 +- 39 files changed, 15318 insertions(+), 9722 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintignore delete mode 100644 .eslintrc delete mode 100644 .prettierignore delete mode 100644 .prettierrc.js create mode 100644 biome.json delete mode 100644 cypress/fixtures/example.json delete mode 100644 cypress/plugins/index.js delete mode 100644 scripts/eject.mjs delete mode 100644 scripts/utils.mjs diff --git a/.distignore b/.distignore index 1350436..e476c52 100644 --- a/.distignore +++ b/.distignore @@ -1,8 +1,9 @@ -/.wordpress-org /.git /.github +/.wordpress-org +/.vscode +/cypress /node_modules -/assets /scripts /package-lock.json /target diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 83eddb4..0000000 --- a/.editorconfig +++ /dev/null @@ -1,17 +0,0 @@ -root = true - -[*] -charset = utf-8 -end_of_line = lf -insert_final_newline = true -indent_style = tab -indent_size = 4 -tabSize = 4 -trim_trailing_whitespace = true - -[*.yml] -indent_style = space -indent_size = 2 - -[*.md] -trim_trailing_whitespace = false diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 3675648..0000000 --- a/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/* -build/* diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index aac3f54..0000000 --- a/.eslintrc +++ /dev/null @@ -1,58 +0,0 @@ -{ - "env": { - "browser": true, - "es2021": true, - "jest": true, - "node": true - }, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended", - "plugin:react/recommended", - "plugin:react-hooks/recommended", - "plugin:jsx-a11y/recommended", - "plugin:cypress/recommended", - "prettier" - ], - "parserOptions": { - "ecmaFeatures": { "jsx": true }, - "sourceType": "module", - "allowImportExportEverywhere": true - }, - "ignorePatterns": ["node_modules/", "pkg/", "build/"], - "parser": "@typescript-eslint/parser", - "plugins": [], - "rules": { - "require-await": "error", - "quotes": ["error", "single", { "avoidEscape": true }], - "comma-dangle": ["error", "always-multiline"], - "array-element-newline": ["error", "consistent"], - "no-constant-condition": ["error", { "checkLoops": true }], - "no-multi-spaces": ["error"], - "semi": ["error", "always"], - "space-in-parens": ["error", "never"], - "key-spacing": ["error", { "afterColon": true }], - "space-infix-ops": ["error"], - "space-before-function-paren": [ - "error", - { - "anonymous": "always", - "named": "never", - "asyncArrow": "always" - } - ], - "react/react-in-jsx-scope": "off", - "quote-props": ["error", "as-needed"], - "no-multiple-empty-lines": ["error", { "max": 1 }], - "@typescript-eslint/no-var-requires": "off", - "lines-around-comment": [ - "error", - { - "beforeBlockComment": true, - "allowBlockStart": true - } - ] - }, - "settings": { "react": { "version": "detect" } } -} diff --git a/.github/dependabot.yml b/.github/dependabot.yml index bc6e58a..cdb240e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -2,7 +2,7 @@ version: 2 updates: - package-ecosystem: 'npm' directory: '/' - schedule: + schedule: interval: 'monthly' - package-ecosystem: 'cargo' diff --git a/.github/workflows/build-production-zip.yml b/.github/workflows/build-production-zip.yml index d93d64a..a7d9b67 100644 --- a/.github/workflows/build-production-zip.yml +++ b/.github/workflows/build-production-zip.yml @@ -1,40 +1,64 @@ -name: Build production zip file -on: push +name: Build and Package +on: + push: + workflow_dispatch: + schedule: + - cron: "0 6 * * *" + +permissions: + contents: write + actions: read + jobs: - build: - name: Build zip file - concurrency: - group: production - ${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v3 - - - name: Install wasm-pack - uses: jetli/wasm-pack-action@v0.4.0 - - name: npm install and build - run: | - npm ci - npm run build - env: - CI: true - - - name: Package - uses: actions/upload-artifact@v3 - with: - name: rust-starter - retention-days: 5 - path: | - ${{ github.workspace }}/ - !${{ github.workspace }}/node_modules/ - !${{ github.workspace }}/cypress/ - !${{ github.workspace }}/target/ - !${{ github.workspace }}/scripts/ - !${{ github.workspace }}/.git/ - !${{ github.workspace }}/.github/ - !${{ github.workspace }}/.wordpress-org/ - !${{ github.workspace }}/assets/ - !${{ github.workspace }}/scripts/ - !${{ github.workspace }}/package-lock.json - !${{ github.workspace }}/Cargo.lock + build: + name: Build and Package + concurrency: + group: production-${{ github.ref }} + cancel-in-progress: true + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Install wasm-pack + uses: jetli/wasm-pack-action@v0.4.0 + + - name: npm install and build + run: | + npm ci + npm run build + env: + CI: true + + - name: Read .distignore + id: read_distignore + run: | + content=$(cat .distignore | sed 's/^/!/') + echo "patterns<> $GITHUB_OUTPUT + echo "$content" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + shell: bash + + - name: Package + uses: actions/upload-artifact@v4 + with: + name: rust-starter + retention-days: 5 + if-no-files-found: error + path: | + ${{ github.workspace }} + ${{ steps.read_distignore.outputs.patterns }} + + - name: Update README + if: github.ref == 'refs/heads/main' + run: | + artifact_url="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + sed -i '/\[Latest Build\]/d' README.md + echo -e "\n[Latest Build]($artifact_url)" >> README.md + + - name: Commit changes + if: github.ref == 'refs/heads/main' + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: Update README with latest build link + file_pattern: 'README.md' diff --git a/.github/workflows/cypress-main.yml b/.github/workflows/cypress-main.yml index 0f249f4..2cd1a6e 100644 --- a/.github/workflows/cypress-main.yml +++ b/.github/workflows/cypress-main.yml @@ -15,7 +15,7 @@ jobs: spec: ${{ steps.list_files.outputs.spec }} steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: List Files id: list_files run: | @@ -28,9 +28,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Cache node modules - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache-node-modules with: path: node_modules @@ -53,11 +53,11 @@ jobs: spec: ${{ fromJson(needs.generate_file_list.outputs.spec) }} steps: - name: Clone repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 - name: Node modules cache - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache-node-modules with: path: node_modules @@ -98,12 +98,12 @@ jobs: spec: cypress/e2e/${{ matrix.spec }}.cy.js env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: failure() with: name: cypress-screenshots path: cypress/screenshots - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: failure() with: name: cypress-videos diff --git a/.github/workflows/cypress-push.yml b/.github/workflows/cypress-push.yml index 742afed..ca0487e 100644 --- a/.github/workflows/cypress-push.yml +++ b/.github/workflows/cypress-push.yml @@ -12,7 +12,7 @@ jobs: spec: ${{ steps.files.outputs.spec }} steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Files id: files run: | @@ -24,9 +24,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Cache node modules - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache-node-modules with: path: node_modules @@ -48,9 +48,9 @@ jobs: spec: ${{ fromJson(needs.prepare_spec_files.outputs.spec) }} steps: - name: Clone repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Restore node modules cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: node_modules key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }} @@ -75,12 +75,12 @@ jobs: spec: cypress/e2e/${{ matrix.spec }}.cy.js env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: failure() with: name: cypress-screenshots path: cypress/screenshots - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: failure() with: name: cypress-videos diff --git a/.github/workflows/release-to-wp-org.yml b/.github/workflows/release-to-wp-org.yml index 2fddece..99ce9bf 100644 --- a/.github/workflows/release-to-wp-org.yml +++ b/.github/workflows/release-to-wp-org.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install wasm-pack uses: jetli/wasm-pack-action@v0.4.0 diff --git a/.github/workflows/update-wordpress-readme.yml b/.github/workflows/update-wordpress-readme.yml index dde9fee..966afd9 100644 --- a/.github/workflows/update-wordpress-readme.yml +++ b/.github/workflows/update-wordpress-readme.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install wasm-pack uses: jetli/wasm-pack-action@v0.4.0 diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 5a65e45..0000000 --- a/.prettierignore +++ /dev/null @@ -1,5 +0,0 @@ -target -node_modules -build -# false positive -.github/workflows/cypress-main.yml diff --git a/.prettierrc.js b/.prettierrc.js deleted file mode 100644 index a7cfb4a..0000000 --- a/.prettierrc.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = { - trailingComma: 'all', - tabWidth: 4, - useTabs: true, - semi: true, - singleQuote: true, - bracketSameLine: true, - importOrder: ['^@wordpress/(.*)$', '', '^[./]'], - overrides: [ - { - files: ['**/*.html'], - options: { - singleQuote: false, - }, - }, - ], -}; diff --git a/Cargo.lock b/Cargo.lock index 9784a82..2e90d00 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "bumpalo" -version = "3.12.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "cfg-if" @@ -16,9 +16,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "js-sys", @@ -29,33 +29,30 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.61" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] [[package]] name = "libc" -version = "0.2.141" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "log" -version = "0.4.17" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "once_cell" -version = "1.17.1" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "ppv-lite86" @@ -65,18 +62,18 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.56" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -123,9 +120,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.109" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", @@ -134,9 +131,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "wasi" @@ -146,9 +143,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.84" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -156,9 +153,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.84" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", @@ -171,9 +168,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.84" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -181,9 +178,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.84" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", @@ -194,15 +191,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.84" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "web-sys" -version = "0.3.61" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/Cargo.toml b/Cargo.toml index ba092a1..bec3e6f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,8 +10,8 @@ path = "./server/lib.rs" [dependencies] getrandom = { version = "0.2", features = ["js"] } rand = "0.8.5" -wasm-bindgen = "0.2.84" +wasm-bindgen = "0.2.92" [dependencies.web-sys] -version = "0.3.61" +version = "0.3.69" features = ["console"] diff --git a/README.md b/README.md index a6532db..c2c3978 100644 --- a/README.md +++ b/README.md @@ -11,47 +11,3 @@ This is a minimum block plugin template to rapidly get started building WP block - Run `npm run rename