wexample-wex-addon-dev-javascript 8.8.2__py3-none-any.whl → 8.10.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wexample_wex_addon_dev_javascript/file/node_package_json_file.py +63 -0
- wexample_wex_addon_dev_javascript/services/node/commands/service/refresh_lock.py +20 -3
- wexample_wex_addon_dev_javascript/workdir/javascript_package_workdir.py +13 -2
- {wexample_wex_addon_dev_javascript-8.8.2.dist-info → wexample_wex_addon_dev_javascript-8.10.0.dist-info}/METADATA +3 -3
- {wexample_wex_addon_dev_javascript-8.8.2.dist-info → wexample_wex_addon_dev_javascript-8.10.0.dist-info}/RECORD +7 -7
- {wexample_wex_addon_dev_javascript-8.8.2.dist-info → wexample_wex_addon_dev_javascript-8.10.0.dist-info}/WHEEL +0 -0
- {wexample_wex_addon_dev_javascript-8.8.2.dist-info → wexample_wex_addon_dev_javascript-8.10.0.dist-info}/entry_points.txt +0 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import re
|
|
4
|
+
|
|
3
5
|
from wexample_filestate.item.file.json_file import JsonFile
|
|
4
6
|
from wexample_helpers.decorator.base_class import base_class
|
|
5
7
|
from wexample_wex_addon_app.item.file.mixin.app_dependencies_config_file_mixin import (
|
|
@@ -78,3 +80,64 @@ class NodePackageJsonFile(AppDependenciesConfigFileMixin, JsonFile):
|
|
|
78
80
|
return (
|
|
79
81
|
self.read_config().search(path="devDependencies").to_dict_or_none() or {}
|
|
80
82
|
)
|
|
83
|
+
|
|
84
|
+
def get_registry_versions(self) -> dict[str, str] | None:
|
|
85
|
+
"""The latest version of each dependency of a scope the .npmrc beside
|
|
86
|
+
this manifest sends to a registry of ours (`@scope:registry=…`), read
|
|
87
|
+
from that registry. Linked or local dependencies are not versions."""
|
|
88
|
+
import json
|
|
89
|
+
import urllib.error
|
|
90
|
+
import urllib.parse
|
|
91
|
+
import urllib.request
|
|
92
|
+
|
|
93
|
+
npmrc = self.get_path().parent / ".npmrc"
|
|
94
|
+
if not npmrc.is_file():
|
|
95
|
+
return None
|
|
96
|
+
scopes = {}
|
|
97
|
+
for line in npmrc.read_text().splitlines():
|
|
98
|
+
match = re.match(r"^\s*(@[^:\s]+):registry\s*=\s*(\S+)", line)
|
|
99
|
+
if match:
|
|
100
|
+
scopes[match.group(1)] = match.group(2).rstrip("/") + "/"
|
|
101
|
+
if not scopes:
|
|
102
|
+
return None
|
|
103
|
+
|
|
104
|
+
versions: dict[str, str] = {}
|
|
105
|
+
dependencies = {
|
|
106
|
+
**self.get_dependencies_versions(),
|
|
107
|
+
**self.get_dev_dependencies_versions(),
|
|
108
|
+
}
|
|
109
|
+
for name, specifier in dependencies.items():
|
|
110
|
+
registry = scopes.get(name.split("/", 1)[0])
|
|
111
|
+
if not registry or re.match(r"^(link|file|portal|workspace):", specifier):
|
|
112
|
+
continue
|
|
113
|
+
try:
|
|
114
|
+
with urllib.request.urlopen(
|
|
115
|
+
urllib.request.Request(
|
|
116
|
+
registry + urllib.parse.quote(name, safe="@"),
|
|
117
|
+
headers=self._forge_headers(registry),
|
|
118
|
+
),
|
|
119
|
+
timeout=15,
|
|
120
|
+
) as answer:
|
|
121
|
+
latest = json.load(answer).get("dist-tags", {}).get("latest")
|
|
122
|
+
except urllib.error.HTTPError as error:
|
|
123
|
+
if error.code == 404:
|
|
124
|
+
continue
|
|
125
|
+
raise
|
|
126
|
+
if latest:
|
|
127
|
+
versions[name] = latest
|
|
128
|
+
return versions
|
|
129
|
+
|
|
130
|
+
def _forge_headers(self, url: str) -> dict[str, str]:
|
|
131
|
+
"""The app's GitLab token, for a registry of its own forge (git.gitlab_url):
|
|
132
|
+
a private group answers nobody else, and another forge would refuse a
|
|
133
|
+
token that is not its own."""
|
|
134
|
+
try:
|
|
135
|
+
forge = (
|
|
136
|
+
self.get_parent_item().get_config().search("git.gitlab_url").get_str_or_none()
|
|
137
|
+
)
|
|
138
|
+
token = self.get_env_parameter("GITLAB_API_TOKEN", default=None)
|
|
139
|
+
except Exception:
|
|
140
|
+
return {}
|
|
141
|
+
if forge and token and url.startswith(forge.rstrip("/") + "/"):
|
|
142
|
+
return {"Authorization": f"Bearer {token}"}
|
|
143
|
+
return {}
|
|
@@ -16,6 +16,9 @@ if TYPE_CHECKING:
|
|
|
16
16
|
from wexample_cli.context.execution_context import ExecutionContext
|
|
17
17
|
from wexample_wex_addon_app.service.app_service import AppService
|
|
18
18
|
|
|
19
|
+
# The image node runs from when the app is not running.
|
|
20
|
+
NODE_LOCK_IMAGE = "node:24-slim"
|
|
21
|
+
|
|
19
22
|
|
|
20
23
|
@option(
|
|
21
24
|
name="npm_packages",
|
|
@@ -52,10 +55,14 @@ def node__service__refresh_lock(
|
|
|
52
55
|
if not npm_packages:
|
|
53
56
|
return
|
|
54
57
|
|
|
58
|
+
# A throwaway node image (the app not running) has yarn and pnpm through
|
|
59
|
+
# corepack only.
|
|
55
60
|
script = f"""
|
|
56
61
|
set -e
|
|
57
62
|
cd {APP_DIR}
|
|
58
|
-
|
|
63
|
+
command -v yarn > /dev/null || yarn() {{ corepack yarn "$@"; }}
|
|
64
|
+
command -v pnpm > /dev/null || pnpm() {{ corepack pnpm "$@"; }}
|
|
65
|
+
if [ -f yarn.lock ]; then yarn install --non-interactive
|
|
59
66
|
elif [ -f pnpm-lock.yaml ]; then pnpm install --lockfile-only
|
|
60
67
|
elif [ -f package-lock.json ]; then npm install --package-lock-only
|
|
61
68
|
else
|
|
@@ -65,7 +72,17 @@ fi
|
|
|
65
72
|
"""
|
|
66
73
|
|
|
67
74
|
context.io.log(f"Refreshing javascript lock file ({npm_packages})…")
|
|
68
|
-
output = service.
|
|
69
|
-
|
|
75
|
+
output = service.exec_or_run(
|
|
76
|
+
["/bin/sh", "-c", script],
|
|
77
|
+
image=NODE_LOCK_IMAGE,
|
|
78
|
+
mount=APP_DIR,
|
|
79
|
+
# A lock refresh builds nothing: the throwaway container runs no
|
|
80
|
+
# package script, which may need what only the app's image has.
|
|
81
|
+
env={
|
|
82
|
+
"COREPACK_HOME": "/tmp/corepack",
|
|
83
|
+
"COREPACK_ENABLE_DOWNLOAD_PROMPT": "0",
|
|
84
|
+
"YARN_IGNORE_SCRIPTS": "true",
|
|
85
|
+
"npm_config_ignore_scripts": "true",
|
|
86
|
+
},
|
|
70
87
|
)
|
|
71
88
|
context.io.log(output)
|
|
@@ -398,7 +398,13 @@ class JavascriptPackageWorkdir(JavascriptWorkdir):
|
|
|
398
398
|
version = self.get_setup_version()
|
|
399
399
|
group_url = self.get_gitlab_registry_url()
|
|
400
400
|
|
|
401
|
-
|
|
401
|
+
# With the suite's token: a private group answers nobody else.
|
|
402
|
+
gateway = NpmRegistryGateway(
|
|
403
|
+
base_url=group_url,
|
|
404
|
+
token=self.get_env_parameter_or_suite_fallback("GITLAB_API_TOKEN"),
|
|
405
|
+
io=self.io,
|
|
406
|
+
timeout=10,
|
|
407
|
+
)
|
|
402
408
|
if gateway.has_version(package, version) and not force:
|
|
403
409
|
self.log(f"{package}@{version} is already on the GitLab registry.")
|
|
404
410
|
return
|
|
@@ -502,7 +508,12 @@ class JavascriptPackageWorkdir(JavascriptWorkdir):
|
|
|
502
508
|
group_url = self.get_gitlab_registry_url()
|
|
503
509
|
if group_url:
|
|
504
510
|
self._wait_for_version(
|
|
505
|
-
NpmRegistryGateway(
|
|
511
|
+
NpmRegistryGateway(
|
|
512
|
+
base_url=group_url,
|
|
513
|
+
token=self.get_env_parameter_or_suite_fallback("GITLAB_API_TOKEN"),
|
|
514
|
+
io=self.io,
|
|
515
|
+
timeout=10,
|
|
516
|
+
),
|
|
506
517
|
delay_seconds=5,
|
|
507
518
|
)
|
|
508
519
|
else:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: wexample-wex-addon-dev-javascript
|
|
3
|
-
Version: 8.
|
|
3
|
+
Version: 8.10.0
|
|
4
4
|
Summary: Extends wex with JavaScript support: enforces JS/TS project layout and symlinks local npm packages into node_modules
|
|
5
5
|
Author-Email: weeger <contact@wexample.com>
|
|
6
6
|
License: MIT
|
|
@@ -14,7 +14,7 @@ Requires-Dist: cattrs>=23.1.0
|
|
|
14
14
|
Requires-Dist: wexample-api>=6.8.0
|
|
15
15
|
Requires-Dist: wexample-filestate-javascript>=6.6.0
|
|
16
16
|
Requires-Dist: wexample-wex-addon-ai>=19.1.0
|
|
17
|
-
Requires-Dist: wexample-wex-addon-app>=34.
|
|
17
|
+
Requires-Dist: wexample-wex-addon-app>=34.10.0
|
|
18
18
|
Provides-Extra: dev
|
|
19
19
|
Requires-Dist: pytest; extra == "dev"
|
|
20
20
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
@@ -22,7 +22,7 @@ Description-Content-Type: text/markdown
|
|
|
22
22
|
|
|
23
23
|
# wex_addon_dev_javascript
|
|
24
24
|
|
|
25
|
-
Version: 8.
|
|
25
|
+
Version: 8.10.0
|
|
26
26
|
|
|
27
27
|
Extends wex with JavaScript support: enforces JS/TS project layout and symlinks local npm packages into node_modules
|
|
28
28
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
wexample_wex_addon_dev_javascript-8.
|
|
2
|
-
wexample_wex_addon_dev_javascript-8.
|
|
3
|
-
wexample_wex_addon_dev_javascript-8.
|
|
1
|
+
wexample_wex_addon_dev_javascript-8.10.0.dist-info/METADATA,sha256=Mi5dExUGDKKkBIvfjobnosRu6erK3Zfk2zj8Ea4wTJI,3403
|
|
2
|
+
wexample_wex_addon_dev_javascript-8.10.0.dist-info/WHEEL,sha256=IuIk3wbaEnFH1cx75iM2R1CmliRI3dFLXTbRakgvgFQ,90
|
|
3
|
+
wexample_wex_addon_dev_javascript-8.10.0.dist-info/entry_points.txt,sha256=WwYdg3RL2Ey1fg4JNNkcQxZcQRgZSgPLLzSDi6lbYgI,143
|
|
4
4
|
wexample_wex_addon_dev_javascript/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
wexample_wex_addon_dev_javascript/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
wexample_wex_addon_dev_javascript/common/npm_registry_gateway.py,sha256=jcAIOZN1eiPeRSjradY095VI93ne86ijbVAZcXzCKpQ,2742
|
|
@@ -13,7 +13,7 @@ wexample_wex_addon_dev_javascript/file/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFB
|
|
|
13
13
|
wexample_wex_addon_dev_javascript/file/javascript_package_json_file.py,sha256=yn1ltv3oBYNg1OvUytJ4PEzH8FSJS2KcIKK8y-cMrl4,2906
|
|
14
14
|
wexample_wex_addon_dev_javascript/file/javascript_package_lock_json_file.py,sha256=PPlIbKksyw0IPjJuaNbxcwty1nsH875owgRCgeJIij4,1388
|
|
15
15
|
wexample_wex_addon_dev_javascript/file/javascript_tsconfig_json_file.py,sha256=a2vfYgB7gbiIiGljU_QA6extFJPyNM6rlhhAS3YoeCs,1395
|
|
16
|
-
wexample_wex_addon_dev_javascript/file/node_package_json_file.py,sha256=
|
|
16
|
+
wexample_wex_addon_dev_javascript/file/node_package_json_file.py,sha256=RTj9CExKr04YSHkUmsSD78W-sx4ciRUqyH0LSHUjkNM,5186
|
|
17
17
|
wexample_wex_addon_dev_javascript/formatter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
18
|
wexample_wex_addon_dev_javascript/formatter/javascript_code_formatter.py,sha256=6TLrynxXH-P0kHiW6FmgROA8fG2Ik03Pn4JV9dctDuE,1618
|
|
19
19
|
wexample_wex_addon_dev_javascript/javascript_addon_manager.py,sha256=zateyPGxtR4eOdjstfLI6MfTagEOWAAeb2CZqF_qMVo,1387
|
|
@@ -28,7 +28,7 @@ wexample_wex_addon_dev_javascript/services/node/__init__.py,sha256=47DEQpj8HBSa-
|
|
|
28
28
|
wexample_wex_addon_dev_javascript/services/node/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
29
29
|
wexample_wex_addon_dev_javascript/services/node/commands/service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
30
|
wexample_wex_addon_dev_javascript/services/node/commands/service/install_local.py,sha256=U4WjWabvGhlET5zocCfKIT-1WwQJbRK0GOGD7krwTnE,3283
|
|
31
|
-
wexample_wex_addon_dev_javascript/services/node/commands/service/refresh_lock.py,sha256=
|
|
31
|
+
wexample_wex_addon_dev_javascript/services/node/commands/service/refresh_lock.py,sha256=dOjy9Hth5UOWJAgzPTc8jsxLquD1PhDnROgPSviZKwQ,2925
|
|
32
32
|
wexample_wex_addon_dev_javascript/services/node/docker/.wex.yml,sha256=JdIF6nGkFcfi76yZYGlXxeWfOK4eAUSV_gAn6i3hk2w,32
|
|
33
33
|
wexample_wex_addon_dev_javascript/services/node/docker/docker-compose.yml,sha256=joejn22luhTK0U2vRMh52NjeWidu1EswuUdfKeb7GEM,371
|
|
34
34
|
wexample_wex_addon_dev_javascript/services/node/service.yml,sha256=jPLW-E4ymVaEnTwdTjVvTJNx04pwMGN4twxeOuN37mo,95
|
|
@@ -47,7 +47,7 @@ wexample_wex_addon_dev_javascript/services/vite/docker/.wex.yml,sha256=JdIF6nGkF
|
|
|
47
47
|
wexample_wex_addon_dev_javascript/services/vite/docker/docker-compose.yml,sha256=M7ejIcht0GxuEAEEcK3urBIrXA66JwYrr5EPUA9nMMM,595
|
|
48
48
|
wexample_wex_addon_dev_javascript/services/vite/service.yml,sha256=8mFPv49QbKA3klHFbNK73QOB7ryy38zFeLiQB3gfDys,184
|
|
49
49
|
wexample_wex_addon_dev_javascript/workdir/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
50
|
-
wexample_wex_addon_dev_javascript/workdir/javascript_package_workdir.py,sha256
|
|
50
|
+
wexample_wex_addon_dev_javascript/workdir/javascript_package_workdir.py,sha256=-fupJbq_9KmCLwjZQ-PcQwoFEcshg-DarABRXaHDJcU,23613
|
|
51
51
|
wexample_wex_addon_dev_javascript/workdir/javascript_packages_suite_workdir.py,sha256=b0QoTWlNYOYfpqEb8vYzL4WRoY0WwBhYOFUoRc4oySI,928
|
|
52
52
|
wexample_wex_addon_dev_javascript/workdir/javascript_workdir.py,sha256=EFY0-500y9PKeLtZIvI-q53n-EfNiHCpKnkmWm-q68w,9948
|
|
53
|
-
wexample_wex_addon_dev_javascript-8.
|
|
53
|
+
wexample_wex_addon_dev_javascript-8.10.0.dist-info/RECORD,,
|
|
File without changes
|