Skip to content

Commit 28d0bf1

Browse files
committed
feat: add Prettier code formatter integration
- Add Prettier config extending WordPress standards - Add .prettierignore for build/vendor directories - Integrate Prettier with lint-staged for auto-formatting on commit - Support JS, CSS, JSON, YAML, Markdown file types - Add yarn format and yarn format:check scripts - Update lint scripts to include formatting checks - Auto-format all existing files to WordPress standards - Update CLAUDE.md with Prettier documentation
1 parent c6d7deb commit 28d0bf1

18 files changed

+554
-461
lines changed
Lines changed: 48 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,51 @@
11
name: Create package
22
on:
3-
workflow_dispatch:
4-
inputs:
5-
PACKAGE_VERSION:
6-
description: 'Package Version'
7-
required: true
3+
workflow_dispatch:
4+
inputs:
5+
PACKAGE_VERSION:
6+
description: 'Package Version'
7+
required: true
88
jobs:
9-
tag:
10-
name: New package
11-
runs-on: ubuntu-latest
12-
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@v3
15-
16-
- name: Install Composer dependencies
17-
uses: ramsey/composer-install@v3
18-
with:
19-
composer-options: --no-dev --optimize-autoloader
20-
21-
- name: Setup Node.js
22-
uses: actions/setup-node@v3
23-
with:
24-
node-version: '18'
25-
26-
- name: Enable Corepack
27-
run: corepack enable
28-
29-
- name: Install dependencies
30-
run: yarn install --immutable
31-
32-
- name: Build assets
33-
run: yarn build
34-
35-
- name: Exclude files listed in .distignore
36-
run: |
37-
if [ -f .distignore ]; then
38-
mkdir filtered
39-
rsync -av --exclude-from='.distignore' . ./filtered
40-
fi
41-
42-
- name: Create zip archive
43-
run: |
44-
cd filtered
45-
zip -r ../monei-${{ github.event.inputs.PACKAGE_VERSION }}.zip .
46-
47-
- name: Upload artifact
48-
uses: actions/upload-artifact@v4
49-
with:
50-
name: monei-${{ github.event.inputs.PACKAGE_VERSION }}
51-
path: monei-${{ github.event.inputs.PACKAGE_VERSION }}.zip
52-
9+
tag:
10+
name: New package
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Install Composer dependencies
17+
uses: ramsey/composer-install@v3
18+
with:
19+
composer-options: --no-dev --optimize-autoloader
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: '18'
25+
26+
- name: Enable Corepack
27+
run: corepack enable
28+
29+
- name: Install dependencies
30+
run: yarn install --immutable
31+
32+
- name: Build assets
33+
run: yarn build
34+
35+
- name: Exclude files listed in .distignore
36+
run: |
37+
if [ -f .distignore ]; then
38+
mkdir filtered
39+
rsync -av --exclude-from='.distignore' . ./filtered
40+
fi
41+
42+
- name: Create zip archive
43+
run: |
44+
cd filtered
45+
zip -r ../monei-${{ github.event.inputs.PACKAGE_VERSION }}.zip .
46+
47+
- name: Upload artifact
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: monei-${{ github.event.inputs.PACKAGE_VERSION }}
51+
path: monei-${{ github.event.inputs.PACKAGE_VERSION }}.zip

.github/workflows/main.yml

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
11
name: Deploy to WordPress.org
22
on:
3-
release:
4-
types: [published]
3+
release:
4+
types: [published]
55
jobs:
6-
tag:
7-
name: New release
8-
runs-on: ubuntu-latest
9-
steps:
10-
- name: Checkout code
11-
uses: actions/checkout@v3
6+
tag:
7+
name: New release
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v3
1212

13-
- name: Install Composer dependencies
14-
uses: ramsey/composer-install@v3
15-
with:
16-
composer-options: --no-dev --optimize-autoloader
13+
- name: Install Composer dependencies
14+
uses: ramsey/composer-install@v3
15+
with:
16+
composer-options: --no-dev --optimize-autoloader
1717

18-
- name: Setup Node.js
19-
uses: actions/setup-node@v3
20-
with:
21-
node-version: '18'
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: '18'
2222

23-
- name: Enable Corepack
24-
run: corepack enable
23+
- name: Enable Corepack
24+
run: corepack enable
2525

26-
- name: Install dependencies
27-
run: yarn install --immutable
26+
- name: Install dependencies
27+
run: yarn install --immutable
2828

29-
- name: Build assets
30-
run: yarn build
29+
- name: Build assets
30+
run: yarn build
3131

32-
- name: WordPress Plugin Deploy
33-
id: deploy
34-
uses: 10up/action-wordpress-plugin-deploy@stable
35-
with:
36-
generate-zip: true
37-
env:
38-
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
39-
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
40-
SLUG: monei
32+
- name: WordPress Plugin Deploy
33+
id: deploy
34+
uses: 10up/action-wordpress-plugin-deploy@stable
35+
with:
36+
generate-zip: true
37+
env:
38+
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
39+
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
40+
SLUG: monei
4141

