Skip to content

Commit 4bc3e1c

Browse files
committed
wip
1 parent ee887c3 commit 4bc3e1c

13 files changed

+93
-100
lines changed

.editorconfig

-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
; This file is for unifying the coding style for different editors and IDEs.
2-
; More information at https://editorconfig.org
3-
41
root = true
52

63
[*]
@@ -13,6 +10,3 @@ trim_trailing_whitespace = true
1310

1411
[*.md]
1512
trim_trailing_whitespace = false
16-
17-
[*.yml]
18-
indent_size = 2

.gitattributes

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
33

44
# Ignore all test and documentation with "export-ignore".
5+
/.editorconfig export-ignore
56
/.gitattributes export-ignore
7+
/.github export-ignore
68
/.gitignore export-ignore
9+
/.php_cs.dist export-ignore
710
/.travis.yml export-ignore
11+
/docs export-ignore
812
/phpunit.xml.dist export-ignore
13+
/psalm.xml.dist export-ignore
914
/tests export-ignore
10-
/.editorconfig export-ignore
11-
/.php.cs export-ignore
12-
/.github export-ignore
13-
File renamed without changes.

.github/SECURITY.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Security Policy
2+
3+
If you discover any security related issues, please email [email protected] instead of using the issue tracker.

.github/workflows/php-cs-fixer.yml

+13-19
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,21 @@ name: Check & fix styling
33
on: [push]
44

55
jobs:
6-
style:
6+
php-cs-fixer:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- name: Checkout code
11-
uses: actions/checkout@v2
10+
- name: Checkout code
11+
uses: actions/checkout@v2
12+
with:
13+
ref: ${{ github.head_ref }}
1214

13-
- name: Fix style
14-
uses: docker://oskarstark/php-cs-fixer-ga
15-
with:
16-
args: --config=.php_cs --allow-risky=yes
15+
- name: Run PHP CS Fixer
16+
uses: docker://oskarstark/php-cs-fixer-ga
17+
with:
18+
args: --config=.php_cs.dist --allow-risky=yes
1719

18-
- name: Extract branch name
19-
shell: bash
20-
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
21-
id: extract_branch
22-
23-
- name: Commit changes
24-
uses: stefanzweifel/[email protected]
25-
with:
26-
commit_message: Fix styling
27-
branch: ${{ steps.extract_branch.outputs.branch }}
28-
env:
29-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
- name: Commit changes
21+
uses: stefanzweifel/git-auto-commit-action@v4
22+
with:
23+
commit_message: Fix styling

.github/workflows/psalm.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
paths:
66
- '**.php'
7-
- 'psalm.xml'
7+
- 'psalm.xml.dist'
88

99
jobs:
1010
psalm:
@@ -21,7 +21,7 @@ jobs:
2121
coverage: none
2222

2323
- name: Cache composer dependencies
24-
uses: actions/cache@v1
24+
uses: actions/cache@v2
2525
with:
2626
path: vendor
2727
key: composer-${{ hashFiles('composer.lock') }}
@@ -30,4 +30,4 @@ jobs:
3030
run: composer install -n --prefer-dist
3131

3232
- name: Run psalm
33-
run: ./vendor/bin/psalm -c psalm.xml
33+
run: ./vendor/bin/psalm

.github/workflows/run-tests.yml

+46-40
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,50 @@
11
name: Tests
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
paths-ignore:
6+
- '**.md'
7+
pull_request:
8+
paths-ignore:
9+
- '**.md'
410

511
jobs:
6-
test:
7-
runs-on: ${{ matrix.os }}
8-
strategy:
9-
fail-fast: true
10-
matrix:
11-
os: [ubuntu-latest, windows-latest]
12-
php: [7.4]
13-
laravel: [7.*]
14-
dependency-version: [prefer-lowest, prefer-stable]
15-
include:
16-
- laravel: 7.*
17-
testbench: 5.*
18-
19-
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
20-
21-
steps:
22-
- name: Checkout code
23-
uses: actions/checkout@v2
24-
25-
- name: Cache dependencies
26-
uses: actions/cache@v1
27-
with:
28-
path: ~/.composer/cache/files
29-
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
30-
31-
- name: Setup PHP
32-
uses: shivammathur/setup-php@v1
33-
with:
34-
php-version: ${{ matrix.php }}
35-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
36-
coverage: none
37-
38-
- name: Install dependencies
39-
run: |
40-
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
41-
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
42-
43-
- name: Execute tests
44-
run: vendor/bin/phpunit
12+
test:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
fail-fast: true
16+
matrix:
17+
os: [ubuntu-latest, windows-latest]
18+
php: [7.4]
19+
laravel: [8.*]
20+
dependency-version: [prefer-lowest, prefer-stable]
21+
include:
22+
- laravel: 8.*
23+
testbench: 6.*
24+
25+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
26+
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v2
30+
31+
- name: Cache dependencies
32+
uses: actions/cache@v2
33+
with:
34+
path: ~/.composer/cache/files
35+
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
36+
37+
- name: Setup PHP
38+
uses: shivammathur/setup-php@v2
39+
with:
40+
php-version: ${{ matrix.php }}
41+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
42+
coverage: none
43+
44+
- name: Install dependencies
45+
run: |
46+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
47+
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
48+
49+
- name: Execute tests
50+
run: vendor/bin/phpunit

.gitignore

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
.idea
2+
.php_cs
3+
.php_cs.cache
4+
.phpunit.result.cache
15
build
26
composer.lock
3-
docs
4-
vendor
57
coverage
6-
.phpunit.result.cache
7-
.idea
8-
.php_cs.cache
9-
8+
phpunit.xml
9+
psalm.xml
10+
vendor

