wexample-wex-addon-dev-javascript 8.6.2__tar.gz → 8.8.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.
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/PKG-INFO +4 -4
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/README.md +1 -1
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/pyproject.toml +3 -3
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/common/__init__.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/common/npm_registry_gateway.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/const/__init__.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/const/registry.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/const/tags.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/file/javascript_package_lock_json_file.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/file/node_package_json_file.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/formatter/__init__.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/formatter/javascript_code_formatter.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/resources/design_rules/javascript_code.md +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/resources/package_gitlab_ci.yml +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/resources/writing_rules/javascript_code.md +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/node/commands/__init__.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/node/commands/service/__init__.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/node/commands/service/install_local.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/node/commands/service/refresh_lock.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/vite/ai/__init__.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/vite/ai/agents/__init__.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/vite/ai/agents/main/__init__.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/vite/ai/agents/main/about-service.md +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/vite/ai/agents/main/agent.yml +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/vite/app_service.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/workdir/javascript_package_workdir.py +184 -35
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/tests/.gitkeep +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/__init__.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/config_value/__init__.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/config_value/javascript_package_readme_config_value.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/file/__init__.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/file/javascript_package_json_file.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/file/javascript_tsconfig_json_file.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/javascript_addon_manager.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/py.typed +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/resources/.wex.yml +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/resources/package_publish.yml +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/__init__.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/node/__init__.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/node/docker/.wex.yml +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/node/docker/docker-compose.yml +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/node/service.yml +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/vite/__init__.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/vite/commands/__init__.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/vite/commands/service/__init__.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/vite/commands/service/install.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/vite/commands/service/ready.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/vite/docker/.wex.yml +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/vite/docker/docker-compose.yml +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/services/vite/service.yml +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/workdir/__init__.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/workdir/javascript_packages_suite_workdir.py +0 -0
- {wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/src/wexample_wex_addon_dev_javascript/workdir/javascript_workdir.py +0 -0
{wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: wexample-wex-addon-dev-javascript
|
|
3
|
-
Version: 8.
|
|
3
|
+
Version: 8.8.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
|
|
@@ -13,8 +13,8 @@ Requires-Dist: attrs>=23.1.0
|
|
|
13
13
|
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
|
-
Requires-Dist: wexample-wex-addon-ai>=19.0
|
|
17
|
-
Requires-Dist: wexample-wex-addon-app>=34.
|
|
16
|
+
Requires-Dist: wexample-wex-addon-ai>=19.1.0
|
|
17
|
+
Requires-Dist: wexample-wex-addon-app>=34.5.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.8.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
|
|
{wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/pyproject.toml
RENAMED
|
@@ -6,7 +6,7 @@ build-backend = "pdm.backend"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "wexample-wex-addon-dev-javascript"
|
|
9
|
-
version = "8.
|
|
9
|
+
version = "8.8.0"
|
|
10
10
|
description = "Extends wex with JavaScript support: enforces JS/TS project layout and symlinks local npm packages into node_modules"
|
|
11
11
|
authors = [
|
|
12
12
|
{ name = "weeger", email = "contact@wexample.com" },
|
|
@@ -22,8 +22,8 @@ dependencies = [
|
|
|
22
22
|
"cattrs>=23.1.0",
|
|
23
23
|
"wexample-api>=6.8.0",
|
|
24
24
|
"wexample-filestate-javascript>=6.6.0",
|
|
25
|
-
"wexample-wex-addon-ai>=19.0
|
|
26
|
-
"wexample-wex-addon-app>=34.
|
|
25
|
+
"wexample-wex-addon-ai>=19.1.0",
|
|
26
|
+
"wexample-wex-addon-app>=34.5.0",
|
|
27
27
|
]
|
|
28
28
|
|
|
29
29
|
[project.readme]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -35,6 +35,19 @@ class JavascriptPackageWorkdir(JavascriptWorkdir):
|
|
|
35
35
|
description="Set when this run created the package on the registry",
|
|
36
36
|
)
|
|
37
37
|
|
|
38
|
+
def get_gitlab_registry_url(self) -> str | None:
|
|
39
|
+
"""The GitLab npm registry of the group, when the suite publishes there.
|
|
40
|
+
|
|
41
|
+
`npm.gitlab_registry.url`, the group's endpoint:
|
|
42
|
+
`https://gitlab.example.com/api/v4/groups/<group>/-/packages/npm/`.
|
|
43
|
+
Installs read it for the vendor's scope, and it forwards what it does
|
|
44
|
+
not hold to npm; each package uploads to its own project's registry,
|
|
45
|
+
which the group one gathers.
|
|
46
|
+
"""
|
|
47
|
+
return self.search_app_or_suite_runtime_config(
|
|
48
|
+
"npm.gitlab_registry.url", default=None
|
|
49
|
+
).get_str_or_none()
|
|
50
|
+
|
|
38
51
|
def get_package_dependency_name(self) -> str:
|
|
39
52
|
return self.get_package_import_name()
|
|
40
53
|
|
|
@@ -128,31 +141,21 @@ class JavascriptPackageWorkdir(JavascriptWorkdir):
|
|
|
128
141
|
UPGRADE_TYPE_MAJOR,
|
|
129
142
|
UPGRADE_TYPE_MINOR,
|
|
130
143
|
)
|
|
131
|
-
from
|
|
132
|
-
from wexample_helpers_git.helper.git import git_has_changes_since_tag
|
|
144
|
+
from wexample_helpers_git.helper.git import git_content_changed_files_since_tag
|
|
133
145
|
|
|
134
|
-
if not
|
|
146
|
+
if not git_content_changed_files_since_tag(last_tag, "src", cwd=self.get_path()):
|
|
135
147
|
return UPGRADE_TYPE_MINOR
|
|
136
148
|
|
|
137
149
|
# Check if all changes in src/ are whitespace-only — safe to treat as patch
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
cwd=self.get_path(),
|
|
141
|
-
check=False,
|
|
142
|
-
capture=True,
|
|
150
|
+
changed_files = git_content_changed_files_since_tag(
|
|
151
|
+
last_tag, "src", cwd=self.get_path(), ignore_whitespace=True
|
|
143
152
|
)
|
|
144
|
-
if not
|
|
153
|
+
if not changed_files:
|
|
145
154
|
self.log("Only whitespace changes in src/, treating as patch.")
|
|
146
155
|
return UPGRADE_TYPE_MINOR
|
|
147
156
|
|
|
148
157
|
# Check if all changed files in src/ are non-TypeScript — cannot break the TS API
|
|
149
|
-
|
|
150
|
-
["git", "diff", "--name-only", last_tag, "--", "src/"],
|
|
151
|
-
cwd=self.get_path(),
|
|
152
|
-
check=False,
|
|
153
|
-
capture=True,
|
|
154
|
-
)
|
|
155
|
-
if not any(f.endswith((".ts", ".tsx")) for f in changed_files.stdout.splitlines()):
|
|
158
|
+
if not any(f.endswith((".ts", ".tsx")) for f in changed_files):
|
|
156
159
|
self.log("Only non-TypeScript files changed in src/, treating as minor.")
|
|
157
160
|
return UPGRADE_TYPE_INTERMEDIATE
|
|
158
161
|
|
|
@@ -232,6 +235,16 @@ class JavascriptPackageWorkdir(JavascriptWorkdir):
|
|
|
232
235
|
f" workflow: {workflow}"
|
|
233
236
|
)
|
|
234
237
|
|
|
238
|
+
def _get_node_command_environment(self) -> dict[str, str]:
|
|
239
|
+
environment = super()._get_node_command_environment()
|
|
240
|
+
group_url = self.get_gitlab_registry_url()
|
|
241
|
+
# The vendor's packages are installed from GitLab, which holds a version
|
|
242
|
+
# as soon as a sibling publishes it, and forwards to npm what it lacks.
|
|
243
|
+
if group_url:
|
|
244
|
+
scope = self.get_project_name().split("/", 1)[0]
|
|
245
|
+
environment[f"npm_config_{scope}:registry"] = group_url
|
|
246
|
+
return environment
|
|
247
|
+
|
|
235
248
|
def _get_readme_content(self) -> ReadmeContentConfigValue | None:
|
|
236
249
|
from wexample_wex_addon_dev_javascript.config_value.javascript_package_readme_config_value import (
|
|
237
250
|
JavascriptPackageReadmeContentConfigValue,
|
|
@@ -279,6 +292,9 @@ class JavascriptPackageWorkdir(JavascriptWorkdir):
|
|
|
279
292
|
# already lists.
|
|
280
293
|
if not self._first_publication:
|
|
281
294
|
return
|
|
295
|
+
# The wait before was on GitLab: npm lists a new package much later.
|
|
296
|
+
if self.get_gitlab_registry_url():
|
|
297
|
+
self._wait_for_version(self._get_registry_gateway())
|
|
282
298
|
try:
|
|
283
299
|
self._declare_trusted_publisher()
|
|
284
300
|
except Exception:
|
|
@@ -286,7 +302,31 @@ class JavascriptPackageWorkdir(JavascriptWorkdir):
|
|
|
286
302
|
|
|
287
303
|
def _publish(self, force: bool = False) -> None:
|
|
288
304
|
"""Push a git tag to the deployment remote to trigger a CI/CD publication workflow."""
|
|
289
|
-
|
|
305
|
+
import os
|
|
306
|
+
|
|
307
|
+
# Our own registry first, where the release counts: what the suite's
|
|
308
|
+
# next packages install, and what the publication waits for. npm then
|
|
309
|
+
# follows from the tag, through the mirror and GitHub's workflow,
|
|
310
|
+
# without anyone waiting for it.
|
|
311
|
+
if self.get_gitlab_registry_url():
|
|
312
|
+
self._publish_to_gitlab_registry(force=force)
|
|
313
|
+
if self.is_published_publicly() and not self._get_registry_gateway().has_package(
|
|
314
|
+
self.get_project_name()
|
|
315
|
+
):
|
|
316
|
+
# npm's first version asks for a login and confirmations: someone
|
|
317
|
+
# has to be there, which a runner never is.
|
|
318
|
+
if os.environ.get("CI"):
|
|
319
|
+
self.warning(
|
|
320
|
+
f"{self.get_project_name()} is not on npm yet: published on "
|
|
321
|
+
"the GitLab registry only. Run its first npm publication "
|
|
322
|
+
f"from a workstation: `wex app::release/publish --local` in "
|
|
323
|
+
f"{self.get_path()}."
|
|
324
|
+
)
|
|
325
|
+
else:
|
|
326
|
+
self._publish_first_version()
|
|
327
|
+
return
|
|
328
|
+
self._push_release_tag()
|
|
329
|
+
return
|
|
290
330
|
|
|
291
331
|
# Only public npm has the chicken-and-egg problem: a private registry
|
|
292
332
|
# (GitLab) lets its CI job token create the package itself.
|
|
@@ -296,20 +336,7 @@ class JavascriptPackageWorkdir(JavascriptWorkdir):
|
|
|
296
336
|
self._publish_first_version()
|
|
297
337
|
return
|
|
298
338
|
|
|
299
|
-
|
|
300
|
-
if not remote:
|
|
301
|
-
self.log("No deployment remote configured, skipping publication.")
|
|
302
|
-
return
|
|
303
|
-
|
|
304
|
-
tag = f"v{self.get_setup_version()}"
|
|
305
|
-
cwd = self.get_path()
|
|
306
|
-
|
|
307
|
-
if git_tag_exists(tag, cwd=cwd, inherit_stdio=False):
|
|
308
|
-
self.log(f"Tag {tag} already exists, skipping creation.")
|
|
309
|
-
else:
|
|
310
|
-
git_tag_annotated(tag, f"Release {tag}", cwd=cwd, inherit_stdio=True)
|
|
311
|
-
|
|
312
|
-
git_push_tag(tag, cwd=cwd, remote=remote, inherit_stdio=True)
|
|
339
|
+
self._push_release_tag()
|
|
313
340
|
|
|
314
341
|
def _publish_first_version(self) -> None:
|
|
315
342
|
"""Create the package on the registry from here, bypassing the CI workflow.
|
|
@@ -321,6 +348,10 @@ class JavascriptPackageWorkdir(JavascriptWorkdir):
|
|
|
321
348
|
the CI tag is deliberately not pushed: it would start a run that can
|
|
322
349
|
only fail. Subsequent versions take the normal tag path again.
|
|
323
350
|
"""
|
|
351
|
+
from wexample_wex_addon_dev_javascript.const.registry import (
|
|
352
|
+
NPM_REGISTRY_URL_DEFAULT,
|
|
353
|
+
)
|
|
354
|
+
|
|
324
355
|
manager = self._get_package_manager()
|
|
325
356
|
package = self.get_project_name()
|
|
326
357
|
|
|
@@ -332,12 +363,112 @@ class JavascriptPackageWorkdir(JavascriptWorkdir):
|
|
|
332
363
|
# Same two steps as the workflow: publishing runs prepublishOnly,
|
|
333
364
|
# which type-checks against dependencies that must be installed.
|
|
334
365
|
self._shell_run_node_command([manager, "install"])
|
|
335
|
-
|
|
366
|
+
# To npm itself: installs read the vendor's scope from GitLab.
|
|
367
|
+
self._shell_run_node_command(
|
|
368
|
+
[manager, "publish", "--access", "public"],
|
|
369
|
+
{f"npm_config_{package.split('/', 1)[0]}:registry": NPM_REGISTRY_URL_DEFAULT},
|
|
370
|
+
)
|
|
336
371
|
|
|
337
372
|
self._first_publication = True
|
|
338
373
|
self.success(f"{package} now exists on the registry.")
|
|
339
374
|
self.warning(self._get_first_publication_notice())
|
|
340
375
|
|
|
376
|
+
def _publish_to_gitlab_registry(self, force: bool = False) -> None:
|
|
377
|
+
"""Upload this version to the npm registry of the package's GitLab project.
|
|
378
|
+
|
|
379
|
+
npm reads the token from a config of its own, written for this alone
|
|
380
|
+
and removed after: the developer's ~/.npmrc keeps their npm session.
|
|
381
|
+
"""
|
|
382
|
+
import json
|
|
383
|
+
import os
|
|
384
|
+
import re
|
|
385
|
+
import shutil
|
|
386
|
+
import tempfile
|
|
387
|
+
import urllib.request
|
|
388
|
+
from urllib.parse import quote, urlparse
|
|
389
|
+
|
|
390
|
+
from wexample_helpers.helper.user import user_get_real_gid, user_get_real_uid
|
|
391
|
+
from wexample_helpers_git.helper.git import git_get_remote_url
|
|
392
|
+
|
|
393
|
+
from wexample_wex_addon_dev_javascript.common.npm_registry_gateway import (
|
|
394
|
+
NpmRegistryGateway,
|
|
395
|
+
)
|
|
396
|
+
|
|
397
|
+
package = self.get_project_name()
|
|
398
|
+
version = self.get_setup_version()
|
|
399
|
+
group_url = self.get_gitlab_registry_url()
|
|
400
|
+
|
|
401
|
+
gateway = NpmRegistryGateway(base_url=group_url, io=self.io, timeout=10)
|
|
402
|
+
if gateway.has_version(package, version) and not force:
|
|
403
|
+
self.log(f"{package}@{version} is already on the GitLab registry.")
|
|
404
|
+
return
|
|
405
|
+
|
|
406
|
+
token = self.get_env_parameter_or_suite_fallback("GITLAB_API_TOKEN")
|
|
407
|
+
api_url = group_url.split("/groups/", 1)[0]
|
|
408
|
+
# The project is the package's origin: ssh://git@host:port/<group>/<name>.git
|
|
409
|
+
project_path = re.sub(
|
|
410
|
+
r"^(ssh://[^/]+/|git@[^:]+:|https?://[^/]+/)",
|
|
411
|
+
"",
|
|
412
|
+
git_get_remote_url(cwd=self.get_path()),
|
|
413
|
+
).removesuffix(".git")
|
|
414
|
+
# By its id: npm joins the package name to the registry URL, and an
|
|
415
|
+
# encoded project path in it is not one every client keeps as is.
|
|
416
|
+
request = urllib.request.Request(
|
|
417
|
+
f"{api_url}/projects/{quote(project_path, safe='')}",
|
|
418
|
+
headers={"PRIVATE-TOKEN": token},
|
|
419
|
+
)
|
|
420
|
+
with urllib.request.urlopen(request, timeout=15) as answer:
|
|
421
|
+
project_id = json.load(answer)["id"]
|
|
422
|
+
registry_url = f"{api_url}/projects/{project_id}/packages/npm/"
|
|
423
|
+
scope = package.split("/", 1)[0]
|
|
424
|
+
|
|
425
|
+
config_dir = tempfile.mkdtemp(prefix="npm-gitlab-")
|
|
426
|
+
os.chown(config_dir, user_get_real_uid(), user_get_real_gid())
|
|
427
|
+
config_path = os.path.join(config_dir, ".npmrc")
|
|
428
|
+
with open(config_path, "w") as config:
|
|
429
|
+
config.write(
|
|
430
|
+
f"{scope}:registry={registry_url}\n"
|
|
431
|
+
f"//{urlparse(registry_url).netloc}{urlparse(registry_url).path}:_authToken={token}\n"
|
|
432
|
+
)
|
|
433
|
+
os.chown(config_path, user_get_real_uid(), user_get_real_gid())
|
|
434
|
+
|
|
435
|
+
self.subtitle("Publishing to the GitLab registry")
|
|
436
|
+
manager = self._get_package_manager()
|
|
437
|
+
# Publishing runs prepublishOnly, which builds against the development
|
|
438
|
+
# dependencies: a package without tests had none installed so far.
|
|
439
|
+
self._shell_run_node_command([manager, "install"])
|
|
440
|
+
try:
|
|
441
|
+
self._shell_run_node_command(
|
|
442
|
+
[manager, "publish"],
|
|
443
|
+
{
|
|
444
|
+
"NPM_CONFIG_USERCONFIG": config_path,
|
|
445
|
+
# The scope's registry set for installs would win over the
|
|
446
|
+
# one in this config: the upload goes to the project.
|
|
447
|
+
f"npm_config_{scope}:registry": registry_url,
|
|
448
|
+
},
|
|
449
|
+
)
|
|
450
|
+
finally:
|
|
451
|
+
shutil.rmtree(config_dir, ignore_errors=True)
|
|
452
|
+
|
|
453
|
+
def _push_release_tag(self) -> None:
|
|
454
|
+
"""Tag the version and push the tag, which starts npm's workflow."""
|
|
455
|
+
from wexample_helpers_git.helper.git import git_push_tag
|
|
456
|
+
|
|
457
|
+
remote = self._get_deployment_remote_name()
|
|
458
|
+
if not remote:
|
|
459
|
+
self.log("No deployment remote configured, skipping publication.")
|
|
460
|
+
return
|
|
461
|
+
|
|
462
|
+
tag = f"v{self.get_setup_version()}"
|
|
463
|
+
cwd = self.get_path()
|
|
464
|
+
|
|
465
|
+
if git_tag_exists(tag, cwd=cwd, inherit_stdio=False):
|
|
466
|
+
self.log(f"Tag {tag} already exists, skipping creation.")
|
|
467
|
+
else:
|
|
468
|
+
git_tag_annotated(tag, f"Release {tag}", cwd=cwd, inherit_stdio=True)
|
|
469
|
+
|
|
470
|
+
git_push_tag(tag, cwd=cwd, remote=remote, inherit_stdio=True)
|
|
471
|
+
|
|
341
472
|
def _refresh_lockfile(self) -> None:
|
|
342
473
|
import shutil
|
|
343
474
|
|
|
@@ -361,16 +492,34 @@ class JavascriptPackageWorkdir(JavascriptWorkdir):
|
|
|
361
492
|
don't expose per-version URLs — relies on the package manifest's
|
|
362
493
|
`versions` map.
|
|
363
494
|
"""
|
|
495
|
+
from wexample_wex_addon_dev_javascript.common.npm_registry_gateway import (
|
|
496
|
+
NpmRegistryGateway,
|
|
497
|
+
)
|
|
498
|
+
|
|
499
|
+
# The GitLab registry, when the suite publishes there, is what the next
|
|
500
|
+
# packages install from: it serves a version as soon as it is uploaded,
|
|
501
|
+
# where npm, behind the mirror and a workflow, takes minutes.
|
|
502
|
+
group_url = self.get_gitlab_registry_url()
|
|
503
|
+
if group_url:
|
|
504
|
+
self._wait_for_version(
|
|
505
|
+
NpmRegistryGateway(base_url=group_url, io=self.io, timeout=10),
|
|
506
|
+
delay_seconds=5,
|
|
507
|
+
)
|
|
508
|
+
else:
|
|
509
|
+
self._wait_for_version(self._get_registry_gateway())
|
|
510
|
+
|
|
511
|
+
def _wait_for_version(
|
|
512
|
+
self, gateway: NpmRegistryGateway, delay_seconds: int = 30
|
|
513
|
+
) -> None:
|
|
514
|
+
"""Poll a registry until the current version is available (max 20 min)."""
|
|
364
515
|
from wexample_helpers.helper.polling_callback_manager import (
|
|
365
516
|
PollingCallbackManager,
|
|
366
517
|
)
|
|
367
518
|
|
|
368
519
|
package = self.get_project_name()
|
|
369
520
|
version = self.get_setup_version()
|
|
370
|
-
gateway = self._get_registry_gateway()
|
|
371
521
|
|
|
372
|
-
max_attempts =
|
|
373
|
-
delay_seconds = 30
|
|
522
|
+
max_attempts = 20 * 60 // delay_seconds
|
|
374
523
|
|
|
375
524
|
self.log(f"Waiting for {package}@{version} to appear on registry…")
|
|
376
525
|
|
{wexample_wex_addon_dev_javascript-8.6.2 → wexample_wex_addon_dev_javascript-8.8.0}/tests/.gitkeep
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|