Skip to content

Commit eaa86cf

Browse files
committed
feat: RoxyAPI WordPress plugin v1.0.0
Official WordPress plugin for RoxyAPI. Wraps 130 API endpoints as Gutenberg blocks and shortcodes with server-side rendering, encrypted API key storage, and WordPress transient caching. Architecture: thin generated layer (from OpenAPI spec) covers every endpoint automatically. 11 hand-crafted hero blocks provide rich editor controls for the most popular endpoints. New API packages require zero plugin code changes. Includes: Settings page, admin onboarding notice, block category, block bindings, PHPCS + PHPStan clean, CI workflows, SVN release automation, i18n .pot file, Plugin Check compatibility.
1 parent d9359fc commit eaa86cf

818 files changed

Lines changed: 127949 additions & 5 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.distignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/.git
2+
/.github
3+
/.gitignore
4+
/.gitattributes
5+
/.distignore
6+
/.editorconfig
7+
/.wordpress-org
8+
/.wp-env.json
9+
/.vscode
10+
/.idea
11+
/bin
12+
/blocks
13+
/docs
14+
/node_modules
15+
/tests
16+
/composer.json
17+
/composer.lock
18+
/package.json
19+
/package-lock.json
20+
/phpcs.xml.dist
21+
/phpstan.neon.dist
22+
/phpunit.xml.dist
23+
/lefthook.yml
24+
/tsconfig.json
25+
/.phpunit.result.cache
26+
/.phpcs.cache
27+
/phpstan.cache
28+
/AGENTS.md
29+
/CONTRIBUTING.md
30+
/CHANGELOG.md
31+
/CODE_OF_CONDUCT.md
32+
/SECURITY.md
33+
/README.md
34+
*.log

.editorconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
indent_style = tab
9+
indent_size = 4
10+
11+
[*.{json,yml,yaml,js,jsx,ts,tsx,css,scss,md}]
12+
indent_style = space
13+
indent_size = 2
14+
15+
[*.php]
16+
indent_style = tab
17+
indent_size = 4
18+
19+
[Makefile]
20+
indent_style = tab

.gitattributes

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/.github export-ignore
2+
/.wordpress-org export-ignore
3+
/tests export-ignore
4+
/blocks export-ignore
5+
/.distignore export-ignore
6+
/.wp-env.json export-ignore
7+
/.editorconfig export-ignore
8+
/.gitattributes export-ignore
9+
/.gitignore export-ignore
10+
/composer.lock export-ignore
11+
/package.json export-ignore
12+
/package-lock.json export-ignore
13+
/phpcs.xml.dist export-ignore
14+
/phpstan.neon.dist export-ignore
15+
/phpunit.xml.dist export-ignore
16+
/lefthook.yml export-ignore
17+
/bin export-ignore

.github/workflows/ci.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
generate-drift:
14+
name: OpenAPI generation drift
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: '20'
21+
cache: 'npm'
22+
- run: npm ci
23+
- name: Regenerate from live OpenAPI
24+
run: npm run generate
25+
- name: Fail if generated code is stale
26+
run: git diff --exit-code src/Generated blocks/generated
27+
28+
lint:
29+
name: Lint and Plugin Check
30+
needs: [generate-drift]
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
- uses: shivammathur/setup-php@v2
35+
with:
36+
php-version: '8.1'
37+
tools: composer
38+
coverage: none
39+
- run: composer install --prefer-dist --no-progress
40+
- run: vendor/bin/phpcs --standard=phpcs.xml.dist
41+
- run: vendor/bin/phpstan analyze --no-progress --memory-limit=1G
42+
- uses: actions/setup-node@v4
43+
with:
44+
node-version: '20'
45+
cache: 'npm'
46+
- run: npm ci
47+
- run: npm run build:all
48+
- run: npx wp-env start
49+
- name: Plugin Check
50+
run: |
51+
npx wp-env run cli wp plugin check roxyapi \
52+
--require=/var/www/html/wp-content/plugins/plugin-check/cli.php \
53+
--severity=5
54+
55+
test:
56+
name: PHPUnit (PHP ${{ matrix.php }} / WP ${{ matrix.wp }})
57+
runs-on: ubuntu-latest
58+
strategy:
59+
fail-fast: false
60+
matrix:
61+
php: ['7.4', '8.1', '8.3']
62+
wp: ['6.5', 'latest']
63+
include:
64+
- php: '8.3'
65+
wp: 'trunk'
66+
services:
67+
mysql:
68+
image: mariadb:10.6
69+
env:
70+
MARIADB_ROOT_PASSWORD: root
71+
ports: ['3306:3306']
72+
options: >-
73+
--health-cmd="mariadb-admin ping"
74+
--health-interval=10s
75+
--health-timeout=5s
76+
--health-retries=5
77+
steps:
78+
- uses: actions/checkout@v4
79+
- uses: shivammathur/setup-php@v2
80+
with:
81+
php-version: ${{ matrix.php }}
82+
extensions: mysqli, zip, gd
83+
tools: composer, wp-cli
84+
coverage: none
85+
- run: composer install --prefer-dist --no-progress
86+
- run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 ${{ matrix.wp }}
87+
- run: vendor/bin/phpunit
88+
89+
build:
90+
name: Build distribution zip
91+
needs: [lint, test]
92+
runs-on: ubuntu-latest
93+
steps:
94+
- uses: actions/checkout@v4
95+
- uses: shivammathur/setup-php@v2
96+
with:
97+
php-version: '8.1'
98+
tools: composer
99+
- run: composer install --no-dev --optimize-autoloader --prefer-dist
100+
- uses: actions/setup-node@v4
101+
with:
102+
node-version: '20'
103+
cache: 'npm'
104+
- run: npm ci
105+
- run: npm run build:all
106+
- run: npm run plugin-zip
107+
- uses: actions/upload-artifact@v4
108+
with:
109+
name: roxyapi-plugin
110+
path: roxyapi.zip
111+
if-no-files-found: error

