From f1f85f63a31c4d2ef595eea095e4e180018ed654 Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Mon, 18 Dec 2023 20:11:56 +0100 Subject: [PATCH] feat: ask for branch name Default to frappe's branch name (version-15 -> version-15) to clearly communicate compatibility. --- frappe/utils/boilerplate.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/frappe/utils/boilerplate.py b/frappe/utils/boilerplate.py index a36d64d74e..4c9df88005 100644 --- a/frappe/utils/boilerplate.py +++ b/frappe/utils/boilerplate.py @@ -15,6 +15,7 @@ import git import requests import frappe +from frappe.utils.change_log import get_app_branch APP_TITLE_PATTERN = re.compile(r"^(?![\W])[^\d_\s][\w -]+$", flags=re.UNICODE) @@ -57,6 +58,7 @@ def _get_user_inputs(app_name): "default": False, "type": bool, }, + "branch_name": {"prompt": "Branch Name", "default": get_app_branch("frappe")}, } for property, config in new_app_config.items(): @@ -190,7 +192,7 @@ def _create_app_boilerplate(dest, hooks, no_git=False): f.write(frappe.as_unicode(gitignore_template.format(app_name=hooks.app_name))) # initialize git repository - app_repo = git.Repo.init(app_directory, initial_branch="develop") + app_repo = git.Repo.init(app_directory, initial_branch=hooks.branch_name) app_repo.git.add(A=True) app_repo.index.commit("feat: Initialize App") @@ -775,6 +777,16 @@ readme_template = """### {app_title} {app_description} +### Installation + +You can install this app using the [bench](https://github.com/frappe/bench) CLI: + +```bash +cd $PATH_TO_YOUR_BENCH +bench get-app $URL_OF_THIS_REPO --branch {branch_name} +bench install-app {app_name} +``` + ### Contributing This app uses `pre-commit` for code formatting and linting. Please [install pre-commit](https://pre-commit.com/#installation) and enable it for this repository: