wexample-wex-addon-dev-javascript 0.0.58__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 (30) hide show
  1. wexample_wex_addon_dev_javascript-0.1.0/PKG-INFO +169 -0
  2. wexample_wex_addon_dev_javascript-0.1.0/README.md +149 -0
  3. {wexample_wex_addon_dev_javascript-0.0.58 → wexample_wex_addon_dev_javascript-0.1.0}/pyproject.toml +3 -3
  4. {wexample_wex_addon_dev_javascript-0.0.58 → wexample_wex_addon_dev_javascript-0.1.0}/src/wexample_wex_addon_dev_javascript/file/javascript_package_json_file.py +4 -5
  5. {wexample_wex_addon_dev_javascript-0.0.58/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
  6. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/services/vite/__init__.py +0 -0
  7. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/services/vite/commands/__init__.py +0 -0
  8. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/services/vite/commands/service/__init__.py +0 -0
  9. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/services/vite/commands/service/install.py +58 -0
  10. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/services/vite/commands/service/ready.py +42 -0
  11. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/services/vite/docker/__init__.py +0 -0
  12. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/services/vite/docker/docker-compose.yml +26 -0
  13. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/services/vite/service.yml +10 -0
  14. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/workdir/__init__.py +0 -0
  15. wexample_wex_addon_dev_javascript-0.1.0/src/wexample_wex_addon_dev_javascript/workdir/javascript_package_workdir.py +210 -0
  16. wexample_wex_addon_dev_javascript-0.0.58/PKG-INFO +0 -107
  17. wexample_wex_addon_dev_javascript-0.0.58/README.md +0 -87
  18. wexample_wex_addon_dev_javascript-0.0.58/src/wexample_wex_addon_dev_javascript/workdir/javascript_package_workdir.py +0 -104
  19. {wexample_wex_addon_dev_javascript-0.0.58 → wexample_wex_addon_dev_javascript-0.1.0}/src/wexample_wex_addon_dev_javascript/__init__.py +0 -0
  20. {wexample_wex_addon_dev_javascript-0.0.58 → wexample_wex_addon_dev_javascript-0.1.0}/src/wexample_wex_addon_dev_javascript/__pycache__/__init__.py +0 -0
  21. {wexample_wex_addon_dev_javascript-0.0.58 → wexample_wex_addon_dev_javascript-0.1.0}/src/wexample_wex_addon_dev_javascript/config_value/__init__.py +0 -0
  22. {wexample_wex_addon_dev_javascript-0.0.58 → wexample_wex_addon_dev_javascript-0.1.0}/src/wexample_wex_addon_dev_javascript/config_value/javascript_package_readme_config_value.py +0 -0
  23. {wexample_wex_addon_dev_javascript-0.0.58 → wexample_wex_addon_dev_javascript-0.1.0}/src/wexample_wex_addon_dev_javascript/file/__init__.py +0 -0
  24. {wexample_wex_addon_dev_javascript-0.0.58 → wexample_wex_addon_dev_javascript-0.1.0}/src/wexample_wex_addon_dev_javascript/file/javascript_tsconfig_json_file.py +0 -0
  25. {wexample_wex_addon_dev_javascript-0.0.58 → wexample_wex_addon_dev_javascript-0.1.0}/src/wexample_wex_addon_dev_javascript/javascript_addon_manager.py +0 -0
  26. {wexample_wex_addon_dev_javascript-0.0.58 → wexample_wex_addon_dev_javascript-0.1.0}/src/wexample_wex_addon_dev_javascript/py.typed +0 -0
  27. {wexample_wex_addon_dev_javascript-0.0.58 → wexample_wex_addon_dev_javascript-0.1.0}/src/wexample_wex_addon_dev_javascript/resources/__init__.py +0 -0
  28. {wexample_wex_addon_dev_javascript-0.0.58 → wexample_wex_addon_dev_javascript-0.1.0}/src/wexample_wex_addon_dev_javascript/resources/package_publish.yml +0 -0
  29. {wexample_wex_addon_dev_javascript-0.0.58 → wexample_wex_addon_dev_javascript-0.1.0}/src/wexample_wex_addon_dev_javascript/workdir/javascript_packages_suite_workdir.py +0 -0
  30. {wexample_wex_addon_dev_javascript-0.0.58 → wexample_wex_addon_dev_javascript-0.1.0}/src/wexample_wex_addon_dev_javascript/workdir/javascript_workdir.py +0 -0
@@ -0,0 +1,169 @@
1
+ Metadata-Version: 2.1
2
+ Name: wexample-wex-addon-dev-javascript
3
+ Version: 0.1.0
4
+ Summary: Python dev addon for wex
5
+ Author-Email: weeger <contact@wexample.com>
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Project-URL: homepage, https://github.com/wexample/python-wex-dev-python
11
+ Requires-Python: >=3.10
12
+ Requires-Dist: attrs>=23.1.0
13
+ Requires-Dist: cattrs>=23.1.0
14
+ Requires-Dist: wexample-filestate-javascript>=0.1.0
15
+ Requires-Dist: wexample-wex-addon-app>=1.0.0
16
+ Provides-Extra: dev
17
+ Requires-Dist: pytest; extra == "dev"
18
+ Requires-Dist: pytest-cov; extra == "dev"
19
+ Description-Content-Type: text/markdown
20
+
21
+ # wex_addon_dev_javascript
22
+
23
+ Version: 0.1.0
24
+
25
+ Python dev addon for wex
26
+
27
+ ## Table of Contents
28
+
29
+ - [Tests](#tests)
30
+ - [Suite Integration](#suite-integration)
31
+ - [Dependencies](#dependencies)
32
+ - [Versioning](#versioning)
33
+ - [License](#license)
34
+ - [Suite Integration](#suite-integration)
35
+ - [Suite Signature](#suite-signature)
36
+ - [Roadmap](#roadmap)
37
+ - [Status Compatibility](#status-compatibility)
38
+ - [Useful Links](#useful-links)
39
+ - [Migration Notes](#migration-notes)
40
+
41
+ ## Tests
42
+
43
+ This project uses `pytest` for testing and `pytest-cov` for code coverage analysis.
44
+
45
+ ### Installation
46
+
47
+ First, install the required testing dependencies:
48
+ ```bash
49
+ .venv/bin/python -m pip install pytest pytest-cov
50
+ ```
51
+
52
+ ### Basic Usage
53
+
54
+ Run all tests with coverage:
55
+ ```bash
56
+ .venv/bin/python -m pytest --cov --cov-report=html
57
+ ```
58
+
59
+ ### Common Commands
60
+ ```bash
61
+ # Run tests with coverage for a specific module
62
+ .venv/bin/python -m pytest --cov=your_module
63
+
64
+ # Show which lines are not covered
65
+ .venv/bin/python -m pytest --cov=your_module --cov-report=term-missing
66
+
67
+ # Generate an HTML coverage report
68
+ .venv/bin/python -m pytest --cov=your_module --cov-report=html
69
+
70
+ # Combine terminal and HTML reports
71
+ .venv/bin/python -m pytest --cov=your_module --cov-report=term-missing --cov-report=html
72
+
73
+ # Run specific test file with coverage
74
+ .venv/bin/python -m pytest tests/test_file.py --cov=your_module --cov-report=term-missing
75
+ ```
76
+
77
+ ### Viewing HTML Reports
78
+
79
+ After generating an HTML report, open `htmlcov/index.html` in your browser to view detailed line-by-line coverage information.
80
+
81
+ ### Coverage Threshold
82
+
83
+ To enforce a minimum coverage percentage:
84
+ ```bash
85
+ .venv/bin/python -m pytest --cov=your_module --cov-fail-under=80
86
+ ```
87
+
88
+ This will cause the test suite to fail if coverage drops below 80%.
89
+
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.
93
+
94
+ ### Related Packages
95
+
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.
97
+
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
106
+
107
+ ## Versioning & Compatibility Policy
108
+
109
+ Wexample packages follow **Semantic Versioning** (SemVer):
110
+
111
+ - **MAJOR**: Breaking changes
112
+ - **MINOR**: New features, backward compatible
113
+ - **PATCH**: Bug fixes, backward compatible
114
+
115
+ We maintain backward compatibility within major versions and provide clear migration guides for breaking changes.
116
+
117
+ ## License
118
+
119
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
120
+
121
+ Free to use in both personal and commercial projects.
122
+
123
+ ## Integration in the Suite
124
+
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.
126
+
127
+ ### Related Packages
128
+
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.
130
+
131
+ Visit the [Wexample Suite documentation](https://docs.wexample.com) for the complete package ecosystem.
132
+
133
+ # About us
134
+
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.
136
+
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.
138
+
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.
140
+
141
+ ## Known Limitations & Roadmap
142
+
143
+ Current limitations and planned features are tracked in the GitHub issues.
144
+
145
+ See the [project roadmap](https://github.com/wexample/python-wex_addon_dev_javascript/issues) for upcoming features and improvements.
146
+
147
+ ## Status & Compatibility
148
+
149
+ **Maturity**: Production-ready
150
+
151
+ **Python Support**: >=3.10
152
+
153
+ **OS Support**: Linux, macOS, Windows
154
+
155
+ **Status**: Actively maintained
156
+
157
+ ## Useful Links
158
+
159
+ - **Homepage**: https://github.com/wexample/python-wex-addon-dev-javascript
160
+ - **Documentation**: [docs.wexample.com](https://docs.wexample.com)
161
+ - **Issue Tracker**: https://github.com/wexample/python-wex-addon-dev-javascript/issues
162
+ - **Discussions**: https://github.com/wexample/python-wex-addon-dev-javascript/discussions
163
+ - **PyPI**: [pypi.org/project/wex_addon_dev_javascript](https://pypi.org/project/wex_addon_dev_javascript/)
164
+
165
+ ## Migration Notes
166
+
167
+ When upgrading between major versions, refer to the migration guides in the documentation.
168
+
169
+ Breaking changes are clearly documented with upgrade paths and examples.
@@ -0,0 +1,149 @@
1
+ # wex_addon_dev_javascript
2
+
3
+ Version: 0.1.0
4
+
5
+ Python dev addon for wex
6
+
7
+ ## Table of Contents
8
+
9
+ - [Tests](#tests)
10
+ - [Suite Integration](#suite-integration)
11
+ - [Dependencies](#dependencies)
12
+ - [Versioning](#versioning)
13
+ - [License](#license)
14
+ - [Suite Integration](#suite-integration)
15
+ - [Suite Signature](#suite-signature)
16
+ - [Roadmap](#roadmap)
17
+ - [Status Compatibility](#status-compatibility)
18
+ - [Useful Links](#useful-links)
19
+ - [Migration Notes](#migration-notes)
20
+
21
+ ## Tests
22
+
23
+ This project uses `pytest` for testing and `pytest-cov` for code coverage analysis.
24
+
25
+ ### Installation
26
+
27
+ First, install the required testing dependencies:
28
+ ```bash
29
+ .venv/bin/python -m pip install pytest pytest-cov
30
+ ```
31
+
32
+ ### Basic Usage
33
+
34
+ Run all tests with coverage:
35
+ ```bash
36
+ .venv/bin/python -m pytest --cov --cov-report=html
37
+ ```
38
+
39
+ ### Common Commands
40
+ ```bash
41
+ # Run tests with coverage for a specific module
42
+ .venv/bin/python -m pytest --cov=your_module
43
+
44
+ # Show which lines are not covered
45
+ .venv/bin/python -m pytest --cov=your_module --cov-report=term-missing
46
+
47
+ # Generate an HTML coverage report
48
+ .venv/bin/python -m pytest --cov=your_module --cov-report=html
49
+
50
+ # Combine terminal and HTML reports
51
+ .venv/bin/python -m pytest --cov=your_module --cov-report=term-missing --cov-report=html
52
+
53
+ # Run specific test file with coverage
54
+ .venv/bin/python -m pytest tests/test_file.py --cov=your_module --cov-report=term-missing
55
+ ```
56
+
57
+ ### Viewing HTML Reports
58
+
59
+ After generating an HTML report, open `htmlcov/index.html` in your browser to view detailed line-by-line coverage information.
60
+
61
+ ### Coverage Threshold
62
+
63
+ To enforce a minimum coverage percentage:
64
+ ```bash
65
+ .venv/bin/python -m pytest --cov=your_module --cov-fail-under=80
66
+ ```
67
+
68
+ This will cause the test suite to fail if coverage drops below 80%.
69
+
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.
73
+
74
+ ### Related Packages
75
+
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.
77
+
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
86
+
87
+ ## Versioning & Compatibility Policy
88
+
89
+ Wexample packages follow **Semantic Versioning** (SemVer):
90
+
91
+ - **MAJOR**: Breaking changes
92
+ - **MINOR**: New features, backward compatible
93
+ - **PATCH**: Bug fixes, backward compatible
94
+
95
+ We maintain backward compatibility within major versions and provide clear migration guides for breaking changes.
96
+
97
+ ## License
98
+
99
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
100
+
101
+ Free to use in both personal and commercial projects.
102
+
103
+ ## Integration in the Suite
104
+
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.
106
+
107
+ ### Related Packages
108
+
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.
110
+
111
+ Visit the [Wexample Suite documentation](https://docs.wexample.com) for the complete package ecosystem.
112
+
113
+ # About us
114
+
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.
116
+
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.
118
+
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.
120
+
121
+ ## Known Limitations & Roadmap
122
+
123
+ Current limitations and planned features are tracked in the GitHub issues.
124
+
125
+ See the [project roadmap](https://github.com/wexample/python-wex_addon_dev_javascript/issues) for upcoming features and improvements.
126
+
127
+ ## Status & Compatibility
128
+
129
+ **Maturity**: Production-ready
130
+
131
+ **Python Support**: >=3.10
132
+
133
+ **OS Support**: Linux, macOS, Windows
134
+
135
+ **Status**: Actively maintained
136
+
137
+ ## Useful Links
138
+
139
+ - **Homepage**: https://github.com/wexample/python-wex-addon-dev-javascript
140
+ - **Documentation**: [docs.wexample.com](https://docs.wexample.com)
141
+ - **Issue Tracker**: https://github.com/wexample/python-wex-addon-dev-javascript/issues
142
+ - **Discussions**: https://github.com/wexample/python-wex-addon-dev-javascript/discussions
143
+ - **PyPI**: [pypi.org/project/wex_addon_dev_javascript](https://pypi.org/project/wex_addon_dev_javascript/)
144
+
145
+ ## Migration Notes
146
+
147
+ When upgrading between major versions, refer to the migration guides in the documentation.
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.58"
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,8 +20,8 @@ classifiers = [
20
20
  dependencies = [
21
21
  "attrs>=23.1.0",
22
22
  "cattrs>=23.1.0",
23
- "wexample-filestate-javascript==0.0.15",
24
- "wexample-wex-addon-app==0.0.56",
23
+ "wexample-filestate-javascript>=0.1.0",
24
+ "wexample-wex-addon-app>=1.0.0",
25
25
  ]
26
26
 
27
27
  [project.readme]
@@ -74,11 +74,10 @@ class JavascriptPackageJsonFile(AppDependenciesConfigFileMixin, JsonFile):
74
74
  def get_dependencies_versions(
75
75
  self, optional: bool = False, group: str = "dev"
76
76
  ) -> dict[str, str]:
77
- return (
78
- self.read_config()
79
- .search(path="dependencies")
80
- .get_dict_or_default(default={})
81
- )
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}
82
81
 
83
82
  def _apply_default_publish_config(self, content: dict) -> None:
84
83
  content.setdefault("type", "module")
@@ -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
+ )
@@ -1,107 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: wexample-wex-addon-dev-javascript
3
- Version: 0.0.58
4
- Summary: Python dev addon for wex
5
- Author-Email: weeger <contact@wexample.com>
6
- License: MIT
7
- Classifier: Programming Language :: Python :: 3
8
- Classifier: License :: OSI Approved :: MIT License
9
- Classifier: Operating System :: OS Independent
10
- Project-URL: homepage, https://github.com/wexample/python-wex-dev-python
11
- Requires-Python: >=3.10
12
- Requires-Dist: attrs>=23.1.0
13
- Requires-Dist: cattrs>=23.1.0
14
- Requires-Dist: wexample-filestate-javascript==0.0.15
15
- Requires-Dist: wexample-wex-addon-app==0.0.56
16
- Provides-Extra: dev
17
- Requires-Dist: pytest; extra == "dev"
18
- Requires-Dist: pytest-cov; extra == "dev"
19
- Description-Content-Type: text/markdown
20
-
21
- # wexample-wex-addon-dev-javascript
22
-
23
- Version: 0.0.58
24
-
25
- Python dev addon for wex
26
-
27
- ## Table of Contents
28
-
29
- - [Status Compatibility](#status-compatibility)
30
- - [Tests](#tests)
31
- - [Roadmap](#roadmap)
32
- - [Useful Links](#useful-links)
33
-
34
-
35
- ## Status & Compatibility
36
-
37
- **Maturity**: Production-ready
38
-
39
- **Python Support**: >=3.10
40
-
41
- **OS Support**: Linux, macOS, Windows
42
-
43
- **Status**: Actively maintained
44
-
45
- ## Tests
46
-
47
- This project uses `pytest` for testing and `pytest-cov` for code coverage analysis.
48
-
49
- ### Installation
50
-
51
- First, install the required testing dependencies:
52
- ```bash
53
- .venv/bin/python -m pip install pytest pytest-cov
54
- ```
55
-
56
- ### Basic Usage
57
-
58
- Run all tests with coverage:
59
- ```bash
60
- .venv/bin/python -m pytest --cov --cov-report=html
61
- ```
62
-
63
- ### Common Commands
64
- ```bash
65
- # Run tests with coverage for a specific module
66
- .venv/bin/python -m pytest --cov=your_module
67
-
68
- # Show which lines are not covered
69
- .venv/bin/python -m pytest --cov=your_module --cov-report=term-missing
70
-
71
- # Generate an HTML coverage report
72
- .venv/bin/python -m pytest --cov=your_module --cov-report=html
73
-
74
- # Combine terminal and HTML reports
75
- .venv/bin/python -m pytest --cov=your_module --cov-report=term-missing --cov-report=html
76
-
77
- # Run specific test file with coverage
78
- .venv/bin/python -m pytest tests/test_file.py --cov=your_module --cov-report=term-missing
79
- ```
80
-
81
- ### Viewing HTML Reports
82
-
83
- After generating an HTML report, open `htmlcov/index.html` in your browser to view detailed line-by-line coverage information.
84
-
85
- ### Coverage Threshold
86
-
87
- To enforce a minimum coverage percentage:
88
- ```bash
89
- .venv/bin/python -m pytest --cov=your_module --cov-fail-under=80
90
- ```
91
-
92
- This will cause the test suite to fail if coverage drops below 80%.
93
-
94
- ## Known Limitations & Roadmap
95
-
96
- Current limitations and planned features are tracked in the GitHub issues.
97
-
98
- See the [project roadmap](https://github.com/wexample/python-wex_addon_dev_javascript/issues) for upcoming features and improvements.
99
-
100
- ## Useful Links
101
-
102
- - **Homepage**: https://github.com/wexample/python-wex-addon-dev-javascript
103
- - **Documentation**: [docs.wexample.com](https://docs.wexample.com)
104
- - **Issue Tracker**: https://github.com/wexample/python-wex-addon-dev-javascript/issues
105
- - **Discussions**: https://github.com/wexample/python-wex-addon-dev-javascript/discussions
106
- - **PyPI**: [pypi.org/project/wexample-wex-addon-dev-javascript](https://pypi.org/project/wexample-wex-addon-dev-javascript/)
107
-
@@ -1,87 +0,0 @@
1
- # wexample-wex-addon-dev-javascript
2
-
3
- Version: 0.0.58
4
-
5
- Python dev addon for wex
6
-
7
- ## Table of Contents
8
-
9
- - [Status Compatibility](#status-compatibility)
10
- - [Tests](#tests)
11
- - [Roadmap](#roadmap)
12
- - [Useful Links](#useful-links)
13
-
14
-
15
- ## Status & Compatibility
16
-
17
- **Maturity**: Production-ready
18
-
19
- **Python Support**: >=3.10
20
-
21
- **OS Support**: Linux, macOS, Windows
22
-
23
- **Status**: Actively maintained
24
-
25
- ## Tests
26
-
27
- This project uses `pytest` for testing and `pytest-cov` for code coverage analysis.
28
-
29
- ### Installation
30
-
31
- First, install the required testing dependencies:
32
- ```bash
33
- .venv/bin/python -m pip install pytest pytest-cov
34
- ```
35
-
36
- ### Basic Usage
37
-
38
- Run all tests with coverage:
39
- ```bash
40
- .venv/bin/python -m pytest --cov --cov-report=html
41
- ```
42
-
43
- ### Common Commands
44
- ```bash
45
- # Run tests with coverage for a specific module
46
- .venv/bin/python -m pytest --cov=your_module
47
-
48
- # Show which lines are not covered
49
- .venv/bin/python -m pytest --cov=your_module --cov-report=term-missing
50
-
51
- # Generate an HTML coverage report
52
- .venv/bin/python -m pytest --cov=your_module --cov-report=html
53
-
54
- # Combine terminal and HTML reports
55
- .venv/bin/python -m pytest --cov=your_module --cov-report=term-missing --cov-report=html
56
-
57
- # Run specific test file with coverage
58
- .venv/bin/python -m pytest tests/test_file.py --cov=your_module --cov-report=term-missing
59
- ```
60
-
61
- ### Viewing HTML Reports
62
-
63
- After generating an HTML report, open `htmlcov/index.html` in your browser to view detailed line-by-line coverage information.
64
-
65
- ### Coverage Threshold
66
-
67
- To enforce a minimum coverage percentage:
68
- ```bash
69
- .venv/bin/python -m pytest --cov=your_module --cov-fail-under=80
70
- ```
71
-
72
- This will cause the test suite to fail if coverage drops below 80%.
73
-
74
- ## Known Limitations & Roadmap
75
-
76
- Current limitations and planned features are tracked in the GitHub issues.
77
-
78
- See the [project roadmap](https://github.com/wexample/python-wex_addon_dev_javascript/issues) for upcoming features and improvements.
79
-
80
- ## Useful Links
81
-
82
- - **Homepage**: https://github.com/wexample/python-wex-addon-dev-javascript
83
- - **Documentation**: [docs.wexample.com](https://docs.wexample.com)
84
- - **Issue Tracker**: https://github.com/wexample/python-wex-addon-dev-javascript/issues
85
- - **Discussions**: https://github.com/wexample/python-wex-addon-dev-javascript/discussions
86
- - **PyPI**: [pypi.org/project/wexample-wex-addon-dev-javascript](https://pypi.org/project/wexample-wex-addon-dev-javascript/)
87
-
@@ -1,104 +0,0 @@
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 _get_readme_content(self) -> ReadmeContentConfigValue | None:
80
- from wexample_wex_addon_dev_javascript.config_value.javascript_package_readme_config_value import (
81
- JavascriptPackageReadmeContentConfigValue,
82
- )
83
-
84
- return JavascriptPackageReadmeContentConfigValue(workdir=self)
85
-
86
- def _get_suite_package_workdir_class(self) -> type[FrameworkPackageSuiteWorkdir]:
87
- from wexample_wex_addon_dev_javascript.workdir.javascript_packages_suite_workdir import (
88
- JavascriptPackagesSuiteWorkdir,
89
- )
90
-
91
- return JavascriptPackagesSuiteWorkdir
92
-
93
- def _publish(self, force: bool = False) -> None:
94
- """Create a git tag (vX.Y.Z) to trigger Trusted Publisher workflow."""
95
- tag = f"v{self.get_project_version()}"
96
- cwd = self.get_path()
97
-
98
- if git_tag_exists(tag, cwd=cwd, inherit_stdio=False):
99
- self.log(f"Tag {tag} already exists, skipping creation.")
100
- else:
101
- git_tag_annotated(tag, f"Release {tag}", cwd=cwd, inherit_stdio=True)
102
-
103
- # Uses git repo to deploy packages (tag push triggers GitHub Actions publication).
104
- self.push_to_deployment_remote()