Skip to content

Commit 3033fce

Browse files
authored
Merge pull request #1 from BeAPI/chore/open-source-template
Open source template
2 parents 5cb4b22 + 725a170 commit 3033fce

30 files changed

+33141
-0
lines changed

.distignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/.git
2+
/.github
3+
/.wordpress-org
4+
/node_modules
5+
/src
6+
7+
.distignore
8+
.editorconfig
9+
.gitattributes
10+
.gitignore
11+
.plugin-data
12+
.wp-env.json
13+
CHANGELOG.md
14+
composer.json
15+
composer.lock
16+
grumphp.yml
17+
LICENSE.md
18+
package.json
19+
package-lock.json
20+
phpcs.xml.dist
21+
phpunit.xml.dist
22+
psalm.xml.dist
23+
README.md
24+
webpack.config.js
25+
yarn.lock

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# This file is for unifying the coding style for different editors and IDEs
2+
# editorconfig.org
3+
4+
# WordPress Coding Standards
5+
# https://make.wordpress.org/core/handbook/coding-standards/
6+
7+
root = true
8+
9+
[*]
10+
charset = utf-8
11+
end_of_line = lf
12+
insert_final_newline = true
13+
trim_trailing_whitespace = true
14+
indent_style = tab
15+
16+
[*.{yml,yaml}]
17+
indent_style = space
18+
indent_size = 2

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/.git export-ignore
2+
/.github export-ignore
3+
/.distignore export-ignore
4+
/.gitattributes export-ignore
5+
/.gitignore export-ignore
6+
/.plugin-data export-ignore
7+
/CHANGELOG.md export-ignore
8+
/grumphp.yml export-ignore
9+
/phpcs.xml.dist export-ignore
10+
/psalm.xml export-ignore
11+
/README.md export-ignore
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: "Check plugin version and tags"
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
7+
jobs:
8+
version-check:
9+
name: "Check version doesn't not already exists."
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
17+
- id: set-vars
18+
name: "Set variables from .plugin-data file"
19+
run: |
20+
# Get all data from .plugin-data file
21+
content=`cat ./.plugin-data`
22+
# the following lines are only required for multi line json
23+
content="${content//'%'/'%25'}"
24+
content="${content//$'\n'/'%0A'}"
25+
content="${content//$'\r'/'%0D'}"
26+
# end of optional handling for multi line json
27+
echo "::set-output name=pluginData::$content"
28+
29+
- id: version-check
30+
name: "Check version in .plugin-data is not existing"
31+
run: |
32+
# Check version from .plugin-data
33+
VERSION=${{fromJson(steps.set-vars.outputs.pluginData).version}}
34+
35+
if git rev-parse "$VERSION" >/dev/null 2>&1; then
36+
echo "Tag aleady exists please update the .plugin-data file to good version";
37+
exit 1;
38+
fi

.github/workflows/quality-php.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: PHP Quality Checks
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
# Cancels all previous workflow runs for pull requests that have not completed.
10+
concurrency:
11+
# The concurrency group contains the workflow name and the branch name for pull requests
12+
# or the commit hash for any other events.
13+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
checks:
18+
name: Lint PHP
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout project
23+
uses: actions/checkout@v3
24+
25+
- name: Setup PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: 8.1
29+
extensions: mbstring, intl
30+
31+
- name: Validate composer file
32+
run: composer validate
33+
34+
- name: Install composer dependencies
35+
run: composer install
36+
37+
- name: Run codesniffer
38+
run: composer cs

