Skip to content

Commit

Permalink
feat: Support templates with _template.json metadata (#1631)
Browse files Browse the repository at this point in the history
  • Loading branch information
gadenbuie authored Aug 27, 2024
1 parent d6d8710 commit 0f7765b
Show file tree
Hide file tree
Showing 96 changed files with 689 additions and 986 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* `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)

* `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)

### Other changes

### Bug fixes
Expand Down
14 changes: 9 additions & 5 deletions shiny/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,17 +582,21 @@ def create(
dir: Optional[Path | str] = None,
package_name: Optional[str] = None,
) -> None:
from ._main_create import use_template_github, use_template_internal

print(f"dir is {dir}")
from ._main_create import use_github_template, use_internal_template

if dir is not None:
dir = Path(dir)

if github is not None:
use_template_github(github, template=template, mode=mode, dest_dir=dir)
use_github_template(
github,
template_name=template,
mode=mode,
dest_dir=dir,
package_name=package_name,
)
else:
use_template_internal(template, mode, dir, package_name)
use_internal_template(template, mode, dir, package_name)


@main.command(
Expand Down
Loading

0 comments on commit 0f7765b

Please sign in to comment.