.php_cs renamed to .php_cs.dist

File renamed without changes.

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# :package_description
1+
# :package_name
22

33
[![Latest Version on Packagist](https://img.shields.io/packagist/v/rawilk/:package_name.svg?style=flat-square)](https://packagist.org/packages/rawilk/:package_name)
44
![Tests](https://github.com/rawilk/:package_name/workflows/Tests/badge.svg?style=flat-square)
@@ -13,7 +13,7 @@ This is where your description should go. Limit it to a paragraph or two. Consid
1313
You can install the package via composer:
1414

1515
```bash
16-
composer require rawilk/package-skeleton-laravel
16+
composer require :vendor_name/:package_name
1717
```
1818

1919
You can publish and run the migrations with:
@@ -54,7 +54,7 @@ Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed re
5454

5555
## Contributing
5656

57-
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
57+
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
5858

5959
## Security
6060

composer.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "rawilk/:package_name",
2+
"name": ":vendor_name/:package_name",
33
"description": ":package_description",
44
"keywords": [
5-
"rawilk",
5+
":vendor_name",
66
":package_name"
77
],
88
"homepage": "https://github.com/rawilk/:package_name",
@@ -20,9 +20,8 @@
2020
},
2121
"require-dev": {
2222
"friendsofphp/php-cs-fixer": "^2.16",
23-
"orchestra/testbench": "^5.0",
24-
"phpunit/phpunit": "^9.0",
25-
"psalm/plugin-laravel": "^1.2",
23+
"orchestra/testbench": "^6.0",
24+
"phpunit/phpunit": "^9.3",
2625
"vimeo/psalm": "^3.11"
2726
},
2827
"autoload": {

configure-skeleton.sh

+9-7
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,26 @@ author_username=$(ask_question "Author username" "$username_guess")
3030

3131
current_directory=$(pwd)
3232
folder_name=$(basename "$current_directory")
33-
package_name=$(ask_question "Package name" "$folder_name")
3433

34+
vendor_name_unsanitized=$(ask_question "Vendor name" "spatie")
35+
package_name=$(ask_question "Package name" "$folder_name")
3536
package_description=$(ask_question "Package description" "")
36-
class_name=$(echo "$package_name" | sed 's/[-_]/ /g' | awk '{for(j=1;j<=NF;j++){ $j=toupper(substr($j,1,1)) substr($j,2) }}1' | sed 's/[[:space:]]//g')
3737

38-
vendor_name_unsanitized=$(ask_question "Vendor name" "rawilk")
38+
class_name=$(echo "$package_name" | sed 's/[-_]/ /g' | awk '{for(j=1;j<=NF;j++){ $j=toupper(substr($j,1,1)) substr($j,2) }}1' | sed 's/[[:space:]]//g')
3939

4040
echo -e "Author: $author_name ($author_username, $author_email)"
4141
echo -e "Package: $package_name <$package_description>"
4242
echo -e "Suggested Class Name: $class_name"
4343

4444
vendor_name="$(tr '[:lower:]' '[:upper:]' <<< ${vendor_name_unsanitized:0:1})${vendor_name_unsanitized:1}"
45+
vendor_name_lowercase=`echo "$vendor_name_unsanitized" | tr '[:upper:]' '[:lower:]'`
4546
package_name_underscore=`echo "-$package_name-" | tr '-' '_'`
4647

4748
echo
48-
files=$(grep -E -r -l -i ":author|:package|rawilk|skeleton" ./* | grep -v "$script_name")
49+
files=$(grep -E -r -l -i ":author|:vendor|:package|rawilk|skeleton" --exclude-dir=vendor ./* | grep -v "$script_name")
4950

50-
echo "This script will replace the above values in all relevant files in the project directory and reset the git repository."
51-
if ! confirm "Modify composer.json and .MD Markdown files?" ; then
51+
echo "This script will replace the above values in all relevant files in the project directory."
52+
if ! confirm "Modify files?" ; then
5253
$safe_exit 1
5354
fi
5455

@@ -61,13 +62,14 @@ for file in $files ; do
6162
sed "s/:author_name/$author_name/g" \
6263
| sed "s/:author_username/$author_username/g" \
6364
| sed "s/:author_email/$author_email/g" \
65+
| sed "s/:vendor_name/$vendor_name_lowercase/g" \
6466
| sed "s/:package_name/$package_name/g" \
6567
| sed "s/Rawilk/$vendor_name/g" \
6668
| sed "s/_skeleton_/$package_name_underscore/g" \
6769
| sed "s/skeleton/$package_name/g" \
6870
| sed "s/Skeleton/$class_name/g" \
6971
| sed "s/:package_description/$package_description/g" \
70-
| sed "/^\*\*Note:\*\* Replace/d" \
72+
| sed "/^\*\*Note:\*\* Run/d" \
7173
> "$temp_file"
7274
rm -f "$file"
7375
new_file=`echo $file | sed -e "s/Skeleton/${class_name}/g"`

psalm.xml renamed to psalm.xml.dist

-7
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,4 @@
1414
<directory name="vendor"/>
1515
</ignoreFiles>
1616
</projectFiles>
17-
18-
<issueHandlers>
19-
</issueHandlers>
20-
21-
<plugins>
22-
<pluginClass class="Psalm\LaravelPlugin\Plugin"/>
23-
</plugins>
2417
</psalm>

0 commit comments

Comments
 (0)