wexample-wex-addon-dev-javascript 0.0.57__tar.gz → 0.1.0__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.
Files changed (29) hide show
  1. {wexample_wex_addon_dev_javascript-0.0.57 → wexample_wex_addon_dev_javascript-0.1.0}/PKG-INFO +48 -123
  2. {wexample_wex_addon_dev_javascript-0.0.57 → wexample_wex_addon_dev_javascript-0.1.0}/README.md +45 -119
  3. {wexample_wex_addon_dev_javascript-0.0.57 → wexample_wex_addon_dev_javascript-0.1.0}/pyproject.toml +3 -4
  4. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/file/__init__.py +1 -0
  5. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/file/javascript_package_json_file.py +132 -0
  6. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/file/javascript_tsconfig_json_file.py +33 -0
  7. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/resources/package_publish.yml +26 -0
  8. {wexample_wex_addon_dev_javascript-0.0.57/src/wexample_wex_addon_dev_javascript/workdir → wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/services}/__init__.py +0 -0
  9. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/services/vite/__init__.py +0 -0
  10. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/services/vite/commands/__init__.py +0 -0
  11. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/services/vite/commands/service/__init__.py +0 -0
  12. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/services/vite/commands/service/install.py +58 -0
  13. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/services/vite/commands/service/ready.py +42 -0
  14. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/services/vite/docker/__init__.py +0 -0
  15. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/services/vite/docker/docker-compose.yml +26 -0
  16. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/services/vite/service.yml +10 -0
  17. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/workdir/__init__.py +0 -0
  18. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/workdir/javascript_package_workdir.py +210 -0
  19. {wexample_wex_addon_dev_javascript-0.0.57 → wexample_wex_addon_dev_javascript-0.1.0}/src/wexample_wex_addon_dev_javascript/workdir/javascript_workdir.py +26 -8
  20. wexample_wex_addon_dev_javascript-0.0.57/src/wexample_wex_addon_dev_javascript/file/javascript_package_json_file.py +0 -28
  21. wexample_wex_addon_dev_javascript-0.0.57/src/wexample_wex_addon_dev_javascript/workdir/javascript_package_workdir.py +0 -93
  22. {wexample_wex_addon_dev_javascript-0.0.57 → wexample_wex_addon_dev_javascript-0.1.0}/src/wexample_wex_addon_dev_javascript/__init__.py +0 -0
  23. {wexample_wex_addon_dev_javascript-0.0.57 → wexample_wex_addon_dev_javascript-0.1.0}/src/wexample_wex_addon_dev_javascript/__pycache__/__init__.py +0 -0
  24. {wexample_wex_addon_dev_javascript-0.0.57 → wexample_wex_addon_dev_javascript-0.1.0}/src/wexample_wex_addon_dev_javascript/config_value/__init__.py +0 -0
  25. {wexample_wex_addon_dev_javascript-0.0.57 → wexample_wex_addon_dev_javascript-0.1.0}/src/wexample_wex_addon_dev_javascript/config_value/javascript_package_readme_config_value.py +0 -0
  26. {wexample_wex_addon_dev_javascript-0.0.57 → wexample_wex_addon_dev_javascript-0.1.0}/src/wexample_wex_addon_dev_javascript/javascript_addon_manager.py +0 -0
  27. {wexample_wex_addon_dev_javascript-0.0.57 → wexample_wex_addon_dev_javascript-0.1.0}/src/wexample_wex_addon_dev_javascript/py.typed +0 -0
  28. {wexample_wex_addon_dev_javascript-0.0.57/src/wexample_wex_addon_dev_javascript/file → wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/resources}/__init__.py +0 -0
  29. {wexample_wex_addon_dev_javascript-0.0.57 → wexample_wex_addon_dev_javascript-0.1.0}/src/wexample_wex_addon_dev_javascript/workdir/javascript_packages_suite_workdir.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wexample-wex-addon-dev-javascript
3
- Version: 0.0.57
3
+ Version: 0.1.0
4
4
  Summary: Python dev addon for wex
5
5
  Author-Email: weeger <contact@wexample.com>
6
6
  License: MIT
@@ -11,58 +11,32 @@ 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-filestate-javascript==0.0.14
15
- Requires-Dist: wexample-wex-addon-app==0.0.55
16
- Requires-Dist: wexample-wex-core==6.0.67
14
+ Requires-Dist: wexample-filestate-javascript>=0.1.0
15
+ Requires-Dist: wexample-wex-addon-app>=1.0.0
17
16
  Provides-Extra: dev
18
17
  Requires-Dist: pytest; extra == "dev"
19
18
  Requires-Dist: pytest-cov; extra == "dev"
20
19
  Description-Content-Type: text/markdown
21
20
 
22
- # wexample-wex-addon-dev-javascript
21
+ # wex_addon_dev_javascript
23
22
 
24
- Version: 0.0.57
23
+ Version: 0.1.0
25
24
 
26
25
  Python dev addon for wex
27
26
 
28
27
  ## Table of Contents
29
28
 
