Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
srtfisher authored Aug 1, 2024
0 parents commit 26867d4
Show file tree
Hide file tree
Showing 50 changed files with 31,104 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .deployignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.DS_Store
Thumbs.db
wp-cli.local.yml
node_modules/
*.sql
*.tar.gz
*.zip
.phpunit.result.cache
Dockerfile
output.log
.github
tests
bin
composer.lock
.phpcs.xml
phpunit.xml
configure.php
DOCKER_ENV
phpunit.xml
tests
.phpcs
Makefile
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = tab
indent_size = 4

[*.{ts,tsx,js,jsx,scss,css,json,yaml,yml,feature,xml}]
indent_style = space
indent_size = 2

# Dotfiles
[.*]
indent_style = space
indent_size = 2
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build
vendor
6 changes: 6 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": ["@alleyinteractive/eslint-config/typescript-react"],
"parserOptions": {
"project": "./tsconfig.eslint.json"
}
}
28 changes: 28 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# Exclude these files from release archives.
#
# This will also make the files unavailable when using Composer with `--prefer-dist`.
#
# Via WPCS.
#
/.github export-ignore
/.phpcs.xml export-ignore
/.phpcs export-ignore
/phpunit.xml export-ignore
/tests export-ignore
/configure.php export-ignore
/Makefile export-ignore

#
# Auto detect text files and perform LF normalization.
#
# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/
#
* text=auto

#
# The above will handle all files not found below.
#
*.md text
*.php text
*.inc text
25 changes: 25 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
day: "saturday"
time: "09:00"
timezone: "America/New_York"
ignore:
- dependency-name: "@wordpress/*"
47 changes: 47 additions & 0 deletions .github/workflows/all-pr-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "All Pull Request Tests"

on:
pull_request:
branches:
- develop
types: [opened, synchronize, reopened, ready_for_review]

jobs:
# We use a single job to ensure that all steps run in the same environment and
# reduce the number of minutes used.
pr-tests:
# Don't run on draft PRs
if: github.event.pull_request.draft == false
# Timeout after 10 minutes
timeout-minutes: 10
# Define a matrix of PHP/WordPress versions to test against
strategy:
matrix:
php: [8.1, 8.2, 8.3]
wordpress: ["latest"]
runs-on: ubuntu-latest
# Cancel any existing runs of this workflow
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}-P${{ matrix.php }}-WP${{ matrix.wordpress }}
cancel-in-progress: true
# Name the job in the matrix
name: "PR Tests PHP ${{ matrix.php }} WordPress ${{ matrix.wordpress }}"
steps:
- uses: actions/checkout@v4

- name: Run General Tests
# See https://github.com/alleyinteractive/action-test-general for more options
uses: alleyinteractive/action-test-general@develop

- name: Run Node Tests
# See https://github.com/alleyinteractive/action-test-node for more options.
# Defaults to the latest LTS version.
uses: alleyinteractive/action-test-node@develop

- name: Run PHP Tests
# See https://github.com/alleyinteractive/action-test-php for more options
uses: alleyinteractive/action-test-php@develop
with:
php-version: '${{ matrix.php }}'
wordpress-version: '${{ matrix.wordpress }}'
skip-wordpress-install: 'true'
14 changes: 14 additions & 0 deletions .github/workflows/built-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Built Release

on:
push:
branches:
- develop
- main
- production

jobs:
built-release:
uses: alleyinteractive/.github/.github/workflows/built-release.yml@main
with:
node: 20
11 changes: 11 additions & 0 deletions .github/workflows/dependabot-auto-approve.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: dependabot-auto-approve
on:
pull_request:

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
uses: alleyinteractive/.github/.github/workflows/dependabot-auto-approve.yml@main
10 changes: 10 additions & 0 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: dependabot-auto-merge
on: pull_request_target

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
uses: alleyinteractive/.github/.github/workflows/dependabot-auto-merge.yml@main
40 changes: 40 additions & 0 deletions .github/workflows/merge-develop-to-scaffold.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow is used on alleyinteractive/create-wordpress-plugin to merge the
# develop branch into the scaffold branch and is NOT meant to be used on other
# repositories. This workflow will be deleted automatically when the
# configuration script is run.

name: Merge Develop to Scaffold Branch

on:
push:
branches:
- develop
- remove-scaffold

jobs:
merge-develop-to-scaffold:
name: merge develop to scaffold
if: ${{ github.repository == 'alleyinteractive/create-wordpress-plugin' }}
runs-on: ubuntu-latest

