diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1384a6a --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +Pipfile.lock +.venv/ + +demo/ diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..237a61b --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["samuelcolvin.jinjahtml"] +} diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..0d46404 --- /dev/null +++ b/Pipfile @@ -0,0 +1,13 @@ +[[source]] +url = "https://pypi.org/simple" +verify_ssl = true +name = "pypi" + +[packages] +copier = "==6.1.0" +djlint = "==1.9.4" + +[dev-packages] + +[requires] +python_version = "3.7" diff --git a/README.md b/README.md index 6a0c947..761394e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,26 @@ # copier-cli -Copier template for Python CLIs with Click and Poetry. + +[Copier](https://github.com/copier-org/copier) template for Python CLIs with Click and Poetry. + +## Development + +- `export PIPENV_VENV_IN_PROJECT=1 && pipenv install --python 3.7` +- `pipenv run copier --version` +- `pipenv run djlint project/* --lint --profile=jinja` +- `pipenv run djlint project/\{\{_copier_conf.answers_file\}\}.jinja --reformat --profile=jinja` +- `rm -rf demo && pipenv run copier . demo` + +## Notes + +- [Copier](https://github.com/copier-org/copier): + - [Documentation](https://copier.readthedocs.io/en/latest/) + - [pdm-project/copier-pdm](https://github.com/pdm-project/copier-pdm) template + - [pawamoy/copier-pdm](https://github.com/pawamoy/copier-pdm) template + - [pawamoy/copier-poetry](https://github.com/pawamoy/copier-poetry) template + - Install: `pipx install copier` +- ['save-exact' option for saving exact version in Pipfile](https://github.com/pypa/pipenv/issues/3441) (open) issue +- [djLint](https://djlint.com/): + - [Linter](https://djlint.com/docs/linter/) + - [VS Code extension](https://marketplace.visualstudio.com/items?itemName=monosans.djlint) + - `pipenv run djlint project/* --check --profile=jinja` + - `pipenv run djlint project/* --reformat --profile=jinja` diff --git a/copier.yml b/copier.yml new file mode 100644 index 0000000..7e0193b --- /dev/null +++ b/copier.yml @@ -0,0 +1,10 @@ +# https://copier.readthedocs.io/en/latest/configuring/#jinja_extensions +# https://github.com/hackebrot/jinja2-time +# https://cookiecutter.readthedocs.io/en/latest/advanced/template_extensions.html + +_subdirectory: project + +author_name: + type: str + help: Your name + default: "João Palmeiro" diff --git a/project/LICENSE.jinja b/project/LICENSE.jinja new file mode 100644 index 0000000..2b5c330 --- /dev/null +++ b/project/LICENSE.jinja @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 {{ author_name }} + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/project/{{_copier_conf.answers_file}}.jinja b/project/{{_copier_conf.answers_file}}.jinja new file mode 100644 index 0000000..2a5bceb --- /dev/null +++ b/project/{{_copier_conf.answers_file}}.jinja @@ -0,0 +1,4 @@ +# Changes here will be overwritten by Copier +# https://copier.readthedocs.io/en/latest/configuring/#the-copier-answersyml-file +# https://copier.readthedocs.io/en/latest/creating/#minimal-example +{{ _copier_answers|to_nice_yaml }}