wexample-wex-addon-dev-php 0.0.16__tar.gz → 0.0.18__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {wexample_wex_addon_dev_php-0.0.16 → wexample_wex_addon_dev_php-0.0.18}/PKG-INFO +69 -13
- {wexample_wex_addon_dev_php-0.0.16 → wexample_wex_addon_dev_php-0.0.18}/README.md +65 -9
- {wexample_wex_addon_dev_php-0.0.16 → wexample_wex_addon_dev_php-0.0.18}/pyproject.toml +4 -4
- wexample_wex_addon_dev_php-0.0.18/src/wexample_wex_addon_dev_php/config_value/php_package_readme_config_value.py +14 -0
- wexample_wex_addon_dev_php-0.0.18/src/wexample_wex_addon_dev_php/file/php_composer_json_file.py +81 -0
- wexample_wex_addon_dev_php-0.0.18/src/wexample_wex_addon_dev_php/workdir/__init__.py +0 -0
- wexample_wex_addon_dev_php-0.0.18/src/wexample_wex_addon_dev_php/workdir/php_package_workdir.py +88 -0
- wexample_wex_addon_dev_php-0.0.18/src/wexample_wex_addon_dev_php/workdir/php_workdir.py +127 -0
- wexample_wex_addon_dev_php-0.0.16/src/wexample_wex_addon_dev_php/workdir/php_package_workdir.py +0 -7
- wexample_wex_addon_dev_php-0.0.16/src/wexample_wex_addon_dev_php/workdir/php_workdir.py +0 -64
- {wexample_wex_addon_dev_php-0.0.16 → wexample_wex_addon_dev_php-0.0.18}/src/wexample_wex_addon_dev_php/__init__.py +0 -0
- {wexample_wex_addon_dev_php-0.0.16 → wexample_wex_addon_dev_php-0.0.18}/src/wexample_wex_addon_dev_php/__pycache__/__init__.py +0 -0
- {wexample_wex_addon_dev_php-0.0.16/src/wexample_wex_addon_dev_php/file → wexample_wex_addon_dev_php-0.0.18/src/wexample_wex_addon_dev_php/config_value}/__init__.py +0 -0
- {wexample_wex_addon_dev_php-0.0.16/src/wexample_wex_addon_dev_php/workdir → wexample_wex_addon_dev_php-0.0.18/src/wexample_wex_addon_dev_php/file}/__init__.py +0 -0
- {wexample_wex_addon_dev_php-0.0.16 → wexample_wex_addon_dev_php-0.0.18}/src/wexample_wex_addon_dev_php/php_addon_manager.py +0 -0
- {wexample_wex_addon_dev_php-0.0.16 → wexample_wex_addon_dev_php-0.0.18}/src/wexample_wex_addon_dev_php/py.typed +0 -0
- {wexample_wex_addon_dev_php-0.0.16 → wexample_wex_addon_dev_php-0.0.18}/src/wexample_wex_addon_dev_php/workdir/php_laravel_workdir.py +0 -0
- {wexample_wex_addon_dev_php-0.0.16 → wexample_wex_addon_dev_php-0.0.18}/src/wexample_wex_addon_dev_php/workdir/php_packages_suite_workdir.py +0 -0
- {wexample_wex_addon_dev_php-0.0.16 → wexample_wex_addon_dev_php-0.0.18}/src/wexample_wex_addon_dev_php/workdir/php_symfony_workdir.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: wexample-wex-addon-dev-php
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.18
|
|
4
4
|
Summary: Python dev addon for wex
|
|
5
5
|
Author-Email: weeger <contact@wexample.com>
|
|
6
6
|
License: MIT
|
|
@@ -11,20 +11,59 @@ Project-URL: homepage, https://github.com/wexample/python-wex-dev-python
|
|
|
11
11
|
Requires-Python: >=3.10
|
|
12
12
|
Requires-Dist: attrs>=23.1.0
|
|
13
13
|
Requires-Dist: cattrs>=23.1.0
|
|
14
|
-
Requires-Dist: wexample-
|
|
15
|
-
Requires-Dist: wexample-wex-
|
|
14
|
+
Requires-Dist: wexample-filestate-php==0.0.13
|
|
15
|
+
Requires-Dist: wexample-wex-addon-app==0.0.54
|
|
16
|
+
Requires-Dist: wexample-wex-core==6.0.66
|
|
16
17
|
Provides-Extra: dev
|
|
17
18
|
Requires-Dist: pytest; extra == "dev"
|
|
18
19
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
19
|
-
Requires-Dist: wexample-filestate-php==0.0.1; extra == "dev"
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
|
|
22
22
|
# wexample-wex-addon-dev-php
|
|
23
23
|
|
|
24
|
-
Version: 0.0.
|
|
24
|
+
Version: 0.0.18
|
|
25
25
|
|
|
26
26
|
Python dev addon for wex
|
|
27
27
|
|
|
28
|
+
## Table of Contents
|
|
29
|
+
|
|
30
|
+
- [Status Compatibility](#status-compatibility)
|
|
31
|
+
- [Api Reference](#api-reference)
|
|
32
|
+
- [Tests](#tests)
|
|
33
|
+
- [Code Quality](#code-quality)
|
|
34
|
+
- [Versioning](#versioning)
|
|
35
|
+
- [Changelog](#changelog)
|
|
36
|
+
- [Migration Notes](#migration-notes)
|
|
37
|
+
- [Roadmap](#roadmap)
|
|
38
|
+
- [Security](#security)
|
|
39
|
+
- [Privacy](#privacy)
|
|
40
|
+
- [Support](#support)
|
|
41
|
+
- [Contribution Guidelines](#contribution-guidelines)
|
|
42
|
+
- [Maintainers](#maintainers)
|
|
43
|
+
- [License](#license)
|
|
44
|
+
- [Useful Links](#useful-links)
|
|
45
|
+
- [Suite Integration](#suite-integration)
|
|
46
|
+
- [Compatibility Matrix](#compatibility-matrix)
|
|
47
|
+
- [Dependencies](#dependencies)
|
|
48
|
+
- [Suite Signature](#suite-signature)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## Status & Compatibility
|
|
52
|
+
|
|
53
|
+
**Maturity**: Production-ready
|
|
54
|
+
|
|
55
|
+
**Python Support**: >=3.10
|
|
56
|
+
|
|
57
|
+
**OS Support**: Linux, macOS, Windows
|
|
58
|
+
|
|
59
|
+
**Status**: Actively maintained
|
|
60
|
+
|
|
61
|
+
## API Reference
|
|
62
|
+
|
|
63
|
+
Full API documentation is available in the source code docstrings.
|
|
64
|
+
|
|
65
|
+
Key modules and classes are documented with type hints for better IDE support.
|
|
66
|
+
|
|
28
67
|
## Tests
|
|
29
68
|
|
|
30
69
|
This project uses `pytest` for testing and `pytest-cov` for code coverage analysis.
|
|
@@ -111,13 +150,13 @@ Breaking changes are clearly documented with upgrade paths and examples.
|
|
|
111
150
|
|
|
112
151
|
Current limitations and planned features are tracked in the GitHub issues.
|
|
113
152
|
|
|
114
|
-
See the [project roadmap](https://github.com/wexample/python-
|
|
153
|
+
See the [project roadmap](https://github.com/wexample/python-wex_addon_dev_php/issues) for upcoming features and improvements.
|
|
115
154
|
|
|
116
155
|
## Security Policy
|
|
117
156
|
|
|
118
157
|
### Reporting Vulnerabilities
|
|
119
158
|
|
|
120
|
-
If you discover a security vulnerability, please email
|
|
159
|
+
If you discover a security vulnerability, please email contact@wexample.com.
|
|
121
160
|
|
|
122
161
|
**Do not** open public issues for security vulnerabilities.
|
|
123
162
|
|
|
@@ -140,7 +179,7 @@ Community support is available through GitHub Discussions.
|
|
|
140
179
|
|
|
141
180
|
## Contribution Guidelines
|
|
142
181
|
|
|
143
|
-
We welcome contributions to the Wexample suite!
|
|
182
|
+
We welcome contributions to the Wexample suite!
|
|
144
183
|
|
|
145
184
|
### How to Contribute
|
|
146
185
|
|
|
@@ -158,14 +197,16 @@ See [CONTRIBUTORS.md](CONTRIBUTORS.md) for the full list of contributors.
|
|
|
158
197
|
|
|
159
198
|
## License
|
|
160
199
|
|
|
161
|
-
MIT
|
|
200
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
201
|
+
|
|
202
|
+
Free to use in both personal and commercial projects.
|
|
162
203
|
|
|
163
204
|
## Useful Links
|
|
164
205
|
|
|
165
|
-
- **Homepage**: https://github.com/wexample/python-wex-dev-
|
|
206
|
+
- **Homepage**: https://github.com/wexample/python-wex-addon-dev-php
|
|
166
207
|
- **Documentation**: [docs.wexample.com](https://docs.wexample.com)
|
|
167
|
-
- **Issue Tracker**: https://github.com/wexample/python-wex-dev-
|
|
168
|
-
- **Discussions**: https://github.com/wexample/python-wex-dev-
|
|
208
|
+
- **Issue Tracker**: https://github.com/wexample/python-wex-addon-dev-php/issues
|
|
209
|
+
- **Discussions**: https://github.com/wexample/python-wex-addon-dev-php/discussions
|
|
169
210
|
- **PyPI**: [pypi.org/project/wexample-wex-addon-dev-php](https://pypi.org/project/wexample-wex-addon-dev-php/)
|
|
170
211
|
|
|
171
212
|
## Integration in the Suite
|
|
@@ -178,9 +219,24 @@ The suite includes packages for configuration management, file handling, prompts
|
|
|
178
219
|
|
|
179
220
|
Visit the [Wexample Suite documentation](https://docs.wexample.com) for the complete package ecosystem.
|
|
180
221
|
|
|
222
|
+
## Compatibility Matrix
|
|
223
|
+
|
|
224
|
+
This package is part of the Wexample suite and is compatible with other suite packages.
|
|
225
|
+
|
|
226
|
+
Refer to each package's documentation for specific version compatibility requirements.
|
|
227
|
+
|
|
228
|
+
## Dependencies
|
|
229
|
+
|
|
230
|
+
- attrs: >=23.1.0
|
|
231
|
+
- cattrs: >=23.1.0
|
|
232
|
+
- wexample-filestate-php: ==0.0.13
|
|
233
|
+
- wexample-wex-addon-app: ==0.0.54
|
|
234
|
+
- wexample-wex-core: ==6.0.66
|
|
235
|
+
|
|
236
|
+
|
|
181
237
|
# About us
|
|
182
238
|
|
|
183
|
-
Wexample stands as a cornerstone of the digital ecosystem — a collective of seasoned engineers, researchers, and creators driven by a relentless pursuit of technological excellence. More than a media platform, it has grown into a vibrant community where innovation meets craftsmanship, and where every line of code reflects a commitment to clarity, durability, and shared intelligence.
|
|
239
|
+
[Wexample](https://wexample.com) stands as a cornerstone of the digital ecosystem — a collective of seasoned engineers, researchers, and creators driven by a relentless pursuit of technological excellence. More than a media platform, it has grown into a vibrant community where innovation meets craftsmanship, and where every line of code reflects a commitment to clarity, durability, and shared intelligence.
|
|
184
240
|
|
|
185
241
|
This packages suite embodies this spirit. Trusted by professionals and enthusiasts alike, it delivers a consistent, high-quality foundation for modern development — open, elegant, and battle-tested. Its reputation is built on years of collaboration, refinement, and rigorous attention to detail, making it a natural choice for those who demand both robustness and beauty in their tools.
|
|
186
242
|
|
|
@@ -1,9 +1,48 @@
|
|
|
1
1
|
# wexample-wex-addon-dev-php
|
|
2
2
|
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.18
|
|
4
4
|
|
|
5
5
|
Python dev addon for wex
|
|
6
6
|
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
- [Status Compatibility](#status-compatibility)
|
|
10
|
+
- [Api Reference](#api-reference)
|
|
11
|
+
- [Tests](#tests)
|
|
12
|
+
- [Code Quality](#code-quality)
|
|
13
|
+
- [Versioning](#versioning)
|
|
14
|
+
- [Changelog](#changelog)
|
|
15
|
+
- [Migration Notes](#migration-notes)
|
|
16
|
+
- [Roadmap](#roadmap)
|
|
17
|
+
- [Security](#security)
|
|
18
|
+
- [Privacy](#privacy)
|
|
19
|
+
- [Support](#support)
|
|
20
|
+
- [Contribution Guidelines](#contribution-guidelines)
|
|
21
|
+
- [Maintainers](#maintainers)
|
|
22
|
+
- [License](#license)
|
|
23
|
+
- [Useful Links](#useful-links)
|
|
24
|
+
- [Suite Integration](#suite-integration)
|
|
25
|
+
- [Compatibility Matrix](#compatibility-matrix)
|
|
26
|
+
- [Dependencies](#dependencies)
|
|
27
|
+
- [Suite Signature](#suite-signature)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Status & Compatibility
|
|
31
|
+
|
|
32
|
+
**Maturity**: Production-ready
|
|
33
|
+
|
|
34
|
+
**Python Support**: >=3.10
|
|
35
|
+
|
|
36
|
+
**OS Support**: Linux, macOS, Windows
|
|
37
|
+
|
|
38
|
+
**Status**: Actively maintained
|
|
39
|
+
|
|
40
|
+
## API Reference
|
|
41
|
+
|
|
42
|
+
Full API documentation is available in the source code docstrings.
|
|
43
|
+
|
|
44
|
+
Key modules and classes are documented with type hints for better IDE support.
|
|
45
|
+
|
|
7
46
|
## Tests
|
|
8
47
|
|
|
9
48
|
This project uses `pytest` for testing and `pytest-cov` for code coverage analysis.
|
|
@@ -90,13 +129,13 @@ Breaking changes are clearly documented with upgrade paths and examples.
|
|
|
90
129
|
|
|
91
130
|
Current limitations and planned features are tracked in the GitHub issues.
|
|
92
131
|
|
|
93
|
-
See the [project roadmap](https://github.com/wexample/python-
|
|
132
|
+
See the [project roadmap](https://github.com/wexample/python-wex_addon_dev_php/issues) for upcoming features and improvements.
|
|
94
133
|
|
|
95
134
|
## Security Policy
|
|
96
135
|
|
|
97
136
|
### Reporting Vulnerabilities
|
|
98
137
|
|
|
99
|
-
If you discover a security vulnerability, please email
|
|
138
|
+
If you discover a security vulnerability, please email contact@wexample.com.
|
|
100
139
|
|
|
101
140
|
**Do not** open public issues for security vulnerabilities.
|
|
102
141
|
|
|
@@ -119,7 +158,7 @@ Community support is available through GitHub Discussions.
|
|
|
119
158
|
|
|
120
159
|
## Contribution Guidelines
|
|
121
160
|
|
|
122
|
-
We welcome contributions to the Wexample suite!
|
|
161
|
+
We welcome contributions to the Wexample suite!
|
|
123
162
|
|
|
124
163
|
### How to Contribute
|
|
125
164
|
|
|
@@ -137,14 +176,16 @@ See [CONTRIBUTORS.md](CONTRIBUTORS.md) for the full list of contributors.
|
|
|
137
176
|
|
|
138
177
|
## License
|
|
139
178
|
|
|
140
|
-
MIT
|
|
179
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
180
|
+
|
|
181
|
+
Free to use in both personal and commercial projects.
|
|
141
182
|
|
|
142
183
|
## Useful Links
|
|
143
184
|
|
|
144
|
-
- **Homepage**: https://github.com/wexample/python-wex-dev-
|
|
185
|
+
- **Homepage**: https://github.com/wexample/python-wex-addon-dev-php
|
|
145
186
|
- **Documentation**: [docs.wexample.com](https://docs.wexample.com)
|
|
146
|
-
- **Issue Tracker**: https://github.com/wexample/python-wex-dev-
|
|
147
|
-
- **Discussions**: https://github.com/wexample/python-wex-dev-
|
|
187
|
+
- **Issue Tracker**: https://github.com/wexample/python-wex-addon-dev-php/issues
|
|
188
|
+
- **Discussions**: https://github.com/wexample/python-wex-addon-dev-php/discussions
|
|
148
189
|
- **PyPI**: [pypi.org/project/wexample-wex-addon-dev-php](https://pypi.org/project/wexample-wex-addon-dev-php/)
|
|
149
190
|
|
|
150
191
|
## Integration in the Suite
|
|
@@ -157,9 +198,24 @@ The suite includes packages for configuration management, file handling, prompts
|
|
|
157
198
|
|
|
158
199
|
Visit the [Wexample Suite documentation](https://docs.wexample.com) for the complete package ecosystem.
|
|
159
200
|
|
|
201
|
+
## Compatibility Matrix
|
|
202
|
+
|
|
203
|
+
This package is part of the Wexample suite and is compatible with other suite packages.
|
|
204
|
+
|
|
205
|
+
Refer to each package's documentation for specific version compatibility requirements.
|
|
206
|
+
|
|
207
|
+
## Dependencies
|
|
208
|
+
|
|
209
|
+
- attrs: >=23.1.0
|
|
210
|
+
- cattrs: >=23.1.0
|
|
211
|
+
- wexample-filestate-php: ==0.0.13
|
|
212
|
+
- wexample-wex-addon-app: ==0.0.54
|
|
213
|
+
- wexample-wex-core: ==6.0.66
|
|
214
|
+
|
|
215
|
+
|
|
160
216
|
# About us
|
|
161
217
|
|
|
162
|
-
Wexample stands as a cornerstone of the digital ecosystem — a collective of seasoned engineers, researchers, and creators driven by a relentless pursuit of technological excellence. More than a media platform, it has grown into a vibrant community where innovation meets craftsmanship, and where every line of code reflects a commitment to clarity, durability, and shared intelligence.
|
|
218
|
+
[Wexample](https://wexample.com) stands as a cornerstone of the digital ecosystem — a collective of seasoned engineers, researchers, and creators driven by a relentless pursuit of technological excellence. More than a media platform, it has grown into a vibrant community where innovation meets craftsmanship, and where every line of code reflects a commitment to clarity, durability, and shared intelligence.
|
|
163
219
|
|
|
164
220
|
This packages suite embodies this spirit. Trusted by professionals and enthusiasts alike, it delivers a consistent, high-quality foundation for modern development — open, elegant, and battle-tested. Its reputation is built on years of collaboration, refinement, and rigorous attention to detail, making it a natural choice for those who demand both robustness and beauty in their tools.
|
|
165
221
|
|
|
@@ -6,7 +6,7 @@ build-backend = "pdm.backend"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "wexample-wex-addon-dev-php"
|
|
9
|
-
version = "0.0.
|
|
9
|
+
version = "0.0.18"
|
|
10
10
|
description = "Python dev addon for wex"
|
|
11
11
|
authors = [
|
|
12
12
|
{ name = "weeger", email = "contact@wexample.com" },
|
|
@@ -20,8 +20,9 @@ classifiers = [
|
|
|
20
20
|
dependencies = [
|
|
21
21
|
"attrs>=23.1.0",
|
|
22
22
|
"cattrs>=23.1.0",
|
|
23
|
-
"wexample-
|
|
24
|
-
"wexample-wex-
|
|
23
|
+
"wexample-filestate-php==0.0.13",
|
|
24
|
+
"wexample-wex-addon-app==0.0.54",
|
|
25
|
+
"wexample-wex-core==6.0.66",
|
|
25
26
|
]
|
|
26
27
|
|
|
27
28
|
[project.readme]
|
|
@@ -38,7 +39,6 @@ homepage = "https://github.com/wexample/python-wex-dev-python"
|
|
|
38
39
|
dev = [
|
|
39
40
|
"pytest",
|
|
40
41
|
"pytest-cov",
|
|
41
|
-
"wexample-filestate-php==0.0.1",
|
|
42
42
|
]
|
|
43
43
|
|
|
44
44
|
[tool.setuptools.packages.find]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from wexample_helpers.decorator.base_class import base_class
|
|
4
|
+
from wexample_wex_addon_app.config_value.app_readme_config_value import (
|
|
5
|
+
AppReadmeConfigValue,
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@base_class
|
|
10
|
+
class PhpPackageReadmeContentConfigValue(AppReadmeConfigValue):
|
|
11
|
+
"""README generation for Php packages."""
|
|
12
|
+
|
|
13
|
+
def _get_app_description(self) -> str:
|
|
14
|
+
return self.workdir.get_app_config().get("description", "")
|
wexample_wex_addon_dev_php-0.0.18/src/wexample_wex_addon_dev_php/file/php_composer_json_file.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
|
|
5
|
+
from wexample_filestate.item.file.json_file import JsonFile
|
|
6
|
+
from wexample_helpers.decorator.base_class import base_class
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from wexample_wex_addon_app.workdir.code_base_workdir import CodeBaseWorkdir
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@base_class
|
|
13
|
+
class PhpComposerJsonFile(JsonFile):
|
|
14
|
+
def add_dependency(
|
|
15
|
+
self,
|
|
16
|
+
package_name: str,
|
|
17
|
+
version: str,
|
|
18
|
+
operator: str = "",
|
|
19
|
+
optional: bool = False,
|
|
20
|
+
group: None | str = None,
|
|
21
|
+
) -> bool:
|
|
22
|
+
"""
|
|
23
|
+
Add or update a Composer dependency.
|
|
24
|
+
Returns True if the dependency list changed.
|
|
25
|
+
"""
|
|
26
|
+
# Composer group
|
|
27
|
+
group_key = "require-dev" if group == "dev" else "require"
|
|
28
|
+
|
|
29
|
+
# Composer does not use operators like pip (==, >=, etc.)
|
|
30
|
+
# So operator is simply prepended if provided.
|
|
31
|
+
constraint = f"{operator}{version}".strip()
|
|
32
|
+
|
|
33
|
+
config = self.read_config()
|
|
34
|
+
|
|
35
|
+
# Extract or create dependency dictionary
|
|
36
|
+
deps_node = config.search(path=group_key, default={})
|
|
37
|
+
deps = deps_node.to_dict() if deps_node else {}
|
|
38
|
+
|
|
39
|
+
old = deps.get(package_name)
|
|
40
|
+
|
|
41
|
+
# Nothing changes
|
|
42
|
+
if old == constraint:
|
|
43
|
+
return False
|
|
44
|
+
|
|
45
|
+
# Apply change
|
|
46
|
+
deps[package_name] = constraint
|
|
47
|
+
|
|
48
|
+
config_updated = {}
|
|
49
|
+
config_updated[group_key] = deps
|
|
50
|
+
config.update_nested(data=config_updated)
|
|
51
|
+
|
|
52
|
+
self.write_config(config)
|
|
53
|
+
|
|
54
|
+
return True
|
|
55
|
+
|
|
56
|
+
def get_dependencies_versions(
|
|
57
|
+
self, optional: bool = False, group: str = "dev"
|
|
58
|
+
) -> dict[str, str]:
|
|
59
|
+
# Default values is not well managed in nested config value, for now.
|
|
60
|
+
require = self.read_config().search(path="require")
|
|
61
|
+
|
|
62
|
+
if not require:
|
|
63
|
+
return {}
|
|
64
|
+
|
|
65
|
+
return require.to_dict()
|
|
66
|
+
|
|
67
|
+
def dumps(self, content: dict | None = None) -> str:
|
|
68
|
+
import json
|
|
69
|
+
|
|
70
|
+
content = content or self.read_parsed()
|
|
71
|
+
|
|
72
|
+
package = self.find_package_workdir()
|
|
73
|
+
if package:
|
|
74
|
+
content["version"] = package.get_project_version()
|
|
75
|
+
|
|
76
|
+
return json.dumps(content or {}, ensure_ascii=False, indent=2)
|
|
77
|
+
|
|
78
|
+
def find_package_workdir(self) -> CodeBaseWorkdir | None:
|
|
79
|
+
from wexample_wex_addon_app.workdir.code_base_workdir import CodeBaseWorkdir
|
|
80
|
+
|
|
81
|
+
return self.find_closest(CodeBaseWorkdir)
|
|
File without changes
|
wexample_wex_addon_dev_php-0.0.18/src/wexample_wex_addon_dev_php/workdir/php_package_workdir.py
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
|
|
5
|
+
from wexample_helpers.helpers.string import string_to_pascal_case
|
|
6
|
+
from wexample_helpers_git.helpers.git import (
|
|
7
|
+
git_tag_exists,
|
|
8
|
+
git_tag_annotated,
|
|
9
|
+
)
|
|
10
|
+
from wexample_wex_addon_app.workdir.framework_packages_suite_workdir import (
|
|
11
|
+
FrameworkPackageSuiteWorkdir,
|
|
12
|
+
)
|
|
13
|
+
from wexample_wex_addon_dev_php.workdir.php_workdir import PhpWorkdir
|
|
14
|
+
|
|
15
|
+
if TYPE_CHECKING:
|
|
16
|
+
from wexample_filestate.config_value.readme_content_config_value import (
|
|
17
|
+
ReadmeContentConfigValue,
|
|
18
|
+
)
|
|
19
|
+
from wexample_filestate.utils.search_result import SearchResult
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class PhpPackageWorkdir(PhpWorkdir):
|
|
23
|
+
def _get_readme_content(self) -> ReadmeContentConfigValue | None:
|
|
24
|
+
from wexample_wex_addon_dev_php.config_value.php_package_readme_config_value import (
|
|
25
|
+
PhpPackageReadmeContentConfigValue,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
return PhpPackageReadmeContentConfigValue(workdir=self)
|
|
29
|
+
|
|
30
|
+
def _get_suite_package_workdir_class(self) -> type[FrameworkPackageSuiteWorkdir]:
|
|
31
|
+
from wexample_wex_addon_dev_php.workdir.php_packages_suite_workdir import (
|
|
32
|
+
PhpPackagesSuiteWorkdir,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
return PhpPackagesSuiteWorkdir
|
|
36
|
+
|
|
37
|
+
def get_package_import_name(self) -> str:
|
|
38
|
+
"""Get the full package import name with vendor prefix."""
|
|
39
|
+
return f"{string_to_pascal_case(self.get_vendor_name())}\\{string_to_pascal_case(self.get_project_name())}"
|
|
40
|
+
|
|
41
|
+
def search_imports_in_codebase(
|
|
42
|
+
self, searched_package: "PhpPackageWorkdir"
|
|
43
|
+
) -> list["SearchResult"]:
|
|
44
|
+
"""Find PHP `use`/qualified references to the given package."""
|
|
45
|
+
import re
|
|
46
|
+
|
|
47
|
+
pkg = re.escape(searched_package.get_package_import_name())
|
|
48
|
+
pattern = rf"(?m)^\s*use\s+{pkg}(?:\\\\[\w]+)*\s*;|{pkg}(?:\\\\[\w]+)*"
|
|
49
|
+
return self.search_in_codebase(pattern, regex=True, flags=re.MULTILINE)
|
|
50
|
+
|
|
51
|
+
def search_in_codebase(
|
|
52
|
+
self, string: str, *, regex: bool = False, flags: int = 0
|
|
53
|
+
) -> list["SearchResult"]:
|
|
54
|
+
from wexample_filestate.utils.search_result import SearchResult
|
|
55
|
+
from wexample_filestate_php.file.php_file import PhpFile
|
|
56
|
+
|
|
57
|
+
found: list[SearchResult] = []
|
|
58
|
+
|
|
59
|
+
def _search(item: PhpFile) -> None:
|
|
60
|
+
found.extend(
|
|
61
|
+
SearchResult.create_for_all_matches(
|
|
62
|
+
string, item, regex=regex, flags=flags
|
|
63
|
+
)
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
self.for_each_child_of_type_recursive(callback=_search, class_type=PhpFile)
|
|
67
|
+
|
|
68
|
+
return found
|
|
69
|
+
|
|
70
|
+
def _publish(self, force: bool = False) -> None:
|
|
71
|
+
"""Add a Packagist-friendly tag (vX.Y.Z) in addition to default tagging."""
|
|
72
|
+
tag = f"v{self.get_project_version()}"
|
|
73
|
+
cwd = self.get_path()
|
|
74
|
+
|
|
75
|
+
if git_tag_exists(tag, cwd=cwd, inherit_stdio=False) and not force:
|
|
76
|
+
self.log(
|
|
77
|
+
f"Tag {tag} already exists, skipping creation (use --force to re-tag)."
|
|
78
|
+
)
|
|
79
|
+
else:
|
|
80
|
+
git_tag_annotated(tag, f"Release {tag}", cwd=cwd, inherit_stdio=True)
|
|
81
|
+
|
|
82
|
+
# Uses git repo to deploy packages.
|
|
83
|
+
self.push_to_deployment_remote()
|
|
84
|
+
|
|
85
|
+
def get_package_name(self) -> str:
|
|
86
|
+
from wexample_helpers.helpers.string import string_to_kebab_case
|
|
87
|
+
|
|
88
|
+
return f"{string_to_kebab_case(self.get_vendor_name())}/{string_to_kebab_case(self.get_project_name())}"
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
|
|
5
|
+
from wexample_filestate_php.option.php.phpcs_fixer_option import PhpcsFixerOption
|
|
6
|
+
from wexample_wex_addon_app.workdir.code_base_workdir import CodeBaseWorkdir
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from wexample_config.const.types import DictConfig
|
|
10
|
+
from wexample_config.options_provider.abstract_options_provider import (
|
|
11
|
+
AbstractOptionsProvider,
|
|
12
|
+
)
|
|
13
|
+
from wexample_filestate.option.children_file_factory_option import (
|
|
14
|
+
ChildrenFileFactoryOption,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
from wexample_wex_addon_dev_php.file.php_composer_json_file import (
|
|
18
|
+
PhpComposerJsonFile,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class PhpWorkdir(CodeBaseWorkdir):
|
|
23
|
+
def get_app_config_file(self, reload: bool = True) -> PhpComposerJsonFile:
|
|
24
|
+
from wexample_wex_addon_dev_php.file.php_composer_json_file import (
|
|
25
|
+
PhpComposerJsonFile,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
config_file = self.find_by_type(PhpComposerJsonFile)
|
|
29
|
+
# Read once to populate content with file source.
|
|
30
|
+
config_file.read_text(reload=reload)
|
|
31
|
+
return config_file
|
|
32
|
+
|
|
33
|
+
def get_dependencies_versions(self) -> dict[str, str]:
|
|
34
|
+
return self.get_app_config_file().get_dependencies_versions()
|
|
35
|
+
|
|
36
|
+
def get_main_code_file_extension(self) -> str:
|
|
37
|
+
from wexample_filestate_php.const.php_file import PHP_FILE_EXTENSION
|
|
38
|
+
|
|
39
|
+
return PHP_FILE_EXTENSION
|
|
40
|
+
|
|
41
|
+
def get_options_providers(self) -> list[type[AbstractOptionsProvider]]:
|
|
42
|
+
from wexample_filestate_php.options_provider.php_options_provider import (
|
|
43
|
+
PhpOptionsProvider,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
options = super().get_options_providers()
|
|
47
|
+
|
|
48
|
+
options.extend(
|
|
49
|
+
[
|
|
50
|
+
PhpOptionsProvider,
|
|
51
|
+
]
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
return options
|
|
55
|
+
|
|
56
|
+
def prepare_value(self, raw_value: DictConfig | None = None) -> DictConfig:
|
|
57
|
+
from wexample_filestate.const.disk import DiskItemType
|
|
58
|
+
from wexample_helpers.helpers.array import array_dict_get_by
|
|
59
|
+
|
|
60
|
+
from wexample_wex_addon_dev_php.file.php_composer_json_file import (
|
|
61
|
+
PhpComposerJsonFile,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
raw_value = super().prepare_value(raw_value=raw_value)
|
|
65
|
+
|
|
66
|
+
# Ensure a composer.json file exists for any PHP package project
|
|
67
|
+
children = raw_value["children"]
|
|
68
|
+
|
|
69
|
+
children.append(
|
|
70
|
+
{
|
|
71
|
+
"class": PhpComposerJsonFile,
|
|
72
|
+
"name": "composer.json",
|
|
73
|
+
"type": DiskItemType.FILE,
|
|
74
|
+
"should_exist": True,
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
# Add rules to .gitignore
|
|
79
|
+
array_dict_get_by("name", ".gitignore", children).setdefault(
|
|
80
|
+
"should_contain_lines", []
|
|
81
|
+
).extend(
|
|
82
|
+
[
|
|
83
|
+
".php-cs-fixer.cache",
|
|
84
|
+
".scannerwork",
|
|
85
|
+
"/vendor",
|
|
86
|
+
]
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
children.extend(
|
|
90
|
+
[
|
|
91
|
+
{
|
|
92
|
+
"name": "tests",
|
|
93
|
+
"type": DiskItemType.DIRECTORY,
|
|
94
|
+
"should_exist": True,
|
|
95
|
+
"children": [
|
|
96
|
+
self._create_php_file_children_filter(),
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "src",
|
|
101
|
+
"type": DiskItemType.DIRECTORY,
|
|
102
|
+
"should_exist": True,
|
|
103
|
+
"children": [
|
|
104
|
+
self._create_php_file_children_filter(),
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
]
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
return raw_value
|
|
111
|
+
|
|
112
|
+
def _create_php_file_children_filter(self) -> ChildrenFileFactoryOption:
|
|
113
|
+
from wexample_filestate.const.disk import DiskItemType
|
|
114
|
+
from wexample_filestate.option.children_filter_option import (
|
|
115
|
+
ChildrenFilterOption,
|
|
116
|
+
)
|
|
117
|
+
from wexample_filestate_php.file.php_file import PhpFile
|
|
118
|
+
|
|
119
|
+
return ChildrenFilterOption(
|
|
120
|
+
pattern={
|
|
121
|
+
"class": PhpFile,
|
|
122
|
+
"type": DiskItemType.FILE,
|
|
123
|
+
"php": [PhpcsFixerOption.get_name()],
|
|
124
|
+
},
|
|
125
|
+
name_pattern=r"^.*\.php$",
|
|
126
|
+
recursive=True,
|
|
127
|
+
)
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import TYPE_CHECKING
|
|
4
|
-
|
|
5
|
-
from wexample_wex_addon_app.workdir.code_base_workdir import CodeBaseWorkdir
|
|
6
|
-
|
|
7
|
-
if TYPE_CHECKING:
|
|
8
|
-
from wexample_config.const.types import DictConfig
|
|
9
|
-
from wexample_filestate.option.children_file_factory_option import (
|
|
10
|
-
ChildrenFileFactoryOption,
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class PhpWorkdir(CodeBaseWorkdir):
|
|
15
|
-
def get_dependencies(self) -> list[str]:
|
|
16
|
-
# TODO search in composer.json
|
|
17
|
-
return []
|
|
18
|
-
|
|
19
|
-
def prepare_value(self, raw_value: DictConfig | None = None) -> DictConfig:
|
|
20
|
-
from wexample_filestate.const.disk import DiskItemType
|
|
21
|
-
from wexample_helpers.helpers.array import array_dict_get_by
|
|
22
|
-
|
|
23
|
-
raw_value = super().prepare_value(raw_value=raw_value)
|
|
24
|
-
|
|
25
|
-
# Ensure a composer.json file exists for any PHP package project
|
|
26
|
-
children = raw_value["children"]
|
|
27
|
-
|
|
28
|
-
children.append(
|
|
29
|
-
{
|
|
30
|
-
"name": "composer.json",
|
|
31
|
-
"type": DiskItemType.FILE,
|
|
32
|
-
"should_exist": True,
|
|
33
|
-
}
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
# Add rules to .gitignore
|
|
37
|
-
array_dict_get_by("name", ".gitignore", children).setdefault(
|
|
38
|
-
"should_contain_lines", []
|
|
39
|
-
).extend(
|
|
40
|
-
[
|
|
41
|
-
".php-cs-fixer.cache",
|
|
42
|
-
".scannerwork",
|
|
43
|
-
"/vendor",
|
|
44
|
-
]
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
return raw_value
|
|
48
|
-
|
|
49
|
-
def _create_php_file_children_filter(self) -> ChildrenFileFactoryOption:
|
|
50
|
-
from wexample_filestate.const.disk import DiskItemType
|
|
51
|
-
from wexample_filestate.option.children_filter_option import (
|
|
52
|
-
ChildrenFilterOption,
|
|
53
|
-
)
|
|
54
|
-
from wexample_filestate_php.file.php_file import PhpFile
|
|
55
|
-
|
|
56
|
-
return ChildrenFilterOption(
|
|
57
|
-
pattern={
|
|
58
|
-
"class": PhpFile,
|
|
59
|
-
"name_pattern": r"^.*\.php$",
|
|
60
|
-
"type": DiskItemType.FILE,
|
|
61
|
-
"python": [],
|
|
62
|
-
},
|
|
63
|
-
recursive=True,
|
|
64
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|