.github/workflows/openapi-sync.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: OpenAPI Sync
2+
on:
3+
repository_dispatch:
4+
types: [openapi-updated]
5+
schedule:
6+
# Daily at 06:00 UTC, same cadence as the TypeScript and Python SDKs.
7+
- cron: '0 6 * * *'
8+
workflow_dispatch:
9+
inputs:
10+
version_bump:
11+
description: 'patch | minor | major'
12+
required: false
13+
default: 'patch'
14+
force:
15+
description: 'Release even if the spec has not changed'
16+
required: false
17+
default: 'false'
18+
19+
jobs:
20+
sync:
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: write
24+
id-token: write
25+
steps:
26+
- uses: actions/checkout@v4
27+
with:
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
fetch-depth: 0
30+
31+
- uses: shivammathur/setup-php@v2
32+
with:
33+
php-version: '8.1'
34+
tools: composer
35+
coverage: none
36+
- run: composer install --prefer-dist --no-progress
37+
38+
- uses: actions/setup-node@v4
39+
with:
40+
node-version: '20'
41+
cache: 'npm'
42+
- run: npm ci
43+
44+
- name: Regenerate from live OpenAPI
45+
run: npm run generate
46+
47+
- name: Check if spec changed
48+
id: diff
49+
run: |
50+
if git diff --quiet specs/openapi.json src/Generated blocks/generated; then
51+
echo "changed=false" >> $GITHUB_OUTPUT
52+
else
53+
echo "changed=true" >> $GITHUB_OUTPUT
54+
fi
55+
56+
- name: Lint
57+
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
58+
run: vendor/bin/phpcs --standard=phpcs.xml.dist
59+
60+
- name: Static analysis
61+
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
62+
run: vendor/bin/phpstan analyze --no-progress --memory-limit=1G
63+
64+
- name: Build blocks
65+
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
66+
run: npm run build:all
67+
68+
- name: Bump version
69+
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
70+
id: bump
71+
run: |
72+
BUMP="${{ github.event.inputs.version_bump || 'patch' }}"
73+
npm version "$BUMP" --no-git-tag-version
74+
VERSION=$(node -p "require('./package.json').version")
75+
echo "version=$VERSION" >> $GITHUB_OUTPUT
76+
77+
# Keep Version header, ROXYAPI_VERSION constant, and Stable tag in sync
78+
sed -i "s/^\(\s*\*\s*Version:\s*\).*/\1$VERSION/" roxyapi.php
79+
sed -i "s/const ROXYAPI_VERSION\s*=\s*'[^']*';/const ROXYAPI_VERSION = '$VERSION';/" roxyapi.php
80+
sed -i "s/^Stable tag:.*$/Stable tag: $VERSION/" readme.txt
81+
82+
- name: Commit, tag, push
83+
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
84+
run: |
85+
git config user.name "github-actions[bot]"
86+
git config user.email "github-actions[bot]@users.noreply.github.com"
87+
VERSION="${{ steps.bump.outputs.version }}"
88+
git add package.json package-lock.json roxyapi.php readme.txt specs/openapi.json src/Generated blocks/generated build/
89+
git commit -m "release: v$VERSION"
90+
git tag "v$VERSION"
91+
git push --follow-tags
92+
93+
- name: No changes, exit clean
94+
if: steps.diff.outputs.changed == 'false' && github.event_name != 'workflow_dispatch'
95+
run: echo "OpenAPI spec unchanged. Nothing to release."