.github/workflows/release.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: "Release new TAG"
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
build-and-release:
9+
name: "Release new TAG"
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
17+
- id: set-vars
18+
name: "Set variable from .plugin-data file"
19+
run: |
20+
# Get all data from .plugin-data file
21+
content=`cat ./.plugin-data`
22+
# the following lines are only required for multi line json
23+
content="${content//'%'/'%25'}"
24+
content="${content//$'\n'/'%0A'}"
25+
content="${content//$'\r'/'%0D'}"
26+
# end of optional handling for multi line json
27+
echo "::set-output name=pluginData::$content"
28+
29+
- id: check-version
30+
name: "Check version does not exists"
31+
run: |
32+
# Get the version from .plugin-data file.
33+
VERSION=${{fromJson(steps.set-vars.outputs.pluginData).version}}
34+
35+
echo "Get Branch tag"
36+
if git rev-parse "$VERSION" >/dev/null 2>&1; then
37+
echo "Tag already exists, stop now";
38+
exit 1;
39+
fi
40+
41+
- id: build-php
42+
name: "Build project PHP"
43+
uses: shivammathur/setup-php@v2
44+
with:
45+
php-version: 8.3
46+
- run: composer install --prefer-dist --no-dev -o --ignore-platform-reqs
47+
48+
- id: commit-and-push
49+
name: "Commit and push new TAG"
50+
run: |
51+
# Get the version from .plugin-data file.
52+
VERSION=${{fromJson(steps.set-vars.outputs.pluginData).version}}
53+
54+
echo "Copy .distignore to .gitignore"
55+
cp .distignore .gitignore
56+
57+
echo "Configure git"
58+
git config --local user.email "$(git log --format='%ae' HEAD^!)"
59+
git config --local user.name "$(git log --format='%an' HEAD^!)"
60+
61+
echo "Creating branch"
62+
git checkout -b release/${VERSION}
63+
64+
echo "Creating tag ${VERSION}"
65+
git add .
66+
git add -u
67+
git commit -m "Release version ${VERSION}"
68+
git tag ${VERSION}
69+
git push --tags

.gitignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
8+
# Coverage directory used by tools like istanbul
9+
coverage
10+
11+
# Compiled binary addons (https://nodejs.org/api/addons.html)
12+
build/Release
13+
build/
14+
15+
# Dependency directories
16+
node_modules/
17+
18+
# Optional npm cache directory
19+
.npm
20+
21+
# Optional eslint cache
22+
.eslintcache
23+
24+
# Output of `npm pack`
25+
*.tgz
26+
27+
# Output of `wp-scripts plugin-zip`
28+
*.zip
29+
30+
# dotenv environment variables file
31+
.env

.plugin-data

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"version": "1.0.0",
3+
"slug": "blockparty-iframe"
4+
}

.wp-env.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

CHANGELOG.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Blockparty Iframe
2+
3+
## Changelog
4+
5+
All notable changes to this project will be documented in this file.
6+
7+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
8+
and this project adheres to [Semantic Versioning](https://semver.org/).
9+
10+
## [1.0.0] - 2025-01-09
11+
12+
### 🎉 Initial Release
13+
14+
#### Added
15+
16+
- **Gutenberg Iframe Block**: New custom block to embed iframes in WordPress editor
17+
- **Configurable Attributes**:
18+
- `url`: URL of the page to embed
19+
- `title`: Iframe title for accessibility
20+
- `lazyload`: Option to enable lazy loading
21+
- **Dimension Support**:
22+
- Customizable width
23+
- Customizable height
24+
- Configurable aspect ratio
25+
- **Alignments**: Support for wide and full-width alignments
26+
- **Internationalization**:
27+
- Full i18n/l10n support
28+
- French translations included
29+
- POT files for translators
30+
- **Performance**:
31+
- Uses `blocks-manifest.php` API (WordPress 6.7+)
32+
- Compatible with `wp_register_block_types_from_metadata_collection` (WordPress 6.8+)
33+
- Optional lazy loading for iframes
34+
- **Code Quality**:
35+
- WordPress Coding Standards (WPCS) compliance
36+
- Static analysis with Psalm
37+
- PHPCompatibility verification
38+
- ESLint for JavaScript
39+
- GrumPHP for pre-commit hooks
40+
- **Documentation**:
41+
- Complete README with usage guide
42+
- PHPDoc for all functions
43+
- Detailed inline comments
44+
- **Development Environment**:
45+
- `@wordpress/env` support for local environment
46+
- npm scripts for development and production
47+
- Composer configuration for development tools
48+
49+
#### Technical
50+
51+
- **Minimum Versions**:
52+
- WordPress 6.7+
53+
- PHP 8.1+
54+
- Requires ext-json
55+
- **Block Editor API**: Uses API version 3
56+
- **Build System**: `@wordpress/scripts` with `--blocks-manifest` flag
57+
- **Structure**: Modular architecture with edit/save separation
58+
- **Styles**: SCSS with automatic RTL support
59+
60+
---
61+
62+
[1.0.0]: https://github.com/BeAPI/blockparty-iframe/releases/tag/1.0.0

0 commit comments

Comments
 (0)