Skip to content

Commit 101738e

Browse files
authored
[CI, CD] Split repo to small package (composer and repository for read-only) (#238)
* refactor: add composer file each package * add helper file autoload * add license each package * fix typo package name (case) * add self version composer * fix typo package name (case) * update dependency in composer database * update composer dep for support and text - best on new merged pr * add monorepo to cs fixer * reefactor: change monorepo rule * remove split project for integrate * ci: add split repo workflows * ci: add close pr in splited repo
1 parent d3da1cf commit 101738e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+950
-15
lines changed

.github/workflows/split.yaml

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Split Test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- '*'
9+
10+
env:
11+
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
12+
13+
jobs:
14+
packages_split:
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
package:
21+
-
22+
local_path: 'Collection'
23+
split_repository: 'collection'
24+
-
25+
local_path: 'Console'
26+
split_repository: 'console'
27+
-
28+
local_path: 'Container'
29+
split_repository: 'container'
30+
-
31+
local_path: 'Cron'
32+
split_repository: 'cron'
33+
-
34+
local_path: 'Database'
35+
split_repository: 'database'
36+
-
37+
local_path: 'File'
38+
split_repository: 'file'
39+
-
40+
local_path: 'Http'
41+
split_repository: 'http'
42+
-
43+
local_path: 'Macroable'
44+
split_repository: 'macroable'
45+
-
46+
local_path: 'Router'
47+
split_repository: 'router'
48+
-
49+
local_path: 'Security'
50+
split_repository: 'security'
51+
-
52+
local_path: 'Support'
53+
split_repository: 'support'
54+
-
55+
local_path: 'Template'
56+
split_repository: 'template'
57+
-
58+
local_path: 'Text'
59+
split_repository: 'text'
60+
-
61+
local_path: 'Time'
62+
split_repository: 'time'
63+
-
64+
local_path: 'View'
65+
split_repository: 'view'
66+
67+
steps:
68+
- uses: actions/checkout@v3
69+
70+
-
71+
if: startsWith(github.ref, 'refs/tags/')
72+
uses: "symplify/monorepo-split-github-action@v2.3.0"
73+
with:
74+
tag: ${GITHUB_REF#refs/tags/}
75+
76+
package_directory: 'src/System/${{ matrix.package.local_path }}'
77+
78+
repository_organization: 'SonyPradana'
79+
repository_name: '${{ matrix.package.split_repository }}'
80+
81+
user_name: "SonyPradana"
82+
user_email: "sonypradana@gmail.com"

.php-cs-fixer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
->in(__DIR__ . DIRECTORY_SEPARATOR . 'tests')
55
->in(__DIR__ . DIRECTORY_SEPARATOR . 'src')
66
->exclude(__DIR__ . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'Template')
7-
->append(['.php-cs-fixer.php', 'rector.php']);
7+
->append(['.php-cs-fixer.php', 'monorepo-builder.php', 'rector.php']);
88

99
$rules = [
1010
'@Symfony' => true,

composer.json

+31-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"name": "sonypradana/php-library",
33
"description": "library to build php mvc",
4-
"keywords": ["framework", "php-mvc", "php-library"],
4+
"keywords": [
5+
"framework",
6+
"php-mvc",
7+
"php-library"
8+
],
59
"license": "MIT",
610
"authors": [
711
{
@@ -20,6 +24,7 @@
2024
"mockery/mockery": "^1.6",
2125
"friendsofphp/php-cs-fixer": "^3.52",
2226
"phpstan/phpstan": "^1.10",
27+
"symplify/monorepo-builder": "^11.2",
2328
"rector/rector": "^1.0"
2429
},
2530
"autoload": {
@@ -28,11 +33,11 @@
2833
"System\\Support\\": "src/System/Macroable"
2934
},
3035
"files": [
31-
"src/System/Collection/helper.php",
32-
"src/System/Integrate/helper.php",
33-
"src/System/Console/helper.php",
34-
"src/System/Text/helper.php",
35-
"src/System/Time/helper.php"
36+
"src/System/Collection/helper.php",
37+
"src/System/Integrate/helper.php",
38+
"src/System/Console/helper.php",
39+
"src/System/Text/helper.php",
40+
"src/System/Time/helper.php"
3641
]
3742
},
3843
"autoload-dev": {
@@ -43,18 +48,28 @@
4348
"tests/Integrate/Commands/CommandTest.php"
4449
]
4550
},
51+
"replace": {
52+
"sonypradana/collection": "0.35.0",
53+
"sonypradana/console": "0.35.0",
54+
"sonypradana/container": "0.35.0",
55+
"sonypradana/cron": "0.35.0",
56+
"sonypradana/database": "0.35.0",
57+
"sonypradana/file": "0.35.0",
58+
"sonypradana/http": "0.35.0",
59+
"sonypradana/integrate": "0.35.0",
60+
"sonypradana/router": "0.35.0",
61+
"sonypradana/security": "0.35.0",
62+
"sonypradana/support": "0.35.0",
63+
"sonypradana/template": "0.35.0",
64+
"sonypradana/text": "0.35.0",
65+
"sonypradana/time": "0.35.0",
66+
"sonypradana/view": "0.35.0"
67+
},
4668
"extra": {
47-
"laravel": {
48-
"dont-discover": [
49-
"*"
50-
]
51-
},
5269
"branch-alias": {
5370
"dev-master": "0.x-dev"
5471
}
5572
},
56-
"minimum-stability": "dev",
57-
"prefer-stable": true,
5873
"scripts": {
5974
"refacto": "rector",
6075
"lint": "php-cs-fixer fix -v",
@@ -74,5 +89,7 @@
7489
"phpstan analyse --ansi --memory-limit=-1",
7590
"phpunit --exclude-group database"
7691
]
77-
}
92+
},
93+
"minimum-stability": "dev",
94+
"prefer-stable": true
7895
}