steps:
- name: Merge develop to scaffold
shell: bash
env:
DEVELOP_BRANCH: develop
SCAFFOLD_BRANCH: scaffold

TOKEN: ${{ secrets.GH_TOKEN }}
run: |
git config --global user.name "$GITHUB_ACTOR"
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
echo "Cloning alleyinteractive/create-wordpress-plugin..."
git clone --recursive --quiet https://$TOKEN@github.com/alleyinteractive/create-wordpress-plugin.git create-wordpress-plugin -b $SCAFFOLD_BRANCH
cd create-wordpress-plugin
git fetch origin $DEVELOP_BRANCH
git fetch origin $SCAFFOLD_BRANCH
git merge origin/$DEVELOP_BRANCH --no-edit
git push -u origin $SCAFFOLD_BRANCH
28 changes: 28 additions & 0 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Update Changelog"

on:
release:
types: [released]

jobs:
update:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: main

- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ github.event.release.name }}
release-notes: ${{ github.event.release.body }}

- name: Commit updated CHANGELOG
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: main
commit_message: Update CHANGELOG
file_pattern: CHANGELOG.md
19 changes: 19 additions & 0 deletions .github/workflows/upgrade-wordpress-plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Update WordPress Plugin

on:
schedule:
- cron: '0 6 1 * *' # Run on the first day of every month at 6am UTC.

permissions:
contents: write
pull-requests: write

jobs:
update-plugin:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: alleyinteractive/action-update-wordpress-plugin@v2.0.0
with:
plugin-file: 'plugin.php'
upgrade-npm-dependencies: "true"
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Build files
build
vendor
composer.lock
node_modules

# Log files
*.log

# Cache files
.phpcs/*.json
.phpunit.result.cache

# Ignore temporary OS files
.DS_Store
.DS_Store?
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
.thumbsdb

# IDE files
*.code-workspace
.idea
.vscode
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
legacy-peer-deps=true
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
61 changes: 61 additions & 0 deletions .phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="create-wordpress-plugin" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
<description>PHP_CodeSniffer standard for create-wordpress-plugin.</description>

<!-- Include Alley Rules -->
<rule ref="Alley-Interactive" />

<!--
Pass some flags to PHPCS:
p flag: Show progress of the run.
s flag: Show sniff codes in all reports.
n flag: Do not print warnings.
-->
<arg value="ps" />

<!-- Whenever possible, cache the scan results and re-use those for unchanged files on the next scan. -->
<arg name="cache" value=".phpcs/cache.json" />

<!-- Strip the filepaths down to the relevant bit. -->
<arg name="basepath" value="./" />

<!-- Check up to 20 files simultaneously. -->
<arg name="parallel" value="20" />

<!-- Set severity to 1 to see everything that isn't effectively turned off. -->
<arg name="severity" value="1" />

<!-- Exclude a few directories and autogenerated files. -->
<exclude-pattern>build/</exclude-pattern>
<exclude-pattern>vendor/</exclude-pattern>

<!-- The version set here matches the minimum version tested in tests. -->
<config name="minimum_supported_wp_version" value="6.5" />

<!-- Define the prefixes that can be used by the plugin -->
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<property name="prefixes" type="array">
<element value="vendor_name" />
<element value="alley" />
<element value="create_wordpress_plugin" />
</property>
</properties>
</rule>

<!-- Disable commenting rules for example code included in the plugin. -->
<rule ref="Squiz.PHP.CommentedOutCode.Found">
<exclude-pattern>src/assets.php</exclude-pattern>
<exclude-pattern>blocks</exclude-pattern>
<exclude-pattern>build</exclude-pattern>
<exclude-pattern>entries</exclude-pattern>
</rule>

<rule ref="Squiz.Commenting.InlineComment">
<exclude-pattern>src/assets.php</exclude-pattern>
</rule>

<rule ref="WordPress.Files.FileName">
<exclude-pattern>tests/*</exclude-pattern>
</rule>
</ruleset>
Empty file added .phpcs/.gitkeep
Empty file.
17 changes: 17 additions & 0 deletions .scaffolder/plugin-feature/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: create-wordpress-plugin@plugin-feature

inputs:
- name: featureName
description: "Feature Name"
type: string
- name: tests
description: "Include Tests?"
type: boolean
default: true

files:
- source: feature.php.hbs
destination: src/features/{{ wpClassFilename inputs.featureName }}
- source: test.php.hbs
if: "{{ inputs.tests }}"
destination: tests/Features/{{ psr4ClassFilename inputs.featureName suffix="Test.php" }}
Loading

0 comments on commit 26867d4

Please sign in to comment.