Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: wpsocio/wp-projects
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: [email protected]
Choose a base ref
...
head repository: wpsocio/wp-projects
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
Showing 707 changed files with 48,812 additions and 32,753 deletions.
8 changes: 8 additions & 0 deletions .changeset/flat-pugs-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"wptelegram-comments": patch
"wptelegram-widget": patch
"wptelegram-login": patch
"wptelegram": patch
---

Fixed the i18n initialization to delay it to init
5 changes: 5 additions & 0 deletions .changeset/tame-feet-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wpsocio/wp-utils": patch
---

Updated the default requirements to PHP 7.4 and WP 6.0
9 changes: 9 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!--- Some description here -->

### Remote Refs

<!--- REMOTE REFS START -->

premium: main

<!--- REMOTE REFS END -->
8 changes: 4 additions & 4 deletions actions/setup/action.yml → .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -12,11 +12,11 @@ inputs:

php-version:
description: "The version of PHP to use."
default: "8"
default: "8.3"

pnpm-version:
description: "The version of pnpm to use."
default: "latest"
default: ""

lockfile:
description: "The lockfile to use."
@@ -34,7 +34,7 @@ runs:
with:
node-version: ${{ inputs.node-version }}

- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4
with:
version: ${{ inputs.pnpm-version }}
run_install: false
@@ -55,7 +55,7 @@ runs:
- name: Wireit cache
if: ${{ inputs.enable-wireit-cache == 'true' }}
uses: google/wireit@setup-github-actions-caching/v1
uses: google/wireit@setup-github-actions-caching/v2

- name: Install dependencies
shell: bash
53 changes: 53 additions & 0 deletions .github/actions/upstream-refs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: "Read the refs/branches to use for checking out upstream repos"
description: "Reads and outputs the refs/branches from PR description to use for checking out upstream repos."
author: "wpsocio"

outputs:
result:
description: "Refs JSON"
value: ${{ steps.details.outputs.result }}

runs:
using: "composite"
steps:
- name: Get details
uses: actions/github-script@v7
id: details
with:
script: |
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
});
/**
* The comment has to be in this format
*
* <!--- REMOTE REFS START -->
* some/project/path: add/some-feature
* some/other/project/path: fix/some-bug
* <!--- REMOTE REFS END -->
*/
const refsCommentRegex =
/<!--- REMOTE REFS START -->(?<content>.+)<!--- REMOTE REFS END -->/is;
const result = (pr.data.body || '').match(refsCommentRegex);
if (!result?.groups?.content) {
return {};
}
const refs = result.groups.content
.trim()
.split(/[\n\r]+/)
.filter((line) => line.trim())
.reduce((list, line) => {
const [name, ref] = line.split(/:\s?/);
list[name.trim()] = ref.trim();
return list;
}, {});
return refs;
2 changes: 1 addition & 1 deletion .github/workflows/deploy-php-package.yml
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ jobs:
token: ${{ secrets.ACCESS_TOKEN_IR }}

- name: Setup Environment
uses: ./actions/setup
uses: ./.github/actions/setup

- name: Prepare
run: |
7 changes: 5 additions & 2 deletions .github/workflows/deploy-wp-project.yml
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ jobs:
token: ${{ secrets.ACCESS_TOKEN_IR }}

- name: Setup Environment
uses: ./actions/setup
uses: ./.github/actions/setup
with:
enable-wireit-cache: true

@@ -38,6 +38,9 @@ jobs:
files: "dist/${{ fromJson(needs.details.outputs.result).relativeDir }}-${{ fromJson(needs.details.outputs.result).version }}.zip"
repo-token: ${{ secrets.ACCESS_TOKEN_IR }}

- name: Install svn
run: sudo apt-get install subversion

- name: Deploy to WordPress.org
id: deploy
uses: 10up/action-wordpress-plugin-deploy@stable
@@ -78,7 +81,7 @@ jobs:
token: ${{ secrets.ACCESS_TOKEN_IR }}

- name: Setup Environment
uses: ./actions/setup
uses: ./.github/actions/setup
with:
enable-wireit-cache: true

104 changes: 91 additions & 13 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
@@ -4,34 +4,35 @@ on:
pull_request:
types: [opened, synchronize]

env:
PREMIUM_REPO_REF: main

jobs:
php-lint-test:
name: "PHP: Lint, Test"
name: "PHP ${{ matrix.php }}: Lint, Test"
if: github.repository == 'wpsocio/wp-projects'
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
matrix:
php: ["7.4", "8.0", "8.1", "8.2", "8.3"]
php: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
steps:
- name: Checkout this repo
uses: actions/checkout@v4
with:
token: ${{ secrets.ACCESS_TOKEN_IR }}

- name: Remote refs
uses: ./.github/actions/upstream-refs
id: remote-refs

- name: Checkout premium projects repo
uses: actions/checkout@v4
with:
path: premium
token: ${{ secrets.ACCESS_TOKEN_IR }}
repository: ${{ secrets.PREMIUM_PROJECTS_REPO }}
ref: ${{ env.PREMIUM_REPO_REF }}
ref: ${{ fromJSON(steps.remote-refs.outputs.result).premium || 'main' }}

- name: Setup Environment
uses: ./actions/setup
uses: ./.github/actions/setup
with:
php-version: ${{ matrix.php }}
enable-wireit-cache: true
@@ -72,27 +73,104 @@ jobs:
with:
token: ${{ secrets.ACCESS_TOKEN_IR }}

