viur-cli 3.0.0__tar.gz → 3.0.0b2__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.
- {viur_cli-3.0.0/src/viur_cli.egg-info → viur_cli-3.0.0b2}/PKG-INFO +1 -1
- {viur_cli-3.0.0 → viur_cli-3.0.0b2}/pyproject.toml +7 -1
- viur_cli-3.0.0b2/src/viur_cli/__init__.py +6 -0
- viur_cli-3.0.0b2/src/viur_cli/_docs_cli.py +24 -0
- viur_cli-3.0.0b2/src/viur_cli/build.py +152 -0
- {viur_cli-3.0.0 → viur_cli-3.0.0b2}/src/viur_cli/cli.py +35 -20
- {viur_cli-3.0.0 → viur_cli-3.0.0b2}/src/viur_cli/cloud.py +163 -155
- {viur_cli-3.0.0 → viur_cli-3.0.0b2}/src/viur_cli/conf.py +60 -26
- {viur_cli-3.0.0 → viur_cli-3.0.0b2}/src/viur_cli/deprecated.py +2 -1
- {viur_cli-3.0.0 → viur_cli-3.0.0b2}/src/viur_cli/local.py +73 -164
- viur_cli-3.0.0b2/src/viur_cli/package.py +354 -0
- {viur_cli-3.0.0 → viur_cli-3.0.0b2}/src/viur_cli/scriptor/cli.py +47 -33
- viur_cli-3.0.0b2/src/viur_cli/scriptor/login.py +59 -0
- {viur_cli-3.0.0 → viur_cli-3.0.0b2}/src/viur_cli/setup.py +24 -28
- {viur_cli-3.0.0 → viur_cli-3.0.0b2}/src/viur_cli/update.py +25 -44
- viur_cli-3.0.0b2/src/viur_cli/utils.py +139 -0
- viur_cli-3.0.0b2/src/viur_cli/version.py +2 -0
- {viur_cli-3.0.0 → viur_cli-3.0.0b2/src/viur_cli.egg-info}/PKG-INFO +1 -1
- {viur_cli-3.0.0 → viur_cli-3.0.0b2}/src/viur_cli.egg-info/SOURCES.txt +2 -0
- {viur_cli-3.0.0 → viur_cli-3.0.0b2}/src/viur_cli.egg-info/entry_points.txt +1 -1
- viur_cli-3.0.0/src/viur_cli/__init__.py +0 -11
- viur_cli-3.0.0/src/viur_cli/build.py +0 -232
- viur_cli-3.0.0/src/viur_cli/package.py +0 -258
- viur_cli-3.0.0/src/viur_cli/utils.py +0 -113
- viur_cli-3.0.0/src/viur_cli/version.py +0 -2
- {viur_cli-3.0.0 → viur_cli-3.0.0b2}/LICENSE +0 -0
- {viur_cli-3.0.0 → viur_cli-3.0.0b2}/README.md +0 -0
- {viur_cli-3.0.0 → viur_cli-3.0.0b2}/setup.cfg +0 -0
- {viur_cli-3.0.0 → viur_cli-3.0.0b2}/src/viur_cli/scriptor/__init__.py +0 -0
- {viur_cli-3.0.0 → viur_cli-3.0.0b2}/src/viur_cli/scripts/__init__.py +0 -0
- {viur_cli-3.0.0 → viur_cli-3.0.0b2}/src/viur_cli/scripts/get_pyodide.py +0 -0
- {viur_cli-3.0.0 → viur_cli-3.0.0b2}/src/viur_cli.egg-info/dependency_links.txt +0 -0
- {viur_cli-3.0.0 → viur_cli-3.0.0b2}/src/viur_cli.egg-info/requires.txt +0 -0
- {viur_cli-3.0.0 → viur_cli-3.0.0b2}/src/viur_cli.egg-info/top_level.txt +0 -0
|
@@ -30,7 +30,7 @@ Homepage = "https://github.com/viur-framework/viur-cli"
|
|
|
30
30
|
"Bug Tracker" = "https://github.com/viur-framework/viur-cli/issues"
|
|
31
31
|
|
|
32
32
|
[project.scripts]
|
|
33
|
-
viur = "viur_cli:
|
|
33
|
+
viur = "viur_cli.cli:main"
|
|
34
34
|
get-pyodide = "viur_cli.scripts.get_pyodide:main"
|
|
35
35
|
|
|
36
36
|
[tool.setuptools]
|
|
@@ -39,3 +39,9 @@ packages = { find = { where = ["src"] } }
|
|
|
39
39
|
|
|
40
40
|
[tool.setuptools.dynamic]
|
|
41
41
|
version = { attr = "viur_cli.version.__version__" }
|
|
42
|
+
|
|
43
|
+
[dependency-groups]
|
|
44
|
+
docs = [
|
|
45
|
+
"mkdocs-shadcn",
|
|
46
|
+
"mkdocs-click~=0.8",
|
|
47
|
+
]
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# viur-cli v3 — package marker only.
|
|
2
|
+
#
|
|
3
|
+
# Submodules are imported explicitly by `cli.py`'s `main()` entry point.
|
|
4
|
+
# The v2 pattern of `from .X import *` here triggered module-level side
|
|
5
|
+
# effects (conf.py auto-loading project.json, sys.exit on missing files)
|
|
6
|
+
# which is now avoided.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Docs-only entry point for mkdocs-click.
|
|
2
|
+
|
|
3
|
+
mkdocs-click introspects the Click group object at import time. The runtime
|
|
4
|
+
entry point `viur_cli.cli:main` attaches all subcommands by importing each
|
|
5
|
+
submodule explicitly (their `@cli.command`/`@cli.group` decorators bind to
|
|
6
|
+
the root group at import time). Without invoking main(), only the commands
|
|
7
|
+
defined directly in `cli.py` are visible.
|
|
8
|
+
|
|
9
|
+
This module performs the same side-effect imports so that `from
|
|
10
|
+
viur_cli._docs_cli import cli` returns a fully populated Click group —
|
|
11
|
+
suitable for static introspection by mkdocs-click.
|
|
12
|
+
"""
|
|
13
|
+
from viur_cli import build # noqa: F401
|
|
14
|
+
from viur_cli import cloud # noqa: F401
|
|
15
|
+
from viur_cli import deprecated # noqa: F401
|
|
16
|
+
from viur_cli import local # noqa: F401
|
|
17
|
+
from viur_cli import package # noqa: F401
|
|
18
|
+
from viur_cli import setup # noqa: F401
|
|
19
|
+
from viur_cli import update # noqa: F401
|
|
20
|
+
from viur_cli.scriptor import script # noqa: F401
|
|
21
|
+
|
|
22
|
+
from viur_cli.cli import cli
|
|
23
|
+
|
|
24
|
+
__all__ = ["cli"]
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"""Build pipeline for ViUR projects: orchestrates npm and exec build steps."""
|
|
2
|
+
|
|
3
|
+
import click
|
|
4
|
+
import os
|
|
5
|
+
from .conf import config
|
|
6
|
+
from .cli import cli
|
|
7
|
+
from . import utils
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _build(conf, name, build_cfg, additional_args):
|
|
11
|
+
"""Run a single build entry from a profile's `builds` section.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
conf: Resolved profile configuration.
|
|
15
|
+
name: The build entry's key (used only for log output).
|
|
16
|
+
build_cfg: The build entry itself. Required keys depend on
|
|
17
|
+
``kind``:
|
|
18
|
+
|
|
19
|
+
* ``kind == "npm"`` — needs ``source`` (relative to
|
|
20
|
+
``conf['sources_folder']``) and ``command`` (the npm
|
|
21
|
+
script name to run).
|
|
22
|
+
* ``kind == "exec"`` — needs ``command`` (a shell string
|
|
23
|
+
executed verbatim).
|
|
24
|
+
|
|
25
|
+
additional_args: Extra args passed to the build callable.
|
|
26
|
+
Currently ignored by both kinds — kept for forward
|
|
27
|
+
compatibility.
|
|
28
|
+
|
|
29
|
+
Aborts (via ``echo_fatal``) on an unknown ``kind``.
|
|
30
|
+
"""
|
|
31
|
+
utils.echo_info(f"""- {build_cfg["kind"]} {name}""")
|
|
32
|
+
match build_cfg["kind"]:
|
|
33
|
+
case "npm":
|
|
34
|
+
utils.system(
|
|
35
|
+
" && ".join(
|
|
36
|
+
(
|
|
37
|
+
f'cd {os.path.join(conf["sources_folder"], build_cfg["source"])}',
|
|
38
|
+
"npm install",
|
|
39
|
+
f'npm run {build_cfg["command"]}'
|
|
40
|
+
)
|
|
41
|
+
)
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
case "exec":
|
|
45
|
+
utils.system(build_cfg["command"])
|
|
46
|
+
|
|
47
|
+
case other:
|
|
48
|
+
utils.echo_fatal(f"Unknown build kind {other!r}")
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _clean(conf, name, build_cfg):
|
|
52
|
+
"""Drop generated artifacts for a single build entry.
|
|
53
|
+
|
|
54
|
+
Args:
|
|
55
|
+
conf: Resolved profile configuration.
|
|
56
|
+
name: The build entry's key (used only for log output).
|
|
57
|
+
build_cfg: The build entry. Recognized keys:
|
|
58
|
+
|
|
59
|
+
* ``target`` (npm only) — deleted under
|
|
60
|
+
``conf['distribution_folder']``
|
|
61
|
+
* ``source`` (npm only) — its ``node_modules`` is dropped
|
|
62
|
+
* ``clean`` (any kind) — explicit shell command run after
|
|
63
|
+
the kind-specific cleanup
|
|
64
|
+
|
|
65
|
+
Aborts on unknown ``kind``.
|
|
66
|
+
"""
|
|
67
|
+
utils.echo_info(f"""- cleaning {build_cfg["kind"]} {name}""")
|
|
68
|
+
|
|
69
|
+
match build_cfg["kind"]:
|
|
70
|
+
# for npm, drop the target folder and node_modules (npm)
|
|
71
|
+
case "npm":
|
|
72
|
+
if target_dir := build_cfg.get("target"):
|
|
73
|
+
target_dir = os.path.join(conf["distribution_folder"], target_dir)
|
|
74
|
+
utils.echo_info(f" - dropping {target_dir}")
|
|
75
|
+
utils.rmdir(target_dir)
|
|
76
|
+
|
|
77
|
+
if build_cfg["kind"] == "npm":
|
|
78
|
+
# todo: Later, call "npm run clean" or a similar command when it exists
|
|
79
|
+
|
|
80
|
+
node_modules = os.path.join(conf["sources_folder"], build_cfg["source"], "node_modules")
|
|
81
|
+
utils.echo_info(f" - dropping {node_modules}")
|
|
82
|
+
utils.rmdir(os.path.join(node_modules))
|
|
83
|
+
|
|
84
|
+
case "exec":
|
|
85
|
+
pass
|
|
86
|
+
|
|
87
|
+
case other:
|
|
88
|
+
utils.echo_fatal(f"Unknown build kind {other!r}")
|
|
89
|
+
|
|
90
|
+
# Always execute explicit "clean" command if provided
|
|
91
|
+
if clean_cmd := build_cfg.get("clean"):
|
|
92
|
+
utils.echo_info(f" - executing {clean_cmd=}")
|
|
93
|
+
utils.system(clean_cmd)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
@cli.group()
|
|
97
|
+
def build():
|
|
98
|
+
"""Build deploy artifacts (npm bundles, exec build steps) for a ViUR project."""
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
@build.command(context_settings={"ignore_unknown_options": True})
|
|
102
|
+
@click.argument("profile", default='default')
|
|
103
|
+
@click.argument("additional_args", nargs=-1)
|
|
104
|
+
def release(profile, additional_args):
|
|
105
|
+
"""Build every entry in the profile's `builds` section, in declaration order."""
|
|
106
|
+
conf = config.get_profile(profile)
|
|
107
|
+
utils.echo_info("building started...")
|
|
108
|
+
|
|
109
|
+
for build_name, build_cfg in conf.get("builds", {}).items():
|
|
110
|
+
_build(conf, build_name, build_cfg, additional_args)
|
|
111
|
+
|
|
112
|
+
utils.echo_info("building finished!")
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
@build.command(context_settings={"ignore_unknown_options": True})
|
|
116
|
+
@click.argument("appname")
|
|
117
|
+
@click.argument("additional_args", nargs=-1)
|
|
118
|
+
@click.argument("profile", default="default")
|
|
119
|
+
def app(appname, profile, additional_args):
|
|
120
|
+
"""Build a single application from the profile's `builds` section."""
|
|
121
|
+
|
|
122
|
+
conf = config.get_profile(profile)
|
|
123
|
+
|
|
124
|
+
if not (build_cfg := conf.get("builds").get(appname)):
|
|
125
|
+
utils.echo_fatal(f"""{appname=} must be one of these options: {", ".join(conf["builds"].keys())}""")
|
|
126
|
+
|
|
127
|
+
utils.echo_info("building started...")
|
|
128
|
+
_build(conf, appname, build_cfg, additional_args)
|
|
129
|
+
utils.echo_info("building finished!")
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
@build.command
|
|
133
|
+
@click.argument("target", default="")
|
|
134
|
+
@click.argument("profile", default="default")
|
|
135
|
+
def clean(target, profile):
|
|
136
|
+
"""Drop build artifacts for one application (TARGET) or for all builds in the profile."""
|
|
137
|
+
|
|
138
|
+
conf = config.get_profile(profile)
|
|
139
|
+
|
|
140
|
+
builds = conf.get("builds", {})
|
|
141
|
+
if target:
|
|
142
|
+
if not (build_cfg := builds.get(target)):
|
|
143
|
+
utils.echo_fatal(f"""{target=} must be one of these options: {", ".join(conf["builds"].keys())}""")
|
|
144
|
+
|
|
145
|
+
builds = {target: build_cfg}
|
|
146
|
+
|
|
147
|
+
utils.echo_info("clean started...")
|
|
148
|
+
|
|
149
|
+
for build_name, build_cfg in builds.items():
|
|
150
|
+
_clean(conf, build_name, build_cfg)
|
|
151
|
+
|
|
152
|
+
utils.echo_info("clean finished!")
|
|
@@ -15,26 +15,16 @@ from pathlib import Path
|
|
|
15
15
|
@click.version_option(__version__)
|
|
16
16
|
@click.pass_context
|
|
17
17
|
def cli(ctx):
|
|
18
|
-
"""
|
|
19
|
-
Command-line interface for managing project configuration and information.
|
|
20
|
-
|
|
21
|
-
The viur-cli provides a set of commands to manage your project's configuration in the 'project.json'.
|
|
22
|
-
It also offers commands to view and modify project information.
|
|
23
|
-
|
|
24
|
-
Note:
|
|
18
|
+
"""Manage and operate ViUR projects from a single command line.
|
|
25
19
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
Reads `project.json` for per-profile settings (deploy targets, build
|
|
21
|
+
pipelines, packaged ViUR frontends). Run `viur project list` to see
|
|
22
|
+
the resolved configuration of a profile.
|
|
29
23
|
"""
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
uv_version = subprocess.check_output(['uv', 'self', 'version']).decode("utf-8")
|
|
33
|
-
version_pattern = r'\b(\d+\.\d+\.\d+)\b'
|
|
34
|
-
match = re.search(version_pattern, uv_version)
|
|
24
|
+
uv_version = subprocess.check_output(["uv", "self", "version"]).decode("utf-8")
|
|
25
|
+
match = re.search(r"\b(\d+\.\d+\.\d+)\b", uv_version)
|
|
35
26
|
sys_uv = match.group(1)
|
|
36
27
|
|
|
37
|
-
# sys kleiner min
|
|
38
28
|
if semver.compare(sys_uv, MINIMAL_UV) < 0:
|
|
39
29
|
echo_warning(
|
|
40
30
|
f"Your uv Version does not match the recommended uv version. \n"
|
|
@@ -48,7 +38,7 @@ def cli(ctx):
|
|
|
48
38
|
@click.argument("action", type=click.Choice(['list']))
|
|
49
39
|
@click.argument("profile", default="default")
|
|
50
40
|
def project(action, profile):
|
|
51
|
-
"""
|
|
41
|
+
"""Inspect the resolved project.json configuration for a profile."""
|
|
52
42
|
project_config = config.get_profile(profile)
|
|
53
43
|
if action == "list":
|
|
54
44
|
echo_info(f"These are the Settings for {profile} profile")
|
|
@@ -59,10 +49,14 @@ def project(action, profile):
|
|
|
59
49
|
@click.option('--shell', type=click.Choice(['bash', 'zsh', 'fish', 'auto']),
|
|
60
50
|
default='auto', help='Shell type (auto-detect if not specified)')
|
|
61
51
|
def setup_autocomplete(shell):
|
|
62
|
-
"""Install shell
|
|
52
|
+
"""Install shell tab-completion for the viur CLI.
|
|
63
53
|
|
|
64
|
-
|
|
65
|
-
to
|
|
54
|
+
Generates Click's completion script for the chosen shell and writes it
|
|
55
|
+
next to the shell's rc file (sourcing it from `~/.bashrc` / `~/.zshrc`,
|
|
56
|
+
or directly into fish's completions dir).
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
shell: ``bash``, ``zsh``, ``fish``, or ``auto`` (detect from $SHELL).
|
|
66
60
|
"""
|
|
67
61
|
# Auto-detect shell if not specified
|
|
68
62
|
if shell == 'auto':
|
|
@@ -258,3 +252,24 @@ def autocomplete_info():
|
|
|
258
252
|
echo_warning("No autocompletion installed")
|
|
259
253
|
echo_info("\nTo install, run:")
|
|
260
254
|
echo_info(" viur setup-autocomplete")
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def main() -> None:
|
|
258
|
+
"""Entry point used by the ``viur`` console script.
|
|
259
|
+
|
|
260
|
+
Imports each command module explicitly so its ``@cli.command`` /
|
|
261
|
+
``@cli.group`` decorators bind to the root ``cli`` group above. This
|
|
262
|
+
replaces the v2 pattern that relied on star-imports in
|
|
263
|
+
``__init__.py`` to trigger the same decorator side-effects.
|
|
264
|
+
"""
|
|
265
|
+
# Side-effect imports — decorators run on module load.
|
|
266
|
+
from viur_cli import build # noqa: F401
|
|
267
|
+
from viur_cli import cloud # noqa: F401
|
|
268
|
+
from viur_cli import local # noqa: F401
|
|
269
|
+
from viur_cli import package # noqa: F401
|
|
270
|
+
from viur_cli import setup # noqa: F401
|
|
271
|
+
from viur_cli import update # noqa: F401
|
|
272
|
+
from viur_cli import deprecated # noqa: F401
|
|
273
|
+
from viur_cli.scriptor import script # noqa: F401
|
|
274
|
+
|
|
275
|
+
cli()
|