Skip to content
Open
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
22 changes: 22 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Exclude development files from `git archive` (e.g. GitHub ZIP downloads)

/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.github export-ignore
/.nvmrc export-ignore
/.php-cs-fixer.php export-ignore
/.php-cs-fixer.cache export-ignore
/.prettierignore export-ignore
/.vscode export-ignore

/eslint.config.js export-ignore
/lefthook.yml export-ignore
/package.json export-ignore
/pnpm-lock.yaml export-ignore
/prettier.config.js export-ignore
/stylelint.config.js export-ignore
/vite.config.js export-ignore

/resources export-ignore
/tests export-ignore
2 changes: 2 additions & 0 deletions .github/workflows/format-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ jobs:
php-cs-fixer:
uses: yardinternet/workflows/.github/workflows/format-php.yml@main
secrets: inherit
with:
php-version: '7.4'
8 changes: 8 additions & 0 deletions .github/workflows/npm-lock-diff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
on:
pull_request:
paths: ['package-lock.json']

jobs:
lockfile_changes:
uses: yardinternet/workflows/.github/workflows/npm-lock-diff.yml@main
secrets: inherit
47 changes: 47 additions & 0 deletions .github/workflows/test-php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Tests

on:
pull_request:
paths:
- '**.php'
- 'composer.json'
- 'composer.lock'
- '.github/workflows/test-php.yml'

jobs:
phpunit:
name: PHPUnit (PHP ${{ matrix.php-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: ['7.4', '8.3']

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none
tools: composer:v2

- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php-version }}-composer-

- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist

- name: Run PHPUnit
run: composer test
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@

# track .github in the root (i.e. do NOT ignore it)
!.github
!.gitattributes

# ignore all files that start with ~
~*
Expand Down Expand Up @@ -96,9 +97,6 @@ bower_components

code-coverage

# no map files
*.map

vendor
!/src/vendor

Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ composer.json
composer.lock
package.json
package-lock.json
pnpm-lock.yaml
217 changes: 143 additions & 74 deletions README.md

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions activate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

use Yard\PageGuard\Foundation\AdminCapability;

/**
* Grant the plugin's admin capability to the configured roles.
*/
if (! function_exists('ypg_activate')) {
function ypg_activate(): void
{
AdminCapability::addToRoles();
}
}
3 changes: 2 additions & 1 deletion build/admin.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 20 additions & 1 deletion build/admin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions build/admin.js.map

Large diffs are not rendered by default.

Loading
Loading