- name: Remote refs
uses: ./.github/actions/upstream-refs
id: remote-refs

- name: Checkout premium projects repo
uses: actions/checkout@v4
with:
path: premium
token: ${{ secrets.ACCESS_TOKEN_IR }}
repository: ${{ secrets.PREMIUM_PROJECTS_REPO }}
ref: ${{ env.PREMIUM_REPO_REF }}
ref: ${{ fromJSON(steps.remote-refs.outputs.result).premium || 'main' }}

- name: Setup Environment
uses: ./actions/setup
uses: ./.github/actions/setup
with:
enable-wireit-cache: true

- name: Lint
run: "pnpm lint:js"
run: "pnpm run lint:js"

- name: Typecheck
run: pnpm typecheck
run: pnpm run typecheck

- name: Build
run: pnpm build
run: pnpm run build

- name: Bundle
run: pnpm bundle:all
run: pnpm run bundle:all

e2e-tests:
name: "E2E Tests - PHP: ${{ matrix.php }}, WP: ${{ matrix.wp }}"
if: github.repository == 'wpsocio/wp-projects'
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
matrix:
# Least version required and the latest version
php: ["7.4", "8.3"]
wp: ["6.4", "master"]

steps:
- name: Checkout this repo
uses: actions/checkout@v4
with:
token: ${{ secrets.ACCESS_TOKEN_IR }}

- name: Remote refs
uses: ./.github/actions/upstream-refs
id: remote-refs

- name: Checkout premium projects repo
uses: actions/checkout@v4
with:
path: premium
token: ${{ secrets.ACCESS_TOKEN_IR }}
repository: ${{ secrets.PREMIUM_PROJECTS_REPO }}
ref: ${{ fromJSON(steps.remote-refs.outputs.result).premium || 'main' }}

- name: Setup Environment
uses: ./.github/actions/setup
with:
enable-wireit-cache: true
php-version: ${{ matrix.php }}

- name: Setup PHP
run: "pnpm run setup:php"

- name: Build
run: pnpm run build

- name: Install Playwright dependencies
run: |
npx playwright install chromium firefox webkit --with-deps
- name: Update wp-env
run: |
contents="$(jq '.core = "WordPress/WordPress#${{ matrix.wp }}" | .phpVersion = "${{ matrix.php }}"' .wp-env.json)"
echo -E "${contents}" > .wp-env.json
- name: Start WordPress Environment
run: |
pnpm run env-start
- name: Run tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: pnpm run test:e2e

- name: Upload debug artifacts
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: e2e-artifacts-wp-${{ matrix.wp }}-php-${{ matrix.php }}
path: |
artifacts/
!artifacts/test-results
if-no-files-found: ignore

- name: Stop WordPress Environment
run: |
pnpm run env-stop
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ jobs:
token: ${{ secrets.ACCESS_TOKEN_IR }}

- name: Setup Environment
uses: ./actions/setup
uses: ./.github/actions/setup
with:
enable-wireit-cache: true

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -12,11 +12,12 @@ vendor/
!/.changeset/
!/.github/
!/.vscode/
!/actions/
!/config/
!/packages/
!/plugins/
!/tools/
!/test/
!/patches/

# Ignore all plugins because there may be other plugins installed
/plugins/*/
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -5,12 +5,13 @@
},
"phpSniffer.autoDetect": true,
"phpSniffer.standard": "phpcs.xml",
"[javascript][javascriptreact][typescript][typescriptreact]": {
"[javascript][javascriptreact][typescript][typescriptreact][json]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "biomejs.biome"
},
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit",
"source.organizeImports.biome": "explicit"
}
},
"typescript.tsdk": "node_modules/typescript/lib"
}
22 changes: 22 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "https://schemas.wp.org/trunk/wp-env.json",
"config": {
"WP_DEBUG_LOG": true
},
"mappings": {
"wp-content/plugins/wptelegram": "./plugins/wptelegram",
"wp-content/plugins/wptelegram-comments": "./plugins/wptelegram-comments",
"wp-content/plugins/wptelegram-login": "./plugins/wptelegram-login",
"wp-content/plugins/wptelegram-widget": "./plugins/wptelegram-widget"
},
"env": {
"tests": {
"mappings": {
"wp-content/plugins/classic-editor": "WordPress/classic-editor",
"wp-content/mu-plugins": "./tools/e2e-mu-plugins",
"wp-content/themes/gutenberg-test-themes/twentytwentyone": "https://downloads.wordpress.org/theme/twentytwentyone.2.3.zip",
"wp-content/themes/gutenberg-test-themes/twentytwentyfour": "https://downloads.wordpress.org/theme/twentytwentyfour.1.2.zip"
}
}
}
}
15 changes: 14 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
@@ -7,7 +7,8 @@
"build/*",
"node_modules/*",
"vendor/*",
".wireit/*"
".wireit/*",
"./packages/js/ui-components/ui/*"
]
},
"organizeImports": {
@@ -25,6 +26,18 @@
"recommended": true,
"style": {
"useTemplate": "off"
},
"correctness": {
"noUnusedImports": {
"level": "warn",
"fix": "none"
},
"noUnusedVariables": "warn"
},
"suspicious": {
"noConsoleLog": {
"level": "warn"
}
}
}
}
Loading