monorepo-builder.php

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Symplify\MonorepoBuilder\Config\MBConfig;
6+
use Symplify\MonorepoBuilder\Release\ReleaseWorker\PushTagReleaseWorker;
7+
use Symplify\MonorepoBuilder\Release\ReleaseWorker\SetCurrentMutualDependenciesReleaseWorker;
8+
use Symplify\MonorepoBuilder\Release\ReleaseWorker\TagVersionReleaseWorker;
9+
use Symplify\MonorepoBuilder\Release\ReleaseWorker\UpdateReplaceReleaseWorker;
10+
11+
return static function (MBConfig $config): void {
12+
$config->packageDirectories([__DIR__ . '/src/System']);
13+
$config->disableDefaultWorkers();
14+
15+
$config->workers([
16+
// update root composer json
17+
UpdateReplaceReleaseWorker::class,
18+
// update child composer json
19+
SetCurrentMutualDependenciesReleaseWorker::class,
20+
// local tag
21+
TagVersionReleaseWorker::class,
22+
// push tag
23+
PushTagReleaseWorker::class,
24+
]);
25+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Close Pull Request
2+
3+
on:
4+
pull_request_target:
5+
types: [opened]
6+
7+
jobs:
8+
run:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: superbrothers/close-pull-request@v3
12+
with:
13+
comment: "Thank you for your pull request. However, this repository is a read-only sub-split. Please submit your PR to https://github.com/sonypradana/php-library instead. Thanks!"

src/System/Collection/LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021-2024 Angger Pradana
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

src/System/Collection/composer.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "sonypradana/collection",
3+
"description": "part of php-library, manage array using collection",
4+
"authors": [
5+
{
6+
"name": "Angger Pradana",
7+
"email": "sonypradana@gmail.com"
8+
}
9+
],
10+
"require": {
11+
"php": "^8.0"
12+
},
13+
"autoload": {
14+
"psr-4": {
15+
"System\\Collection\\": ""
16+
},
17+
"files": [
18+
"helper.php"
19+
]
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Close Pull Request
2+
3+
on:
4+
pull_request_target:
5+
types: [opened]
6+
7+
jobs:
8+
run:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: superbrothers/close-pull-request@v3
12+
with:
13+
comment: "Thank you for your pull request. However, this repository is a read-only sub-split. Please submit your PR to https://github.com/sonypradana/php-library instead. Thanks!"

src/System/Console/LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021-2024 Angger Pradana
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

src/System/Console/composer.json

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "sonypradana/console",
3+
"description": "part of php-library, console",
4+
"authors": [
5+
{
6+
"name": "Angger Pradana",
7+
"email": "sonypradana@gmail.com"
8+
}
9+
],
10+
"require": {
11+
"php": "^8.0",
12+
"sonypradana/validator": "^0.8",
13+
"sonypradana/text": "^0.35"
14+
},
15+
"autoload": {
16+
"psr-4": {
17+
"System\\Console\\": ""
18+
},
19+
"files": [
20+
"helper.php"
21+
]
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Close Pull Request
2+
3+
on:
4+
pull_request_target:
5+
types: [opened]
6+
7+
jobs:
8+
run:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: superbrothers/close-pull-request@v3
12+
with:
13+
comment: "Thank you for your pull request. However, this repository is a read-only sub-split. Please submit your PR to https://github.com/sonypradana/php-library instead. Thanks!"

src/System/Container/LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021-2024 Angger Pradana
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

src/System/Container/composer.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "sonypradana/container",
3+
"description": "part of php-library, dependency injection container",
4+
"authors": [
5+
{
6+
"name": "Angger Pradana",
7+
"email": "sonypradana@gmail.com"
8+
}
9+
],
10+
"require": {
11+
"php": "^8.0",
12+
"php-di/php-di": "^7.0"
13+
},
14+
"autoload": {
15+
"psr-4": {
16+
"System\\Container\\": ""
17+
}
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Close Pull Request
2+
3+
on:
4+
pull_request_target:
5+
types: [opened]
6+
7+
jobs:
8+
run:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: superbrothers/close-pull-request@v3
12+
with:
13+
comment: "Thank you for your pull request. However, this repository is a read-only sub-split. Please submit your PR to https://github.com/sonypradana/php-library instead. Thanks!"

0 commit comments

Comments
 (0)