wexample-wex-addon-dev-javascript 0.0.55__tar.gz → 0.0.56__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 (17) hide show
  1. {wexample_wex_addon_dev_javascript-0.0.55 → wexample_wex_addon_dev_javascript-0.0.56}/PKG-INFO +69 -12
  2. {wexample_wex_addon_dev_javascript-0.0.55 → wexample_wex_addon_dev_javascript-0.0.56}/README.md +65 -9
  3. {wexample_wex_addon_dev_javascript-0.0.55 → wexample_wex_addon_dev_javascript-0.0.56}/pyproject.toml +4 -3
  4. {wexample_wex_addon_dev_javascript-0.0.55/src/wexample_wex_addon_dev_javascript/workdir → wexample_wex_addon_dev_javascript-0.0.56/src/wexample_wex_addon_dev_javascript/config_value}/__init__.py +0 -0
  5. wexample_wex_addon_dev_javascript-0.0.56/src/wexample_wex_addon_dev_javascript/config_value/javascript_package_readme_config_value.py +14 -0
  6. wexample_wex_addon_dev_javascript-0.0.55/src/wexample_wex_addon_dev_javascript/py.typed → wexample_wex_addon_dev_javascript-0.0.56/src/wexample_wex_addon_dev_javascript/file/__init__.py +0 -0
  7. wexample_wex_addon_dev_javascript-0.0.56/src/wexample_wex_addon_dev_javascript/file/javascript_package_json_file.py +43 -0
  8. wexample_wex_addon_dev_javascript-0.0.56/src/wexample_wex_addon_dev_javascript/py.typed +0 -0
  9. wexample_wex_addon_dev_javascript-0.0.56/src/wexample_wex_addon_dev_javascript/workdir/__init__.py +0 -0
  10. wexample_wex_addon_dev_javascript-0.0.56/src/wexample_wex_addon_dev_javascript/workdir/javascript_package_workdir.py +92 -0
  11. wexample_wex_addon_dev_javascript-0.0.56/src/wexample_wex_addon_dev_javascript/workdir/javascript_workdir.py +130 -0
  12. wexample_wex_addon_dev_javascript-0.0.55/src/wexample_wex_addon_dev_javascript/workdir/javascript_package_workdir.py +0 -17
  13. wexample_wex_addon_dev_javascript-0.0.55/src/wexample_wex_addon_dev_javascript/workdir/javascript_workdir.py +0 -9
  14. {wexample_wex_addon_dev_javascript-0.0.55 → wexample_wex_addon_dev_javascript-0.0.56}/src/wexample_wex_addon_dev_javascript/__init__.py +0 -0
  15. {wexample_wex_addon_dev_javascript-0.0.55 → wexample_wex_addon_dev_javascript-0.0.56}/src/wexample_wex_addon_dev_javascript/__pycache__/__init__.py +0 -0
  16. {wexample_wex_addon_dev_javascript-0.0.55 → wexample_wex_addon_dev_javascript-0.0.56}/src/wexample_wex_addon_dev_javascript/javascript_addon_manager.py +0 -0
  17. {wexample_wex_addon_dev_javascript-0.0.55 → wexample_wex_addon_dev_javascript-0.0.56}/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.55
3
+ Version: 0.0.56
4
4
  Summary: Python dev addon for wex
5
5
  Author-Email: weeger <contact@wexample.com>
6
6
  License: MIT
@@ -11,8 +11,9 @@ 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-wex-addon-app==0.0.53
15
- Requires-Dist: wexample-wex-core==6.0.65
14
+ Requires-Dist: wexample-filestate-javascript==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"
@@ -20,10 +21,49 @@ Description-Content-Type: text/markdown
20
21
 
21
22
  # wexample-wex-addon-dev-javascript
22
23
 
23
- Version: 0.0.55
24
+ Version: 0.0.56
24
25
 
25
26
  Python dev addon for wex
26
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
+
27
67
  ## Tests
28
68
 
29
69
  This project uses `pytest` for testing and `pytest-cov` for code coverage analysis.
@@ -110,13 +150,13 @@ Breaking changes are clearly documented with upgrade paths and examples.
110
150
 
111
151
  Current limitations and planned features are tracked in the GitHub issues.
112
152
 
