Skip to content

Commit 99a5a70

Browse files
authored
Merge pull request #131 from bnomei/v5
V5
2 parents 8d633a1 + 67b48ea commit 99a5a70

File tree

25 files changed

+2634
-4598
lines changed

25 files changed

+2634
-4598
lines changed

.github/workflows/pest-tests.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
name: Pest Tests
22

3-
on: [ 'push', 'pull_request' ]
3+
on:
4+
push:
5+
paths:
6+
- "**.php"
7+
- "composer.lock"
8+
pull_request:
9+
paths:
10+
- "**.php"
11+
- "composer.lock"
412

513
jobs:
614
test:
@@ -24,16 +32,12 @@ jobs:
2432
key: composer-${{ hashFiles('composer.lock') }}
2533

2634
- name: Install
27-
run: composer install --no-interaction --prefer-dist --optimize-autoloader
28-
29-
- name: PEST
30-
run: composer coverage
31-
32-
# - name: Test & publish code coverage
33-
# uses: paambaati/[email protected]
34-
# with:
35-
# coverageCommand: composer coverage
36-
# coverageLocations: ${{github.workspace}}/tests/clover.xml:clover
37-
# env:
38-
# CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
35+
run: composer kirby
3936

37+
- name: Test & publish code coverage
38+
uses: paambaati/[email protected]
39+
with:
40+
coverageCommand: vendor/bin/pest --ci
41+
coverageLocations: ${{github.workspace}}/tests/clover.xml:clover
42+
env:
43+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}

.github/workflows/phpstan.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ jobs:
2828
key: composer-${{ hashFiles('composer.lock') }}
2929

3030
- name: Install
31-
run: |
32-
composer install --no-interaction --prefer-dist --optimize-autoloader
31+
run: composer kirby
3332

3433
- name: Run PHPStan
35-
run: |
36-
php tests/patch.php
37-
./vendor/bin/phpstan --error-format=github
34+
run: vendor/bin/phpstan --error-format=github

README.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# Kirby Janitor
22