.github/workflows/release.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Release
2+
on:
3+
push:
4+
tags: ['v*.*.*']
5+
workflow_dispatch:
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
environment: wp-release
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- uses: shivammathur/setup-php@v2
15+
with:
16+
php-version: '8.1'
17+
tools: composer
18+
coverage: none
19+
- run: composer install --no-dev --optimize-autoloader --prefer-dist
20+
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: '20'
24+
cache: 'npm'
25+
- run: npm ci
26+
- run: npm run build:all
27+
28+
- name: Deploy to WordPress.org
29+
id: deploy
30+
uses: 10up/action-wordpress-plugin-deploy@stable
31+
with:
32+
generate-zip: true
33+
env:
34+
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
35+
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
36+
SLUG: roxyapi
37+
38+
- name: Attach zip to GitHub release
39+
uses: softprops/action-gh-release@v2
40+
with:
41+
files: ${{ steps.deploy.outputs.zip-path }}
42+
generate_release_notes: true

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/vendor/
2+
/node_modules/
3+
*.log
4+
.phpunit.result.cache
5+
.phpcs.cache
6+
phpstan.cache
7+
.DS_Store
8+
.idea/
9+
.vscode/
10+
11+
# Maintainer-only docs, never published or committed
12+
CLAUDE.md
13+
MAINTAINER.md

.wordpress-org/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# WordPress.org Asset Files
2+
3+
This directory holds the plugin assets that get pushed to the WordPress.org SVN `assets/` directory by the 10up deploy action. Drop the actual image files in here and tag a release.
4+
5+
| File | Dimensions | Notes |
6+
|---|---|---|
7+
| `icon-128x128.png` | 128 by 128 | Standard icon shown in plugin browser |
8+
| `icon-256x256.png` | 256 by 256 | High DPI icon |
9+
| `banner-772x250.png` | 772 by 250 | Standard banner shown on plugin listing page |
10+
| `banner-1544x500.png` | 1544 by 500 | High DPI banner |
11+
| `screenshot-1.png` | any | Plugin settings page where you paste your RoxyAPI key |
12+
| `screenshot-2.png` | any | Daily Horoscope block in the Gutenberg editor with sign picker |
13+
| `screenshot-3.png` | any | Frontend rendering of a daily horoscope on a WordPress page |
14+
| `screenshot-4.png` | any | Tarot card pull with three card spread |
15+
| `screenshot-5.png` | any | I Ching hexagram cast with interpretation |
16+
| `screenshot-6.png` | any | RoxyAPI inserter category showing the ten hero blocks |
17+
18+
Screenshot captions come from the `== Screenshots ==` block in `readme.txt`. Number them sequentially. Captions and files must match.
19+
20+
Banner design notes:
21+
- Left third: logo and plugin name. Right two thirds: tagline. Dark mode safe background.
22+
- No screenshots inside the banner. They look bad at 772 by 250.
23+
- Must read at both 772 by 250 and 1544 by 500.
24+
25+
Icon design notes:
26+
- SVG preferred. Single glyph, high contrast, works on light and dark WP admin backgrounds.
27+
- If using PNG, ship both 128 and 256 sizes.
28+
29+
Reference: https://developer.wordpress.org/plugins/wordpress-org/plugin-assets/

.wp-env.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"$schema": "https://schemas.wp.org/trunk/wp-env.json",
3+
"core": null,
4+
"phpVersion": "8.1",
5+
"plugins": [
6+
".",
7+
"https://downloads.wordpress.org/plugin/plugin-check.latest-stable.zip"
8+
],
9+
"themes": [],
10+
"config": {
11+
"WP_DEBUG": true,
12+
"WP_DEBUG_LOG": true,
13+
"WP_DEBUG_DISPLAY": false,
14+
"SCRIPT_DEBUG": true
15+
},
16+
"lifecycleScripts": {
17+
"afterStart": "npx wp-env run cli wp plugin activate roxyapi plugin-check"
18+
}
19+
}

0 commit comments

Comments
 (0)