Skip to content

Commit 0f7765b

Browse files
authored
feat: Support templates with _template.json metadata (#1631)
1 parent d6d8710 commit 0f7765b

File tree

96 files changed

+689
-986
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+689
-986
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
* `shiny create` now supports a succinct format for specifying the GitHub repository via the `--github` flag, e.g. `--github posit-dev/py-shiny-templates`. You can now also use `--github` and `--template` together, in which case `--github` should point to a repository containing a directory matching the name provided in `--template`. (#1623)
1515

16+
* `shiny create` now identifies templates in external repositories using a `_template.json` metadata file. This file should contain at an `"id"` and optionally a `"title"` and `"description"`. When `shiny create` is called with the `--github` flag but without a `--template` flag, it will offer a menu listing all available templates in the repository. (#1631)
17+
1618
### Other changes
1719

1820
### Bug fixes

shiny/_main.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -582,17 +582,21 @@ def create(
582582
dir: Optional[Path | str] = None,
583583
package_name: Optional[str] = None,
584584
) -> None:
585-
from ._main_create import use_template_github, use_template_internal
586-
587-
print(f"dir is {dir}")
585+
from ._main_create import use_github_template, use_internal_template
588586

589587
if dir is not None:
590588
dir = Path(dir)
591589

592590
if github is not None:
593-
use_template_github(github, template=template, mode=mode, dest_dir=dir)
591+
use_github_template(
592+
github,
593+
template_name=template,
594+
mode=mode,
595+
dest_dir=dir,
596+
package_name=package_name,
597+
)
594598
else:
595-
use_template_internal(template, mode, dir, package_name)
599+
use_internal_template(template, mode, dir, package_name)
596600

597601

598602
@main.command(

0 commit comments

Comments
 (0)