30
- - [Status Compatibility](#status-compatibility)
31
- - [Api Reference](#api-reference)
32
29
  - [Tests](#tests)
33
- - [Code Quality](#code-quality)
30
+ - [Suite Integration](#suite-integration)
31
+ - [Dependencies](#dependencies)
34
32
  - [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
33
  - [License](#license)
44
- - [Useful Links](#useful-links)
45
34
  - [Suite Integration](#suite-integration)
46
- - [Compatibility Matrix](#compatibility-matrix)
47
- - [Dependencies](#dependencies)
48
35
  - [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.
36
+ - [Roadmap](#roadmap)
37
+ - [Status Compatibility](#status-compatibility)
38
+ - [Useful Links](#useful-links)
39
+ - [Migration Notes](#migration-notes)
66
40
 
67
41
  ## Tests
68
42
 
@@ -113,16 +87,22 @@ To enforce a minimum coverage percentage:
113
87
 
114
88
  This will cause the test suite to fail if coverage drops below 80%.
115
89
 
116
- ## Code Quality & Typing
90
+ ## Integration in the Suite
91
+
92
+ This package is part of the Wexample Suite — a collection of high-quality, modular tools designed to work seamlessly together across multiple languages and environments.
117
93
 
118
- All the suite packages follow strict quality standards:
94
+ ### Related Packages
119
95
 
120
- - **Type hints**: Full type coverage with mypy validation
121
- - **Code formatting**: Enforced with black and isort
122
- - **Linting**: Comprehensive checks with custom scripts and tools
123
- - **Testing**: High test coverage requirements
96
+ The suite includes packages for configuration management, file handling, prompts, and more. Each package can be used independently or as part of the integrated suite.
124
97
 
125
- These standards ensure reliability and maintainability across the suite.
98
+ Visit the [Wexample Suite documentation](https://docs.wexample.com) for the complete package ecosystem.
99
+
100
+ ## Dependencies
101
+
102
+ - attrs: >=23.1.0
103
+ - cattrs: >=23.1.0
104
+ - wexample-filestate-javascript: >=0.1.0
105
+ - wexample-wex-addon-app: >=1.0.0
126
106
 
127
107
  ## Versioning & Compatibility Policy
128
108
 
@@ -134,72 +114,45 @@ Wexample packages follow **Semantic Versioning** (SemVer):
134
114
 
135
115
  We maintain backward compatibility within major versions and provide clear migration guides for breaking changes.
136
116
 
137
- ## Changelog
138
-
139
- See [CHANGELOG.md](CHANGELOG.md) for detailed version history and release notes.
140
-
141
- Major changes are documented with migration guides when applicable.
142
-
143
- ## Migration Notes
144
-
145
- When upgrading between major versions, refer to the migration guides in the documentation.
146
-
147
- Breaking changes are clearly documented with upgrade paths and examples.
148
-
149
- ## Known Limitations & Roadmap
150
-
151
- Current limitations and planned features are tracked in the GitHub issues.
152
-
153
- See the [project roadmap](https://github.com/wexample/python-wex_addon_dev_javascript/issues) for upcoming features and improvements.
154
-
155
- ## Security Policy
156
-
157
- ### Reporting Vulnerabilities
117
+ ## License
158
118
 
159
- If you discover a security vulnerability, please email contact@wexample.com.
119
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
160
120
 
161
- **Do not** open public issues for security vulnerabilities.
121
+ Free to use in both personal and commercial projects.
162
122
 
163
- We take security seriously and will respond promptly to verified reports.
123
+ ## Integration in the Suite
164
124
 
165
- ## Privacy & Telemetry
125
+ This package is part of the Wexample Suite — a collection of high-quality, modular tools designed to work seamlessly together across multiple languages and environments.
166
126
 
167
- This package does **not** collect any telemetry or usage data.
127
+ ### Related Packages
168
128
 
169
- Your privacy is respected no data is transmitted to external services.
129
+ The suite includes packages for configuration management, file handling, prompts, and more. Each package can be used independently or as part of the integrated suite.
170
130
 
171
- ## Support Channels
131
+ Visit the [Wexample Suite documentation](https://docs.wexample.com) for the complete package ecosystem.
172
132
 
173
- - **GitHub Issues**: Bug reports and feature requests
174
- - **GitHub Discussions**: Questions and community support
175
- - **Documentation**: Comprehensive guides and API reference
176
- - **Email**: contact@wexample.com for general inquiries
133
+ # About us
177
134
 
178
- Community support is available through GitHub Discussions.
135
+ [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.
179
136
 
180
- ## Contribution Guidelines
137
+ 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.
181
138
 
182
- We welcome contributions to the Wexample suite!
139
+ Wexample cultivates a culture of mastery. Each package, each contribution carries the mark of a community that values precision, ethics, and innovation — a community proud to shape the future of digital craftsmanship.
183
140
 
184
- ### How to Contribute
141
+ ## Known Limitations & Roadmap
185
142
 
186
- 1. **Fork** the repository
187
- 2. **Create** a feature branch
188
- 3. **Make** your changes
189
- 4. **Test** thoroughly
190
- 5. **Submit** a pull request
143
+ Current limitations and planned features are tracked in the GitHub issues.
191
144
 
192
- ## Maintainers & Authors
145
+ See the [project roadmap](https://github.com/wexample/python-wex_addon_dev_javascript/issues) for upcoming features and improvements.
193
146
 
194
- Maintained by the Wexample team and community contributors.
147
+ ## Status & Compatibility
195
148
 
196
- See [CONTRIBUTORS.md](CONTRIBUTORS.md) for the full list of contributors.
149
+ **Maturity**: Production-ready
197
150
 
198
- ## License
151
+ **Python Support**: >=3.10
199
152
 
200
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
153
+ **OS Support**: Linux, macOS, Windows
201
154
 
202
- Free to use in both personal and commercial projects.
155
+ **Status**: Actively maintained
203
156
 
204
157
  ## Useful Links
205
158
 
@@ -207,38 +160,10 @@ Free to use in both personal and commercial projects.
207
160
  - **Documentation**: [docs.wexample.com](https://docs.wexample.com)
208
161
  - **Issue Tracker**: https://github.com/wexample/python-wex-addon-dev-javascript/issues
209
162
  - **Discussions**: https://github.com/wexample/python-wex-addon-dev-javascript/discussions
210
- - **PyPI**: [pypi.org/project/wexample-wex-addon-dev-javascript](https://pypi.org/project/wexample-wex-addon-dev-javascript/)
163
+ - **PyPI**: [pypi.org/project/wex_addon_dev_javascript](https://pypi.org/project/wex_addon_dev_javascript/)
211
164
 
212
- ## Integration in the Suite
213
-
214
- This package is part of the Wexample Suite — a collection of high-quality, modular tools designed to work seamlessly together across multiple languages and environments.
215
-
216
- ### Related Packages
217
-
218
- The suite includes packages for configuration management, file handling, prompts, and more. Each package can be used independently or as part of the integrated suite.
219
-
220
- Visit the [Wexample Suite documentation](https://docs.wexample.com) for the complete package ecosystem.
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-javascript: ==0.0.14
233
- - wexample-wex-addon-app: ==0.0.55
234
- - wexample-wex-core: ==6.0.67
235
-
236
-
237
- # About us
238
-
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.
240
-
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.
165
+ ## Migration Notes
242
166
 
243
- Wexample cultivates a culture of mastery. Each package, each contribution carries the mark of a community that values precision, ethics, and innovation — a community proud to shape the future of digital craftsmanship.
167
+ When upgrading between major versions, refer to the migration guides in the documentation.
244
168
 
169
+ Breaking changes are clearly documented with upgrade paths and examples.
@@ -1,47 +1,22 @@
1
- # wexample-wex-addon-dev-javascript
1
+ # wex_addon_dev_javascript
2
2
 
3
- Version: 0.0.57
3
+ Version: 0.1.0
4
4
 
5
5
  Python dev addon for wex
6
6
 
7
7
  ## Table of Contents
8
8
 
9
- - [Status Compatibility](#status-compatibility)
10
- - [Api Reference](#api-reference)
11
9
  - [Tests](#tests)
12
- - [Code Quality](#code-quality)
10
+ - [Suite Integration](#suite-integration)
11
+ - [Dependencies](#dependencies)
13
12
  - [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
13
  - [License](#license)
23
- - [Useful Links](#useful-links)
24
14
  - [Suite Integration](#suite-integration)
25
- - [Compatibility Matrix](#compatibility-matrix)
26
- - [Dependencies](#dependencies)
27
15
  - [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.
16
+ - [Roadmap](#roadmap)
17
+ - [Status Compatibility](#status-compatibility)
18
+ - [Useful Links](#useful-links)
19
+ - [Migration Notes](#migration-notes)
45
20
 
46
21
  ## Tests
47
22
 
@@ -92,16 +67,22 @@ To enforce a minimum coverage percentage:
92
67
 
93
68
  This will cause the test suite to fail if coverage drops below 80%.
94
69
 
95
- ## Code Quality & Typing
70
+ ## Integration in the Suite
71
+
72
+ This package is part of the Wexample Suite — a collection of high-quality, modular tools designed to work seamlessly together across multiple languages and environments.
96
73
 
97
- All the suite packages follow strict quality standards:
74
+ ### Related Packages
98
75
 
99
- - **Type hints**: Full type coverage with mypy validation
100
- - **Code formatting**: Enforced with black and isort
101
- - **Linting**: Comprehensive checks with custom scripts and tools
102
- - **Testing**: High test coverage requirements
76
+ The suite includes packages for configuration management, file handling, prompts, and more. Each package can be used independently or as part of the integrated suite.
103
77
 
104
- These standards ensure reliability and maintainability across the suite.
78
+ Visit the [Wexample Suite documentation](https://docs.wexample.com) for the complete package ecosystem.
79
+
80
+ ## Dependencies
81
+
82
+ - attrs: >=23.1.0
83
+ - cattrs: >=23.1.0
84
+ - wexample-filestate-javascript: >=0.1.0
85
+ - wexample-wex-addon-app: >=1.0.0
105
86
 
106
87
  ## Versioning & Compatibility Policy
107
88
 
@@ -113,72 +94,45 @@ Wexample packages follow **Semantic Versioning** (SemVer):
113
94
 
114
95
  We maintain backward compatibility within major versions and provide clear migration guides for breaking changes.
115
96
 
116
- ## Changelog
117
-
118
- See [CHANGELOG.md](CHANGELOG.md) for detailed version history and release notes.
119
-
120
- Major changes are documented with migration guides when applicable.
121
-
122
- ## Migration Notes
123
-
124
- When upgrading between major versions, refer to the migration guides in the documentation.
125
-
126
- Breaking changes are clearly documented with upgrade paths and examples.
127
-
128
- ## Known Limitations & Roadmap
129
-
130
- Current limitations and planned features are tracked in the GitHub issues.
131
-
132
- See the [project roadmap](https://github.com/wexample/python-wex_addon_dev_javascript/issues) for upcoming features and improvements.
133
-
134
- ## Security Policy
135
-
136
- ### Reporting Vulnerabilities
97
+ ## License
137
98
 
138
- If you discover a security vulnerability, please email contact@wexample.com.
99
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
139
100
 
140
- **Do not** open public issues for security vulnerabilities.
101
+ Free to use in both personal and commercial projects.
141
102
 
142
- We take security seriously and will respond promptly to verified reports.
103
+ ## Integration in the Suite
143
104
 
144
- ## Privacy & Telemetry
105
+ This package is part of the Wexample Suite — a collection of high-quality, modular tools designed to work seamlessly together across multiple languages and environments.
145
106
 
146
- This package does **not** collect any telemetry or usage data.
107
+ ### Related Packages
147
108
 
148
- Your privacy is respected no data is transmitted to external services.
109
+ The suite includes packages for configuration management, file handling, prompts, and more. Each package can be used independently or as part of the integrated suite.
149
110
 
150
- ## Support Channels
111
+ Visit the [Wexample Suite documentation](https://docs.wexample.com) for the complete package ecosystem.
151
112
 
152
- - **GitHub Issues**: Bug reports and feature requests
153
- - **GitHub Discussions**: Questions and community support
154
- - **Documentation**: Comprehensive guides and API reference
155
- - **Email**: contact@wexample.com for general inquiries
113
+ # About us
156
114
 
157
- Community support is available through GitHub Discussions.
115
+ [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.
158
116
 
159
- ## Contribution Guidelines
117
+ 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.
160
118
 
161
- We welcome contributions to the Wexample suite!
119
+ Wexample cultivates a culture of mastery. Each package, each contribution carries the mark of a community that values precision, ethics, and innovation — a community proud to shape the future of digital craftsmanship.
162
120
 
163
- ### How to Contribute
121
+ ## Known Limitations & Roadmap
164
122
 
165
- 1. **Fork** the repository
166
- 2. **Create** a feature branch
167
- 3. **Make** your changes
168
- 4. **Test** thoroughly
169
- 5. **Submit** a pull request
123
+ Current limitations and planned features are tracked in the GitHub issues.
170
124
 
171
- ## Maintainers & Authors
125
+ See the [project roadmap](https://github.com/wexample/python-wex_addon_dev_javascript/issues) for upcoming features and improvements.
172
126
 
173
- Maintained by the Wexample team and community contributors.
127
+ ## Status & Compatibility
174
128
 
175
- See [CONTRIBUTORS.md](CONTRIBUTORS.md) for the full list of contributors.
129
+ **Maturity**: Production-ready
176
130
 
177
- ## License
131
+ **Python Support**: >=3.10
178
132
 
179
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
133
+ **OS Support**: Linux, macOS, Windows
180
134
 
181
- Free to use in both personal and commercial projects.
135
+ **Status**: Actively maintained
182
136
 
183
137
  ## Useful Links
184
138
 
@@ -186,38 +140,10 @@ Free to use in both personal and commercial projects.
186
140
  - **Documentation**: [docs.wexample.com](https://docs.wexample.com)
187
141
  - **Issue Tracker**: https://github.com/wexample/python-wex-addon-dev-javascript/issues
188
142
  - **Discussions**: https://github.com/wexample/python-wex-addon-dev-javascript/discussions
189
- - **PyPI**: [pypi.org/project/wexample-wex-addon-dev-javascript](https://pypi.org/project/wexample-wex-addon-dev-javascript/)
143
+ - **PyPI**: [pypi.org/project/wex_addon_dev_javascript](https://pypi.org/project/wex_addon_dev_javascript/)
190
144
 
191
- ## Integration in the Suite
192
-
193
- This package is part of the Wexample Suite — a collection of high-quality, modular tools designed to work seamlessly together across multiple languages and environments.
194
-
195
- ### Related Packages
196
-
197
- The suite includes packages for configuration management, file handling, prompts, and more. Each package can be used independently or as part of the integrated suite.
198
-
199
- Visit the [Wexample Suite documentation](https://docs.wexample.com) for the complete package ecosystem.
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-javascript: ==0.0.14
212
- - wexample-wex-addon-app: ==0.0.55
213
- - wexample-wex-core: ==6.0.67
214
-
215
-
216
- # About us
217
-
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.
219
-
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.
145
+ ## Migration Notes
221
146
 
222
- Wexample cultivates a culture of mastery. Each package, each contribution carries the mark of a community that values precision, ethics, and innovation — a community proud to shape the future of digital craftsmanship.
147
+ When upgrading between major versions, refer to the migration guides in the documentation.
223
148
 
149
+ Breaking changes are clearly documented with upgrade paths and examples.
@@ -6,7 +6,7 @@ build-backend = "pdm.backend"
6
6
 
7
7
  [project]
8
8
  name = "wexample-wex-addon-dev-javascript"
9
- version = "0.0.57"
9
+ version = "0.1.0"
10
10
  description = "Python dev addon for wex"
11
11
  authors = [
12
12
  { name = "weeger", email = "contact@wexample.com" },
@@ -20,9 +20,8 @@ classifiers = [
20
20
  dependencies = [
21
21
  "attrs>=23.1.0",
22
22
  "cattrs>=23.1.0",
23
- "wexample-filestate-javascript==0.0.14",
24
- "wexample-wex-addon-app==0.0.55",
25
- "wexample-wex-core==6.0.67",
23
+ "wexample-filestate-javascript>=0.1.0",
24
+ "wexample-wex-addon-app>=1.0.0",
26
25
  ]
27
26
 
28
27
  [project.readme]
@@ -0,0 +1 @@
1
+ from __future__ import annotations
@@ -0,0 +1,132 @@
1
+ from __future__ import annotations
2
+
3
+ from wexample_filestate.item.file.json_file import JsonFile
4
+ from wexample_helpers.decorator.base_class import base_class
5
+ from wexample_wex_addon_app.item.file.mixin.app_dependencies_config_file_mixin import (
6
+ AppDependenciesConfigFileMixin,
7
+ )
8
+
9
+
10
+ @base_class
11
+ class JavascriptPackageJsonFile(AppDependenciesConfigFileMixin, JsonFile):
12
+ def add_dependency(
13
+ self,
14
+ operator: str = "",
15
+ **kwargs,
16
+ ) -> bool:
17
+ # NPM uses bare versions (or ^/~), not "==".
18
+ return super().add_dependency(
19
+ operator=operator,
20
+ **kwargs,
21
+ )
22
+
23
+ def add_dependency_from_string(
24
+ self,
25
+ package_name: str,
26
+ version: str,
27
+ operator: str = "",
28
+ optional: bool = False,
29
+ group: None | str = None,
30
+ ) -> bool:
31
+ """
32
+ Add or update an npm dependency entry from a raw package name + version string.
33
+ Equivalent to add_dependency() but without requiring a CodeBaseWorkdir.
34
+ """
35
+ if optional:
36
+ section = "optionalDependencies"
37
+ elif group == "dev":
38
+ section = "devDependencies"
39
+ elif group:
40
+ section = group
41
+ else:
42
+ section = "dependencies"
43
+
44
+ constraint = f"{operator}{version}".strip()
45
+
46
+ config = self.read_config()
47
+ deps_node = config.search(path=section, default={})
48
+ deps = deps_node.to_dict() if deps_node else {}
49
+
50
+ if deps.get(package_name) == constraint:
51
+ return False
52
+
53
+ deps[package_name] = constraint
54
+ config.update_nested({section: deps})
55
+ self.write_config(config)
56
+
57
+ return True
58
+
59
+ def dumps(self, content: dict | None = None) -> str:
60
+ content = content or self.read_parsed()
61
+
62
+ workdir = self.get_parent_item()
63
+ content["name"] = workdir.get_project_name()
64
+ content["version"] = workdir.get_project_version()
65
+
66
+ remote_url = workdir.get_public_remote_repository_url()
67
+ if remote_url:
68
+ content["repository"] = remote_url
69
+
70
+ self._apply_default_publish_config(content)
71
+
72
+ return super().dumps(content or {})
73
+
74
+ def get_dependencies_versions(
75
+ self, optional: bool = False, group: str = "dev"
76
+ ) -> dict[str, str]:
77
+ config = self.read_config()
78
+ deps = config.search(path="dependencies").get_dict_or_default(default={})
79
+ peer = config.search(path="peerDependencies").get_dict_or_default(default={})
80
+ return {**deps, **peer}
81
+
82
+ def _apply_default_publish_config(self, content: dict) -> None:
83
+ content.setdefault("type", "module")
84
+
85
+ publish_config = content.get("publishConfig")
86
+ if publish_config is None:
87
+ content["publishConfig"] = {"access": "public"}
88
+ elif isinstance(publish_config, dict):
89
+ publish_config.setdefault("access", "public")
90
+
91
+ files = content.get("files")
92
+ exports = content.get("exports")
93
+
94
+ exports_text = str(exports) if exports is not None else ""
95
+ files_list = files if isinstance(files, list) else []
96
+ uses_dist = "dist" in exports_text or "dist" in files_list
97
+ uses_src = "src" in exports_text or "src" in files_list
98
+
99
+ # Default strategy: publish built artifacts (dist) so consumers don't need
100
+ # to transpile TS/ESM sources from node_modules.
101
+ if exports is None and (files is None or (uses_src and not uses_dist)):
102
+ content.setdefault("files", ["dist"])
103
+ content.setdefault(
104
+ "exports",
105
+ {
106
+ "./*": {
107
+ "types": "./dist/*.d.ts",
108
+ "default": "./dist/*.js",
109
+ }
110
+ },
111
+ )
112
+ content.setdefault(
113
+ "typesVersions",
114
+ {
115
+ "*": {
116
+ "*": ["dist/*"],
117
+ }
118
+ },
119
+ )
120
+ return
121
+
122
+ if uses_src and not uses_dist:
123
+ if files is None:
124
+ content.setdefault("files", ["src"])
125
+ content.setdefault(
126
+ "typesVersions",
127
+ {
128
+ "*": {
129
+ "*": ["src/*"],
130
+ }
131
+ },
132
+ )
@@ -0,0 +1,33 @@
1
+ from __future__ import annotations
2
+
3
+ from wexample_filestate.item.file.json_file import JsonFile
4
+ from wexample_helpers.decorator.base_class import base_class
5
+
6
+
7
+ @base_class
8
+ class JavascriptTsconfigJsonFile(JsonFile):
9
+ def dumps(self, content: dict | None = None) -> str:
10
+ content = content or self.read_parsed()
11
+
12
+ compiler_options = content.get("compilerOptions")
13
+ if compiler_options is None or not isinstance(compiler_options, dict):
14
+ compiler_options = {}
15
+ content["compilerOptions"] = compiler_options
16
+
17
+ compiler_options.setdefault("target", "ES2020")
18
+ compiler_options.setdefault("module", "NodeNext")
19
+ compiler_options.setdefault("moduleResolution", "NodeNext")
20
+ compiler_options.setdefault("rootDir", "src")
21
+ compiler_options.setdefault("outDir", "dist")
22
+ compiler_options.setdefault("declaration", True)
23
+ compiler_options.setdefault("declarationMap", True)
24
+ compiler_options.setdefault("sourceMap", True)
25
+ compiler_options.setdefault("strict", False)
26
+ compiler_options.setdefault("esModuleInterop", True)
27
+ compiler_options.setdefault("skipLibCheck", True)
28
+ compiler_options.setdefault("forceConsistentCasingInFileNames", True)
29
+
30
+ content.setdefault("include", ["src"])
31
+ content.setdefault("exclude", ["dist", "node_modules", "tests"])
32
+
33
+ return super().dumps(content)
@@ -0,0 +1,26 @@
1
+ name: Publish to npm
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+ workflow_dispatch: {}
8
+
9
+ permissions:
10
+ contents: read
11
+ id-token: write
12
+
13
+ jobs:
14
+ publish:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - uses: actions/setup-node@v4
20
+ with:
21
+ node-version: "24"
22
+ registry-url: "https://registry.npmjs.org"
23
+
24
+ - run: npm install
25
+
26
+ - run: npm publish --access public
@@ -0,0 +1,58 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from wexample_wex_core.const.globals import COMMAND_TYPE_SERVICE
6
+ from wexample_wex_core.decorator.command import command
7
+
8
+ if TYPE_CHECKING:
9
+ from wexample_wex_addon_app.service.app_service import AppService
10
+ from wexample_wex_core.context.execution_context import ExecutionContext
11
+
12
+
13
+ @command(
14
+ type=COMMAND_TYPE_SERVICE,
15
+ description="Patch vite.config.ts to allow all hosts (needed behind a reverse proxy)",
16
+ )
17
+ def vite__service__install(
18
+ context: ExecutionContext,
19
+ service: AppService,
20
+ ) -> None:
21
+ import re
22
+
23
+ app_path = service.app_workdir.get_path()
24
+
25
+ for config_name in ["vite.config.ts", "vite.config.js"]:
26
+ config_path = app_path / config_name
27
+ if not config_path.exists():
28
+ continue
29
+
30
+ content = config_path.read_text()
31
+
32
+ if "allowedHosts" in content:
33
+ context.io.log(f" {config_name}: allowedHosts already set, skipping")
34
+ return
35
+
36
+ # defineConfig() → defineConfig({ vite: { server: { allowedHosts: true } } })
37
+ # defineConfig({ ... }) → add server.allowedHosts: true inside vite: {}
38
+ if "defineConfig()" in content:
39
+ content = content.replace(
40
+ "defineConfig()",
41
+ "defineConfig({ vite: { server: { allowedHosts: true } } })",
42
+ )
43
+ elif re.search(r"defineConfig\(\s*\{", content):
44
+ content = re.sub(
45
+ r"(defineConfig\(\s*\{)",
46
+ r"\1 vite: { server: { allowedHosts: true } },",
47
+ content,
48
+ count=1,
49
+ )
50
+ else:
51
+ context.io.log(f" {config_name}: unrecognized format, skipping")
52
+ return
53
+
54
+ config_path.write_text(content)
55
+ context.io.log(f" ✓ {config_name}: allowedHosts patched")
56
+ return
57
+
58
+ context.io.log(" No vite.config.ts/js found, skipping allowedHosts patch")
@@ -0,0 +1,42 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from wexample_wex_core.const.globals import COMMAND_TYPE_SERVICE
6
+ from wexample_wex_core.decorator.command import command
7
+
8
+ if TYPE_CHECKING:
9
+ from wexample_app.response.boolean_response import BooleanResponse
10
+ from wexample_wex_addon_app.service.app_service import AppService
11
+ from wexample_wex_core.context.execution_context import ExecutionContext
12
+
13
+
14
+ @command(
15
+ type=COMMAND_TYPE_SERVICE, description="Check if the Vite dev server is responding"
16
+ )
17
+ def vite__service__ready(
18
+ context: ExecutionContext,
19
+ service: AppService,
20
+ ) -> BooleanResponse:
21
+ import subprocess
22
+
23
+ from wexample_app.response.boolean_response import BooleanResponse
24
+
25
+ runtime = service.app_workdir.get_runtime_config()
26
+ app_project_name = runtime.search("app.project_name").get_str()
27
+ container_name = f"{app_project_name}_vite"
28
+ port = service.manifest.get("vars", {}).get("VITE_PORT", {}).get("default", "8080")
29
+
30
+ result = subprocess.run(
31
+ [
32
+ "docker",
33
+ "exec",
34
+ container_name,
35
+ "bun",
36
+ "-e",
37
+ f"await fetch('http://localhost:{port}')",
38
+ ],
39
+ capture_output=True,
40
+ )
41
+
42
+ return BooleanResponse(kernel=context.kernel, content=result.returncode == 0)
@@ -0,0 +1,26 @@
1
+ services:
2
+
3
+ vite:
4
+ container_name: ${APP_PROJECT_NAME}_vite
5
+ image: oven/bun:latest
6
+ working_dir: /app
7
+ command: sh -c "bun install && bun run dev --host"
8
+ environment:
9
+ VIRTUAL_HOST: ${APP_DOMAINS_STRING}
10
+ VIRTUAL_PORT: ${VITE_PORT:-8080}
11
+ volumes:
12
+ - ${APP_PATH}:/app
13
+ - vite_node_modules:/app/node_modules
14
+ healthcheck:
15
+ test: ["CMD", "bun", "-e", "await fetch('http://localhost:8080')"]
16
+ interval: 10s
17
+ timeout: 5s
18
+ retries: 10
19
+ start_period: 60s
20
+ networks:
21
+ wex_net:
22
+ aliases:
23
+ - vite
24
+
25
+ volumes:
26
+ vite_node_modules:
@@ -0,0 +1,10 @@
1
+ name: vite
2
+ tags:
3
+ - frontend
4
+ - javascript
5
+ docker:
6
+ compose: docker/docker-compose.yml
7
+ vars:
8
+ VITE_PORT:
9
+ default: "8080"
10
+ description: "Port exposed by the Vite dev server"
@@ -0,0 +1,210 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from wexample_helpers.helpers.string import string_to_kebab_case
6
+ from wexample_helpers_git.helpers.git import (
7
+ git_tag_annotated,
8
+ git_tag_exists,
9
+ )
10
+
11
+ from wexample_wex_addon_dev_javascript.workdir.javascript_workdir import (
12
+ JavascriptWorkdir,
13
+ )
14
+
15
+ if TYPE_CHECKING:
16
+ from wexample_config.const.types import DictConfig
17
+ from wexample_filestate.config_value.readme_content_config_value import (
18
+ ReadmeContentConfigValue,
19
+ )
20
+ from wexample_wex_addon_app.workdir.framework_packages_suite_workdir import (
21
+ FrameworkPackageSuiteWorkdir,
22
+ )
23
+
24
+
25
+ class JavascriptPackageWorkdir(JavascriptWorkdir):
26
+ def get_package_dependency_name(self) -> str:
27
+ return self.get_package_import_name()
28
+
29
+ def get_package_import_name(self) -> str:
30
+ """Get the full package import name with vendor prefix."""
31
+ return self.get_project_name()
32
+
33
+ def get_project_name(self) -> str:
34
+ return f"@{self.get_vendor_name()}/{string_to_kebab_case(super().get_project_name())}"
35
+
36
+ def prepare_value(self, raw_value: DictConfig | None = None) -> DictConfig:
37
+ from wexample_filestate.const.disk import DiskItemType
38
+ from wexample_helpers.helpers.file import file_read
39
+ from wexample_helpers.helpers.module import module_get_path
40
+
41
+ import wexample_wex_addon_dev_javascript
42
+
43
+ raw_value = super().prepare_value(raw_value=raw_value)
44
+ children = raw_value["children"]
45
+
46
+ children.extend(
47
+ [
48
+ {
49
+ "name": ".github",
50
+ "type": DiskItemType.DIRECTORY,
51
+ "should_exist": True,
52
+ "children": [
53
+ {
54
+ "name": "workflows",
55
+ "type": DiskItemType.DIRECTORY,
56
+ "should_exist": True,
57
+ "children": [
58
+ {
59
+ "name": "publish.yml",
60
+ "type": DiskItemType.FILE,
61
+ "should_exist": True,
62
+ "content": file_read(
63
+ module_get_path(
64
+ wexample_wex_addon_dev_javascript
65
+ )
66
+ / "resources"
67
+ / "package_publish.yml"
68
+ ),
69
+ }
70
+ ],
71
+ }
72
+ ],
73
+ }
74
+ ]
75
+ )
76
+
77
+ return raw_value
78
+
79
+ def _classify_version_bump(self, last_tag: str) -> str:
80
+ from wexample_helpers.const.types import (
81
+ UPGRADE_TYPE_MAJOR,
82
+ UPGRADE_TYPE_MINOR,
83
+ )
84
+ from wexample_helpers.helpers.shell import shell_run
85
+ from wexample_helpers_git.helpers.git import git_has_changes_since_tag
86
+
87
+ if not git_has_changes_since_tag(last_tag, "src", cwd=self.get_path()):
88
+ return UPGRADE_TYPE_MINOR
89
+
90
+ # Check if all changes in src/ are whitespace-only — safe to treat as patch
91
+ result = shell_run(
92
+ ["git", "diff", "-w", "--ignore-blank-lines", last_tag, "--", "src/"],
93
+ cwd=self.get_path(),
94
+ check=False,
95
+ capture=True,
96
+ )
97
+ if not result.stdout.strip():
98
+ self.log("Only whitespace changes in src/, treating as patch.")
99
+ return UPGRADE_TYPE_MINOR
100
+
101
+ # Check if all changed files in src/ are non-TypeScript — cannot break the TS API
102
+ changed_files = shell_run(
103
+ ["git", "diff", "--name-only", last_tag, "--", "src/"],
104
+ cwd=self.get_path(),
105
+ check=False,
106
+ capture=True,
107
+ )
108
+ ts_files = [
109
+ f
110
+ for f in changed_files.stdout.splitlines()
111
+ if f.endswith(".ts") or f.endswith(".tsx")
112
+ ]
113
+ if not ts_files:
114
+ self.log("Only non-TypeScript files changed in src/, treating as minor.")
115
+ return UPGRADE_TYPE_INTERMEDIATE
116
+
117
+ return UPGRADE_TYPE_MAJOR
118
+
119
+ def _get_critical_directories(self) -> list[str]:
120
+ return ["src"]
121
+
122
+ def _get_readme_content(self) -> ReadmeContentConfigValue | None:
123
+ from wexample_wex_addon_dev_javascript.config_value.javascript_package_readme_config_value import (
124
+ JavascriptPackageReadmeContentConfigValue,
125
+ )
126
+
127
+ return JavascriptPackageReadmeContentConfigValue(workdir=self)
128
+
129
+ def _get_suite_workdir_class(self) -> type[FrameworkPackageSuiteWorkdir]:
130
+ from wexample_wex_addon_dev_javascript.workdir.javascript_packages_suite_workdir import (
131
+ JavascriptPackagesSuiteWorkdir,
132
+ )
133
+
134
+ return JavascriptPackagesSuiteWorkdir
135
+
136
+ def _publish(self, force: bool = False) -> None:
137
+ """Push a git tag to the deployment remote to trigger a CI/CD publication workflow."""
138
+ from wexample_helpers_git.helpers.git import git_push_tag
139
+
140
+ remote = self._get_deployment_remote_name()
141
+ if not remote:
142
+ self.log("No deployment remote configured, skipping publication.")
143
+ return
144
+
145
+ tag = f"v{self.get_project_version()}"
146
+ cwd = self.get_path()
147
+
148
+ if git_tag_exists(tag, cwd=cwd, inherit_stdio=False):
149
+ self.log(f"Tag {tag} already exists, skipping creation.")
150
+ else:
151
+ git_tag_annotated(tag, f"Release {tag}", cwd=cwd, inherit_stdio=True)
152
+
153
+ git_push_tag(tag, cwd=cwd, remote=remote, inherit_stdio=True)
154
+
155
+ def _wait_for_registry(self) -> None:
156
+ """Poll the configured npm registry until the current version is available (max 20 min).
157
+
158
+ Fetches the package manifest and checks for the version in 'versions' — compatible
159
+ with both public npm and private registries (e.g. GitLab) that don't expose
160
+ per-version URLs.
161
+ """
162
+ import json
163
+ import time
164
+ import urllib.error
165
+ import urllib.request
166
+
167
+ package = self.get_project_name()
168
+ version = self.get_project_version()
169
+
170
+ registry_base = (
171
+ self.get_runtime_config().search("npm.registry_url").get_str_or_none()
172
+ )
173
+ token = self.get_runtime_config().search("npm.api_token").get_str_or_none()
174
+
175
+ encoded = package.replace("/", "%2F")
176
+ base = (registry_base or "https://registry.npmjs.org").rstrip("/")
177
+ url = f"{base}/{encoded}"
178
+
179
+ max_attempts = 40
180
+ delay = 30.0
181
+
182
+ self.log(f"Waiting for {package}@{version} to appear on registry…")
183
+
184
+ for attempt in range(1, max_attempts + 1):
185
+ try:
186
+ req = urllib.request.Request(url)
187
+ if token:
188
+ req.add_header("Authorization", f"Bearer {token}")
189
+ with urllib.request.urlopen(req, timeout=10) as resp:
190
+ if resp.status == 200:
191
+ data = json.loads(resp.read())
192
+ if version in data.get("versions", {}):
193
+ self.success(f"{package}@{version} is available.")
194
+ return
195
+ except urllib.error.HTTPError as e:
196
+ if e.code != 404:
197
+ raise
198
+ except Exception:
199
+ pass
200
+
201
+ self.log(
202
+ f"Not yet available (attempt {attempt}/{max_attempts}), "
203
+ f"retrying in {int(delay)}s…"
204
+ )
205
+ time.sleep(delay)
206
+
207
+ raise RuntimeError(
208
+ f"Timed out waiting for {package}@{version} on registry after "
209
+ f"{max_attempts * int(delay) // 60} minutes."
210
+ )
@@ -57,20 +57,21 @@ class JavascriptWorkdir(CodeBaseWorkdir):
57
57
  from wexample_wex_addon_dev_javascript.file.javascript_package_json_file import (
58
58
  JavascriptPackageJsonFile,
59
59
  )
60
+ from wexample_wex_addon_dev_javascript.file.javascript_tsconfig_json_file import (
61
+ JavascriptTsconfigJsonFile,
62
+ )
60
63
 
61
64
  raw_value = super().prepare_value(raw_value=raw_value)
62
65
 
63
66
  # Ensure a package.json file exists for any JavaScript package project
64
67
  children = raw_value["children"]
65
68
 
66
- children.append(
67
- {
68
- "class": JavascriptPackageJsonFile,
69
- "name": "package.json",
70
- "type": DiskItemType.FILE,
71
- "should_exist": True,
72
- }
73
- )
69
+ javascript_options = raw_value.setdefault("javascript", [])
70
+ if isinstance(javascript_options, list):
71
+ if "npm_package_lock" not in javascript_options:
72
+ javascript_options.append("npm_package_lock")
73
+ elif isinstance(javascript_options, dict):
74
+ javascript_options.setdefault("npm_package_lock", True)
74
75
 
75
76
  # Add rules to .gitignore
76
77
  array_dict_get_by("name", ".gitignore", children).setdefault(
@@ -87,6 +88,23 @@ class JavascriptWorkdir(CodeBaseWorkdir):
87
88
 
88
89
  children.extend(
89
90
  [
91
+ {
92
+ "class": JavascriptPackageJsonFile,
93
+ "name": "package.json",
94
+ "type": DiskItemType.FILE,
95
+ "should_exist": True,
96
+ },
97
+ {
98
+ "class": JavascriptTsconfigJsonFile,
99
+ "name": "tsconfig.json",
100
+ "type": DiskItemType.FILE,
101
+ "should_exist": True,
102
+ },
103
+ {
104
+ "name": ".npmrc",
105
+ "type": DiskItemType.FILE,
106
+ "should_exist": True,
107
+ },
90
108
  {
91
109
  "name": "tests",
92
110
  "type": DiskItemType.DIRECTORY,
@@ -1,28 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from wexample_filestate.item.file.json_file import JsonFile
4
- from wexample_helpers.decorator.base_class import base_class
5
-
6
-
7
- @base_class
8
- class JavascriptPackageJsonFile(JsonFile):
9
- def dumps(self, content: dict | None = None) -> str:
10
- content = content or self.read_parsed()
11
-
12
- workdir = self.get_parent_item()
13
- content["name"] = workdir.get_package_import_name()
14
- content["version"] = workdir.get_project_version()
15
-
16
- if not content.get("type"):
17
- content["type"] = "module"
18
-
19
- return super().dumps(content or {})
20
-
21
- def get_dependencies_versions(
22
- self, optional: bool = False, group: str = "dev"
23
- ) -> dict[str, str]:
24
- return (
25
- self.read_config()
26
- .search(path="dependencies")
27
- .get_dict_or_default(default={})
28
- )
@@ -1,93 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import os
4
- import subprocess
5
- from typing import TYPE_CHECKING
6
-
7
- from wexample_helpers.helpers.string import string_to_kebab_case
8
-
9
- from wexample_wex_addon_dev_javascript.workdir.javascript_workdir import (
10
- JavascriptWorkdir,
11
- )
12
-
13
- if TYPE_CHECKING:
14
- from wexample_filestate.config_value.readme_content_config_value import (
15
- ReadmeContentConfigValue,
16
- )
17
- from wexample_wex_addon_app.workdir.framework_packages_suite_workdir import (
18
- FrameworkPackageSuiteWorkdir,
19
- )
20
-
21
-
22
- class JavascriptPackageWorkdir(JavascriptWorkdir):
23
- def get_package_import_name(self) -> str:
24
- """Get the full package import name with vendor prefix."""
25
- return (
26
- f"@{self.get_vendor_name()}/{string_to_kebab_case(self.get_project_name())}"
27
- )
28
-
29
- def _get_readme_content(self) -> ReadmeContentConfigValue | None:
30
- from wexample_wex_addon_dev_javascript.config_value.javascript_package_readme_config_value import (
31
- JavascriptPackageReadmeContentConfigValue,
32
- )
33
-
34
- return JavascriptPackageReadmeContentConfigValue(workdir=self)
35
-
36
- def _get_suite_package_workdir_class(self) -> type[FrameworkPackageSuiteWorkdir]:
37
- from wexample_wex_addon_dev_javascript.workdir.javascript_packages_suite_workdir import (
38
- JavascriptPackagesSuiteWorkdir,
39
- )
40
-
41
- return JavascriptPackagesSuiteWorkdir
42
-
43
- def _publish(self, force: bool = False) -> None:
44
- """Publish the package to npm, skipping if the version already exists."""
45
- from wexample_helpers.helpers.shell import shell_run
46
-
47
- package_name = self.get_package_name()
48
- version = self.get_project_version()
49
- registry = self.get_env_parameter_or_suite_fallback(
50
- key="NPM_REGISTRY", default="https://registry.npmjs.org"
51
- )
52
-
53
- # Detect if the version already exists on the registry
54
- release_exists = False
55
- try:
56
- shell_run(
57
- [
58
- "npm",
59
- "view",
60
- f"{package_name}@{version}",
61
- "version",
62
- "--registry",
63
- registry,
64
- ],
65
- cwd=self.get_path(),
66
- inherit_stdio=False,
67
- )
68
- release_exists = True
69
- except subprocess.CalledProcessError:
70
- release_exists = False
71
-
72
- if release_exists and not force:
73
- self.warning(
74
- f'Trying to publish an existing release for package "{package_name}" version {version}'
75
- )
76
- return
77
-
78
- token = self.get_env_parameter_or_suite_fallback("NPM_TOKEN")
79
- env = os.environ.copy()
80
- host = registry.rstrip("/").split("://")[-1]
81
-
82
- if registry:
83
- env["npm_config_registry"] = registry
84
- if token:
85
- env["NPM_TOKEN"] = token
86
- env[f"npm_config_//{host}/:_authToken"] = token
87
-
88
- shell_run(
89
- ["npm", "publish", "--registry", registry],
90
- cwd=self.get_path(),
91
- env=env,
92
- inherit_stdio=True,
93
- )