42-
- name: Upload Release
43-
uses: ncipollo/release-action@v1.14.0
44-
with:
45-
allowUpdates: true
46-
omitBodyDuringUpdate: true
47-
artifacts: ${{ steps.deploy.outputs.zip-path }}
48-
artifactContentType: 'application/zip'
49-
token: ${{ secrets.GITHUB_TOKEN }}
42+
- name: Upload Release
43+
uses: ncipollo/release-action@v1.14.0
44+
with:
45+
allowUpdates: true
46+
omitBodyDuringUpdate: true
47+
artifacts: ${{ steps.deploy.outputs.zip-path }}
48+
artifactContentType: 'application/zip'
49+
token: ${{ secrets.GITHUB_TOKEN }}

.lintstagedrc.json

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
{
2-
"*.php": [
3-
"composer phpcbf --",
4-
"composer phpstan --"
5-
],
6-
"*.{js,jsx}": [
7-
"wp-scripts lint-js --fix"
8-
],
9-
"*.{css,scss}": [
10-
"wp-scripts lint-style --fix"
11-
]
2+
"*.php": [ "composer phpcbf --", "composer phpstan --" ],
3+
"*.{js,jsx}": [ "wp-scripts format", "wp-scripts lint-js --fix" ],
4+
"*.{css,scss}": [ "wp-scripts format", "wp-scripts lint-style --fix" ],
5+
"*.{json,yml,yaml,md}": [ "wp-scripts format" ]
126
}

.mcp.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"mcpServers": {
3-
"browsermcp": {
4-
"command": "npx",
5-
"args": ["@browsermcp/mcp@latest"]
6-
}
7-
}
2+
"mcpServers": {
3+
"browsermcp": {
4+
"command": "npx",
5+
"args": [ "@browsermcp/mcp@latest" ]
6+
}
7+
}
88
}

.prettierignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Dependencies
2+
node_modules/
3+
vendor/
4+
5+
# Build output
6+
public/
7+
build/
8+
dist/
9+
10+
# Version control
11+
.git/
12+
13+
# Package manager files
14+
package-lock.json
15+
yarn.lock
16+
composer.lock
17+
18+
# WordPress
19+
*.pot
20+
21+
# IDE
22+
.idea/
23+
.vscode/
24+
25+
# Logs
26+
*.log
27+
28+
# OS
29+
.DS_Store

.prettierrc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* Prettier configuration
3+
* Extends WordPress coding standards
4+
*/
5+
module.exports = {
6+
...require( '@wordpress/prettier-config' ),
7+
// Override specific settings if needed
8+
// e.g., printWidth: 100,
9+
};

.release-it.json

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
{
2-
"git": {
3-
"tagName": "${version}",
4-
"commitMessage": "chore: release v${version}"
5-
},
6-
"github": {
7-
"release": true,
8-
"releaseNotes": "npx conventional-changelog -p conventionalcommits -u"
9-
},
10-
"npm": {
11-
"publish": false
12-
},
13-
"plugins": {
14-
"@release-it/bumper": {
15-
"out": [
16-
".readme-template",
17-
"readme.txt",
18-
"woocommerce-gateway-monei.php",
19-
"class-woocommerce-gateway-monei.php"
20-
]
21-
},
22-
"@release-it/conventional-changelog": {
23-
"infile": "CHANGELOG.md",
24-
"preset": {
25-
"name": "conventionalcommits"
26-
}
27-
}
28-
},
29-
"hooks": {
30-
"after:git:release": "node scripts/generate-readme.js 10 && git add readme.txt README.md && git commit --amend --no-edit"
31-
}
2+
"git": {
3+
"tagName": "${version}",
4+
"commitMessage": "chore: release v${version}"
5+
},
6+
"github": {
7+
"release": true,
8+
"releaseNotes": "npx conventional-changelog -p conventionalcommits -u"
9+
},
10+
"npm": {
11+
"publish": false
12+
},
13+
"plugins": {
14+
"@release-it/bumper": {
15+
"out": [
16+
".readme-template",
17+
"readme.txt",
18+
"woocommerce-gateway-monei.php",
19+
"class-woocommerce-gateway-monei.php"
20+
]
21+
},
22+
"@release-it/conventional-changelog": {
23+
"infile": "CHANGELOG.md",
24+
"preset": {
25+
"name": "conventionalcommits"
26+
}
27+
}
28+
},
29+
"hooks": {
30+
"after:git:release": "node scripts/generate-readme.js 10 && git add readme.txt README.md && git commit --amend --no-edit"
31+
}
3232
}

0 commit comments

Comments
 (0)