3-
![Release](https://flat.badgen.net/packagist/v/bnomei/kirby3-janitor?color=ae81ff)
4-
![Downloads](https://flat.badgen.net/packagist/dt/bnomei/kirby3-janitor?color=272822)
5-
[![Coverage](https://flat.badgen.net/codeclimate/coverage/bnomei/kirby3-janitor)](https://flat.badgen.net/codeclimate/coverage/bnomei/kirby3-janitor)
6-
[![Maintainability](https://flat.badgen.net/codeclimate/maintainability/bnomei/kirby3-janitor)](https://codeclimate.com/github/bnomei/kirby3-janitor)
7-
[![Discord](https://flat.badgen.net/badge/discord/bnomei?color=7289da)](https://discordapp.com/users/bnomei)
3+
[![Kirby 5](https://flat.badgen.net/badge/Kirby/5?color=ECC748)](https://getkirby.com)
4+
![PHP 8.2](https://flat.badgen.net/badge/PHP/8.2?color=4E5B93&icon=php&label)
5+
![Release](https://flat.badgen.net/packagist/v/bnomei/kirby3-janitor?color=ae81ff&icon=github&label)
6+
![Downloads](https://flat.badgen.net/packagist/dt/bnomei/kirby3-janitor?color=272822&icon=github&label)
7+
[![Coverage](https://flat.badgen.net/codeclimate/coverage/bnomei/kirby3-janitor?icon=codeclimate&label)](https://codeclimate.com/github/bnomei/kirby3-janitor)
8+
[![Maintainability](https://flat.badgen.net/codeclimate/maintainability/bnomei/kirby3-janitor?icon=codeclimate&label)](https://codeclimate.com/github/bnomei/kirby3-janitor/issues)
9+
[![Discord](https://flat.badgen.net/badge/discord/bnomei?color=7289da&icon=discord&label)](https://discordapp.com/users/bnomei)
10+
[![Buymecoffee](https://flat.badgen.net/badge/icon/donate?icon=buymeacoffee&color=FF813F&label)](https://www.buymeacoffee.com/bnomei)
811

9-
Kirby Plugin for running commands.
12+
13+
Janitor is a Kirby CMS Plugin for running commands.
1014

1115
- It is a Panel Button!
1216
- It has commands built-in for cleaning the cache, sessions, create zip-backup, pre-generate thumbs, open URLs, refresh the current Panel page and more.
@@ -78,6 +82,21 @@ return [
7882
7983
```
8084

85+
### View Buttons
86+
87+
You can also use Janitor to create up to 10 custom [view buttons](https://getkirby.com/releases/5/view-buttons#custom-vue-component).
88+
89+
**site/blueprints/page/default.yml**
90+
```yml
91+
buttons:
92+
janitor: # or janitor_1, janitor_2, ... janitor_9
93+
command: whistle
94+
label: Whistle
95+
icon: audio
96+
preview: true
97+
settings: true
98+
```
99+
81100
### Callback
82101

83102
Instead of using a command you can also create a callback in a custom plugin options or any config file.
@@ -169,6 +188,7 @@ In either the command or the callback you will be setting/returning data to the
169188
- `icon`, see `icon`-field option
170189
- `label`, see `label`-field option
171190
- `message`, see `message`-field option
191+
- `notification`, array of method and message, like `['success', 'Deployed!']`
172192
- `open`, URL to open, use with `intab`-field option to open in a new tab
173193
- `reload`, if `true` will reload panel view once api call is received
174194
- `success`, see `success`-field option
@@ -401,6 +421,10 @@ return [
401421

402422
You can also overwrite the maintenance snippet if you create your own and store it as `site/snippets/maintenance.php`.
403423

424+
## Tinker(well), REPL and Debugging
425+
426+
You can use the `kirby janitor:tinker` command to start a REPL session in the terminal. This is a great way to test code snippets, debug and explore your Kirby installation. Another alternative would be using the [Tinkerwell App](https://tinkerwell.app/) which has built-in support for Kirby as long as it can find the `./kirby/bootstrap.php` file via the matching [driver](https://github.com/beyondcode/tinkerwell/blob/58254e11a6aad428eefd63b1ae624b0568414227/src/Drivers/KirbyTinkerwellDriver.php#L14).
427+
404428
## Dependencies
405429

406430
- [Kirby CLI](https://github.com/getkirby/cli)

composer.json

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "bnomei/kirby3-janitor",
33
"type": "kirby-plugin",
4-
"version": "4.4.2",
4+
"version": "5.0.0",
55
"license": "MIT",
66
"homepage": "https://github.com/bnomei/kirby3-janitor",
77
"description": "Kirby Plugin for running commands like cleaning the cache from within the Panel, PHP code or a cronjob",
@@ -50,24 +50,20 @@
5050
"symfony/finder": "^7.0"
5151
},
5252
"require-dev": {
53-
"getkirby/cli": "dev-develop",
54-
"getkirby/cms": "^4.3.0",
55-
"larastan/larastan": "^2.9",
53+
"getkirby/cli": "^1.5.0",
54+
"getkirby/cms": "dev-v5/develop",
55+
"larastan/larastan": "^v3.0.0",
5656
"laravel/pint": "^1.13",
57-
"pestphp/pest": "^2.24",
58-
"pestphp/pest-plugin-type-coverage": "^2.4",
57+
"pestphp/pest": "^v3.5.1",
5958
"spatie/ray": "^1.39"
6059
},
6160
"scripts": {
62-
"analyze": "./vendor/bin/phpstan",
61+
"stan": "./vendor/bin/phpstan",
6362
"fix": "./vendor/bin/pint",
64-
"test": "./vendor/bin/pest",
65-
"coverage": [
66-
"php tests/patch.php",
67-
"php ./vendor/bin/pest --coverage --coverage-clover=tests/clover.xml"
68-
],
63+
"test": "./vendor/bin/pest --profile",
6964
"dist": [
7065
"npm run format",
66+
"npm run build",
7167
"composer fix",
7268
"composer install --no-dev --optimize-autoloader",
7369
"git rm -rf --cached .; git add .;"
@@ -77,7 +73,9 @@
7773
"composer install",
7874
"composer update",
7975
"composer install --working-dir=tests/kirby --no-dev --optimize-autoloader",
80-
"composer update --working-dir=tests/kirby"
76+
"composer update --working-dir=tests/kirby",
77+
"sed -i.bak 's/function dump(/function xdump(/g' tests/kirby/config/helpers.php",
78+
"sed -i.bak 's/function e(/function xe(/g' tests/kirby/config/helpers.php"
8179
]
8280
},
8381
"extra": {

0 commit comments

Comments
 (0)