Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 84 additions & 15 deletions .distignore
Original file line number Diff line number Diff line change
@@ -1,28 +1,97 @@
# Files left out of the WordPress.org / release build
# Files and folders left out of the release zip and the deploys.
# Patterns use rsync/.gitignore syntax; a leading "/" anchors to the repo root.
# Anything NOT listed here is "deployable": changing it triggers a release.

# GitHub, CI and repo setup
/.github
/bin
/.wordpress-org

# Git
.git
.github
.gitignore
.gitattributes
.distignore
.editorconfig
.claude
.wp-env.json
.wp-env.override.json
.DS_Store
Thumbs.db
README.md

# IDE / editors / AI assistants
.vscode
.vscodeignore
.idea
sftp.json
/.claude
CLAUDE.md

# Docker (local development)
/.docker
Dockerfile
docker-compose.yml

# Environment
.env
.env.example

# Composer (dev tools only; the plugin does not need vendor/)
/vendor
composer.json
composer.lock

# Node / front-end tooling
node_modules
package.json
package-lock.json
.nvmrc
.eslintrc
.eslintcache
.prettierrc
.stylelintrc
.stylelintcache

# Coding standards / static analysis
.editorconfig
phpcs.xml
phpcs.xml.dist
.phpcs.xml.dist
.phpcs.cache
phpcs-report.xml
phpstan.neon
phpstan.neon.dist

# Testing
/tests
phpunit.xml
phpunit.xml.dist
node_modules
tests
bin
*.map
phpunit-integration.xml.dist
.wp-env.json
.wp-env.override.json
.phpunit.result.cache
.phpunit.cache

# Block sources: `npm run build` compiles them into build/, which ships
# StackFolio: blocks/ is NOT excluded. The block is plain JavaScript with no
# build step, so blocks/album-grid/ is the runtime code and must ship.
# /blocks

# Build output
/release
*.zip
*.tar.gz

# OS files
.DS_Store
Thumbs.db

# Logs and database dumps
*.log
*.sql
*.sqlite

# Documentation only needed on GitHub (readme.txt ships)
README.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
SECURITY.md

# --------------------------------------------------
# Project-specific (kept from this repo)
# --------------------------------------------------
.phpcs.xml.dist
*.map
*.tar.gz
5 changes: 5 additions & 0 deletions .docker/uploads.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
upload_max_filesize = 64M
post_max_size = 64M
memory_limit = 512M
max_execution_time = 300
max_input_vars = 3000
15 changes: 15 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
WORDPRESS_DB_HOST=db
WORDPRESS_DB_USER=wordpress
WORDPRESS_DB_PASSWORD=wordpress
WORDPRESS_DB_NAME=wordpress

MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=wordpress
MYSQL_USER=wordpress
MYSQL_PASSWORD=wordpress

PLUGIN_SLUG=stackfolio

# Host ports (change these if another project already uses them)
WP_HTTP_PORT=8000
PMA_HTTP_PORT=8080
39 changes: 39 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Bug report
description: Something doesn't work as it should.
labels: [bug]
body:
- type: textarea
id: what
attributes:
label: What happened?
description: What did you do, what did you expect, and what happened instead?
validations:
required: true
- type: textarea
id: steps
attributes:
label: Steps to reproduce
placeholder: |
1. Go to ...
2. Click ...
3. See error ...
validations:
required: true
- type: input
id: version
attributes:
label: Plugin version
placeholder: e.g. 2.1.0
validations:
required: true
- type: input
id: environment
attributes:
label: WordPress and PHP versions
placeholder: e.g. WordPress 7.0, PHP 8.3
- type: textarea
id: logs
attributes:
label: Errors or logs
description: PHP errors (wp-content/debug.log) or browser console errors, if any.
render: text
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Report a security vulnerability
url: https://github.com/wpgenius/stackfolio/security/advisories/new
about: Please report security issues privately, not as a public issue.
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Feature or change
description: Suggest an improvement or a new feature.
labels: [enhancement]
body:
- type: textarea
id: problem
attributes:
label: What problem does this solve?
description: Who needs it, and what do they do today without it?
validations:
required: true
- type: textarea
id: proposal
attributes:
label: What would you like to happen?
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Alternatives you considered
41 changes: 41 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: 2
updates:
# Keeps the SHA-pinned actions in .github/workflows up to date.
# Dependabot PRs need no linked issue; none of these change the plugin zip
# unless build/ changes, so they normally make no release.
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
commit-message:
prefix: ci
labels:
- dependencies

