Quick start guide/How-to's
To create a new package using the template, use either BestieTemplate.generate
or BestieTemplate.new_pkg_quick
.
To apply a template to an existing package, use either BestieTemplate.apply
.
In this page we have gathered short examples, focused on some use cases.
For a more in-depth guide, check the Full guide
Interactive/Wizard experience
using BestieTemplate: generate
root_dir = mktempdir()
pkg_destination = joinpath(root_dir, "NewPkg.jl")
generate(
# :local or :online,
pkg_destination, # full path to the package
# Dict("Question" => Answer), # to manually set answers
# defautls = true,
# quiet = true,
# use_latest = true,
)
# Answer a bunch of questions
/home/runner/work/BestieTemplate.jl/BestieTemplate.jl/docs/.CondaPkg/.pixi/envs/default/lib/python3.12/site-packages/copier/_vcs.py:183: ShallowCloneWarning: The repository '/home/runner/work/BestieTemplate.jl/BestieTemplate.jl' is a shallow clone, this might lead to unexpected failure or unusually high resource consumption.
warn(
Quick Tiny package
A minimalist package.
using BestieTemplate: new_pkg_quick
root_dir = mktempdir()
pkg_destination = joinpath(root_dir, "TinyPackage.jl")
package_owner = "JuliaBesties"
authors = "JuliaBesties maintainers"
new_pkg_quick(
pkg_destination,
package_owner,
authors,
:tiny,
)
# Resulting folder:
- TinyPackage.jl/
- .copier-answers.yml
- .gitignore
- LICENSE
- Project.toml
- README.md
- src/
- TinyPackage.jl
- test/
- Project.toml
- runtests.jl
Quick Light package
The common niceties: documentation, CI, .JuliaFormatter.toml
and other config files that you might want to use (but won't affect you if you don't).
using BestieTemplate
pkg_destination = joinpath(root_dir, "LightPackage.jl")
package_owner = "JuliaBesties"
authors = "JuliaBesties maintainers"
new_pkg_quick(
pkg_destination,
package_owner,
authors,
:light,
)
# Resulting folder:
Everything from the level above plus:
- LightPackage.jl/
- .JuliaFormatter.toml
- .editorconfig
- .lychee.toml
- .markdownlint.json
- .yamlfmt.yml
- .yamllint.yml
- .github/
- PULL_REQUEST_TEMPLATE.md
- workflows/
- CompatHelper.yml
- Docs.yml
- ReusableTest.yml
- TagBot.yml
- Test.yml
- TestOnPRs.yml
- docs/
- Project.toml
- make.jl
- src/
- 95-reference.md
- index.md
Quick Moderate package
Opinionated suggestions for more stable packages without sacrificing too much development speed.
using BestieTemplate
pkg_destination = joinpath(root_dir, "ModeratePackage.jl")
package_owner = "JuliaBesties"
authors = "JuliaBesties maintainers"
new_pkg_quick(
pkg_destination,
package_owner,
authors,
:moderate,
)
# Resulting folder:
Everything from the level above plus:
- ModeratePackage.jl/
- .pre-commit-config.yaml
- .github/
- dependabot.yml
- workflows/
- Lint.yml
- PreCommitUpdate.yml
- test/
- test-basic-test.jl
Quick Robust package
Opinionated selection to help with larger packages and more developers.
using BestieTemplate
pkg_destination = joinpath(root_dir, "RobustPackage.jl")
package_owner = "JuliaBesties"
authors = "JuliaBesties maintainers"
new_pkg_quick(
pkg_destination,
package_owner,
authors,
:robust,
)
# Resulting folder:
Everything from the level above plus:
- RobustPackage.jl/
- .all-contributorsrc
- CITATION.cff
- CODE_OF_CONDUCT.md
- .github/
- ISSUE_TEMPLATE/
- 10-bug-report.yml
- 20-feature-request.yml
- 30-usage.yml
- 99-general.yml
- config.yml
- docs/
- src/
- 90-contributing.md
- 91-developer.md
Apply to an existing package
Here is an example of applying the template to an existing package.
This is the existing package:
pkg_destination = joinpath(root_dir, "ExistingPackage.jl")
Dict{String, Any} with 3 entries:
"PackageOwner" => "JuliaBesties"
"Authors" => "JuliaBesties maintainers"
"AddPrecommit" => true
Now we apply the template.
using BestieTemplate: apply
apply(
# :local or :online,
pkg_destination, # full path to the package
# Dict("Question" => Answer), # to manually set answers
# defautls = true,
# quiet = true,
# use_latest = true,
)
# You will be asked questions. For instance, if we only select to add pre-commit, this would be the result:
- ExistingPackage.jl/
- .JuliaFormatter.toml
- .copier-answers.yml
- .editorconfig
- .gitignore
- .lychee.toml
- .markdownlint.json
- .pre-commit-config.yaml
- .yamlfmt.yml
- .yamllint.yml
- LICENSE
- Project.toml
- README.md
- .github/
- PULL_REQUEST_TEMPLATE.md
- workflows/
- CompatHelper.yml
- Docs.yml
- PreCommitUpdate.yml
- ReusableTest.yml
- TagBot.yml
- Test.yml
- TestOnPRs.yml
- docs/
- Project.toml
- make.jl
- src/
- 95-reference.md
- index.md
- src/
- ExistingPackage.jl
- test/
- Project.toml
- runtests.jl
Change details with new_pkg_quick
For more details on the hidden options see the [Advanced options and non-interactive answers](@ref advanced_options section.
using BestieTemplate: new_pkg_quick
pkg_destination = joinpath(root_dir, "TinyPackage.jl")
package_owner = "JuliaBesties"
authors = "JuliaBesties maintainers"
# Explicitly setting options
extra_data = Dict(
"JuliaMinVersion" => "1.0", # From the essential questions that `:tiny` autocompletes
"AddDocs" => true, # From the :light strategy
"AddLintCI" => true, # From the :moderate strategy
"AddAllcontributors" => true, # From the :robust strategy
"AddCirrusCI" => true, # From the hidden optionss
)
new_pkg_quick(
pkg_destination,
package_owner,
authors,
:tiny,
extra_data,
)
# Resulting folder: (Notice the new files in comparison to :tiny
- TinyPackage.jl/
- .all-contributorsrc
- .copier-answers.yml
- .gitignore
- LICENSE
- Project.toml
- README.md
- .github/
- workflows/
- Lint.yml
- docs/
- Project.toml
- make.jl
- src/
- 95-reference.md
- index.md
- src/
- TinyPackage.jl
- test/
- Project.toml
- runtests.jl