113
- See the [project roadmap](https://github.com/wexample/python-wex-dev-python/issues) for upcoming features and improvements.
153
+ See the [project roadmap](https://github.com/wexample/python-wex_addon_dev_javascript/issues) for upcoming features and improvements.
114
154
 
115
155
  ## Security Policy
116
156
 
117
157
  ### Reporting Vulnerabilities
118
158
 
119
- If you discover a security vulnerability, please email security@wexample.com.
159
+ If you discover a security vulnerability, please email contact@wexample.com.
120
160
 
121
161
  **Do not** open public issues for security vulnerabilities.
122
162
 
@@ -139,7 +179,7 @@ Community support is available through GitHub Discussions.
139
179
 
140
180
  ## Contribution Guidelines
141
181
 
142
- We welcome contributions to the Wexample suite!
182
+ We welcome contributions to the Wexample suite!
143
183
 
144
184
  ### How to Contribute
145
185
 
@@ -157,14 +197,16 @@ See [CONTRIBUTORS.md](CONTRIBUTORS.md) for the full list of contributors.
157
197
 
158
198
  ## License
159
199
 
160
- 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.
161
203
 
162
204
  ## Useful Links
163
205
 
164
- - **Homepage**: https://github.com/wexample/python-wex-dev-python
206
+ - **Homepage**: https://github.com/wexample/python-wex-addon-dev-javascript
165
207
  - **Documentation**: [docs.wexample.com](https://docs.wexample.com)
166
- - **Issue Tracker**: https://github.com/wexample/python-wex-dev-python/issues
167
- - **Discussions**: https://github.com/wexample/python-wex-dev-python/discussions
208
+ - **Issue Tracker**: https://github.com/wexample/python-wex-addon-dev-javascript/issues
209
+ - **Discussions**: https://github.com/wexample/python-wex-addon-dev-javascript/discussions
168
210
  - **PyPI**: [pypi.org/project/wexample-wex-addon-dev-javascript](https://pypi.org/project/wexample-wex-addon-dev-javascript/)
169
211
 
170
212
  ## Integration in the Suite
@@ -177,9 +219,24 @@ The suite includes packages for configuration management, file handling, prompts
177
219
 
178
220
  Visit the [Wexample Suite documentation](https://docs.wexample.com) for the complete package ecosystem.
179
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.13
233
+ - wexample-wex-addon-app: ==0.0.54
234
+ - wexample-wex-core: ==6.0.66
235
+
236
+
180
237
  # About us
181
238
 
182
- 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.
183
240
 
184
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.
185
242
 
@@ -1,9 +1,48 @@
1
1
  # wexample-wex-addon-dev-javascript
2
2
 
3
- Version: 0.0.55
3
+ Version: 0.0.56
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-wex-dev-python/issues) for upcoming features and improvements.
132
+ See the [project roadmap](https://github.com/wexample/python-wex_addon_dev_javascript/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 security@wexample.com.
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-python
185
+ - **Homepage**: https://github.com/wexample/python-wex-addon-dev-javascript
145
186
  - **Documentation**: [docs.wexample.com](https://docs.wexample.com)
146
- - **Issue Tracker**: https://github.com/wexample/python-wex-dev-python/issues
147
- - **Discussions**: https://github.com/wexample/python-wex-dev-python/discussions
187
+ - **Issue Tracker**: https://github.com/wexample/python-wex-addon-dev-javascript/issues
188
+ - **Discussions**: https://github.com/wexample/python-wex-addon-dev-javascript/discussions
148
189
  - **PyPI**: [pypi.org/project/wexample-wex-addon-dev-javascript](https://pypi.org/project/wexample-wex-addon-dev-javascript/)
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-javascript: ==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-javascript"
9
- version = "0.0.55"
9
+ version = "0.0.56"
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-wex-addon-app==0.0.53",
24
- "wexample-wex-core==6.0.65",
23
+ "wexample-filestate-javascript==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]
@@ -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 JavascriptPackageReadmeContentConfigValue(AppReadmeConfigValue):
11
+ """README generation for Javascript packages."""
12
+
13
+ def _get_app_description(self) -> str:
14
+ return self.workdir.get_app_config().get("description", "")
@@ -0,0 +1,43 @@
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 JavascriptPackageJsonFile(JsonFile):
14
+ def get_dependencies_versions(
15
+ self, optional: bool = False, group: str = "dev"
16
+ ) -> dict[str, str]:
17
+ return (
18
+ self.read_config()
19
+ .search(path="dependencies")
20
+ .get_dict_or_default(default={})
21
+ )
22
+
23
+ def dumps(self, content: dict | None = None) -> str:
24
+ import json
25
+
26
+ content = content or self.read_parsed()
27
+
28
+ package = self.find_package_workdir()
29
+ if package:
30
+ if not content.get("name"):
31
+ content["name"] = package.get_package_import_name()
32
+
33
+ content["version"] = package.get_project_version()
34
+
35
+ if not content.get("type"):
36
+ content["type"] = "module"
37
+
38
+ return json.dumps(content or {}, ensure_ascii=False, indent=2)
39
+
40
+ def find_package_workdir(self) -> CodeBaseWorkdir | None:
41
+ from wexample_wex_addon_app.workdir.code_base_workdir import CodeBaseWorkdir
42
+
43
+ return self.find_closest(CodeBaseWorkdir)
@@ -0,0 +1,92 @@
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
+ from wexample_wex_addon_dev_javascript.workdir.javascript_workdir import (
9
+ JavascriptWorkdir,
10
+ )
11
+
12
+ if TYPE_CHECKING:
13
+ from wexample_filestate.config_value.readme_content_config_value import (
14
+ ReadmeContentConfigValue,
15
+ )
16
+ from wexample_wex_addon_app.workdir.framework_packages_suite_workdir import (
17
+ FrameworkPackageSuiteWorkdir,
18
+ )
19
+
20
+
21
+ class JavascriptPackageWorkdir(JavascriptWorkdir):
22
+ def _get_readme_content(self) -> ReadmeContentConfigValue | None:
23
+ from wexample_wex_addon_dev_javascript.config_value.javascript_package_readme_config_value import (
24
+ JavascriptPackageReadmeContentConfigValue,
25
+ )
26
+
27
+ return JavascriptPackageReadmeContentConfigValue(workdir=self)
28
+
29
+ def _get_suite_package_workdir_class(self) -> type[FrameworkPackageSuiteWorkdir]:
30
+ from wexample_wex_addon_dev_javascript.workdir.javascript_packages_suite_workdir import (
31
+ JavascriptPackagesSuiteWorkdir,
32
+ )
33
+
34
+ return JavascriptPackagesSuiteWorkdir
35
+
36
+ def get_package_import_name(self) -> str:
37
+ """Get the full package import name with vendor prefix."""
38
+ return (
39
+ f"@{self.get_vendor_name()}/{string_to_kebab_case(self.get_project_name())}"
40
+ )
41
+
42
+ def _publish(self, force: bool = False) -> None:
43
+ """Publish the package to npm, skipping if the version already exists."""
44
+ from wexample_helpers.helpers.shell import shell_run
45
+
46
+ package_name = self.get_package_name()
47
+ version = self.get_project_version()
48
+ registry = self.get_env_parameter_or_suite_fallback(
49
+ key="NPM_REGISTRY", default="https://registry.npmjs.org"
50
+ )
51
+
52
+ # Detect if the version already exists on the registry
53
+ release_exists = False
54
+ try:
55
+ shell_run(
56
+ [
57
+ "npm",
58
+ "view",
59
+ f"{package_name}@{version}",
60
+ "version",
61
+ "--registry",
62
+ registry,
63
+ ],
64
+ cwd=self.get_path(),
65
+ inherit_stdio=False,
66
+ )
67
+ release_exists = True
68
+ except subprocess.CalledProcessError:
69
+ release_exists = False
70
+
71
+ if release_exists and not force:
72
+ self.warning(
73
+ f'Trying to publish an existing release for package "{package_name}" version {version}'
74
+ )
75
+ return
76
+
77
+ token = self.get_env_parameter_or_suite_fallback("NPM_TOKEN")
78
+ env = os.environ.copy()
79
+ host = registry.rstrip("/").split("://")[-1]
80
+
81
+ if registry:
82
+ env["npm_config_registry"] = registry
83
+ if token:
84
+ env["NPM_TOKEN"] = token
85
+ env[f"npm_config_//{host}/:_authToken"] = token
86
+
87
+ shell_run(
88
+ ["npm", "publish", "--registry", registry],
89
+ cwd=self.get_path(),
90
+ env=env,
91
+ inherit_stdio=True,
92
+ )
@@ -0,0 +1,130 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from wexample_config.options_provider.abstract_options_provider import (
6
+ AbstractOptionsProvider,
7
+ )
8
+ from wexample_wex_addon_app.workdir.code_base_workdir import CodeBaseWorkdir
9
+
10
+ if TYPE_CHECKING:
11
+ from wexample_config.const.types import DictConfig
12
+ from wexample_filestate.option.children_file_factory_option import (
13
+ ChildrenFileFactoryOption,
14
+ )
15
+
16
+ from wexample_wex_addon_dev_javascript.file.javascript_package_json_file import (
17
+ JavascriptPackageJsonFile,
18
+ )
19
+
20
+
21
+ class JavascriptWorkdir(CodeBaseWorkdir):
22
+ def get_app_config_file(self, reload: bool = True) -> JavascriptPackageJsonFile:
23
+ from wexample_wex_addon_dev_javascript.file.javascript_package_json_file import (
24
+ JavascriptPackageJsonFile,
25
+ )
26
+
27
+ config_file = self.find_by_type(JavascriptPackageJsonFile)
28
+ # Read once to populate content with file source.
29
+ config_file.read_text(reload=reload)
30
+ return config_file
31
+
32
+ def get_dependencies_versions(self) -> dict[str, str]:
33
+ return self.get_app_config_file().get_dependencies_versions()
34
+
35
+ def get_main_code_file_extension(self) -> str:
36
+ return "js"
37
+
38
+ def get_options_providers(self) -> list[type[AbstractOptionsProvider]]:
39
+ from wexample_filestate_javascript.options_provider.javascript_options_provider import (
40
+ JavascriptOptionsProvider,
41
+ )
42
+
43
+ options = super().get_options_providers()
44
+
45
+ options.extend(
46
+ [
47
+ JavascriptOptionsProvider,
48
+ ]
49
+ )
50
+
51
+ return options
52
+
53
+ def prepare_value(self, raw_value: DictConfig | None = None) -> DictConfig:
54
+ from wexample_filestate.const.disk import DiskItemType
55
+ from wexample_helpers.helpers.array import array_dict_get_by
56
+
57
+ from wexample_wex_addon_dev_javascript.file.javascript_package_json_file import (
58
+ JavascriptPackageJsonFile,
59
+ )
60
+
61
+ raw_value = super().prepare_value(raw_value=raw_value)
62
+
63
+ # Ensure a package.json file exists for any JavaScript package project
64
+ children = raw_value["children"]
65
+
66
+ children.append(
67
+ {
68
+ "class": JavascriptPackageJsonFile,
69
+ "name": "package.json",
70
+ "type": DiskItemType.FILE,
71
+ "should_exist": True,
72
+ }
73
+ )
74
+
75
+ # Add rules to .gitignore
76
+ array_dict_get_by("name", ".gitignore", children).setdefault(
77
+ "should_contain_lines", []
78
+ ).extend(
79
+ [
80
+ "node_modules/",
81
+ "dist/",
82
+ "build/",
83
+ ".npm",
84
+ ".eslintcache",
85
+ ]
86
+ )
87
+
88
+ children.extend(
89
+ [
90
+ {
91
+ "name": "tests",
92
+ "type": DiskItemType.DIRECTORY,
93
+ "should_exist": True,
94
+ "children": [
95
+ self._create_javascript_file_children_filter(),
96
+ ],
97
+ },
98
+ {
99
+ "name": "src",
100
+ "type": DiskItemType.DIRECTORY,
101
+ "should_exist": True,
102
+ "children": [
103
+ self._create_javascript_file_children_filter(),
104
+ ],
105
+ },
106
+ ]
107
+ )
108
+
109
+ return raw_value
110
+
111
+ def _create_javascript_file_children_filter(self) -> ChildrenFileFactoryOption:
112
+ from wexample_filestate.const.disk import DiskItemType
113
+ from wexample_filestate.option.children_filter_option import (
114
+ ChildrenFilterOption,
115
+ )
116
+ from wexample_filestate_javascript.file.javascript_file import JavascriptFile
117
+ from wexample_filestate_javascript.option.javascript.biome_option import (
118
+ BiomeOption,
119
+ )
120
+
121
+ # Using a generic pattern since there's no specific JavascriptFile class yet
122
+ return ChildrenFilterOption(
123
+ pattern={
124
+ "class": JavascriptFile,
125
+ "type": DiskItemType.FILE,
126
+ "javascript": [BiomeOption.get_name()],
127
+ },
128
+ name_pattern=r"^.*\.(js|jsx|ts|tsx)$",
129
+ recursive=True,
130
+ )
@@ -1,17 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from typing import TYPE_CHECKING
4
-
5
- from wexample_wex_addon_dev_javascript.workdir.javascript_workdir import (
6
- JavascriptWorkdir,
7
- )
8
-
9
- if TYPE_CHECKING:
10
- from wexample_config.const.types import DictConfig
11
-
12
-
13
- class JavascriptPackageWorkdir(JavascriptWorkdir):
14
- def prepare_value(self, raw_value: DictConfig | None = None) -> DictConfig:
15
- raw_value = super().prepare_value(raw_value=raw_value)
16
-
17
- return raw_value
@@ -1,9 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from wexample_wex_addon_app.workdir.code_base_workdir import CodeBaseWorkdir
4
-
5
-
6
- class JavascriptWorkdir(CodeBaseWorkdir):
7
- def get_dependencies(self) -> list[str]:
8
- # TODO search in package.json
9
- return []