# Dev tools from package.json (@wordpress/scripts and friends), one grouped
# PR a month. If CI then says build/ is out of date, check out the PR's
# branch, run `npm run build`, and commit the result to it.
- package-ecosystem: npm
directory: /
schedule:
interval: monthly
groups:
npm:
patterns: ['*']
commit-message:
prefix: build
labels:
- dependencies

# Dev tools from composer.json (PHPCS, PHPStan, PHPUnit), one grouped PR a month.
- package-ecosystem: composer
directory: /
schedule:
interval: monthly
groups:
composer:
patterns: ['*']
commit-message:
prefix: build
labels:
- dependencies
20 changes: 20 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!-- Every pull request closes at least one issue. One line per issue: -->
Closes #

## What changed

<!-- For several issues, list the changes under each issue number. -->

## How it was tested

- [ ] `composer lint`, `composer phpcs`, `composer phpstan` and `composer test` pass
- [ ] `npm run lint` passes (and `npm run build` was run and committed after block changes)
- [ ] Tried in WordPress (or covered by `npm run test:integration`)

<!--
Will merging this make a release? Only if the plugin zip changes, that is, a
file .distignore does not exclude (PHP, assets, build/, readme.txt...). Docs,
tests, CI and config changes make no release. The version goes up by a patch;
add the label release:minor or release:major for more. Don't edit the version
or the changelog by hand.
-->
84 changes: 84 additions & 0 deletions .github/scripts/lib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/usr/bin/env bash
# Shared helpers for the release and deploy workflows. Source, don't execute.

# File that holds the version header, in the repo root:
# plugin: the PHP file with a "Plugin Name:" header
# theme: style.css with a "Theme Name:" header
main_plugin_file() {
local f
for f in *.php; do
[ -f "$f" ] || continue
if head -n 30 "$f" | grep -qiE '^[[:space:]/*#@]*Plugin Name:'; then
echo "$f"
return 0
fi
done
if [ -f style.css ] && head -n 30 style.css | grep -qiE '^[[:space:]/*#@]*Theme Name:'; then
echo "style.css"
return 0
fi
echo "::error::No plugin file ('Plugin Name:' header in a root .php file) or theme stylesheet ('Theme Name:' header in style.css) found in the repo root" >&2
return 1
}

# Version from the main plugin file header.
header_version() {
head -n 30 "$1" | sed -nE 's/^[[:space:]/*#@]*Version:[[:space:]]*([^[:space:]]+).*/\1/Ip' | head -n 1
}

# Reads paths on stdin, prints the ones that ship (not excluded by .distignore).
# .distignore uses .gitignore syntax, so git itself does the matching in a
# scratch repo whose only ignore file is a copy of .distignore.
deployable_paths() {
local scratch
scratch=$(mktemp -d)
git init -q "$scratch"
cp .distignore "$scratch/.gitignore"
printf '.git\n' >> "$scratch/.gitignore"
local paths ignored
paths=$(cat)
[ -n "$paths" ] || { rm -rf "$scratch"; return 0; }
ignored=$(cd "$scratch" && printf '%s\n' "$paths" | git check-ignore --no-index --stdin || true)
rm -rf "$scratch"
printf '%s\n' "$paths" | while IFS= read -r p; do
[ -n "$p" ] || continue
if ! printf '%s\n' "$ignored" | grep -qxF -- "$p"; then
echo "$p"
fi
done
}

# Copies the deployable files into $1 (created if missing).
build_package() {
local dest="$1"
mkdir -p "$dest"
rsync --archive --delete --exclude='.git' --exclude-from='.distignore' ./ "$dest/"
if find "$dest" -type l | grep -q .; then
echo "::error::Symlinks are not allowed in the package:" >&2
find "$dest" -type l >&2
return 1
fi
}

# Builds the package as it is at a git revision, from committed files only
# (untracked vendor/, node_modules/ etc. never count), using that revision's
# own .distignore. Usage: package_at <rev> <dest>
package_at() {
local rev="$1" dest="$2" tree
tree=$(mktemp -d)
git archive --format=tar "$rev" | tar -x -C "$tree"
( cd "$tree" && touch .distignore && build_package "$dest" )
rm -rf "$tree"
}

# Prints the files that differ between the packages at two revisions
# (added, removed or changed); prints nothing when the zips would be identical.
# Usage: package_diff <old-rev> <new-rev>
package_diff() {
local work
work=$(mktemp -d)
package_at "$1" "$work/old"
package_at "$2" "$work/new"
( cd "$work" && diff -rq old new || true ) | sed -E 's#^Files old/(.*) and new/.* differ$#changed \1#; s#^Only in old(/?)(.*): (.*)$#removed \2/\3#; s#^Only in new(/?)(.*): (.*)$#added \2/\3#; s# /# #'
rm -rf "$work"
}
Loading
Loading