Showing preview only (451K chars total). Download the full file or copy to clipboard to get everything.
Repository: JuliaCI/PkgTemplates.jl
Branch: master
Commit: aaf2a16fc74b
Files: 182
Total size: 405.7 KB
Directory structure:
gitextract_vcepmtte/
├── .gitattributes
├── .github/
│ ├── dependabot.yml
│ └── workflows/
│ ├── CI.yml
│ ├── JuliaNightly.yml
│ └── TagBot.yml
├── .gitignore
├── LICENSE
├── Project.toml
├── README.md
├── docs/
│ ├── Project.toml
│ ├── make.jl
│ └── src/
│ ├── developer.md
│ ├── index.md
│ ├── migrating.md
│ └── user.md
├── src/
│ ├── PkgTemplates.jl
│ ├── deprecated.jl
│ ├── interactive.jl
│ ├── plugin.jl
│ ├── plugins/
│ │ ├── badges.jl
│ │ ├── ci.jl
│ │ ├── citation.jl
│ │ ├── codeowners.jl
│ │ ├── compat_helper.jl
│ │ ├── coverage.jl
│ │ ├── dependabot.jl
│ │ ├── develop.jl
│ │ ├── documenter.jl
│ │ ├── formatter.jl
│ │ ├── git.jl
│ │ ├── license.jl
│ │ ├── pkgbenchmark.jl
│ │ ├── project_file.jl
│ │ ├── readme.jl
│ │ ├── register.jl
│ │ ├── src_dir.jl
│ │ ├── tagbot.jl
│ │ └── tests.jl
│ ├── show.jl
│ └── template.jl
├── templates/
│ ├── .JuliaFormatter.toml
│ ├── CITATION.bib
│ ├── README.md
│ ├── appveyor.yml
│ ├── benchmark/
│ │ └── benchmarks.jlt
│ ├── cirrus.yml
│ ├── docs/
│ │ ├── make.jlt
│ │ └── src/
│ │ └── index.md
│ ├── drone.star
│ ├── github/
│ │ ├── dependabot.yml
│ │ └── workflows/
│ │ ├── CI.yml
│ │ ├── CompatHelper.yml
│ │ ├── Register.yml
│ │ └── TagBot.yml
│ ├── gitlab-ci.yml
│ ├── licenses/
│ │ ├── AGPL-3.0-or-later
│ │ ├── Apache-2.0
│ │ ├── BSD-2-Clause
│ │ ├── BSD-3-Clause
│ │ ├── EUPL-1.2
│ │ ├── GPL-2.0-or-later
│ │ ├── GPL-3.0-or-later
│ │ ├── ISC
│ │ ├── LGPL-2.1-or-later
│ │ ├── LGPL-3.0-or-later
│ │ ├── MIT
│ │ └── MPL-2.0
│ ├── src/
│ │ └── module.jlt
│ ├── test/
│ │ └── runtests.jlt
│ └── travis.yml
└── test/
├── fixtures/
│ ├── AllPlugins/
│ │ ├── .JuliaFormatter.toml
│ │ ├── .appveyor.yml
│ │ ├── .cirrus.yml
│ │ ├── .drone.star
│ │ ├── .github/
│ │ │ ├── dependabot.yml
│ │ │ └── workflows/
│ │ │ ├── CI.yml
│ │ │ ├── CompatHelper.yml
│ │ │ ├── Register.yml
│ │ │ └── TagBot.yml
│ │ ├── .gitignore
│ │ ├── .gitlab-ci.yml
│ │ ├── .travis.yml
│ │ ├── CITATION.bib
│ │ ├── CODEOWNERS
│ │ ├── LICENSE
│ │ ├── Manifest.toml
│ │ ├── Project.toml
│ │ ├── README.md
│ │ ├── benchmark/
│ │ │ └── benchmarks.jl
│ │ ├── docs/
│ │ │ ├── Manifest.toml
│ │ │ ├── Project.toml
│ │ │ ├── make.jl
│ │ │ └── src/
│ │ │ └── index.md
│ │ ├── src/
│ │ │ └── AllPlugins.jl
│ │ └── test/
│ │ └── runtests.jl
│ ├── Basic/
│ │ ├── .github/
│ │ │ ├── dependabot.yml
│ │ │ └── workflows/
│ │ │ ├── CI.yml
│ │ │ └── TagBot.yml
│ │ ├── .gitignore
│ │ ├── LICENSE
│ │ ├── Manifest.toml
│ │ ├── Project.toml
│ │ ├── README.md
│ │ ├── src/
│ │ │ └── Basic.jl
│ │ └── test/
│ │ └── runtests.jl
│ ├── DocumenterGitHubActions/
│ │ ├── .github/
│ │ │ ├── dependabot.yml
│ │ │ └── workflows/
│ │ │ ├── CI.yml
│ │ │ └── TagBot.yml
│ │ ├── .gitignore
│ │ ├── LICENSE
│ │ ├── Project.toml
│ │ ├── README.md
│ │ ├── docs/
│ │ │ ├── Manifest.toml
│ │ │ ├── Project.toml
│ │ │ ├── make.jl
│ │ │ └── src/
│ │ │ └── index.md
│ │ ├── src/
│ │ │ └── DocumenterGitHubActions.jl
│ │ └── test/
│ │ └── runtests.jl
│ ├── DocumenterGitLabCI/
│ │ ├── .github/
│ │ │ ├── dependabot.yml
│ │ │ └── workflows/
│ │ │ ├── CI.yml
│ │ │ └── TagBot.yml
│ │ ├── .gitignore
│ │ ├── .gitlab-ci.yml
│ │ ├── LICENSE
│ │ ├── Project.toml
│ │ ├── README.md
│ │ ├── docs/
│ │ │ ├── Manifest.toml
│ │ │ ├── Project.toml
│ │ │ ├── make.jl
│ │ │ └── src/
│ │ │ └── index.md
│ │ ├── src/
│ │ │ └── DocumenterGitLabCI.jl
│ │ └── test/
│ │ └── runtests.jl
│ ├── DocumenterTravis/
│ │ ├── .github/
│ │ │ ├── dependabot.yml
│ │ │ └── workflows/
│ │ │ ├── CI.yml
│ │ │ └── TagBot.yml
│ │ ├── .gitignore
│ │ ├── .travis.yml
│ │ ├── LICENSE
│ │ ├── Project.toml
│ │ ├── README.md
│ │ ├── docs/
│ │ │ ├── Manifest.toml
│ │ │ ├── Project.toml
│ │ │ ├── make.jl
│ │ │ └── src/
│ │ │ └── index.md
│ │ ├── src/
│ │ │ └── DocumenterTravis.jl
│ │ └── test/
│ │ └── runtests.jl
│ ├── WackyOptions/
│ │ ├── .JuliaFormatter.toml
│ │ ├── .appveyor.yml
│ │ ├── .cirrus.yml
│ │ ├── .codecov.yml
│ │ ├── .coveralls.yml
│ │ ├── .drone.star
│ │ ├── .github/
│ │ │ ├── dependabot.yml
│ │ │ └── workflows/
│ │ │ ├── CI.yml
│ │ │ ├── CompatHelper.yml
│ │ │ ├── Register.yml
│ │ │ └── TagBot.yml
│ │ ├── .gitignore
│ │ ├── .gitlab-ci.yml
│ │ ├── .travis.yml
│ │ ├── CITATION.bib
│ │ ├── CODEOWNERS
│ │ ├── LICENSE
│ │ ├── Manifest.toml
│ │ ├── Project.toml
│ │ ├── README.md
│ │ ├── docs/
│ │ │ ├── Manifest.toml
│ │ │ ├── Project.toml
│ │ │ ├── make.jl
│ │ │ └── src/
│ │ │ ├── assets/
│ │ │ │ └── static.txt
│ │ │ └── index.md
│ │ ├── src/
│ │ │ └── WackyOptions.jl
│ │ └── test/
│ │ ├── Project.toml
│ │ └── runtests.jl
│ └── static.txt
├── git.jl
├── interactive.jl
├── plugin.jl
├── reference.jl
├── runtests.jl
├── show.jl
└── template.jl
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitattributes
================================================
* eol=lf
*.png -text
================================================
FILE: .github/dependabot.yml
================================================
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
# To group all GitHub Actions updates into a single PR, uncomment the following:
# groups:
# github-actions:
# patterns:
# - "*"
- package-ecosystem: "julia"
directories:
- "/"
- "/docs"
- "/test"
schedule:
interval: "weekly"
# To group all Julia dependency updates into a single PR, uncomment the following:
# groups:
# julia-dependencies:
# patterns:
# - "*"
================================================
FILE: .github/workflows/CI.yml
================================================
name: CI
# Run on master, tags, or any pull request
on:
schedule:
- cron: '0 2 * * *' # Daily at 2 AM UTC (8 PM CST)
push:
branches: [master]
tags: ["*"]
pull_request:
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- "1.0" # LTS
- "1.7" # interactive tests require <= 1.8
- "1" # Latest Release
os:
- ubuntu-latest
- macOS-latest
- windows-latest
arch:
- x64
- x86
exclude:
# Test 32-bit only on Linux
- os: macOS-latest
arch: x86
- os: windows-latest
arch: x86
include:
# Add specific version used to run the reference tests.
# Must be kept in sync with version check in `test/runtests.jl`,
# and with the branch protection rules on the repository which
# require this specific job to pass on all PRs
# (see Settings > Branches > Branch protection rules).
- os: ubuntu-latest
version: 1.10.6
arch: x64
steps:
- uses: actions/checkout@v6
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v5
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-${{ matrix.arch }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.arch }}-test-${{ env.cache-name }}-
${{ runner.os }}-${{ matrix.arch }}-test-
${{ runner.os }}-${{ matrix.arch }}-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@latest
- run: |
git config --global user.name Tester
git config --global user.email te@st.er
- uses: julia-actions/julia-runtest@latest
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v5
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- run: |
git config --global user.name name
git config --global user.email email
git config --global github.user username
- run: |
julia --project=docs -e '
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()'
- run: |
julia --project=docs -e '
using Documenter: doctest
using PkgTemplates
doctest(PkgTemplates)'
- run: julia --project=docs docs/make.jl
env:
JULIA_PKG_SERVER: ""
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
================================================
FILE: .github/workflows/JuliaNightly.yml
================================================
name: JuliaNightly
# Nightly Scheduled Julia Nightly Run
on:
schedule:
- cron: '0 2 * * *' # Daily at 2 AM UTC (8 PM CST)
jobs:
test:
name: Julia Nightly - Ubuntu - x64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: julia-actions/setup-julia@v2
with:
version: nightly
arch: x64
- uses: actions/cache@v5
env:
cache-name: julia-nightly-cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ env.cache-name }}-
- uses: julia-actions/julia-buildpkg@latest
- run: |
git config --global user.name Tester
git config --global user.email te@st.er
- uses: julia-actions/julia-runtest@latest
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v5
with:
files: lcov.info
================================================
FILE: .github/workflows/TagBot.yml
================================================
name: TagBot
on:
issue_comment:
types:
- created
workflow_dispatch:
jobs:
TagBot:
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
ssh: ${{ secrets.DOCUMENTER_KEY }}
================================================
FILE: .gitignore
================================================
/docs/build/
*.jl.*.cov
*.jl.cov
*.jl.mem
/Manifest*.toml
/test/fixtures/*/test/Manifest*.toml
/docs/Manifest*.toml
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2017-2020 Chris de Graaf, Invenia Technical Computing Corporation
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.
================================================
FILE: Project.toml
================================================
name = "PkgTemplates"
uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1"
authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"]
version = "0.7.61"
[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433"
Mocking = "78c3b35d-d492-501b-9361-3d52fe80e533"
Mustache = "ffc61752-8dc7-55ee-8c37-f3e9cdd09e70"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
[compat]
Dates = "<0.0.1, 1"
InteractiveUtils = "<0.0.1, 1"
LibGit2 = "<0.0.1, 1"
Mocking = "0.7, 0.8"
Mustache = "1"
Parameters = "0.12"
Pkg = "<0.0.1, 1"
REPL = "<0.0.1, 1"
UUIDs = "<0.0.1, 1"
julia = "1"
[extras]
DeepDiffs = "ab62b9b5-e342-54a8-a765-a90f495de1a6"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[targets]
test = ["DeepDiffs", "Random", "Suppressor", "Test"]
================================================
FILE: README.md
================================================
# PkgTemplates
[](https://juliaci.github.io/PkgTemplates.jl/stable)
[](https://juliaci.github.io/PkgTemplates.jl/dev)
[](https://github.com/JuliaCI/PkgTemplates.jl/actions/workflows/CI.yml?query=branch%3Amaster)
[](https://codecov.io/gh/JuliaCI/PkgTemplates.jl)
[](https://github.com/invenia/BlueStyle)
[](https://github.com/SciML/ColPrac)
**PkgTemplates creates new Julia packages in an easy, repeatable, and customizable way.**
## Installation
Install with the Julia package manager [Pkg](https://pkgdocs.julialang.org/), just like any other registered Julia package:
```julia
pkg> add PkgTemplates # Press ']' to enter the Pkg REPL mode.
```
or
```julia
julia> using Pkg; Pkg.add("PkgTemplates")
```
## Usage
### Interactive Generation
You can fully customize your package interactively with:
```julia
using PkgTemplates
Template(interactive=true)("MyPkg")
```
This will prompt you to select options, displaying the default settings in parentheses.
### Manual creation
Creating a `Template` is as simple as:
```julia
using PkgTemplates
tpl = Template()
```
The no-keywords constructor assumes the existence of some preexisting Git configuration (show configuration using `git config --list` and set with `git config --global`):
- `user.name`: Your real name, e.g. John Smith.
- `user.email`: Your email address, eg. john.smith@acme.corp.
- `github.user`: Your GitHub username: e.g. john-smith.
Once you have a `Template`, use it to generate a package:
```julia
tpl("MyPkg")
```
However, it's probably desirable to customize the template to your liking with various options and plugins:
```julia
using PkgTemplates
tpl = Template(;
dir="~/code",
plugins=[
Git(; manifest=true, ssh=true),
GitHubActions(; x86=true),
Codecov(),
Documenter{GitHubActions}(),
],
)
```
---
For a much more detailed overview, please see [the User Guide documentation](https://juliaci.github.io/PkgTemplates.jl/stable/user/).
## Contributing
Issues and pull requests are welcome!
New contributors should make sure to read the [ColPrac Contributor Guide](https://github.com/SciML/ColPrac).
For some more PkgTemplates-specific tips, see the [Developer Guide documentation](https://juliaci.github.io/PkgTemplates.jl/stable/developer/).
================================================
FILE: docs/Project.toml
================================================
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
PkgTemplates = "14b8a8f1-9102-5b29-a752-f990bacb7fe1"
[compat]
Documenter = "1"
================================================
FILE: docs/make.jl
================================================
using Documenter: Documenter, makedocs, deploydocs
using PkgTemplates: PkgTemplates
makedocs(;
modules=[PkgTemplates],
authors="Chris de Graaf, Invenia Technical Computing Corporation",
sitename="PkgTemplates.jl",
format=Documenter.HTML(;
repolink="https://github.com/JuliaCI/PkgTemplates.jl",
canonical="https://juliaci.github.io/PkgTemplates.jl",
assets=String[],
),
pages=[
"Home" => "index.md",
"User Guide" => "user.md",
"Developer Guide" => "developer.md",
"Migrating To PkgTemplates 0.7+" => "migrating.md",
],
)
deploydocs(;
repo="github.com/JuliaCI/PkgTemplates.jl",
)
================================================
FILE: docs/src/developer.md
================================================
```@meta
CurrentModule = PkgTemplates
```
# PkgTemplates Developer Guide
```@contents
Pages = ["developer.md"]
```
Issues and pull requests are welcome!
New contributors should make sure to read the [ColPrac Contributor Guide](https://github.com/SciML/ColPrac).
[PkgTemplates](https://github.com/JuliaCI/PkgTemplates.jl/) can be easily extended by adding new [`Plugin`](@ref)s.
There are three types of plugins: [`Plugin`](@ref), [`FilePlugin`](@ref), and [`BadgePlugin`](@ref).
```@docs
Plugin
FilePlugin
BadgePlugin
```
## Template + Package Creation Pipeline
The [`Template`](@ref) constructor basically does this:
```
- extract values from keyword arguments
- create a Template from the values
- for each plugin:
- validate plugin against the template
```
The plugin validation step uses the [`validate`](@ref) function.
It lets us catch mistakes before we try to generate packages.
```@docs
validate
```
The package generation process looks like this:
```
- create empty directory for the package
- for each plugin, ordered by priority:
- run plugin prehook
- for each plugin, ordered by priority:
- run plugin hook
- for each plugin, ordered by priority:
- run plugin posthook
```
As you can tell, plugins play a central role in setting up a package.
The three main entrypoints for plugins to do work are the [`prehook`](@ref), the [`hook`](@ref), and the [`posthook`](@ref).
As the names might imply, they basically mean "before the main stage", "the main stage", and "after the main stage", respectively.
Each stage is basically identical, since the functions take the exact same arguments.
However, the multiple stages allow us to depend on artifacts of the previous stages.
For example, the [`Git`](@ref) plugin uses [`posthook`](@ref) to commit all generated files, but it wouldn't make sense to do that before the files are generated.
But what about dependencies within the same stage?
In this case, we have [`priority`](@ref) to define which plugins go when.
The [`Git`](@ref) plugin also uses this function to lower its posthook's priority, so that even if other plugins generate files in their posthooks, they still get committed (provided that those plugins didn't set an even lower priority).
```@docs
prehook
hook
posthook
priority
```
## `Plugin` Walkthrough
Concrete types that subtype [`Plugin`](@ref) directly are free to do almost anything.
To understand how they're implemented, let's look at simplified versions of two plugins: [`Documenter`](@ref) to explore templating, and [`Git`](@ref) to further clarify the multi-stage pipeline.
### Example: `Documenter`
```julia
@plugin struct Documenter <: Plugin
make_jl::String = default_file("docs", "make.jlt")
index_md::String = default_file("docs", "src", "index.md")
end
gitignore(::Documenter) = ["/docs/build/"]
badges(::Documenter) = [
Badge(
"Stable",
"https://img.shields.io/badge/docs-stable-blue.svg",
"https://{{{USER}}}.github.io/{{{PKG}}}.jl/stable",
),
Badge(
"Dev",
"https://img.shields.io/badge/docs-dev-blue.svg",
"https://{{{USER}}}.github.io/{{{PKG}}}.jl/dev",
),
]
view(p::Documenter, t::Template, pkg::AbstractString) = Dict(
"AUTHORS" => join(t.authors, ", "),
"PKG" => pkg,
"REPO" => "$(t.host)/$(t.user)/$pkg.jl",
"USER" => t.user,
)
function hook(p::Documenter, t::Template, pkg_dir::AbstractString)
pkg = pkg_name(pkg_dir)
docs_dir = joinpath(pkg_dir, "docs")
make = render_file(p.make_jl, combined_view(p, t, pkg), tags(p))
gen_file(joinpath(docs_dir, "make.jl"), make)
index = render_file(p.index_md, combined_view(p, t, pkg), tags(p))
gen_file(joinpath(docs_dir, "src", "index.md"), index)
# What this function does is not relevant here.
create_documentation_project()
end
```
The `@plugin` macro defines some helpful methods for us.
Inside of our struct definition, we're using [`default_file`](@ref) to refer to files in this repository.
```@docs
@plugin
default_file
```
The first method we implement for `Documenter` is [`gitignore`](@ref), so that packages created with this plugin ignore documentation build artifacts.
```@docs
gitignore
```
Second, we implement [`badges`](@ref) to add a couple of badges to new packages' README files.
```@docs
badges
Badge
```
These two functions, [`gitignore`](@ref) and [`badges`](@ref), are currently the only "special" functions for cross-plugin interactions.
In other cases, you can still access the [`Template`](@ref)'s plugins to depend on the presence/properties of other plugins via [`getplugin`](@ref), although that's less powerful.
```@docs
getplugin
```
Third, we implement [`view`](@ref), which is used to fill placeholders in badges and rendered files.
```@docs
view
```
Finally, we implement [`hook`](@ref), which is the real workhorse for the plugin.
Inside of this function, we generate a couple of files with the help of a few more text templating functions.
```@docs
render_file
render_text
gen_file
combined_view
tags
pkg_name
```
For more information on text templating, see the [`FilePlugin` Walkthrough](@ref) and the section on [Custom Template Files](@ref).
### Example: `Git`
```julia
struct Git <: Plugin end
priority(::Git, ::typeof(posthook)) = 5
function validate(::Git, ::Template)
foreach(("user.name", "user.email")) do k
if isempty(LibGit2.getconfig(k, ""))
throw(ArgumentError("Git: Global Git config is missing required value '$k'"))
end
end
end
function prehook(::Git, t::Template, pkg_dir::AbstractString)
LibGit2.with(LibGit2.init(pkg_dir)) do repo
LibGit2.commit(repo, "Initial commit")
pkg = pkg_name(pkg_dir)
url = "https://$(t.host)/$(t.user)/$pkg.jl"
close(GitRemote(repo, "origin", url))
end
end
function hook(::Git, t::Template, pkg_dir::AbstractString)
ignore = mapreduce(gitignore, append!, t.plugins)
unique!(sort!(ignore))
gen_file(joinpath(pkg_dir, ".gitignore"), join(ignore, "\n"))
end
function posthook(::Git, ::Template, pkg_dir::AbstractString)
LibGit2.with(GitRepo(pkg_dir)) do repo
LibGit2.add!(repo, ".")
LibGit2.commit(repo, "Files generated by PkgTemplates")
end
end
```
We didn't use `@plugin` for this one, because there are no fields.
Validation and all three hooks are implemented:
- [`validate`](@ref) makes sure that all required Git configuration is present.
- [`prehook`](@ref) creates the Git repository for the package.
- [`hook`](@ref) generates the `.gitignore` file, using the special [`gitignore`](@ref) function.
- [`posthook`](@ref) adds and commits all the generated files.
As previously mentioned, we use [`priority`](@ref) to make sure that we wait until all other plugins are finished their work before committing files.
Hopefully, this demonstrates the level of control you have over the package generation process when developing plugins, and when it makes sense to exercise that power!
## `FilePlugin` Walkthrough
Most of the time, you don't really need all of the control that we showed off above.
Plugins that subtype [`FilePlugin`](@ref) perform a much more limited task.
In general, they just generate one templated file.
To illustrate, let's look at the [`Citation`](@ref) plugin, which creates a `CITATION.bib` file.
```julia
@plugin struct Citation <: FilePlugin
file::String = default_file("CITATION.bib")
end
source(p::Citation) = p.file
destination(::Citation) = "CITATION.bib"
tags(::Citation) = "<<", ">>"
view(::Citation, t::Template, pkg::AbstractString) = Dict(
"AUTHORS" => join(t.authors, ", "),
"MONTH" => month(today()),
"PKG" => pkg,
"URL" => "https://$(t.host)/$(t.user)/$pkg.jl",
"YEAR" => year(today()),
)
```
Similar to the `Documenter` example above, we're defining a keyword constructor, and assigning a default template file from this repository.
This plugin adds nothing to `.gitignore`, and it doesn't add any badges, so implementations for [`gitignore`](@ref) and [`badges`](@ref) are omitted.
First, we implement [`source`](@ref) and [`destination`](@ref) to define where the template file comes from, and where it goes.
These functions are specific to [`FilePlugin`](@ref)s, and have no effect on regular [`Plugin`](@ref)s by default.
```@docs
source
destination
```
Next, we implement [`tags`](@ref).
We briefly saw this function earlier, but in this case it's necessary to change its behaviour from the default.
To see why, it might help to see the template file in its entirety:
```
@misc{<<&PKG>>.jl,
author = {<<&AUTHORS>>},
title = {<<&PKG>>.jl},
url = {<<&URL>>},
version = {v0.1.0},
year = {<<&YEAR>>},
month = {<<&MONTH>>}
}
```
Because the file contains its own `{}` delimiters, we need to use different ones for templating to work properly.
Finally, we implement [`view`](@ref) to fill in the placeholders that we saw in the template file.
## Doing Extra Work With `FilePlugin`s
Notice that we didn't have to implement [`hook`](@ref) for our plugin.
It's implemented for all [`FilePlugin`](@ref)s, like so:
```julia
function render_plugin(p::FilePlugin, t::Template, pkg::AbstractString)
return render_file(source(p), combined_view(p, t, pkg), tags(p))
end
function hook(p::FilePlugin, t::Template, pkg_dir::AbstractString)
source(p) === nothing && return
pkg = pkg_name(pkg_dir)
path = joinpath(pkg_dir, destination(p))
text = render_plugin(p, t, pkg)
gen_file(path, text)
end
```
But what if we want to do a little more than just generate one file?
A good example of this is the [`Tests`](@ref) plugin.
It creates `runtests.jl`, but it also modifies the `Project.toml` to include the `Test` dependency.
Of course, we could use a normal [`Plugin`](@ref), but it turns out there's a way to avoid that while still getting the extra capbilities that we want.
The plugin implements its own `hook`, but uses `invoke` to avoid duplicating the file creation code:
```julia
@plugin struct Tests <: FilePlugin
file::String = default_file("runtests.jlt")
end
source(p::Tests) = p.file
destination(::Tests) = joinpath("test", "runtests.jl")
view(::Tests, ::Template, pkg::AbstractString) = Dict("PKG" => pkg)
function hook(p::Tests, t::Template, pkg_dir::AbstractString)
# Do the normal FilePlugin behaviour to create the test script.
invoke(hook, Tuple{FilePlugin, Template, AbstractString}, p, t, pkg_dir)
# Do some other work.
add_test_dependency()
end
```
There is also a default [`validate`](@ref) implementation for [`FilePlugin`](@ref)s, which checks that the plugin's [`source`](@ref) file exists, and throws an `ArgumentError` otherwise.
If you want to extend the validation but keep the file existence check, use the `invoke` method as described above.
For more examples, see the plugins in the [Continuous Integration (CI)](@ref) and [Code Coverage](@ref) sections.
## Supporting Interactive Mode
When it comes to supporting interactive mode for your custom plugins, you have two options: write your own [`interactive`](@ref) method, or use the default one.
If you choose the first option, then you are free to implement the method however you want.
If you want to use the default implementation, then there are a few functions that you should be aware of, although in many cases you will not need to add any new methods.
```@docs
interactive
prompt
customizable
input_tips
convert_input
```
## Miscellaneous Tips
### Writing Template Files
For an overview of writing template files for Mustache.jl, see [Custom Template Files](@ref) in the user guide.
### Predicates
There are a few predicate functions for plugins that are occasionally used to answer questions like "does this `Template` have any code coverage plugins?".
If you're implementing a plugin that fits into one of the following categories, it would be wise to implement the corresponding predicate function to return `true` for instances of your type.
```@docs
needs_username
is_ci
is_coverage
```
### Formatting Version Numbers
When writing configuration files for CI services, working with version numbers is often needed.
There are a few convenience functions that can be used to make this a little bit easier.
```@docs
compat_version
format_version
collect_versions
```
## Testing
If you write a cool new plugin that could be useful to other people, or find and fix a bug, you're encouraged to open a pull request with your changes.
Here are some testing tips to ensure that your PR goes through as smoothly as possible.
### Updating Reference Tests & Fixtures
If you've added or modified plugins, you should update the reference tests and the associated test fixtures.
In `test/reference.jl`, you'll find a "Reference tests" test set that basically generates a bunch of packages, and then checks each file against a reference file, which is stored somewhere in `test/fixtures`.
Note the reference tests only run on one specific version of Julia; check `test/runtests.jl` to see the current version used.
For new plugins, you should add an instance of your plugin to the "All plugins" and "Wacky options" test sets, then run the tests with `Pkg.test`.
They should pass, and there will be new files in `test/fixtures`.
Check them to make sure that they contain exactly what you would expect!
For changes to existing plugins, update the plugin options appropriately in the "Wacky options" test set.
Failing tests will give you the option to review and accept changes to the fixtures, updating the files automatically for you.
### Running reference tests locally
In the file `test/runtests.jl`, there is a variable called `REFERENCE_JULIA_VERSION`, currently set to `v"1.7.2"`.
If you use any other Julia version (even the latest stable one) to launch the test suite, the reference tests mentioned above will not run, and you will miss a crucial correctness check for your code.
Therefore, we strongly suggest you test PkgTemplates locally against Julia 1.7.2.
This version can be easily installed and started with [juliaup](https://github.com/JuliaLang/juliaup):
```bash
juliaup add 1.7.2
julia +1.7.2
```
### Updating "Show" Tests
Depending on what you've changed, the tests in `test/show.jl` might fail.
To fix those, you'll need to update the `expected` value to match what is actually displayed in a Julia REPL (assuming that the new value is correct).
================================================
FILE: docs/src/index.md
================================================
```@meta
CurrentModule = PkgTemplates
```
# PkgTemplates
**[PkgTemplates](https://github.com/JuliaCI/PkgTemplates.jl/) creates new Julia packages in an easy, repeatable, and customizable way.**
## Documentation
If you're looking to **create new packages**, see the [User Guide](user.md).
If you want to **create new plugins**, see the [Developer Guide](developer.md).
if you're trying to **migrate from an older version of PkgTemplates**, see [Migrating To PkgTemplates 0.7+](migrating.md).
```@docs
PkgTemplates
```
## Index
```@index
```
================================================
FILE: docs/src/migrating.md
================================================
```@meta
CurrentModule = PkgTemplates
```
# Migrating To PkgTemplates 0.7+
PkgTemplates 0.7 is a ground-up rewrite of the package with similar functionality but with updated APIs and internals.
Here is a summary of things that existed in older versions but have been moved elsewhere or removed.
However, it might be easier to just read the [User Guide](user.md).
## Template keywords
The recurring theme is "everything is a plugin now".
| Old | New |
| :------------------: | :-------------------------------: |
| `license="ISC"` | `plugins=[License(; name="ISC")]` |
| `develop=true` * | `plugins=[Develop()]` |
| `git=false` | `plugins=[!Git]` |
| `julia_version=v"1"` | `julia=v"1"` |
| `ssh=true` | `plugins=[Git(; ssh=true)]` |
| `manifest=true` | `plugins=[Git(; manifest=true)]` |
\* `develop=true` was the default setting, but it is no longer the default in PkgTemplates 0.7+.
## Plugins
Aside from renamings, basically every plugin has had their constructors reworked.
So if you are using anything non-default, you should consult the new docstring.
| Old | New |
| :-----------: | :--------------------: |
| `GitHubPages` | `Documenter{TravisCI}` |
| `GitLabPages` | `Documenter{GitLabCI}` |
## Package Generation
One less name to remember!
| Old | New |
| :-----------------------------------------: | :---------------------------------: |
| `generate(::Template, pkg::AbstractString)` | `(::Template)(pkg::AbstractString)` |
## Interactive Mode
| Old | New |
| :-----------------------------------------: | :---------------------------------: |
| `interactive_template()` | `Template(; interactive=true)` |
| `generate_interactive(pkg::AbstractString)` | `Template(; interactive=true)(pkg)` |
## Other Functions
Two less names to remember!
Although it's unlikely that anyone used these.
| Old | New |
| :------------------: | :--------------------------------------------------------------------------------------------------: |
| `available_licenses` | [View licenses on GitHub](https://github.com/JuliaCI/PkgTemplates.jl/tree/master/templates/licenses) |
| `show_license` | [View licenses on GitHub](https://github.com/JuliaCI/PkgTemplates.jl/tree/master/templates/licenses) |
## Custom Plugins
In addition to the changes in usage, custom plugins from older versions of PkgTemplates will not work in 0.7+.
See the [Developer Guide](developer.md) for more information on the new extension API.
================================================
FILE: docs/src/user.md
================================================
```@meta
CurrentModule = PkgTemplates
```
# PkgTemplates User Guide
```@contents
Pages = ["user.md"]
```
Using [PkgTemplates](https://github.com/JuliaCI/PkgTemplates.jl/) is straightforward.
Just create a [`Template`](@ref), and call it on a package name to generate that package:
```julia
using PkgTemplates
t = Template()
t("MyPkg")
```
## Template
```@docs
Template
generate
```
## Plugins
Plugins add functionality to `Template`s.
There are a number of plugins available to automate common boilerplate tasks.
### Default Plugins
These plugins are included by default.
They can be overridden by supplying another value, or disabled by negating the type (`!Type`), both as elements of the `plugins` keyword.
```@docs
ProjectFile
SrcDir
Tests
Readme
License
Git
GitHubActions
Dependabot
TagBot
Secret
```
### Continuous Integration (CI)
These plugins will create the configuration files of common CI services for you.
```@docs
AppVeyor
CirrusCI
DroneCI
GitLabCI
TravisCI
```
### Code Coverage
These plugins will enable code coverage reporting from CI.
```@docs
Codecov
Coveralls
```
### Documentation
These plugins will help you build a documentation website.
```@docs
Documenter
Logo
```
### Badges
These plugins will add badges to the README.
```@docs
BlueStyleBadge
ColPracBadge
PkgEvalBadge
```
### Miscellaneous
```@docs
Develop
Citation
RegisterAction
Formatter
CodeOwners
PkgBenchmark
CompatHelper
```
## A More Complicated Example
Here are a few example templates that use the options and plugins explained above.
This one includes plugins suitable for a project hosted on GitHub, and some other customizations:
```julia
Template(;
user="my-username",
dir="~/code",
authors="Acme Corp",
julia=v"1.1",
plugins=[
License(; name="MPL-2.0"),
Git(; manifest=true, ssh=true),
GitHubActions(; x86=true),
Codecov(),
Documenter{GitHubActions}(),
Develop(),
],
)
```
Here's one that works well for projects hosted on GitLab:
```julia
Template(;
user="my-username",
host="gitlab.com",
plugins=[
GitLabCI(),
Documenter{GitLabCI}(),
],
)
```
## Custom Template Files
!!! note "Templates vs Templating"
This documentation refers plenty to [`Template`](@ref)s, the package's main type, but it also refers to "template files" and "text templating", which are plaintext files with placeholders to be filled with data, and the technique of filling those placeholders with data, respectively.
These concepts should be familiar if you've used [Jinja](https://palletsprojects.com/p/jinja) or [Mustache](https://mustache.github.io) (Mustache is the particular flavour used by PkgTemplates, via [Mustache.jl](https://github.com/jverzani/Mustache.jl)).
Please keep the difference between these two things in mind!
Many plugins support a `file` argument or similar, which sets the path to the template file to be used for generating files.
Each plugin has a sensible default that should make sense for most people, but you might have a specialized workflow that requires a totally different template file.
If that's the case, a basic understanding of [Mustache](https://mustache.github.io)'s syntax is required.
Here's an example template file:
```
Hello, {{{name}}}.
{{#weather}}
It's {{{weather}}} outside.
{{/weather}}
{{^weather}}
I don't know what the weather outside is.
{{/weather}}
{{#has_things}}
I have the following things:
{{/has_things}}
{{#things}}
- Here's a thing: {{{.}}}
{{/things}}
{{#people}}
- {{{name}}} is {{{mood}}}
{{/people}}
```
In the first section, `name` is a key, and its value replaces `{{{name}}}`.
In the second section, `weather`'s value may or may not exist.
If it does exist, then "It's \$weather outside" is printed.
Otherwise, "I don't know what the weather outside is" is printed.
Mustache uses a notion of "truthiness" similar to Python or JavaScript, where values of `nothing`, `false`, or empty collections are all considered to not exist.
In the third section, `has_things`' value is printed if it's truthy.
Then, if the `things` list is truthy (i.e. not empty), its values are each printed on their own line.
The reason that we have two separate keys is that `{{#things}}` iterates over the whole `things` list, even when there are no `{{{.}}}` placeholders, which would duplicate "I have the following things:" `n` times.
The fourth section iterates over the `people` list, but instead of using the `{{{.}}}` placeholder, we have `name` and `mood`, which are keys or fields of the list elements.
Most types are supported here, including `Dict`s and structs.
`NamedTuple`s require you to use `{{{:name}}}` instead of the normal `{{{name}}}`, though.
You might notice that some curlies are in groups of two (`{{key}}`), and some are in groups of three (`{{{key}}}`).
Whenever we want to subtitute in a value, using the triple curlies disables HTML escaping, which we rarely want for the types of files we're creating.
If you do want escaping, just use the double curlies.
And if you're using different delimiters, for example `<<foo>>`, use `<<&foo>>` to disable escaping.
Assuming the following view:
```julia
struct Person; name::String; mood::String; end
things = ["a", "b", "c"]
view = Dict(
"name" => "Chris",
"weather" => "sunny",
"has_things" => !isempty(things),
"things" => things,
"people" => [Person("John", "happy"), Person("Jane", "sad")],
)
```
Our example template would produce this:
```
Hello, Chris.
It's sunny outside.
I have the following things:
- Here's a thing: a
- Here's a thing: b
- Here's a thing: c
- John is happy
- Jane is sad
```
## Extending Existing Plugins
Most of the existing plugins generate a file from a template file.
If you want to use custom template files, you may run into situations where the data passed into the templating engine is not sufficient.
In this case, you can look into implementing [`user_view`](@ref) to supply whatever data is necessary for your use case.
```@docs
user_view
```
For example, suppose you were using the [`Readme`](@ref) plugin with a custom template file that looked like this:
```md
# {{PKG}}
Created on *{{TODAY}}*.
```
The [`view`](@ref) function supplies a value for `PKG`, but it does not supply a value for `TODAY`.
Rather than override [`view`](@ref), we can implement this function to get both the default values and whatever else we need to add.
```julia
user_view(::Readme, ::Template, ::AbstractString) = Dict("TODAY" => today())
```
## Saving Templates
One of the main reasons for PkgTemplates' existence is for new packages to be consistent.
This means using the same template more than once, so we want a way to save a template to be used later.
Here's my recommendation for loading a template whenever it's needed:
```julia
function template()
@eval begin
using PkgTemplates
Template(; #= ... =#)
end
end
```
Add this to your `startup.jl`, and you can create your template from anywhere, without incurring any startup cost.
Another strategy is to write the string representation of the template to a Julia file:
```julia
const t = Template(; #= ... =#)
open("template.jl", "w") do io
println(io, "using PkgTemplates")
print(io, t)
end
```
Then the template is just an `include` away:
```julia
const t = include("template.jl")
```
The only disadvantage to this approach is that the saved template is much less human-readable than code you wrote yourself.
One more method of saving templates is to simply use the Serialization package in the standard library:
```julia
const t = Template(; #= ... =#)
using Serialization
open(io -> serialize(io, t), "template.bin", "w")
```
Then simply `deserialize` to load:
```julia
using Serialization
const t = open(deserialize, "template.bin")
```
This approach has the same disadvantage as the previous one, and the serialization format is not guaranteed to be stable across Julia versions.
================================================
FILE: src/PkgTemplates.jl
================================================
@doc read(joinpath(dirname(@__DIR__), "README.md"), String)
module PkgTemplates
using Base: active_project, contractuser
using Dates: month, today, year
using InteractiveUtils: subtypes
using LibGit2: LibGit2, GitConfig, GitReference, GitRemote, GitRepo, delete_branch
using Pkg: Pkg, TOML, PackageSpec
using REPL.TerminalMenus: MultiSelectMenu, RadioMenu, request
using UUIDs: uuid4
using Mustache: render
using Parameters: @with_kw_noshow
using Mocking
export
Template,
AppVeyor,
BlueStyleBadge,
CirrusCI,
Citation,
Codecov,
CodeOwners,
ColPracBadge,
CompatHelper,
Coveralls,
Dependabot,
Develop,
Documenter,
DroneCI,
Formatter,
Git,
GitHubActions,
GitLabCI,
License,
Logo,
NoDeploy,
PkgBenchmark,
PkgEvalBadge,
ProjectFile,
Readme,
RegisterAction,
Runic,
Secret,
SrcDir,
TagBot,
Tests,
TravisCI
"""
Plugins are PkgTemplates' source of customization and extensibility.
Add plugins to your [`Template`](@ref)s to enable extra pieces of repository setup.
When implementing a new plugin, subtype this type to have full control over its behaviour.
"""
abstract type Plugin end
include("template.jl")
include("plugin.jl")
include("show.jl")
include("interactive.jl")
include("deprecated.jl")
# Run some function with a project activated at the given path.
function with_project(f::Function, path::AbstractString)
proj = active_project()
try
Pkg.activate(path)
f()
finally
proj === nothing ? Pkg.activate() : Pkg.activate(proj)
end
end
end
================================================
FILE: src/deprecated.jl
================================================
@deprecate generate(t::Template, pkg::AbstractString) t(pkg)
@deprecate generate(pkg::AbstractString, t::Template) t(pkg)
@deprecate interactive_template() Template(; interactive=true)
@deprecate generate_interactive(pkg::AbstractString) Template(; interactive=true)(pkg)
@deprecate GitHubPages(; kwargs...) Documenter{TravisCI}(; kwargs...)
@deprecate GitLabPages(; kwargs...) Documenter{GitLabCI}(; kwargs...)
================================================
FILE: src/interactive.jl
================================================
"""
generate([pkg::AbstractString]) -> Template
Shortcut for `Template(; interactive=true)(pkg)`.
If no package name is supplied, you will be prompted for one.
"""
function generate(pkg::AbstractString=prompt(Template, String, :pkg))
t = Template(; interactive=true)
t(pkg)
return t
end
"""
interactive(T::Type{<:Plugin}) -> T
Interactively create a plugin of type `T`. Implement this method and ignore other
related functions only if you want completely custom behaviour.
"""
function interactive(T::Type)
pairs = Vector{Pair{Symbol, Type}}(interactive_pairs(T))
# There must be at least 2 MultiSelectMenu options.
# If there are none, return immediately.
# If there's just one, add a "dummy" option.
isempty(pairs) && return T()
just_one = length(pairs) == 1
just_one && push!(pairs, :None => Nothing)
println("$(nameof(T)) keywords to customize:")
opts = map(first.(pairs)) do k
if k != :None
"$k ($(repr(defaultkw(T, k))))"
else
"$k"
end
end
menu = MultiSelectMenu(opts; pagesize=length(pairs))
customize = sort!(collect(request(menu)))
# If the "None" option was selected, don't customize anything.
just_one && lastindex(pairs) in customize && return T()
kwargs = Dict{Symbol, Any}()
foreach(pairs[customize]) do (name, F)
kwargs[name] = prompt(T, F, name)
end
return T(; kwargs...)
end
struct NotCustomizable end
"""
customizable(::Type{<:Plugin}) -> Vector{Pair{Symbol, DataType}}
Return a list of keyword arguments that the given plugin type accepts,
which are not fields of the type, and should be customizable in interactive mode.
For example, for a constructor `Foo(; x::Bool)`, provide `[x => Bool]`.
If `T` has fields which should not be customizable, use `NotCustomizable` as the type.
"""
customizable(::Type) = ()
function pretty_message(s::AbstractString)
replacements = [
r"Array{(.*?),1}" => s"Vector{\1}",
r"Union{Nothing, (.*?)}" => s"Union{\1, Nothing}",
]
return reduce((s, p) -> replace(s, p), replacements; init=s)
end
"""
input_tips(::Type{T}) -> Vector{String}
Provide some extra tips to users on how to structure their input for the type `T`,
for example if multiple delimited values are expected.
"""
input_tips(::Type{Vector{T}}) where T = [input_tips(T)..., "comma-delimited"]
input_tips(::Type{Union{T, Nothing}}) where T = [input_tips(T)..., input_tips(Nothing)...]
input_tips(::Type{Nothing}) = ["'nothing' for nothing"]
input_tips(::Type{Secret}) = ["name only"]
# Show expected input type as a tip if it's anything other than `String`
input_tips(::Type{T}) where T = String[string(T)]
input_tips(::Type{String}) = String[]
input_tips(::Type{<:Signed}) = ["Int"] # Specific Int type likely not important
"""
convert_input(::Type{P}, ::Type{T}, s::AbstractString) -> T
Convert the user input `s` into an instance of `T` for plugin of type `P`.
A default implementation of `T(s)` exists.
"""
convert_input(::Type, T::Type{<:Real}, s::AbstractString) = parse(T, s)
convert_input(::Type, T::Type, s::AbstractString) = T(s)
function convert_input(P::Type, ::Type{Union{T, Nothing}}, s::AbstractString) where T
# This is kind of sketchy because technically, there might be some other input
# whose value we want to instantiate with the string "nothing",
# but I think that would be a pretty rare occurrence.
# If that really happens, they can just override this method.
return s == "nothing" ? nothing : convert_input(P, T, s)
end
function convert_input(P::Type, ::Type{Union{T, Symbol, Nothing}}, s::AbstractString) where T
# Assume inputs starting with ':' char are intended as Symbols, if a plugin accept symbols.
# i.e. assume the set of valid Symbols the plugin expects can be spelt starting with ':'.
return if startswith(s, ":")
Symbol(chop(s, head=1, tail=0)) # remove ':'
else
convert_input(P, Union{T,Nothing}, s)
end
end
function convert_input(::Type, ::Type{Bool}, s::AbstractString)
s = lowercase(s)
return if startswith(s, 't') || startswith(s, 'y')
true
elseif startswith(s, 'f') || startswith(s, 'n')
false
else
throw(ArgumentError("Unrecognized boolean response"))
end
end
function convert_input(P::Type, T::Type{<:Vector}, s::AbstractString)
startswith(s, '[') && endswith(s, ']') && (s = s[2:end-1])
xs = map(x -> strip(x, [' ', '\t', '"']), split(s, ","))
return map(x -> convert_input(P, eltype(T), x), xs)
end
# how would the user type `x` in interactive mode?
input_string(x) = string(x)
input_string(x::AbstractString) = isempty(x) ? repr(x) : String(x)
input_string(x::Symbol) = repr(x)
"""
prompt(::Type{P}, ::Type{T}, ::Val{name::Symbol}) -> Any
Prompts for an input of type `T` for field `name` of plugin type `P`.
Implement this method to customize particular fields of particular types.
"""
prompt(P::Type, T::Type, name::Symbol) = prompt(P, T, Val(name))
# The trailing `nothing` is a hack for `fallback_prompt` to use, ignore it.
function prompt(P::Type, ::Type{T}, ::Val{name}, ::Nothing=nothing) where {T, name}
default = defaultkw(P, name)
tips = join([input_tips(T); "default: $(input_string(default))"], ", ")
input = Base.prompt(pretty_message("Enter value for '$name' ($tips)"))
input === nothing && throw(InterruptException())
input = strip(input, '"')
return if isempty(input)
default
else
try
# Working around what appears to be a bug in Julia 1.0:
# #145#issuecomment-623049535
if VERSION < v"1.1" && T isa Union && Nothing <: T
if input == "nothing"
nothing
else
convert_input(P, T.a === Nothing ? T.b : T.a, input)
end
else
convert_input(P, T, input)
end
catch ex
ex isa InterruptException && rethrow()
@warn "Invalid input" ex
prompt(P, T, name)
end
end
end
# Compute all the concrete subtypes of T.
concretes_rec(T::Type) = isabstracttype(T) ? vcat(map(concretes_rec, subtypes(T))...) : Any[T]
concretes(T::Type) = sort!(concretes_rec(T); by=nameof)
# Compute name => type pairs for T's interactive options.
function interactive_pairs(T::Type)
pairs = collect(map(name -> name => fieldtype(T, name), fieldnames(T)))
# Use prepend! here so that users can override field types if they wish.
prepend!(pairs, reverse(customizable(T)))
uniqueby!(first, pairs)
filter!(p -> last(p) !== NotCustomizable, pairs)
sort!(pairs; by=first)
return pairs
end
# unique!(f, xs) added here: https://github.com/JuliaLang/julia/pull/30141
if VERSION >= v"1.1"
const uniqueby! = unique!
else
function uniqueby!(f, xs)
seen = Set()
todelete = Int[]
foreach(enumerate(map(f, xs))) do (i, out)
out in seen && push!(todelete, i)
push!(seen, out)
end
return deleteat!(xs, todelete)
end
end
================================================
FILE: src/plugin.jl
================================================
const DEFAULT_PRIORITY = 1000
const DEFAULT_TEMPLATE_DIR = Ref{String}(joinpath(dirname(dirname(pathof(PkgTemplates))), "templates"))
"""
@plugin struct ... end
Define a plugin subtype with keyword constructors and default values.
For details on the general syntax, see
[Parameters.jl](https://mauro3.github.io/Parameters.jl/stable/manual/#Types-with-default-values-and-keyword-constructors-1).
There are a few extra restrictions:
- Before using this macro, you must have imported `@with_kw_noshow` and `PkgTemplates` must
be in scope: `using PkgTemplates: PkgTemplates, @with_kw_noshow, @plugin`.
- The type must be a subtype of [`Plugin`](@ref) (or one of its abstract subtypes)
- The type cannot be parametric
- All fields must have default values
## Example
```julia
using PkgTemplates: PkgTemplates, @plugin, @with_kw_noshow, Plugin
@plugin struct MyPlugin <: Plugin
x::String = "hello!"
y::Union{Int, Nothing} = nothing
end
```
## Implementing `@plugin` Manually
If for whatever reason, you are unable to meet the criteria outlined above,
you can manually implement the methods that `@plugin` would have created for you.
This is only mandatory if you want to use your plugin in interactive mode.
### Keyword Constructors
If possible, use `@with_kw_noshow` to create a keyword constructor for your type.
Your type must be capable of being instantiated with no arguments.
### Default Values
If your type's fields have sensible default values, implement `defaultkw` like so:
```julia
using PkgTemplates: PkgTemplates, Plugin
struct MyPlugin <: Plugin
x::String
end
PkgTemplates.defaultkw(::Type{MyPlugin}, ::Val{:x}) = "my default"
```
Remember to add a method to the function belonging to PkgTemplates,
rather than creating your own function that PkgTemplates won't see.
If your plugin's fields have no sane defaults, then you'll need to implement
[`prompt`](@ref) appropriately instead.
"""
macro plugin(ex::Expr)
@assert ex.head === :struct "Expression must be a struct definition"
@assert ex.args[2] isa Expr && ex.args[2].head === :<: "Type must have a supertype"
T = ex.args[2].args[1]
@assert T isa Symbol "@plugin does not work for parametric types"
msg = "Run `using PkgTemplates: @with_kw_noshow` before using this macro"
@assert isdefined(__module__, Symbol("@with_kw_noshow")) msg
block = :(begin @with_kw_noshow $ex end)
foreach(filter(arg -> arg isa Expr, ex.args[3].args)) do field
@assert field.head === :(=) "Field must have a default value"
name = QuoteNode(field.args[1].args[1])
default = field.args[2]
def = :(PkgTemplates.defaultkw(::Type{$T}, ::Val{$name}) = $default)
push!(block.args, def)
end
return esc(block)
end
function Base.:(==)(a::T, b::T) where T <: Plugin
return all(n -> getfield(a, n) == getfield(b, n), fieldnames(T))
end
struct Disabled{P<:Plugin} end
Base.:(!)(P::Type{<:Plugin}) = Disabled{P}()
"""
Secret(name::AbstractString)
Represents a GitHub repository secret.
When converted to a string, yields `\${{ secrets.<name> }}`.
"""
struct Secret
name::String
end
Base.print(io::IO, s::Secret) = print(io, "\${{ secrets.$(s.name) }}")
"""
A simple plugin that, in general, creates a single file.
"""
abstract type FilePlugin <: Plugin end
"""
default_file(paths::AbstractString...) -> String
Return a path relative to the default template file directory
(`PkgTemplates/templates`).
"""
default_file(paths::AbstractString...) = joinpath(DEFAULT_TEMPLATE_DIR[], paths...)
"""
view(::Plugin, ::Template, pkg::AbstractString) -> Dict{String, Any}
Return the view to be passed to the text templating engine for this plugin.
`pkg` is the name of the package being generated.
For [`FilePlugin`](@ref)s, this is used for both the plugin badges
(see [`badges`](@ref)) and the template file (see [`source`](@ref)).
For other [`Plugin`](@ref)s, it is used only for badges,
but you can always call it yourself as part of your [`hook`](@ref) implementation.
By default, an empty `Dict` is returned.
"""
view(::Plugin, ::Template, ::AbstractString) = Dict{String, Any}()
"""
user_view(::Plugin, ::Template, pkg::AbstractString) -> Dict{String, Any}
The same as [`view`](@ref), but for use by package *users* for extension.
Values returned by this function will override those from [`view`](@ref)
when the keys are the same.
"""
user_view(::Plugin, ::Template, ::AbstractString) = Dict{String, Any}()
"""
combined_view(::Plugin, ::Template, pkg::AbstractString) -> Dict{String, Any}
This function combines [`view`](@ref) and [`user_view`](@ref) for use in text templating.
If you're doing manual file creation or text templating (i.e. writing [`Plugin`](@ref)s
that are not [`FilePlugin`](@ref)s), then you should use this function
rather than either of the former two.
!!! note
Do not implement this function yourself!
If you're implementing a plugin, you should implement [`view`](@ref).
If you're customizing a plugin as a user, you should implement [`user_view`](@ref).
"""
function combined_view(p::Plugin, t::Template, pkg::AbstractString)
return merge(view(p, t, pkg), user_view(p, t, pkg))
end
"""
tags(::Plugin) -> Tuple{String, String}
Return the delimiters used for text templating.
See the [`Citation`](@ref) plugin for a rare case where changing the tags is necessary.
By default, the tags are `"{{"` and `"}}"`.
"""
tags(::Plugin) = "{{", "}}"
"""
priority(::Plugin, ::Union{typeof(prehook), typeof(hook), typeof(posthook)}) -> Int
Determines the order in which plugins are processed (higher goes first).
The default priority (`DEFAULT_PRIORITY`), is `$DEFAULT_PRIORITY`.
You can implement this function per-stage (by using `::typeof(hook)`, for example),
or for all stages by simply using `::Function`.
"""
priority(::Plugin, ::Function) = DEFAULT_PRIORITY
"""
gitignore(::Plugin) -> Vector{String}
Return patterns that should be added to `.gitignore`.
These are used by the [`Git`](@ref) plugin.
By default, an empty list is returned.
"""
gitignore(::Plugin) = String[]
"""
badges(::Plugin) -> Union{Badge, Vector{Badge}}
Return a list of [`Badge`](@ref)s, or just one, to be added to `README.md`.
These are used by the [`Readme`](@ref) plugin to add badges to the README.
By default, an empty list is returned.
"""
badges(::Plugin) = Badge[]
"""
source(::FilePlugin) -> Union{String, Nothing}
Return the path to a plugin's template file, or `nothing` to indicate no file.
By default, `nothing` is returned.
"""
source(::FilePlugin) = nothing
"""
destination(::FilePlugin) -> String
Return the destination, relative to the package root, of a plugin's configuration file.
This function **must** be implemented.
"""
function destination end
"""
Badge(hover::AbstractString, image::AbstractString, link::AbstractString)
Container for Markdown badge data.
Each argument can contain placeholders,
which will be filled in with values from [`combined_view`](@ref).
## Arguments
- `hover::AbstractString`: Text to appear when the mouse is hovered over the badge.
- `image::AbstractString`: URL to the image to display.
- `link::AbstractString`: URL to go to upon clicking the badge.
"""
struct Badge
hover::String
image::String
link::String
end
Base.string(b::Badge) = "[)]($(b.link))"
# Format a plugin's badges as a list of strings, with all substitutions applied.
function badges(p::Plugin, t::Template, pkg::AbstractString)
bs = badges(p)
bs isa Vector || (bs = [bs])
return map(b -> render_text(string(b), combined_view(p, t, pkg)), bs)
end
"""
validate(::Plugin, ::Template)
Perform any required validation for a [`Plugin`](@ref).
It is preferred to do validation here instead of in [`prehook`](@ref),
because this function is called at [`Template`](@ref) construction time,
whereas the prehook is only run at package generation time.
"""
validate(::Plugin, ::Template) = nothing
"""
prehook(::Plugin, ::Template, pkg_dir::AbstractString)
Stage 1 of the package generation process (the "before" stage, in general).
At this point, `pkg_dir` is an empty directory that will eventually contain the package,
and neither the [`hook`](@ref)s nor the [`posthook`](@ref)s have run.
!!! note
`pkg_dir` only stays empty until the first plugin chooses to create a file.
See also: [`priority`](@ref).
"""
prehook(::Plugin, ::Template, ::AbstractString) = nothing
"""
hook(::Plugin, ::Template, pkg_dir::AbstractString)
Stage 2 of the package generation pipeline (the "main" stage, in general).
At this point, the [`prehook`](@ref)s have run, but not the [`posthook`](@ref)s.
`pkg_dir` is the directory in which the package is being generated; [`pkg_name`](@ref)`
will return the package name.
!!! note
You usually shouldn't implement this function for [`FilePlugin`](@ref)s.
If you do, it should probably `invoke` the generic method
(otherwise, there's not much reason to subtype `FilePlugin`).
"""
hook(::Plugin, ::Template, ::AbstractString) = nothing
"""
posthook(::Plugin, ::Template, pkg_dir::AbstractString)
Stage 3 of the package generation pipeline (the "after" stage, in general).
At this point, both the [`prehook`](@ref)s and [`hook`](@ref)s have run.
"""
posthook(::Plugin, ::Template, ::AbstractString) = nothing
function validate(p::T, ::Template) where T <: FilePlugin
src = source(p)
src === nothing && return
isfile(src) || throw(ArgumentError("$(nameof(T)): The file $src does not exist"))
end
function hook(p::FilePlugin, t::Template, pkg_dir::AbstractString)
source(p) === nothing && return
pkg = pkg_name(pkg_dir)
path = joinpath(pkg_dir, destination(p))
text = render_plugin(p, t, pkg)
gen_file(path, text)
end
function render_plugin(p::FilePlugin, t::Template, pkg::AbstractString)
return render_file(source(p), combined_view(p, t, pkg), tags(p))
end
"""
gen_file(file::AbstractString, text::AbstractString)
Create a new file containing some given text.
Trailing whitespace is removed, and the file will end with a newline.
"""
function gen_file(file::AbstractString, text::AbstractString)
mkpath(dirname(file))
text = strip(join(map(rstrip, split(text, "\n")), "\n")) * "\n"
write(file, text)
end
"""
render_file(file::AbstractString, view::Dict{<:AbstractString}, tags=nothing) -> String
Render a template file with the data in `view`.
`tags` should be a tuple of two strings, which are the opening and closing delimiters,
or `nothing` to use the default delimiters.
"""
function render_file(file::AbstractString, view::Dict{<:AbstractString}, tags=nothing)
return render_text(read(file, String), view, tags)
end
"""
render_text(text::AbstractString, view::Dict{<:AbstractString}, tags=nothing) -> String
Render some text with the data in `view`.
`tags` should be a tuple of two strings, which are the opening and closing delimiters,
or `nothing` to use the default delimiters.
"""
function render_text(text::AbstractString, view::Dict{<:AbstractString}, tags=nothing)
return tags === nothing ? render(text, view) : render(text, view; tags=tags)
end
"""
needs_username(::Plugin) -> Bool
Determine whether or not a plugin needs a Git hosting service username to function correctly.
If you are implementing a plugin that uses the `user` field of a [`Template`](@ref),
you should implement this function and return `true`.
"""
needs_username(::Plugin) = false
"""
pkg_name(pkg_dir::AbstractString)
Return package name of package at `pkg_dir`, i.e., `basename(pkg_dir)` excluding any
`.jl` suffix, if present. For example, `foo/bar/Whee.jl` and `foo/bar/Whee` both
return `Whee`.
"""
function pkg_name(pkg_dir::AbstractString)
pkg = basename(pkg_dir)
return endswith(pkg, ".jl") ? pkg[1:end-3] : pkg
end
include(joinpath("plugins", "project_file.jl"))
include(joinpath("plugins", "src_dir.jl"))
include(joinpath("plugins", "tests.jl"))
include(joinpath("plugins", "readme.jl"))
include(joinpath("plugins", "license.jl"))
include(joinpath("plugins", "git.jl"))
include(joinpath("plugins", "tagbot.jl"))
include(joinpath("plugins", "develop.jl"))
include(joinpath("plugins", "coverage.jl"))
include(joinpath("plugins", "codeowners.jl"))
include(joinpath("plugins", "ci.jl"))
include(joinpath("plugins", "compat_helper.jl"))
include(joinpath("plugins", "citation.jl"))
include(joinpath("plugins", "documenter.jl"))
include(joinpath("plugins", "badges.jl"))
include(joinpath("plugins", "register.jl"))
include(joinpath("plugins", "dependabot.jl"))
include(joinpath("plugins", "formatter.jl"))
include(joinpath("plugins", "pkgbenchmark.jl"))
================================================
FILE: src/plugins/badges.jl
================================================
"""
A [`Plugin`](@ref) that only adds a [`Badge`](@ref) to the [`Readme`](@ref) file.
Concrete subtypes only need to implement a [`badges`](@ref) method.
"""
abstract type BadgePlugin <: Plugin end
"""
BlueStyleBadge()
Adds a [`BlueStyle`](https://github.com/invenia/BlueStyle) badge to the [`Readme`](@ref) file.
"""
struct BlueStyleBadge <: BadgePlugin end
function badges(::BlueStyleBadge)
return Badge(
"Code Style: Blue",
"https://img.shields.io/badge/code%20style-blue-4495d1.svg",
"https://github.com/invenia/BlueStyle",
)
end
"""
ColPracBadge()
Adds a [`ColPrac`](https://github.com/SciML/ColPrac) badge to the [`Readme`](@ref) file.
"""
struct ColPracBadge <: BadgePlugin end
function badges(::ColPracBadge)
return Badge(
"ColPrac: Contributor's Guide on Collaborative Practices for Community Packages",
"https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet",
"https://github.com/SciML/ColPrac",
)
end
"""
PkgEvalBadge()
Adds a [`PkgEval` badge](https://github.com/JuliaCI/NanosoldierReports#pkgeval-reports) to the [`Readme`](@ref) file.
"""
struct PkgEvalBadge <: BadgePlugin end
function badges(::PkgEvalBadge)
return Badge(
"PkgEval",
"https://JuliaCI.github.io/NanosoldierReports/pkgeval_badges/{{{PKG1}}}/{{{PKG}}}.svg",
"https://JuliaCI.github.io/NanosoldierReports/pkgeval_badges/{{{PKG1}}}/{{{PKG}}}.html"
)
end
function view(::PkgEvalBadge, t::Template, pkg::AbstractString)
return Dict("PKG1" => first(pkg), "PKG" => pkg)
end
================================================
FILE: src/plugins/ci.jl
================================================
"""
format_version(v::Union{VersionNumber, AbstractString}) -> String
Strip everything but the major and minor release from a `VersionNumber`.
Strings are left in their original form.
"""
format_version(v::VersionNumber) = "$(v.major).$(v.minor)"
format_version(v::AbstractString) = string(v)
const ALLOWED_FAILURES = ["nightly"] # TODO: Update this list with new RCs.
const DEFAULT_CI_VERSIONS = map(format_version, [default_version(), VERSION, "nightly"])
const DEFAULT_CI_VERSIONS_GITHUB = map(format_version, [default_version(), VERSION, "pre"])
const DEFAULT_CI_VERSIONS_NO_PRERELEASE = map(format_version, [default_version(), VERSION])
const EXTRA_VERSIONS_DOC = "- `extra_versions::Vector`: Extra Julia versions to test, as strings or `VersionNumber`s."
"""
GitHubActions(;
file="$(contractuser(default_file("github", "workflows", "CI.yml")))",
destination="CI.yml",
linux=true,
osx=false,
windows=false,
x64=true,
x86=false,
coverage=true,
extra_versions=$DEFAULT_CI_VERSIONS_GITHUB,
)
Integrates your packages with [GitHub Actions](https://github.com/features/actions).
## Keyword Arguments
- `file::AbstractString`: Template file for the workflow file.
- `destination::AbstractString`: Destination of the workflow file,
relative to `.github/workflows`.
- `linux::Bool`: Whether or not to run builds on Linux.
- `osx::Bool`: Whether or not to run builds on OSX (MacOS).
- `windows::Bool`: Whether or not to run builds on Windows.
- `x64::Bool`: Whether or not to run builds on 64-bit architecture.
- `x86::Bool`: Whether or not to run builds on 32-bit architecture.
- `coverage::Bool`: Whether or not to publish code coverage.
Another code coverage plugin such as [`Codecov`](@ref) must also be included.
$EXTRA_VERSIONS_DOC
!!! note
If using coverage plugins, don't forget to manually add your API tokens as secrets,
as described [here](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets#creating-encrypted-secrets).
"""
@plugin struct GitHubActions <: FilePlugin
file::String = default_file("github", "workflows", "CI.yml")
destination::String = "CI.yml"
linux::Bool = true
osx::Bool = false
windows::Bool = false
x64::Bool = true
x86::Bool = false
coverage::Bool = true
extra_versions::Vector = DEFAULT_CI_VERSIONS_GITHUB
end
source(p::GitHubActions) = p.file
destination(p::GitHubActions) = joinpath(".github", "workflows", p.destination)
tags(::GitHubActions) = "<<", ">>"
badges(p::GitHubActions) = Badge(
"Build Status",
"https://github.com/{{{USER}}}/{{{PKG}}}.jl/actions/workflows/$(p.destination)/badge.svg?branch={{{BRANCH}}}",
"https://github.com/{{{USER}}}/{{{PKG}}}.jl/actions/workflows/$(p.destination)?query=branch%3A{{{BRANCH}}}",
)
function view(p::GitHubActions, t::Template, pkg::AbstractString)
os = String[]
p.linux && push!(os, "ubuntu-latest")
p.osx && push!(os, "macOS-latest")
p.windows && push!(os, "windows-latest")
arch = filter(a -> getfield(p, Symbol(a)), ["x64", "x86"])
excludes = Dict{String, String}[]
p.osx && p.x86 && push!(excludes, Dict("E_OS" => "macOS-latest", "E_ARCH" => "x86"))
v = Dict(
"ARCH" => arch,
"EXCLUDES" => excludes,
"HAS_CODECOV" => p.coverage && hasplugin(t, Codecov),
"HAS_COVERALLS" => p.coverage && hasplugin(t, Coveralls),
"HAS_DOCUMENTER" => hasplugin(t, Documenter{GitHubActions}),
"HAS_EXCLUDES" => !isempty(excludes),
"HAS_RUNIC" => hasplugin(t, Runic{GitHubActions}),
"OS" => os,
"PKG" => pkg,
"USER" => t.user,
"VERSIONS" => collect_versions(t, p.extra_versions),
)
p = getplugin(t, Git)
if p !== nothing
v["BRANCH"] = p.branch
end
return v
end
"""
TravisCI(;
file="$(contractuser(default_file("travis.yml")))",
linux=true,
osx=false,
windows=false,
x64=true,
x86=false,
arm64=false,
coverage=true,
extra_versions=$DEFAULT_CI_VERSIONS,
)
Integrates your packages with [Travis CI](https://travis-ci.com).
## Keyword Arguments
- `file::AbstractString`: Template file for `.travis.yml`.
- `linux::Bool`: Whether or not to run builds on Linux.
- `osx::Bool`: Whether or not to run builds on OSX (MacOS).
- `windows::Bool`: Whether or not to run builds on Windows.
- `x64::Bool`: Whether or not to run builds on 64-bit architecture.
- `x86::Bool`: Whether or not to run builds on 32-bit architecture.
- `arm64::Bool`: Whether or not to run builds on the ARM64 architecture.
- `coverage::Bool`: Whether or not to publish code coverage.
Another code coverage plugin such as [`Codecov`](@ref) must also be included.
$EXTRA_VERSIONS_DOC
"""
@plugin struct TravisCI <: FilePlugin
file::String = default_file("travis.yml")
linux::Bool = true
osx::Bool = false
windows::Bool = false
x64::Bool = true
x86::Bool = false
arm64::Bool = false
coverage::Bool = true
extra_versions::Vector = DEFAULT_CI_VERSIONS
end
source(p::TravisCI) = p.file
destination(::TravisCI) = ".travis.yml"
badges(::TravisCI) = Badge(
"Build Status",
"https://app.travis-ci.com/{{{USER}}}/{{{PKG}}}.jl.svg?branch={{{BRANCH}}}",
"https://app.travis-ci.com/{{{USER}}}/{{{PKG}}}.jl",
)
function view(p::TravisCI, t::Template, pkg::AbstractString)
os = filter(o -> getfield(p, Symbol(o)), ["linux", "osx", "windows"])
arch = filter(a -> getfield(p, Symbol(a)), ["x64", "x86", "arm64"])
versions = collect_versions(t, p.extra_versions)
allow_failures = filter(in(versions), ALLOWED_FAILURES)
excludes = Dict{String, String}[]
p.x86 && p.osx && push!(excludes, Dict("E_OS" => "osx", "E_ARCH" => "x86"))
if p.arm64
p.osx && push!(excludes, Dict("E_OS" => "osx", "E_ARCH" => "arm64"))
p.windows && push!(excludes, Dict("E_OS" => "windows", "E_ARCH" => "arm64"))
"pre" in versions && push!(excludes, Dict("E_JULIA" => "pre", "E_ARCH" => "arm64"))
end
return Dict(
"ALLOW_FAILURES" => allow_failures,
"ARCH" => arch,
"BRANCH" => something(default_branch(t), DEFAULT_DEFAULT_BRANCH),
"EXCLUDES" => excludes,
"HAS_ALLOW_FAILURES" => !isempty(allow_failures),
"HAS_CODECOV" => hasplugin(t, Codecov),
"HAS_COVERAGE" => p.coverage && hasplugin(t, is_coverage),
"HAS_COVERALLS" => hasplugin(t, Coveralls),
"HAS_DOCUMENTER" => hasplugin(t, Documenter{TravisCI}),
"HAS_EXCLUDES" => !isempty(excludes),
"OS" => os,
"PKG" => pkg,
"USER" => t.user,
"VERSION" => format_version(t.julia),
"VERSIONS" => versions,
)
end
"""
AppVeyor(;
file="$(contractuser(default_file("appveyor.yml")))",
x86=false,
coverage=true,
extra_versions=$DEFAULT_CI_VERSIONS,
)
Integrates your packages with [AppVeyor](https://appveyor.com)
via [AppVeyor.jl](https://github.com/JuliaCI/Appveyor.jl).
## Keyword Arguments
- `file::AbstractString`: Template file for `.appveyor.yml`.
- `x86::Bool`: Whether or not to run builds on 32-bit systems,
in addition to the default 64-bit builds.
- `coverage::Bool`: Whether or not to publish code coverage.
[`Codecov`](@ref) must also be included.
$EXTRA_VERSIONS_DOC
"""
@plugin struct AppVeyor <: FilePlugin
file::String = default_file("appveyor.yml")
x86::Bool = false
coverage::Bool = true
extra_versions::Vector = DEFAULT_CI_VERSIONS
end
source(p::AppVeyor) = p.file
destination(::AppVeyor) = ".appveyor.yml"
badges(::AppVeyor) = Badge(
"Build Status",
"https://ci.appveyor.com/api/projects/status/github/{{{USER}}}/{{{PKG}}}.jl?svg=true",
"https://ci.appveyor.com/project/{{{USER}}}/{{{PKG}}}-jl",
)
function view(p::AppVeyor, t::Template, pkg::AbstractString)
platforms = ["x64"]
p.x86 && push!(platforms, "x86")
versions = collect_versions(t, p.extra_versions)
allow_failures = filter(in(versions), ALLOWED_FAILURES)
return Dict(
"ALLOW_FAILURES" => allow_failures,
"BRANCH" => something(default_branch(t), DEFAULT_DEFAULT_BRANCH),
"HAS_ALLOW_FAILURES" => !isempty(allow_failures),
"HAS_CODECOV" => p.coverage && hasplugin(t, Codecov),
"PKG" => pkg,
"PLATFORMS" => platforms,
"USER" => t.user,
"VERSIONS" => versions,
)
end
"""
CirrusCI(;
file="$(contractuser(default_file("cirrus.yml")))",
image="freebsd-12-0-release-amd64",
coverage=true,
extra_versions=$DEFAULT_CI_VERSIONS,
)
Integrates your packages with [Cirrus CI](https://cirrus-ci.org)
via [CirrusCI.jl](https://github.com/ararslan/CirrusCI.jl).
## Keyword Arguments
- `file::AbstractString`: Template file for `.cirrus.yml`.
- `image::AbstractString`: The FreeBSD image to be used.
- `coverage::Bool`: Whether or not to publish code coverage.
[`Codecov`](@ref) must also be included.
$EXTRA_VERSIONS_DOC
!!! note
Code coverage submission from Cirrus CI is not yet supported by
[Coverage.jl](https://github.com/JuliaCI/Coverage.jl).
"""
@plugin struct CirrusCI <: FilePlugin
file::String = default_file("cirrus.yml")
image::String = "freebsd-12-0-release-amd64"
coverage::Bool = true
extra_versions::Vector = DEFAULT_CI_VERSIONS
end
source(p::CirrusCI) = p.file
destination(::CirrusCI) = ".cirrus.yml"
badges(::CirrusCI) = Badge(
"Build Status",
"https://api.cirrus-ci.com/github/{{{USER}}}/{{{PKG}}}.jl.svg",
"https://cirrus-ci.com/github/{{{USER}}}/{{{PKG}}}.jl",
)
function view(p::CirrusCI, t::Template, pkg::AbstractString)
return Dict(
"HAS_CODECOV" => hasplugin(t, Codecov),
"HAS_COVERALLS" => hasplugin(t, Coveralls),
"HAS_COVERAGE" => p.coverage && hasplugin(t, is_coverage),
"IMAGE" => p.image,
"PKG" => pkg,
"USER" => t.user,
"VERSIONS" => collect_versions(t, p.extra_versions),
)
end
"""
GitLabCI(;
file="$(contractuser(default_file("gitlab-ci.yml")))",
coverage=true,
extra_versions=$DEFAULT_CI_VERSIONS_NO_PRERELEASE,
)
Integrates your packages with [GitLab CI](https://docs.gitlab.com/ce/ci).
## Keyword Arguments
- `file::AbstractString`: Template file for `.gitlab-ci.yml`.
- `coverage::Bool`: Whether or not to compute code coverage.
$EXTRA_VERSIONS_DOC
## GitLab Pages
Documentation can be generated by including a `Documenter{GitLabCI}` plugin.
See [`Documenter`](@ref) for more information.
!!! note
Nightly Julia is not supported.
"""
@plugin struct GitLabCI <: FilePlugin
file::String = default_file("gitlab-ci.yml")
coverage::Bool = true
# Nightly has no Docker image.
extra_versions::Vector = DEFAULT_CI_VERSIONS_NO_PRERELEASE
end
gitignore(p::GitLabCI) = p.coverage ? COVERAGE_GITIGNORE : String[]
source(p::GitLabCI) = p.file
destination(::GitLabCI) = ".gitlab-ci.yml"
function badges(p::GitLabCI)
ci = Badge(
"Build Status",
"https://{{{HOST}}}/{{{USER}}}/{{{PKG}}}.jl/badges/{{{BRANCH}}}/pipeline.svg",
"https://{{{HOST}}}/{{{USER}}}/{{{PKG}}}.jl/pipelines",
)
cov = Badge(
"Coverage",
"https://{{{HOST}}}/{{{USER}}}/{{{PKG}}}.jl/badges/{{{BRANCH}}}/coverage.svg",
"https://{{{HOST}}}/{{{USER}}}/{{{PKG}}}.jl/commits/{{{BRANCH}}}",
)
return p.coverage ? [ci, cov] : [ci]
end
function view(p::GitLabCI, t::Template, pkg::AbstractString)
return Dict(
"BRANCH" => something(default_branch(t), DEFAULT_DEFAULT_BRANCH),
"HAS_COVERAGE" => p.coverage,
"HAS_DOCUMENTER" => hasplugin(t, Documenter{GitLabCI}),
"HOST" => t.host,
"PKG" => pkg,
"USER" => t.user,
"VERSION" => format_version(t.julia),
"VERSIONS" => collect_versions(t, p.extra_versions),
)
end
"""
DroneCI(;
file="$(contractuser(default_file("drone.star")))",
amd64=true,
arm=false,
arm64=false,
extra_versions=$DEFAULT_CI_VERSIONS_NO_PRERELEASE,
)
Integrates your packages with [Drone CI](https://drone.io).
## Keyword Arguments
- `file::AbstractString`: Template file for `.drone.star`.
- `destination::AbstractString`: File destination, relative to the repository root.
For example, you might want to generate a `.drone.yml` instead of the default Starlark file.
- `amd64::Bool`: Whether or not to run builds on AMD64.
- `arm::Bool`: Whether or not to run builds on ARM (32-bit).
- `arm64::Bool`: Whether or not to run builds on ARM64.
$EXTRA_VERSIONS_DOC
!!! note
Nightly Julia is not supported.
"""
@plugin struct DroneCI <: FilePlugin
file::String = default_file("drone.star")
destination::String = ".drone.star"
amd64::Bool = true
arm::Bool = false
arm64::Bool = false
extra_versions::Vector = DEFAULT_CI_VERSIONS_NO_PRERELEASE
end
source(p::DroneCI) = p.file
destination(p::DroneCI) = p.destination
badges(::DroneCI) = Badge(
"Build Status",
"https://cloud.drone.io/api/badges/{{{USER}}}/{{{PKG}}}.jl/status.svg",
"https://cloud.drone.io/{{{USER}}}/{{{PKG}}}.jl",
)
function view(p::DroneCI, t::Template, pkg::AbstractString)
arches = String[]
p.amd64 && push!(arches, "amd64")
p.arm && push!(arches, "arm")
p.arm64 && push!(arches, "arm64")
return Dict(
"ARCHES" => join(map(repr, arches), ", "),
"PKG" => pkg,
"USER" => t.user,
"VERSIONS" => join(map(repr, collect_versions(t, p.extra_versions)), ", "),
)
end
"""
collect_versions(t::Template, versions::Vector) -> Vector{String}
Combine `t`'s Julia version with `versions`, and format them as `major.minor`.
This is useful for creating lists of versions to be included in CI configurations.
"""
function collect_versions(t::Template, versions::Vector)
custom = map(v -> v isa VersionNumber ? format_version(v) : string(v), versions)
vs = map(v -> lstrip(v, 'v'), [format_version(t.julia); custom])
filter!(vs) do v
# Throw away any versions lower than the template's minimum.
# but v1.6 should be accepted as a CI number even when t.julia = v1.6.7
try
Base.thisminor(VersionNumber(v)) >= Base.thisminor(t.julia)
catch e
e isa ArgumentError || rethrow()
true
end
end
return sort(unique(vs))
end
const AllCI = Union{AppVeyor, GitHubActions, TravisCI, CirrusCI, GitLabCI, DroneCI}
"""
is_ci(::Plugin) -> Bool
Determine whether or not a plugin is a CI plugin.
If you are adding a CI plugin, you should implement this function and return `true`.
"""
is_ci(::Plugin) = false
is_ci(::AllCI) = true
needs_username(::AllCI) = true
customizable(::Type{<:AllCI}) = (:extra_versions => Vector{String},)
================================================
FILE: src/plugins/citation.jl
================================================
"""
Citation(; file="$(contractuser(default_file("CITATION.bib")))", readme=false)
Creates a `CITATION.bib` file for citing package repositories.
## Keyword Arguments
- `file::AbstractString`: Template file for `CITATION.bib`.
- `readme::Bool`: Whether or not to include a section about citing in the README.
"""
@plugin struct Citation <: FilePlugin
file::String = default_file("CITATION.bib")
readme::Bool = false
end
tags(::Citation) = "<<", ">>"
source(p::Citation) = p.file
destination(::Citation) = "CITATION.bib"
view(::Citation, t::Template, pkg::AbstractString) = Dict(
"AUTHORS" => join(t.authors, ", "),
"MONTH" => month(today()),
"PKG" => pkg,
"URL" => "https://$(t.host)/$(t.user)/$pkg.jl",
"VERSION" => "v$(first([p for p in t.plugins if p isa ProjectFile]).version)",
"YEAR" => year(today()),
)
needs_username(::Citation) = true
================================================
FILE: src/plugins/codeowners.jl
================================================
"""
CodeOwners <: Plugin
CodeOwners(; owners)
A plugin which created GitLab/GitHub compatible CODEOWNERS files.
owners should be a vector of patterns mapped to a vector of owner names.
For example:
`owners=["*"=>["@invenia"], "README.md"=>["@documentation","@oxinabox]]`
assigns general ownership over all files to the invenia group,
but assigns ownership of the readme to the documentation group and to the user oxinabox.
By default, it creates an empty CODEOWNERS file.
"""
@plugin struct CodeOwners <: Plugin
owners::Vector{Pair{String,Vector{String}}} = Vector{Pair{String,Vector{String}}}()
end
PkgTemplates.destination(::CodeOwners) = "CODEOWNERS"
function render_plugin(p::CodeOwners)
join((pattern * " " * join(subowners, " ") for (pattern, subowners) in p.owners), "\n")
end
function PkgTemplates.hook(p::CodeOwners, ::Template, pkg_dir::AbstractString)
path = joinpath(pkg_dir, destination(p))
text = render_plugin(p)
PkgTemplates.gen_file(path, text)
end
function PkgTemplates.validate(p::CodeOwners, ::Template)
for (pattern, subowners) in p.owners
contains(pattern, r"\s") && throw(ArgumentError(("Pattern ($pattern) must not contain whitespace")))
for subowner in subowners
contains(subowner, r"\s") && throw(ArgumentError("Owner name ($subowner) must not contain whitespace"))
'@' ∈ subowner || throw(ArgumentError("Owner name ($subowner) must be `@user` or `email@domain.com`"))
end
end
end
================================================
FILE: src/plugins/compat_helper.jl
================================================
"""
CompatHelper(;
file="$(contractuser(default_file("github", "workflows", "CompatHelper.yml")))",
destination="CompatHelper.yml",
cron="0 0 * * *",
)
Integrates your packages with [CompatHelper](https://github.com/bcbi/CompatHelper.jl) via GitHub Actions.
!!! note "Deprecated in favor of Dependabot"
As of December 2025, [Dependabot supports Julia](https://github.blog/changelog/2025-12-16-dependabot-version-updates-now-support-julia/)
and is now the recommended approach for keeping package dependencies up to date.
The [`Dependabot`](@ref) plugin is included in the default template plugins.
`CompatHelper` remains available for users who prefer it.
## Keyword Arguments
- `file::AbstractString`: Template file for the workflow file.
- `destination::AbstractString`: Destination of the workflow file,
relative to `.github/workflows`.
- `cron::AbstractString`: Cron expression for the schedule interval.
"""
@plugin struct CompatHelper <: FilePlugin
file::String = default_file("github", "workflows", "CompatHelper.yml")
destination::String = "CompatHelper.yml"
cron::String = "0 0 * * *"
end
source(p::CompatHelper) = p.file
destination(p::CompatHelper) = joinpath(".github", "workflows", p.destination)
tags(::CompatHelper) = "<<", ">>"
view(p::CompatHelper, ::Template, ::AbstractString) = Dict("CRON" => p.cron)
================================================
FILE: src/plugins/coverage.jl
================================================
const COVERAGE_GITIGNORE = ["*.jl.cov", "*.jl.*.cov", "*.jl.mem"]
"""
Codecov(; file=nothing)
Sets up code coverage submission from CI to [Codecov](https://codecov.io).
## Keyword Arguments
- `file::Union{AbstractString, Nothing}`: Template file for `.codecov.yml`,
or `nothing` to create no file.
"""
@plugin struct Codecov <: FilePlugin
file::Union{String, Nothing} = nothing
end
source(p::Codecov) = p.file
destination(::Codecov) = ".codecov.yml"
badges(::Codecov) = Badge(
"Coverage",
"https://codecov.io/gh/{{{USER}}}/{{{PKG}}}.jl/branch/{{{BRANCH}}}/graph/badge.svg",
"https://codecov.io/gh/{{{USER}}}/{{{PKG}}}.jl",
)
"""
Coveralls(; file=nothing)
Sets up code coverage submission from CI to [Coveralls](https://coveralls.io).
## Keyword Arguments
- `file::Union{AbstractString, Nothing}`: Template file for `.coveralls.yml`,
or `nothing` to create no file.
"""
@plugin struct Coveralls <: FilePlugin
file::Union{String, Nothing} = nothing
end
source(p::Coveralls) = p.file
destination(::Coveralls) = ".coveralls.yml"
badges(::Coveralls) = Badge(
"Coverage",
"https://coveralls.io/repos/github/{{{USER}}}/{{{PKG}}}.jl/badge.svg?branch={{{BRANCH}}}",
"https://coveralls.io/github/{{{USER}}}/{{{PKG}}}.jl?branch={{{BRANCH}}}",
)
gitignore(::Union{Codecov, Coveralls}) = COVERAGE_GITIGNORE
view(::Union{Codecov, Coveralls}, t::Template, pkg::AbstractString) = Dict(
"BRANCH" => something(default_branch(t), DEFAULT_DEFAULT_BRANCH),
"PKG" => pkg,
"USER" => t.user,
)
"""
is_coverage(::Plugin) -> Bool
Determine whether or not a plugin is a coverage plugin.
If you are adding a coverage plugin, you should implement this function and return `true`.
"""
is_coverage(::Plugin) = false
is_coverage(::Union{Codecov, Coveralls}) = true
needs_username(::Union{Codecov, Coveralls}) = true
================================================
FILE: src/plugins/dependabot.jl
================================================
"""
Dependabot(; file="$(contractuser(default_file("github", "dependabot.yml")))")
Sets up Dependabot to create PRs whenever GitHub Actions or Julia package dependencies
can be updated. Monitors the root `/`, `/docs`, and `/test` directories for Julia dependencies.
As of December 2025, [Dependabot supports Julia](https://github.blog/changelog/2025-12-16-dependabot-version-updates-now-support-julia/)
and is the recommended approach for keeping package dependencies up to date.
This replaces the functionality previously provided by [`CompatHelper`](@ref).
!!! note "Only for GitHub actions"
Currently, this plugin is configured to setup Dependabot only for the
GitHub actions package ecosystem. For example, it will create PRs whenever
GitHub actions such as `uses: actions/checkout@v5` can be updated to
`uses: actions/checkout@v6`. If you want to configure Dependabot to update
other package ecosystems, please modify the resulting file yourself.
## Keyword Arguments
- `file::AbstractString`: Template file for `dependabot.yml`.
"""
@plugin struct Dependabot <: FilePlugin
file::String = default_file("github", "dependabot.yml")
end
source(p::Dependabot) = p.file
destination(::Dependabot) = joinpath(".github", "dependabot.yml")
================================================
FILE: src/plugins/develop.jl
================================================
"""
Develop()
Adds generated packages to the current environment by `dev`ing them.
See the Pkg documentation
[here](https://julialang.github.io/Pkg.jl/v1/managing-packages/#Developing-packages-1)
for more details.
"""
struct Develop <: Plugin end
function posthook(::Develop, ::Template, pkg_dir::AbstractString)
Pkg.develop(PackageSpec(; path=pkg_dir))
end
================================================
FILE: src/plugins/documenter.jl
================================================
const DOCUMENTER_DEP = PackageSpec(;
name="Documenter",
uuid="e30172f5-a6a5-5a46-863b-614d45cd2de4",
)
struct NoDeploy end
const YesDeploy = Union{TravisCI, GitHubActions, GitLabCI}
const GitHubPagesStyle = Union{TravisCI, GitHubActions}
"""
Logo(; light=nothing, dark=nothing)
Logo information for documentation.
## Keyword Arguments
- `light::AbstractString`: Path to a logo file for the light (default) theme.
- `dark::AbstractString`: Path to a logo file for the dark theme.
"""
@with_kw_noshow struct Logo
light::Union{String, Nothing} = nothing
dark::Union{String, Nothing} = nothing
end
"""
Documenter{T}(;
make_jl="$(contractuser(default_file("docs", "make.jlt")))",
index_md="$(contractuser(default_file("docs", "src", "index.md")))",
assets=String[],
logo=Logo(),
canonical_url=make_canonical(T),
devbranch=nothing,
edit_link=:devbranch,
makedocs_kwargs=Dict{Symbol,Any}(),
)
Sets up documentation generation via [Documenter.jl](https://github.com/JuliaDocs/Documenter.jl).
Documentation deployment depends on `T`, where `T` is some supported CI plugin,
or `Nothing` to only support local documentation builds.
!!! note
If you are deploying documentation with GitHub Actions or Travis CI, don't forget to complete
[the required configuration](https://documenter.juliadocs.org/stable/man/hosting/#Hosting-Documentation).
In particular, you may need to run
```julia
using DocumenterTools; DocumenterTools.genkeys(user="MyUser", repo="MyPackage.jl")
```
and follow the instructions there.
## Supported Type Parameters
- `GitHubActions`: Deploys documentation to [GitHub Pages](https://pages.github.com)
with the help of [`GitHubActions`](@ref).
- `TravisCI`: Deploys documentation to [GitHub Pages](https://pages.github.com)
with the help of [`TravisCI`](@ref).
- `GitLabCI`: Deploys documentation to [GitLab Pages](https://pages.gitlab.com)
with the help of [`GitLabCI`](@ref).
- `NoDeploy` (default): Does not set up documentation deployment.
## Keyword Arguments
- `make_jl::AbstractString`: Template file for `make.jl`.
- `index_md::AbstractString`: Template file for `index.md`.
- `assets::Vector{<:AbstractString}`: Extra assets for the generated site.
- `logo::Logo`: A [`Logo`](@ref) containing documentation logo information.
- `canonical_url::Union{Function, Nothing}`: A function to generate the site's canonical URL.
The default value will compute GitHub Pages and GitLab Pages URLs
for [`TravisCI`](@ref) and [`GitLabCI`](@ref), respectively.
If set to `nothing`, no canonical URL is set.
- `edit_link::Union{AbstractString, Symbol, Nothing}`: Branch, tag or commit that the
"Edit on…" link will point to. Defaults to the branch identified by `devbranch`.
If `edit_link=:commit`, then the link will point to the latest commit when docs are built.
If `edit_link=nothing`, then the "Edit on…" link will be hidden altogether.
- `devbranch::Union{AbstractString, Nothing}`: Branch that will trigger docs deployment.
If `nothing`, then the default branch according to the `Template` will be used.
- `makedocs_kwargs::Dict{Symbol,Any}`: Extra keyword arguments to be inserted into `makedocs`.
"""
struct Documenter{T} <: Plugin
assets::Vector{String}
logo::Logo
makedocs_kwargs::Dict{Symbol}
canonical_url::Union{Function, Nothing}
make_jl::String
index_md::String
devbranch::Union{String, Nothing}
edit_link::Union{String, Symbol, Nothing}
end
# Can't use @plugin because we're implementing our own no-arguments constructor.
function Documenter{T}(;
assets::Vector{<:AbstractString}=String[],
logo::Logo=Logo(),
makedocs_kwargs::Dict{Symbol}=Dict{Symbol, Any}(),
canonical_url::Union{Function, Nothing}=make_canonical(T),
make_jl::AbstractString=default_file("docs", "make.jlt"),
index_md::AbstractString=default_file("docs", "src", "index.md"),
devbranch::Union{AbstractString, Nothing}=nothing,
edit_link::Union{AbstractString, Symbol, Nothing}=:devbranch,
) where {T}
return Documenter{T}(
assets,
logo,
makedocs_kwargs,
canonical_url,
make_jl,
index_md,
devbranch,
edit_link,
)
end
Documenter(; kwargs...) = Documenter{NoDeploy}(; kwargs...)
# We have to define these manually because we didn't use @plugin.
defaultkw(::Type{<:Documenter}, ::Val{:assets}) = String[]
defaultkw(::Type{<:Documenter}, ::Val{:logo}) = Logo()
defaultkw(::Type{<:Documenter}, ::Val{:make_jl}) = default_file("docs", "make.jlt")
defaultkw(::Type{<:Documenter}, ::Val{:index_md}) = default_file("docs", "src", "index.md")
defaultkw(::Type{<:Documenter}, ::Val{:devbranch}) = nothing
defaultkw(::Type{<:Documenter}, ::Val{:edit_link}) = :devbranch
gitignore(::Documenter) = ["/docs/build/", "/docs/Manifest*.toml"]
priority(::Documenter, ::Function) = DEFAULT_PRIORITY - 1 # We need SrcDir to go first.
badges(::Documenter) = Badge[]
badges(::Documenter{<:GitHubPagesStyle}) = [
Badge(
"Stable",
"https://img.shields.io/badge/docs-stable-blue.svg",
"https://{{{USER}}}.github.io/{{{PKG}}}.jl/stable/",
),
Badge(
"Dev",
"https://img.shields.io/badge/docs-dev-blue.svg",
"https://{{{USER}}}.github.io/{{{PKG}}}.jl/dev/",
),
]
badges(::Documenter{GitLabCI}) = Badge(
"Dev",
"https://img.shields.io/badge/docs-dev-blue.svg",
# TODO: Support custom domain here.
"https://{{{USER}}}.gitlab.io/{{{PKG}}}.jl/dev",
)
function view(p::Documenter, t::Template, pkg::AbstractString)
devbranch = p.devbranch === nothing ? default_branch(t) : p.devbranch
return Dict(
"ASSETS" => map(basename, p.assets),
"AUTHORS" => join(t.authors, ", "),
"CANONICAL" => p.canonical_url === nothing ? nothing : p.canonical_url(t, pkg),
"HAS_ASSETS" => !isempty(p.assets),
"MAKEDOCS_KWARGS" => map(((k, v),) -> k => repr(v), sort(collect(p.makedocs_kwargs), by=first)),
"PKG" => pkg,
"REPO" => "$(t.host)/$(t.user)/$pkg.jl",
"USER" => t.user,
"BRANCH" => devbranch,
"EDIT_LINK" => p.edit_link == :devbranch ? _quoted(devbranch) : _quoted(p.edit_link),
)
end
# So both Symbol and Strings get interpolated correctly into `{{{s}}}`.
_quoted(s::AbstractString) = string('"', s, '"')
_quoted(s::Symbol) = repr(s)
function view(p::Documenter{<:GitHubPagesStyle}, t::Template, pkg::AbstractString)
base = invoke(view, Tuple{Documenter, Template, AbstractString}, p, t, pkg)
return merge(base, Dict("HAS_DEPLOY" => true))
end
function validate(p::Documenter, ::Template)
foreach(p.assets) do a
isfile(a) || throw(ArgumentError("Asset file $a does not exist"))
end
foreach((:light, :dark)) do k
logo = getfield(p.logo, k)
if logo !== nothing && !isfile(logo)
throw(ArgumentError("Logo file $logo does not exist"))
end
end
end
function validate(p::Documenter{T}, t::Template) where T <: YesDeploy
invoke(validate, Tuple{Documenter, Template}, p, t)
if !hasplugin(t, T)
name = nameof(T)
s = "Documenter: The $name plugin must be included for docs deployment to be set up"
throw(ArgumentError(s))
end
end
function hook(p::Documenter, t::Template, pkg_dir::AbstractString)
pkg = pkg_name(pkg_dir)
docs_dir = joinpath(pkg_dir, "docs")
# Generate files.
make = render_file(p.make_jl, combined_view(p, t, pkg), tags(p))
index = render_file(p.index_md, combined_view(p, t, pkg), tags(p))
gen_file(joinpath(docs_dir, "make.jl"), make)
gen_file(joinpath(docs_dir, "src", "index.md"), index)
# Copy over any assets.
assets_dir = joinpath(docs_dir, "src", "assets")
mkpath(assets_dir)
foreach(a -> cp(a, joinpath(assets_dir, basename(a))), p.assets)
foreach((:light => "logo", :dark => "logo-dark")) do (k, f)
logo = getfield(p.logo, k)
if logo !== nothing
_, ext = splitext(logo)
cp(logo, joinpath(assets_dir, "$f$ext"))
end
end
isempty(readdir(assets_dir)) && rm(assets_dir)
# Create the documentation project.
with_project(docs_dir) do
Pkg.add(DOCUMENTER_DEP)
cd(() -> Pkg.develop(PackageSpec(; path="..")), docs_dir)
end
end
github_pages_url(t::Template, pkg::AbstractString) = "https://$(t.user).github.io/$pkg.jl"
gitlab_pages_url(t::Template, pkg::AbstractString) = "https://$(t.user).gitlab.io/$pkg.jl"
make_canonical(::Type{<:GitHubPagesStyle}) = github_pages_url
make_canonical(::Type{GitLabCI}) = gitlab_pages_url
make_canonical(::Type{NoDeploy}) = nothing
needs_username(::Documenter) = true
function customizable(::Type{<:Documenter})
return (:canonical_url => NotCustomizable, :makedocs_kwargs => NotCustomizable)
end
function interactive(::Type{Documenter})
styles = [NoDeploy, TravisCI, GitLabCI, GitHubActions]
menu = RadioMenu(map(string, styles); pagesize=length(styles))
println("Documenter deploy style:")
idx = request(menu)
return interactive(Documenter{styles[idx]})
end
function prompt(::Type{<:Documenter}, ::Type{Logo}, ::Val{:logo})
light = Base.prompt("Enter value for 'logo.light' (default: nothing)")
dark = Base.prompt("Enter value for 'logo.dark' (default: nothing)")
return Logo(; light=light, dark=dark)
end
================================================
FILE: src/plugins/formatter.jl
================================================
"""
Formatter(;
file="$(contractuser(default_file(".JuliaFormatter.toml")))",
style="nostyle"
)
Create a `.JuliaFormatter.toml` file, used by [JuliaFormatter.jl](https://github.com/domluna/JuliaFormatter.jl) and the Julia VSCode extension to configure automatic code formatting.
This file can be entirely customized by the user, see the [JuliaFormatter.jl docs](https://domluna.github.io/JuliaFormatter.jl/stable/).
## Keyword Arguments
- `file::String`: Template file for `.JuliaFormatter.toml`.
- `style::String`: Style name, defaults to `"nostyle"` for an empty style but can also be one of `("sciml", "blue", "yas")` for a fully preconfigured style.
"""
@plugin struct Formatter <: FilePlugin
file::String = default_file(".JuliaFormatter.toml")
style::String = "nostyle"
end
function validate(p::Formatter, t::Template)
if p.style ∉ ("nostyle", "blue", "sciml", "yas")
throw(ArgumentError("""JuliaFormatter style must be either "nostyle", "blue", "sciml" or "yas"."""))
end
end
source(p::Formatter) = p.file
destination(::Formatter) = ".JuliaFormatter.toml"
function view(p::Formatter, t::Template, pkg::AbstractString)
d = Dict{String,String}()
if p.style == "nostyle"
d["STYLE"] = ""
else
d["STYLE"] = """style = \"$(p.style)\""""
end
return d
end
function prompt(::Type{Formatter}, ::Type{String}, ::Val{:style})
options = ["nostyle", "blue", "sciml", "yas"]
menu = RadioMenu(options; pagesize=length(options))
println("Select a JuliaFormatter style:")
idx = request(menu)
return options[idx]
end
struct Runic{T} <: Plugin end
Runic() = Runic{GitHubActions}()
function validate(::Runic{T}, t::Template) where {T}
if T === GitHubActions
hasplugin(t, T) || throw(ArgumentError("Runic: The GitHubActions plugin must be included"))
else
throw(ArgumentError("Runic: Only GitHubActions is supported at the moment"))
end
end
================================================
FILE: src/plugins/git.jl
================================================
const DEFAULT_DEFAULT_BRANCH = "main"
"""
Git(;
ignore=String[],
name=nothing,
email=nothing,
branch=LibGit2.getconfig("init.defaultBranch", "$DEFAULT_DEFAULT_BRANCH")
ssh=false,
jl=true,
manifest=false,
gpgsign=false,
)
Creates a Git repository and a `.gitignore` file.
## Keyword Arguments
- `ignore::Vector{<:AbstractString}`: Patterns to add to the `.gitignore`.
See also: [`gitignore`](@ref).
- `name::AbstractString`: Your real name, if you have not set `user.name` with Git.
- `email::AbstractString`: Your email address, if you have not set `user.email` with Git.
- `branch::AbstractString`: The desired name of the repository's default branch.
- `ssh::Bool`: Whether or not to use SSH for the remote.
If left unset, HTTPS is used.
- `jl::Bool`: Whether or not to add a `.jl` suffix to the remote URL.
- `manifest::Bool`: Whether or not to commit `Manifest.toml`.
- `gpgsign::Bool`: Whether or not to sign commits with your GPG key.
This option requires that the Git CLI is installed,
and for you to have a GPG key associated with your committer identity.
"""
@plugin struct Git <: Plugin
ignore::Vector{String} = String[]
name::Union{String, Nothing} = nothing
email::Union{String, Nothing} = nothing
branch::String = @mock(LibGit2.getconfig("init.defaultBranch", DEFAULT_DEFAULT_BRANCH))
ssh::Bool = false
jl::Bool = true
manifest::Bool = false
gpgsign::Bool = false
end
# Try to make sure that no files are created after we commit.
priority(::Git, ::typeof(posthook)) = 5
gitignore(p::Git) = p.ignore
function validate(p::Git, t::Template)
if p.gpgsign && !git_is_installed()
throw(ArgumentError("Git: gpgsign is set but the Git CLI is not installed"))
end
foreach((:name, :email)) do k
user_k = "user.$k"
if getproperty(p, k) === nothing && isempty(@mock LibGit2.getconfig(user_k, ""))
throw(ArgumentError("Git: Global Git config is missing required value '$user_k'"))
end
end
end
# Set up the Git repository.
function prehook(p::Git, t::Template, pkg_dir::AbstractString)
LibGit2.with(@mock LibGit2.init(pkg_dir)) do repo
LibGit2.with(GitConfig(repo)) do config
foreach((:name, :email)) do k
v = getproperty(p, k)
v === nothing || LibGit2.set!(config, "user.$k", v)
end
end
commit(p, repo, pkg_dir, "Initial commit")
pkg = pkg_name(pkg_dir)
suffix = p.jl ? ".jl" : ""
url = if p.ssh
"git@$(t.host):$(t.user)/$pkg$suffix.git"
else
"https://$(t.host)/$(t.user)/$pkg$suffix"
end
default = LibGit2.branch(repo)
branch = something(p.branch, default)
if branch != default
LibGit2.branch!(repo, branch)
delete_branch(GitReference(repo, "refs/heads/$default"))
end
close(GitRemote(repo, "origin", url))
end
end
# Create the .gitignore.
function hook(p::Git, t::Template, pkg_dir::AbstractString)
ignore = mapreduce(gitignore, vcat, t.plugins)
# Only ignore manifests at the repo root.
p.manifest || "Manifest.toml" in ignore || push!(ignore, "/Manifest*.toml")
unique!(sort!(ignore))
gen_file(joinpath(pkg_dir, ".gitignore"), join(ignore, "\n"))
end
# Commit the files.
function posthook(p::Git, ::Template, pkg_dir::AbstractString)
# Special case for issue 211.
if Sys.iswindows()
files = filter(f -> startswith(f, "_git2_"), readdir(pkg_dir))
foreach(f -> rm(joinpath(pkg_dir, f)), files)
end
# Ensure that the manifest exists if it's going to be committed.
manifest = joinpath(pkg_dir, "Manifest.toml")
if p.manifest && !isfile(manifest)
with_project(Pkg.update, pkg_dir)
end
LibGit2.with(GitRepo(pkg_dir)) do repo
LibGit2.add!(repo, ".")
msg = "Files generated by PkgTemplates"
v = @mock version_of("PkgTemplates")
v === nothing || (msg *= "\n\nPkgTemplates version: $v")
# TODO: Put the template config in the message too?
commit(p, repo, pkg_dir, msg)
end
end
function commit(p::Git, repo::GitRepo, pkg_dir::AbstractString, msg::AbstractString)
if p.gpgsign
run(pipeline(`git -C $pkg_dir commit -S --allow-empty -m $msg`; stdout=devnull))
else
LibGit2.commit(repo, msg)
end
end
needs_username(::Git) = true
function git_is_installed()
return try
run(pipeline(`git --version`; stdout=devnull))
true
catch
false
end
end
if isdefined(Pkg, :dependencies)
function version_of(pkg::AbstractString)
for p in values(Pkg.dependencies())
p.name == pkg && return p.version
end
return nothing
end
else
version_of(pkg::AbstractString) = get(Pkg.installed(), pkg, nothing)
end
================================================
FILE: src/plugins/license.jl
================================================
"""
License(; name="MIT", path=nothing, destination="LICENSE")
Creates a license file.
## Keyword Arguments
- `name::AbstractString`: Name of a license supported by PkgTemplates.
Available licenses can be seen
[here](https://github.com/JuliaCI/PkgTemplates.jl/tree/master/templates/licenses).
- `path::Union{AbstractString, Nothing}`: Path to a custom license file.
This keyword takes priority over `name`.
- `destination::AbstractString`: File destination, relative to the repository root.
For example, `"LICENSE.md"` might be desired.
"""
struct License <: FilePlugin
path::String
destination::String
end
const LICENSE_ALIASES = Dict(
# Legacy names kept for backward compatibility; prefer SPDX identifiers.
"ASL" => "Apache-2.0",
"BSD2" => "BSD-2-Clause",
"BSD3" => "BSD-3-Clause",
"MPL" => "MPL-2.0",
"EUPL-1.2+" => "EUPL-1.2",
"AGPL-3.0+" => "AGPL-3.0-or-later",
"GPL-2.0+" => "GPL-2.0-or-later",
"GPL-3.0+" => "GPL-3.0-or-later",
"LGPL-2.1+" => "LGPL-2.1-or-later",
"LGPL-3.0+" => "LGPL-3.0-or-later",
)
function License(;
name::AbstractString="MIT",
path::Union{AbstractString, Nothing}=nothing,
destination::AbstractString="LICENSE",
)
if path === nothing
if haskey(LICENSE_ALIASES, name)
new = LICENSE_ALIASES[name]
Base.depwarn("License name \"$name\" is deprecated; use \"$new\" instead.", :License)
name = new
end
path = default_file("licenses", name)
isfile(path) || throw(ArgumentError("License '$(basename(path))' is not available"))
end
return License(path, destination)
end
defaultkw(::Type{License}, ::Val{:path}) = nothing
defaultkw(::Type{License}, ::Val{:name}) = "MIT"
defaultkw(::Type{License}, ::Val{:destination}) = "LICENSE"
source(p::License) = p.path
destination(p::License) = p.destination
view(::License, t::Template, ::AbstractString) = Dict(
"AUTHORS" => join(t.authors, ", "),
"YEAR" => year(today()),
)
function prompt(::Type{License}, ::Type, ::Val{:name})
options = readdir(default_file("licenses"))
# Move MIT to the top.
deleteat!(options, findfirst(==("MIT"), options))
pushfirst!(options, "MIT")
menu = RadioMenu(options; pagesize=length(options))
println("Select a license:")
idx = request(menu)
return options[idx]
end
customizable(::Type{License}) = (:name => String,)
================================================
FILE: src/plugins/pkgbenchmark.jl
================================================
"""
PkgBenchmark(; file="$(contractuser(default_file("benchmark", "benchmarks.jlt")))")
Sets up a [PkgBenchmark.jl](https://github.com/JuliaCI/PkgBenchmark.jl) benchmark suite.
To ensure benchmark reproducibility, you will need to manually create an environment in the `benchmark` subfolder (for which the `Manifest.toml` is committed to version control).
In this environment, you should at the very least:
- `pkg> add BenchmarkTools`
- `pkg> dev` your new package.
## Keyword Arguments
- `file::AbstractString`: Template file for `benchmarks.jl`.
"""
@plugin struct PkgBenchmark <: FilePlugin
file::String = default_file("benchmark", "benchmarks.jlt")
end
source(p::PkgBenchmark) = p.file
destination(::PkgBenchmark) = joinpath("benchmark", "benchmarks.jl")
view(::PkgBenchmark, ::Template, pkg::AbstractString) = Dict("PKG" => pkg)
================================================
FILE: src/plugins/project_file.jl
================================================
"""
ProjectFile(; version=v"1.0.0-DEV")
Creates a `Project.toml`.
## Keyword Arguments
- `version::VersionNumber`: The initial version of created packages.
"""
@plugin struct ProjectFile <: Plugin
version::VersionNumber = v"1.0.0-DEV"
end
# Other plugins like Tests will modify this file.
priority(::ProjectFile, ::typeof(hook)) = typemax(Int) - 5
function hook(p::ProjectFile, t::Template, pkg_dir::AbstractString)
toml = Dict(
"name" => pkg_name(pkg_dir),
"uuid" => string(@mock uuid4()),
"authors" => t.authors,
"version" => string(p.version),
"compat" => Dict("julia" => compat_version(t.julia)),
)
write_project(joinpath(pkg_dir, "Project.toml"), toml)
end
# Taken from:
# https://github.com/JuliaLang/Pkg.jl/blob/v1.7.0/src/project.jl#L175-L177
function project_key_order(key::String)
_project_key_order = ["name", "uuid", "keywords", "license", "desc", "deps", "compat"]
return something(findfirst(x -> x == key, _project_key_order), length(_project_key_order) + 1)
end
write_project(path::AbstractString, dict) =
open(io -> write_project(io, dict), path; write = true)
write_project(io::IO, dict) =
TOML.print(io, dict, sorted = true, by = key -> (project_key_order(key), key))
"""
compat_version(v::VersionNumber) -> String
Format a `VersionNumber` to exclude trailing zero components.
"""
function compat_version(v::VersionNumber)
return if v.patch == 0 && v.minor == 0
"$(v.major)"
elseif v.patch == 0
"$(v.major).$(v.minor)"
else
"$(v.major).$(v.minor).$(v.patch)"
end
end
================================================
FILE: src/plugins/readme.jl
================================================
"""
Readme(;
file="$(contractuser(default_file("README.md")))",
destination="README.md",
inline_badges=false,
)
Creates a `README` file that contains badges for other included plugins.
## Keyword Arguments
- `file::AbstractString`: Template file for the `README`.
- `destination::AbstractString`: File destination, relative to the repository root.
For example, values of `"README"` or `"README.rst"` might be desired.
- `inline_badges::Bool`: Whether or not to put the badges on the same line as the package name.
- `badge_order::Vector{typeof(Plugin)}`: Plugins in the order their badges should appear.
- `badge_off::Vector{typeof(Plugin)}`: Plugins which should not have their badges added.
"""
@plugin struct Readme <: FilePlugin
file::String = default_file("README.md")
destination::String = "README.md"
inline_badges::Bool = false
badge_order::Vector{typeof(Plugin)} = default_badge_order()
badge_off::Vector{typeof(Plugin)} = []
end
source(p::Readme) = p.file
destination(p::Readme) = p.destination
function view(p::Readme, t::Template, pkg::AbstractString)
# Explicitly ordered badges go first.
strings = String[]
done = DataType[]
foreach(p.badge_order) do T
if hasplugin(t, T) && !in(T, p.badge_off)
append!(strings, badges(getplugin(t, T), t, pkg))
push!(done, T)
end
end
# And the rest go after, in no particular order.
foreach(setdiff(map(typeof, t.plugins), done)) do T
if !in(T, p.badge_off)
append!(strings, badges(getplugin(t, T), t, pkg))
end
end
return Dict(
"BADGES" => strings,
"HAS_CITATION" => hasplugin(t, Citation) && getplugin(t, Citation).readme,
"HAS_INLINE_BADGES" => !isempty(strings) && p.inline_badges,
"PKG" => pkg,
)
end
default_badge_order() = [
Documenter{GitHubActions},
Documenter{GitLabCI},
Documenter{TravisCI},
GitHubActions,
GitLabCI,
TravisCI,
AppVeyor,
DroneCI,
CirrusCI,
Codecov,
Coveralls,
subtypes(BadgePlugin)...
]
================================================
FILE: src/plugins/register.jl
================================================
"""
RegisterAction(;
file="$(contractuser(default_file("github", "workflows", "Register.yml")))",
destination="Register.yml",
prompt="Version to register or component to bump",
)
Add a GitHub Actions workflow for registering a package with the General registry via workflow dispatch.
See [here](https://github.com/julia-actions/RegisterAction) for more information.
## Keyword Arguments
- `file::AbstractString`: Template file for the workflow file.
- `destination::AbstractString`: Destination of the workflow file,
relative to `.github/workflows`.
- `prompt::AbstractString`: Prompt for workflow dispatch.
"""
@plugin struct RegisterAction <: FilePlugin
file::String = default_file("github", "workflows", "Register.yml")
destination::String = "Register.yml"
prompt::String = "Version to register or component to bump"
end
source(p::RegisterAction) = p.file
destination(p::RegisterAction) = joinpath(".github", "workflows", p.destination)
tags(::RegisterAction) = "<<", ">>"
view(p::RegisterAction, ::Template, ::AbstractString) = Dict("PROMPT" => p.prompt)
================================================
FILE: src/plugins/src_dir.jl
================================================
"""
SrcDir(; file="$(contractuser(default_file("src", "module.jlt")))")
Creates a module entrypoint.
## Keyword Arguments
- `file::AbstractString`: Template file for `src/<module>.jl`.
"""
@plugin mutable struct SrcDir <: FilePlugin
file::String = default_file("src", "module.jlt")
destination::String = ""
end
Base.:(==)(a::SrcDir, b::SrcDir) = a.file == b.file
# Don't display the destination field.
function Base.show(io::IO, ::MIME"text/plain", p::SrcDir)
indent = get(io, :indent, 0)
print(io, repeat(' ', indent), "SrcDir:")
print(io, "\n", repeat(' ', indent + 2), "file: ", show_field(p.file))
end
source(p::SrcDir) = p.file
destination(p::SrcDir) = p.destination
view(::SrcDir, ::Template, pkg::AbstractString) = Dict("PKG" => pkg)
# Update the destination now that we know the package name.
# Kind of hacky, but oh well.
function prehook(p::SrcDir, ::Template, pkg_dir::AbstractString)
p.destination = joinpath("src", pkg_name(pkg_dir) * ".jl")
end
================================================
FILE: src/plugins/tagbot.jl
================================================
"""
TagBot(;
file="$(contractuser(default_file("github", "workflows", "TagBot.yml")))",
destination="TagBot.yml",
trigger="JuliaTagBot",
token=Secret("GITHUB_TOKEN"),
ssh=Secret("DOCUMENTER_KEY"),
ssh_password=nothing,
changelog=nothing,
changelog_ignore=nothing,
gpg=nothing,
gpg_password=nothing,
registry=nothing,
branches=nothing,
dispatch=nothing,
dispatch_delay=nothing,
)
Adds GitHub release support via [TagBot](https://github.com/JuliaRegistries/TagBot).
## Keyword Arguments
- `file::AbstractString`: Template file for the workflow file.
- `destination::AbstractString`: Destination of the workflow file, relative to `.github/workflows`.
- `trigger::AbstractString`: Username of the trigger user for custom registries.
- `token::Secret`: Name of the token secret to use.
- `ssh::Secret`: Name of the SSH private key secret to use.
- `ssh_password::Secret`: Name of the SSH key password secret to use.
- `changelog::AbstractString`: Custom changelog template.
- `changelog_ignore::Vector{<:AbstractString}`: Issue/pull request labels to ignore in the changelog.
- `gpg::Secret`: Name of the GPG private key secret to use.
- `gpg_password::Secret`: Name of the GPG private key password secret to use.
- `registry::AbstractString`: Custom registry, in the format `owner/repo`.
- `branches::Bool`: Whether or not to enable the `branches` option.
- `dispatch::Bool`: Whether or not to enable the `dispatch` option.
- `dispatch_delay::Int`: Number of minutes to delay for dispatch events.
"""
@plugin struct TagBot <: FilePlugin
file::String = default_file("github", "workflows", "TagBot.yml")
destination::String = "TagBot.yml"
trigger::String = "JuliaTagBot"
token::Secret = Secret("GITHUB_TOKEN")
ssh::Union{Secret, Nothing} = Secret("DOCUMENTER_KEY")
ssh_password::Union{Secret, Nothing} = nothing
changelog::Union{String, Nothing} = nothing
changelog_ignore::Union{Vector{String}, Nothing} = nothing
gpg::Union{Secret, Nothing} = nothing
gpg_password::Union{Secret, Nothing} = nothing
registry::Union{String, Nothing} = nothing
branches::Union{Bool, Nothing} = nothing
dispatch::Union{Bool, Nothing} = nothing
dispatch_delay::Union{Int, Nothing} = nothing
end
source(p::TagBot) = p.file
destination(p::TagBot) = joinpath(".github", "workflows", p.destination)
function view(p::TagBot, ::Template, ::AbstractString)
changelog = if p.changelog === nothing
nothing
else
# This magic number aligns the text block just right.
lines = map(line -> rstrip(repeat(' ', 12) * line), split(p.changelog, "\n"))
"|\n" * join(lines, "\n")
end
ignore = p.changelog_ignore === nothing ? nothing : join(p.changelog_ignore, ", ")
return Dict(
"BRANCHES" => p.branches === nothing ? nothing : string(p.branches),
"CHANGELOG" => changelog,
"CHANGELOG_IGNORE" => ignore,
"TRIGGER" => p.trigger,
"DISPATCH" => p.dispatch === nothing ? nothing : string(p.dispatch),
"DISPATCH_DELAY" => p.dispatch_delay,
"GPG" => p.gpg,
"GPG_PASSWORD" => p.gpg_password,
"REGISTRY" => p.registry,
"SSH" => p.ssh,
"SSH_PASSWORD" => p.ssh_password,
"TOKEN" => p.token,
)
end
================================================
FILE: src/plugins/tests.jl
================================================
const TEST_UUID = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
const TEST_DEP = PackageSpec(; name="Test", uuid=TEST_UUID)
const AQUA_UUID = "4c88cf16-eb10-579e-8560-4a9242c79595"
const AQUA_DEP = PackageSpec(; name="Aqua", uuid=AQUA_UUID)
const JET_UUID = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
const JET_DEP = PackageSpec(; name="JET", uuid=JET_UUID)
"""
Tests(;
file="$(contractuser(default_file("test", "runtests.jlt")))",
project=false,
aqua=false,
aqua_kwargs=NamedTuple(),
jet=false,
)
Sets up testing for packages.
## Keyword Arguments
- `file::AbstractString`: Template file for `runtests.jl`.
- `project::Bool`: Whether or not to create a new project for tests (`test/Project.toml`).
See [the Pkg docs](https://julialang.github.io/Pkg.jl/v1/creating-packages/#Test-specific-dependencies-in-Julia-1.2-and-above-1)
for more details.
- `aqua::Bool`: Controls whether or not to add quality tests with [Aqua.jl](https://github.com/JuliaTesting/Aqua.jl).
- `aqua_kwargs::NamedTuple`: Which keyword arguments to supply to Aqua tests (many people use `ambiguities=false` for example)
- `jet::Bool`: Controls whether or not to add a linting test with [JET.jl](https://github.com/aviatesk/JET.jl) (works best on type-stable code)
!!! note
Managing test dependencies with `test/Project.toml` is only supported
in Julia 1.2 and later.
"""
@plugin struct Tests <: FilePlugin
file::String = default_file("test", "runtests.jlt")
project::Bool = false
aqua::Bool = false
aqua_kwargs::NamedTuple = NamedTuple()
jet::Bool = false
end
source(p::Tests) = p.file
destination(::Tests) = joinpath("test", "runtests.jl")
function view(p::Tests, ::Template, pkg::AbstractString)
d = Dict("PKG" => pkg)
if p.aqua
if isempty(p.aqua_kwargs)
kwargs_str = ""
else
kwargs_str = "; " * strip(string(p.aqua_kwargs), ['(', ')'])
end
d["AQUA_IMPORT"] = "\nusing Aqua"
d["AQUA_TESTSET"] = """
@testset "Code quality (Aqua.jl)" begin
Aqua.test_all($pkg$kwargs_str)
end
"""
else
d["AQUA_IMPORT"] = ""
d["AQUA_TESTSET"] = ""
end
if p.jet
d["JET_IMPORT"] = "\nusing JET"
d["JET_TESTSET"] = """
@testset "Code linting (JET.jl)" begin
JET.test_package($pkg; target_defined_modules = true)
end
"""
else
d["JET_IMPORT"] = ""
d["JET_TESTSET"] = ""
end
return d
end
function validate(p::Tests, t::Template)
invoke(validate, Tuple{FilePlugin,Template}, p, t)
p.project && t.julia < v"1.2" && @warn string(
"Tests: The project option is set to create a project (supported in Julia 1.2 and later) ",
"but a Julia version older than 1.2 ($(t.julia)) is supported by the template",
)
aqua_kwargs_names = (
:ambiguities,
:unbound_args,
:undefined_exports,
:piracy,
:project_extras,
:stale_deps,
:deps_compat,
:project_toml_formatting,
)
for (key, val) in pairs(p.aqua_kwargs)
if !(val isa Bool)
throw(ArgumentError("Aqua keyword arguments must have boolean values"))
elseif !(key in aqua_kwargs_names)
throw(ArgumentError("Aqua keyword arguments must belong to $aqua_kwargs_names"))
end
end
end
function hook(p::Tests, t::Template, pkg_dir::AbstractString)
# Do the normal FilePlugin behaviour to create the test script.
invoke(hook, Tuple{FilePlugin,Template,AbstractString}, p, t, pkg_dir)
# Then set up the test depdendency in the chosen way.
if p.project
make_test_project(p, pkg_dir)
else
add_test_dependency(p, pkg_dir)
end
end
# Create a new test project.
function make_test_project(p::Tests, pkg_dir::AbstractString)
with_project(() -> Pkg.add(TEST_DEP), joinpath(pkg_dir, "test"))
if p.aqua
with_project(() -> Pkg.add(AQUA_DEP), joinpath(pkg_dir, "test"))
end
if p.jet
with_project(() -> Pkg.add(JET_DEP), joinpath(pkg_dir, "test"))
end
end
# Add Test as a test-only dependency.
function add_test_dependency(p::Tests, pkg_dir::AbstractString)
# Add the dependency manually since there's no programmatic way to add to [extras].
path = joinpath(pkg_dir, "Project.toml")
toml = TOML.parsefile(path)
get!(toml, "extras", Dict())["Test"] = TEST_UUID
if p.aqua
get!(toml, "extras", Dict())["Aqua"] = AQUA_UUID
end
if p.jet
get!(toml, "extras", Dict())["JET"] = JET_UUID
end
targets = String[]
if p.aqua
push!(targets, "Aqua")
end
if p.jet
push!(targets, "JET")
end
push!(targets, "Test")
get!(toml, "targets", Dict())["test"] = targets
write_project(path, toml)
# Generate the manifest by updating the project.
with_project(Pkg.update, pkg_dir)
end
function badges(p::Tests)
bs = Badge[]
if p.aqua
b = Badge(
"Aqua",
"https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg",
"https://github.com/JuliaTesting/Aqua.jl",
)
push!(bs, b)
end
return bs
end
================================================
FILE: src/show.jl
================================================
function Base.show(io::IO, m::MIME"text/plain", t::Template)
println(io, "Template:")
foreach(fieldnames(Template)) do n
n === :plugins || println(io, repeat(' ', 2), n, ": ", show_field(getfield(t, n)))
end
if isempty(t.plugins)
print(io, " plugins: None")
else
print(io, repeat(' ', 2), "plugins:")
foreach(sort(t.plugins; by=string)) do p
println(io)
show(IOContext(io, :indent => 4), m, p)
end
end
end
function Base.show(io::IO, ::MIME"text/plain", p::T) where T <: Plugin
indent = get(io, :indent, 0)
print(io, repeat(' ', indent), nameof(T))
ns = fieldnames(T)
isempty(ns) || print(io, ":")
foreach(ns) do n
println(io)
print(io, repeat(' ', indent + 2), n, ": ", show_field(getfield(p, n)))
end
end
show_field(x) = repr(x)
if Sys.iswindows()
show_field(x::AbstractString) = replace(repr(contractuser(x)), "\\\\" => "\\")
else
show_field(x::AbstractString) = repr(contractuser(x))
end
================================================
FILE: src/template.jl
================================================
default_user() = LibGit2.getconfig("github.user", "")
default_version() = v"1.10.10" # LTS as of June 2025, see https://julialang.org/downloads/#long_term_support_release
default_plugins() = [
ProjectFile(),
SrcDir(),
Git(),
License(),
Readme(),
Tests(),
TagBot(),
GitHubActions(),
Dependabot(),
]
function default_authors()
name = LibGit2.getconfig("user.name", "")
isempty(name) && return "contributors"
email = LibGit2.getconfig("user.email", "")
authors = isempty(email) ? name : "$name <$email>"
return "$authors and contributors"
end
struct MissingUserException{T} <: Exception end
function Base.showerror(io::IO, ::MissingUserException{T}) where T
s = """$(nameof(T)): Git hosting service username is required, set one with keyword `user="<username>"`"""
print(io, s)
end
"""
Template(; kwargs...)
A configuration used to generate packages.
## Keyword Arguments
### User Options
- `user::AbstractString="$(default_user())"`: GitHub (or other code hosting service) username.
The default value comes from the global Git config (`github.user`).
If no value is obtained, many plugins that use this value will not work.
- `authors::Union{AbstractString, Vector{<:AbstractString}}="$(default_authors())"`: Package authors.
Like `user`, it takes its default value from the global Git config
(`user.name` and `user.email`).
### Package Options
- `dir::AbstractString="$(contractuser(Pkg.devdir()))"`: Directory to place packages in.
- `host::AbstractString="github.com"`: URL to the code hosting service where packages will reside.
- `julia::VersionNumber=$(repr(default_version()))`: Minimum allowed Julia version.
### Template Plugins
- `plugins::Vector{<:Plugin}=Plugin[]`: A list of [`Plugin`](@ref)s used by the template.
The default plugins are [`ProjectFile`](@ref), [`SrcDir`](@ref), [`Tests`](@ref),
[`Readme`](@ref), [`License`](@ref), [`Git`](@ref), [`Dependabot`](@ref),
[`TagBot`](@ref) and [`GitHubActions`](@ref).
To disable a default plugin, pass in the negated type: `!PluginType`.
To override a default plugin instead of disabling it, pass in your own instance.
### Interactive Mode
- `interactive::Bool=false`: In addition to specifying the template options with keywords,
you can also build up a template by following a set of prompts.
To create a template interactively, set this keyword to `true`.
See also the similar [`generate`](@ref) function.
---
To create a package from a `Template`, use the following syntax:
```julia
julia> t = Template();
julia> t("PkgName")
```
"""
struct Template
authors::Vector{String}
dir::String
host::String
julia::VersionNumber
plugins::Vector{<:Plugin}
user::String
end
Template(; interactive::Bool=false, kwargs...) = Template(Val(interactive); kwargs...)
Template(::Val{true}; kwargs...) = interactive(Template; kwargs...)
function Template(::Val{false}; kwargs...)
kwargs = Dict(kwargs)
user = @mock getkw!(kwargs, :user)
dir = abspath(expanduser(getkw!(kwargs, :dir)))
host = replace(getkw!(kwargs, :host), r".*://" => "")
julia = getkw!(kwargs, :julia)
authors = getkw!(kwargs, :authors)
authors isa Vector || (authors = map(strip, split(authors, ",")))
plugins = Vector{Any}(collect(getkw!(kwargs, :plugins)))
disabled = map(d -> first(typeof(d).parameters), filter(p -> p isa Disabled, plugins))
filter!(p -> p isa Plugin, plugins)
# Remove a default if the user has specified (or disabled) a plugin of that type.
defaults = filter(default_plugins()) do p
!(typeof(p) in vcat(typeof.(plugins), disabled))
end
append!(plugins, defaults)
plugins = Vector{Plugin}(sort(plugins; by=string))
if isempty(user)
foreach(plugins) do p
needs_username(p) && throw(MissingUserException{typeof(p)}())
end
end
if !isempty(kwargs)
@warn "Unrecognized keywords were supplied, see the documentation for help" kwargs
end
t = Template(authors, dir, host, julia, plugins, user)
foreach(p -> validate(p, t), t.plugins)
return t
end
"""
(::Template)(pkg::AbstractString)
Generate a package named `pkg` from a [`Template`](@ref).
Return the path to the package directory.
"""
function (t::Template)(pkg::AbstractString)
_valid_pkg_name(pkg)
pkg_dir = joinpath(t.dir, pkg)
ispath(pkg_dir) && throw(ArgumentError("$pkg_dir already exists"))
mkpath(pkg_dir)
try
foreach((prehook, hook, posthook)) do h
@info "Running $(nameof(h))s"
foreach(sort(t.plugins; by=p -> priority(p, h), rev=true)) do p
h(p, t, pkg_dir)
end
end
catch
rm(pkg_dir; recursive=true, force=true)
rethrow()
end
@info "New package is at $pkg_dir"
return pkg_dir
end
function _valid_pkg_name(pkg::AbstractString)
if endswith(pkg, ".jl")
pkg = splitext(pkg)[1]
end
if repr(Symbol(pkg)) ≠ ":$(pkg)"
throw(ArgumentError("The package name is invalid"))
end
end
function Base.:(==)(a::Template, b::Template)
return a.authors == b.authors &&
a.dir == b.dir &&
a.host == b.host &&
a.julia == b.julia &&
a.user == b.user &&
all(map(==, a.plugins, b.plugins))
end
# Does the template have a plugin that satisfies some predicate?
hasplugin(t::Template, f::Function) = any(f, t.plugins)
hasplugin(t::Template, ::Type{T}) where T <: Plugin = hasplugin(t, p -> p isa T)
"""
getplugin(t::Template, ::Type{T<:Plugin}) -> Union{T, Nothing}
Get the plugin of type `T` from the template `t`, if it's present.
"""
function getplugin(t::Template, ::Type{T}) where T <: Plugin
i = findfirst(p -> p isa T, t.plugins)
return i === nothing ? nothing : t.plugins[i]
end
# Get a keyword or a default value.
getkw!(kwargs, k) = pop!(kwargs, k, defaultkw(Template, k))
# Default Template keyword values.
defaultkw(::Type{T}, s::Symbol) where T = defaultkw(T, Val(s))
defaultkw(::Type{Template}, ::Val{:authors}) = default_authors()
defaultkw(::Type{Template}, ::Val{:dir}) = contractuser(Pkg.devdir())
defaultkw(::Type{Template}, ::Val{:host}) = "github.com"
defaultkw(::Type{Template}, ::Val{:julia}) = default_version()
defaultkw(::Type{Template}, ::Val{:plugins}) = Plugin[]
defaultkw(::Type{Template}, ::Val{:user}) = default_user()
function interactive(::Type{Template}; kwargs...)
# If the user supplied any keywords themselves, don't prompt for them.
kwargs = Dict{Symbol, Any}(kwargs)
options = [:user, :authors, :dir, :host, :julia, :plugins]
customizable = setdiff(options, keys(kwargs))
# Make sure we don't try to show a menu with < 2 options.
isempty(customizable) && return Template(; kwargs...)
just_one = length(customizable) == 1
just_one && push!(customizable, :none)
try
println("Template keywords to customize:")
opts = map(k -> "$k ($(repr(defaultkw(Template, k))))" , customizable)
menu = MultiSelectMenu(opts; pagesize=length(customizable))
customize = customizable[sort!(collect(request(menu)))]
just_one && last(customizable) in customize && return Template(; kwargs...)
# Prompt for each keyword.
foreach(customize) do k
kwargs[k] = prompt(Template, fieldtype(Template, k), k)
end
while true
try
return Template(; kwargs...)
catch e
e isa MissingUserException || rethrow()
kwargs[:user] = prompt(Template, String, :user)
end
end
catch e
e isa InterruptException || rethrow()
println()
@info "Cancelled"
return nothing
end
end
prompt(::Type{Template}, ::Type, ::Val{:pkg}) = Base.prompt("Package name")
function prompt(::Type{Template}, ::Type, ::Val{:user})
return if isempty(@mock default_user())
input = Base.prompt("Enter value for 'user' (required)")
input === nothing && throw(InterruptException())
return input
else
fallback_prompt(String, :user)
end
end
function prompt(::Type{Template}, ::Type, ::Val{:host})
hosts = ["github.com", "gitlab.com", "bitbucket.org", "Other"]
menu = RadioMenu(hosts; pagesize=length(hosts))
println("Select Git repository hosting service:")
idx = request(menu)
return if idx == lastindex(hosts)
fallback_prompt(String, :host)
else
hosts[idx]
end
end
function prompt(::Type{Template}, ::Type, ::Val{:julia})
versions = map(format_version, VersionNumber.(1, 0:VERSION.minor))
push!(versions, "Other")
menu = RadioMenu(map(string, versions); pagesize=length(versions))
println("Select minimum Julia version:")
idx = request(menu)
return if idx == lastindex(versions)
fallback_prompt(VersionNumber, :julia)
else
VersionNumber(versions[idx])
end
end
const CR = "\r"
const DOWN = "\eOB"
function prompt(::Type{Template}, ::Type, ::Val{:plugins})
defaults = map(typeof, default_plugins())
ndefaults = length(defaults)
# Put the defaults first.
options = unique!([defaults; concretes(Plugin)])
menu = MultiSelectMenu(map(T -> string(nameof(T)), options); pagesize=length(options))
println("Select plugins:")
# Pre-select the default plugins and move the cursor to the first non-default.
# To make this better, we need julia#30043.
print(stdin.buffer, (CR * DOWN)^ndefaults)
types = sort!(collect(request(menu)))
plugins = Vector{Any}(map(interactive, options[types]))
# Find any defaults that were disabled.
foreach(i -> i in types || push!(plugins, !defaults[i]), 1:ndefaults)
return plugins
end
# Call the default prompt method even if a specialized one exists.
fallback_prompt(T::Type, name::Symbol) = prompt(Template, T, Val(name), nothing)
function default_branch(t::Template)
git = getplugin(t, Git)
return git === nothing ? nothing : git.branch
end
================================================
FILE: templates/.JuliaFormatter.toml
================================================
# See https://domluna.github.io/JuliaFormatter.jl/stable/ for a list of options
{{{STYLE}}}
================================================
FILE: templates/CITATION.bib
================================================
@misc{<<&PKG>>.jl,
author = {<<&AUTHORS>>},
title = {<<&PKG>>.jl},
url = {<<&URL>>},
version = {<<&VERSION>>},
year = {<<&YEAR>>},
month = {<<&MONTH>>}
}
================================================
FILE: templates/README.md
================================================
# {{{PKG}}}{{#HAS_INLINE_BADGES}} {{#BADGES}}{{{.}}} {{/BADGES}}{{/HAS_INLINE_BADGES}}
{{^HAS_INLINE_BADGES}}
{{#BADGES}}
{{{.}}}
{{/BADGES}}
{{/HAS_INLINE_BADGES}}
{{#HAS_CITATION}}
## Citing
See [`CITATION.bib`](CITATION.bib) for the relevant reference(s).
{{/HAS_CITATION}}
================================================
FILE: templates/appveyor.yml
================================================
# Documentation: https://github.com/JuliaCI/Appveyor.jl
environment:
matrix:
{{#VERSIONS}}
- julia_version: {{{.}}}
{{/VERSIONS}}
platform:
{{#PLATFORMS}}
- {{{.}}}
{{/PLATFORMS}}
cache:
- '%USERPROFILE%\.julia\artifacts'
{{#HAS_ALLOW_FAILURES}}
matrix:
allow_failures:
{{#ALLOW_FAILURES}}
- julia_version: {{{.}}}
{{/ALLOW_FAILURES}}
{{/HAS_ALLOW_FAILURES}}
branches:
only:
- {{{BRANCH}}}
- /release-.*/
notifications:
- provider: Email
on_build_success: false
on_build_failure: false
on_build_status_changed: false
install:
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))
build_script:
- echo "%JL_BUILD_SCRIPT%"
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"
test_script:
- echo "%JL_TEST_SCRIPT%"
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"
{{#HAS_CODECOV}}
on_success:
- echo "%JL_CODECOV_SCRIPT%"
- C:\julia\bin\julia -e "%JL_CODECOV_SCRIPT%"
{{/HAS_CODECOV}}
================================================
FILE: templates/benchmark/benchmarks.jlt
================================================
using {{{PKG}}}
using BenchmarkTools
SUITE = BenchmarkGroup()
SUITE["rand"] = @benchmarkable rand(10)
# Write your benchmarks here.
================================================
FILE: templates/cirrus.yml
================================================
freebsd_instance:
image: {{{IMAGE}}}
task:
name: FreeBSD
artifacts_cache:
folder: ~/.julia/artifacts
env:
{{#VERSIONS}}
JULIA_VERSION: {{{.}}}
{{/VERSIONS}}
install_script:
- sh -c "$(fetch https://raw.githubusercontent.com/ararslan/CirrusCI.jl/master/bin/install.sh -o -)"
build_script:
- cirrusjl build
test_script:
- cirrusjl test
{{#HAS_COVERAGE}}
coverage_script:
- cirrusjl coverage{{#HAS_CODECOV}} codecov{{/HAS_CODECOV}}{{#HAS_COVERALLS}} coveralls{{/HAS_COVERALLS}}
{{/HAS_COVERAGE}}
================================================
FILE: templates/docs/make.jlt
================================================
using {{{PKG}}}
using Documenter
DocMeta.setdocmeta!({{{PKG}}}, :DocTestSetup, :(using {{{PKG}}}); recursive=true)
makedocs(;
modules=[{{{PKG}}}],
authors="{{{AUTHORS}}}",
sitename="{{{PKG}}}.jl",
format=Documenter.HTML(;
{{#CANONICAL}}
canonical="{{{CANONICAL}}}",
{{/CANONICAL}}
{{#EDIT_LINK}}
edit_link={{{EDIT_LINK}}},
{{/EDIT_LINK}}
assets={{^HAS_ASSETS}}String{{/HAS_ASSETS}}[{{^HAS_ASSETS}}],{{/HAS_ASSETS}}
{{#ASSETS}}
"assets/{{{.}}}",
{{/ASSETS}}
{{#HAS_ASSETS}}
],
{{/HAS_ASSETS}}
),
pages=[
"Home" => "index.md",
],
{{#MAKEDOCS_KWARGS}}
{{{first}}}={{{second}}},
{{/MAKEDOCS_KWARGS}}
)
{{#HAS_DEPLOY}}
deploydocs(;
repo="{{{REPO}}}",
{{#BRANCH}}
devbranch="{{{BRANCH}}}",
{{/BRANCH}}
)
{{/HAS_DEPLOY}}
================================================
FILE: templates/docs/src/index.md
================================================
```@meta
CurrentModule = {{{PKG}}}
```
# {{{PKG}}}
Documentation for [{{{PKG}}}](https://{{{REPO}}}).
```@index
```
```@autodocs
Modules = [{{{PKG}}}]
```
================================================
FILE: templates/drone.star
================================================
def main(ctx):
pipelines = []
for arch in [{{{ARCHES}}}]:
for julia in [{{{VERSIONS}}}]:
pipelines.append(pipeline(arch, julia))
return pipelines
def pipeline(arch, julia):
return {
"kind": "pipeline",
"type": "docker",
"name": "Julia %s - %s" % (julia, arch),
"platform": {
"os": "linux",
"arch": arch,
},
"steps": [
{
"name": "test",
"image": "julia:%s" % julia,
"commands": [
"julia -e 'using InteractiveUtils; versioninfo()'",
"julia --project=@. -e 'using Pkg; Pkg.instantiate(); Pkg.build(); Pkg.test();'",
],
},
],
}
================================================
FILE: templates/github/dependabot.yml
================================================
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
# To group all GitHub Actions updates into a single PR, uncomment the following:
# groups:
# github-actions:
# patterns:
# - "*"
- package-ecosystem: "julia"
directories:
- "/"
- "/docs"
- "/test"
schedule:
interval: "weekly"
# To group all Julia dependency updates into a single PR, uncomment the following:
# groups:
# julia-dependencies:
# patterns:
# - "*"
================================================
FILE: templates/github/workflows/CI.yml
================================================
name: CI
on:
push:
branches:
<<#BRANCH>>
- <<BRANCH>>
<</BRANCH>>
tags: ['*']
pull_request:
workflow_dispatch:
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created
actions: write
contents: read
strategy:
fail-fast: false
matrix:
version:
<<#VERSIONS>>
- '<<&.>>'
<</VERSIONS>>
os:
<<#OS>>
- <<&.>>
<</OS>>
arch:
<<#ARCH>>
- <<&.>>
<</ARCH>>
<<#HAS_EXCLUDES>>
exclude:
<</HAS_EXCLUDES>>
<<#EXCLUDES>>
- os: <<&E_OS>>
arch: <<&E_ARCH>>
<<#E_VERSION>>
version: '<<&E_VERSION>>'
<</E_VERSION>>
<</EXCLUDES>>
steps:
- uses: actions/checkout@v6
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
<<#HAS_CODECOV>>
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v4
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
<</HAS_CODECOV>>
<<#HAS_COVERALLS>>
- uses: julia-actions/julia-uploadcoveralls@v1
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
<</HAS_COVERALLS>>
<<#HAS_DOCUMENTER>>
docs:
name: Documentation
runs-on: ubuntu-latest
permissions:
actions: write # needed to allow julia-actions/cache to proactively delete old caches that it has created
contents: write
statuses: write
steps:
- uses: actions/checkout@v6
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-docdeploy@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
- name: Run doctests
shell: julia --project=docs --color=yes {0}
run: |
using Documenter: DocMeta, doctest
using <<&PKG>>
DocMeta.setdocmeta!(<<&PKG>>, :DocTestSetup, :(using <<&PKG>>); recursive=true)
doctest(<<&PKG>>)
<</HAS_DOCUMENTER>>
<<#HAS_RUNIC>>
runic:
name: Runic formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: fredrikekre/runic-action@v1
with:
version: '1'
<</HAS_RUNIC>>
================================================
FILE: templates/github/workflows/CompatHelper.yml
================================================
name: CompatHelper
on:
schedule:
- cron: <<&CRON>>
workflow_dispatch:
jobs:
CompatHelper:
runs-on: ubuntu-latest
steps:
- name: Install CompatHelper
run: using Pkg; Pkg.add("CompatHelper")
shell: julia --color=yes {0}
- name: Run CompatHelper
run: using CompatHelper; CompatHelper.main()
shell: julia --color=yes {0}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
================================================
FILE: templates/github/workflows/Register.yml
================================================
name: Register Package
on:
workflow_dispatch:
inputs:
version:
description: <<&PROMPT>>
required: true
jobs:
register:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: julia-actions/RegisterAction@latest
with:
token: ${{ secrets.GITHUB_TOKEN }}
================================================
FILE: templates/github/workflows/TagBot.yml
================================================
name: TagBot
on:
issue_comment:
types:
- created
workflow_dispatch:
jobs:
TagBot:
if: github.event_name == 'workflow_dispatch' || github.actor == '{{{TRIGGER}}}'
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: {{{TOKEN}}}
{{#SSH}}
# For commits that modify workflow files: SSH key enables tagging, but
# releases require manual creation. For full automation of such commits,
# use a PAT with `workflow` scope instead of GITHUB_TOKEN.
# See: https://github.com/JuliaRegistries/TagBot#commits-that-modify-workflow-files
ssh: {{{SSH}}}
{{/SSH}}
{{#SSH_PASSWORD}}
ssh_password: {{{SSH_PASSWORD}}}
{{/SSH_PASSWORD}}
{{#CHANGELOG}}
changelog: {{{CHANGELOG}}}
{{/CHANGELOG}}
{{#CHANGELOG_IGNORE}}
changelog_ignore: {{{CHANGELOG_IGNORE}}}
{{/CHANGELOG_IGNORE}}
{{#GPG}}
gpg: {{{GPG}}}
{{/GPG}}
{{#GPG_PASSWORD}}
gpg_password: {{{GPG_PASSWORD}}}
{{/GPG_PASSWORD}}
{{#REGISTRY}}
registry: {{{REGISTRY}}}
{{/REGISTRY}}
{{#BRANCHES}}
branches: {{{BRANCHES}}}
{{/BRANCHES}}
{{#DISPATCH}}
dispatch: {{{DISPATCH}}}
{{/DISPATCH}}
{{#DISPATCH_DELAY}}
dispatch_delay: {{{DISPATCH_DELAY}}}
{{/DISPATCH_DELAY}}
================================================
FILE: templates/gitlab-ci.yml
================================================
.script:
script:
- |
julia --project=@. -e '
using Pkg
Pkg.build()
Pkg.test({{#HAS_COVERAGE}}coverage=true{{/HAS_COVERAGE}})'
{{#HAS_COVERAGE}}
.coverage:
coverage: /Test coverage (\d+\.\d+%)/
after_script:
- |
julia -e '
using Pkg
Pkg.add("Coverage")
using Coverage
c, t = get_summary(process_folder())
using Printf
@printf "Test coverage %.2f%%\n" 100c / t'
{{/HAS_COVERAGE}}
{{#VERSIONS}}
Julia {{{.}}}:
image: julia:{{{.}}}
extends:
- .script
{{#HAS_COVERAGE}}
- .coverage
{{/HAS_COVERAGE}}
{{/VERSIONS}}
{{#HAS_DOCUMENTER}}
pages:
image: julia:{{{VERSION}}}
stage: deploy
script:
- |
julia --project=docs -e '
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()
using Documenter: doctest
using {{{PKG}}}
doctest({{{PKG}}})
include("docs/make.jl")'
- mkdir -p public
- mv docs/build public/dev
artifacts:
paths:
- public
only:
- {{{BRANCH}}}
{{/HAS_DOCUMENTER}}
================================================
FILE: templates/licenses/AGPL-3.0-or-later
================================================
Copyright (C) {{{YEAR}}} {{{AUTHORS}}}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.
================================================
FILE: templates/licenses/Apache-2.0
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: templates/licenses/BSD-2-Clause
================================================
BSD 2-Clause License
Copyright (c) {{{YEAR}}}, {{{AUTHORS}}}
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
================================================
FILE: templates/licenses/BSD-3-Clause
================================================
BSD 3-Clause License
Copyright (c) {{{YEAR}}}, {{{AUTHORS}}}
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
================================================
FILE: templates/licenses/EUPL-1.2
================================================
European Union Public Licence
V. 1.2
EUPL © the European Union 2007, 2016
This European Union Public Licence (the ‘EUPL’) applies to the Work (as
defined below) which is provided under the terms of this Licence. Any use of
the Work, other than as authorised under this Licence is prohibited (to the
extent such use is covered by a right of the copyright holder of the Work).
The Work is provided under the terms of this Licence when the Licensor (as
defined below) has placed the following notice immediately following the
copyright notice for the Work: “Licensed under the EUPL”, or has expressed by
any other means his willingness to license under the EUPL.
1. Definitions
In this Licence, the following terms have the following meaning:
— ‘The Licence’: this Licence.
— ‘The Original Work’: the work or software distributed or communicated by the
‘Licensor under this Licence, available as Source Code and also as
‘Executable Code as the case may be.
— ‘Derivative Works’: the works or software that could be created by the
‘Licensee, based upon the Original Work or modifications thereof. This
‘Licence does not define the extent of modification or dependence on the
‘Original Work required in order to classify a work as a Derivative Work;
‘this extent is determined by copyright law applicable in the country
‘mentioned in Article 15.
— ‘The Work’: the Original Work or its Derivative Works.
— ‘The Source Code’: the human-readable form of the Work which is the most
convenient for people to study and modify.
— ‘The Executable Code’: any code which has generally been compiled and which
is meant to be interpreted by a computer as a program.
— ‘The Licensor’: the natural or legal person that distributes or communicates
the Work under the Licence.
— ‘Contributor(s)’: any natural or legal person who modifies the Work under
the Licence, or otherwise contributes to the creation of a Derivative Work.
— ‘The Licensee’ or ‘You’: any natural or legal person who makes any usage of
the Work under the terms of the Licence.
— ‘Distribution’ or ‘Communication’: any act of selling, giving, lending,
renting, distributing, communicating, transmitting, or otherwise making
available, online or offline, copies of the Work or providing access to its
essential functionalities at the disposal of any other natural or legal
person.
2. Scope of the rights granted by the Licence
The Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
sublicensable licence to do the following, for the duration of copyright
vested in the Original Work:
— use the Work in any circumstance and for all usage,
— reproduce the Work,
— modify the Work, and make Derivative Works based upon the Work,
— communicate to the public, including the right to make available or display
the Work or copies thereof to the public and perform publicly, as the case
may be, the Work,
— distribute the Work or copies thereof,
— lend and rent the Work or copies thereof,
— sublicense rights in the Work or copies thereof.
Those rights can be exercised on any media, supports and formats, whether now
known or later invented, as far as the applicable law permits so.
In the countries where moral rights apply, the Licensor waives his right to
exercise his moral right to the extent allowed by law in order to make
effective the licence of the economic rights here above listed.
The Licensor grants to the Licensee royalty-free, non-exclusive usage rights
to any patents held by the Licensor, to the extent necessary to make use of
the rights granted on the Work under this Licence.
3. Communication of the Source Code
The Licensor may provide the Work either in its Source Code form, or as
Execut
gitextract_vcepmtte/
├── .gitattributes
├── .github/
│ ├── dependabot.yml
│ └── workflows/
│ ├── CI.yml
│ ├── JuliaNightly.yml
│ └── TagBot.yml
├── .gitignore
├── LICENSE
├── Project.toml
├── README.md
├── docs/
│ ├── Project.toml
│ ├── make.jl
│ └── src/
│ ├── developer.md
│ ├── index.md
│ ├── migrating.md
│ └── user.md
├── src/
│ ├── PkgTemplates.jl
│ ├── deprecated.jl
│ ├── interactive.jl
│ ├── plugin.jl
│ ├── plugins/
│ │ ├── badges.jl
│ │ ├── ci.jl
│ │ ├── citation.jl
│ │ ├── codeowners.jl
│ │ ├── compat_helper.jl
│ │ ├── coverage.jl
│ │ ├── dependabot.jl
│ │ ├── develop.jl
│ │ ├── documenter.jl
│ │ ├── formatter.jl
│ │ ├── git.jl
│ │ ├── license.jl
│ │ ├── pkgbenchmark.jl
│ │ ├── project_file.jl
│ │ ├── readme.jl
│ │ ├── register.jl
│ │ ├── src_dir.jl
│ │ ├── tagbot.jl
│ │ └── tests.jl
│ ├── show.jl
│ └── template.jl
├── templates/
│ ├── .JuliaFormatter.toml
│ ├── CITATION.bib
│ ├── README.md
│ ├── appveyor.yml
│ ├── benchmark/
│ │ └── benchmarks.jlt
│ ├── cirrus.yml
│ ├── docs/
│ │ ├── make.jlt
│ │ └── src/
│ │ └── index.md
│ ├── drone.star
│ ├── github/
│ │ ├── dependabot.yml
│ │ └── workflows/
│ │ ├── CI.yml
│ │ ├── CompatHelper.yml
│ │ ├── Register.yml
│ │ └── TagBot.yml
│ ├── gitlab-ci.yml
│ ├── licenses/
│ │ ├── AGPL-3.0-or-later
│ │ ├── Apache-2.0
│ │ ├── BSD-2-Clause
│ │ ├── BSD-3-Clause
│ │ ├── EUPL-1.2
│ │ ├── GPL-2.0-or-later
│ │ ├── GPL-3.0-or-later
│ │ ├── ISC
│ │ ├── LGPL-2.1-or-later
│ │ ├── LGPL-3.0-or-later
│ │ ├── MIT
│ │ └── MPL-2.0
│ ├── src/
│ │ └── module.jlt
│ ├── test/
│ │ └── runtests.jlt
│ └── travis.yml
└── test/
├── fixtures/
│ ├── AllPlugins/
│ │ ├── .JuliaFormatter.toml
│ │ ├── .appveyor.yml
│ │ ├── .cirrus.yml
│ │ ├── .drone.star
│ │ ├── .github/
│ │ │ ├── dependabot.yml
│ │ │ └── workflows/
│ │ │ ├── CI.yml
│ │ │ ├── CompatHelper.yml
│ │ │ ├── Register.yml
│ │ │ └── TagBot.yml
│ │ ├── .gitignore
│ │ ├── .gitlab-ci.yml
│ │ ├── .travis.yml
│ │ ├── CITATION.bib
│ │ ├── CODEOWNERS
│ │ ├── LICENSE
│ │ ├── Manifest.toml
│ │ ├── Project.toml
│ │ ├── README.md
│ │ ├── benchmark/
│ │ │ └── benchmarks.jl
│ │ ├── docs/
│ │ │ ├── Manifest.toml
│ │ │ ├── Project.toml
│ │ │ ├── make.jl
│ │ │ └── src/
│ │ │ └── index.md
│ │ ├── src/
│ │ │ └── AllPlugins.jl
│ │ └── test/
│ │ └── runtests.jl
│ ├── Basic/
│ │ ├── .github/
│ │ │ ├── dependabot.yml
│ │ │ └── workflows/
│ │ │ ├── CI.yml
│ │ │ └── TagBot.yml
│ │ ├── .gitignore
│ │ ├── LICENSE
│ │ ├── Manifest.toml
│ │ ├── Project.toml
│ │ ├── README.md
│ │ ├── src/
│ │ │ └── Basic.jl
│ │ └── test/
│ │ └── runtests.jl
│ ├── DocumenterGitHubActions/
│ │ ├── .github/
│ │ │ ├── dependabot.yml
│ │ │ └── workflows/
│ │ │ ├── CI.yml
│ │ │ └── TagBot.yml
│ │ ├── .gitignore
│ │ ├── LICENSE
│ │ ├── Project.toml
│ │ ├── README.md
│ │ ├── docs/
│ │ │ ├── Manifest.toml
│ │ │ ├── Project.toml
│ │ │ ├── make.jl
│ │ │ └── src/
│ │ │ └── index.md
│ │ ├── src/
│ │ │ └── DocumenterGitHubActions.jl
│ │ └── test/
│ │ └── runtests.jl
│ ├── DocumenterGitLabCI/
│ │ ├── .github/
│ │ │ ├── dependabot.yml
│ │ │ └── workflows/
│ │ │ ├── CI.yml
│ │ │ └── TagBot.yml
│ │ ├── .gitignore
│ │ ├── .gitlab-ci.yml
│ │ ├── LICENSE
│ │ ├── Project.toml
│ │ ├── README.md
│ │ ├── docs/
│ │ │ ├── Manifest.toml
│ │ │ ├── Project.toml
│ │ │ ├── make.jl
│ │ │ └── src/
│ │ │ └── index.md
│ │ ├── src/
│ │ │ └── DocumenterGitLabCI.jl
│ │ └── test/
│ │ └── runtests.jl
│ ├── DocumenterTravis/
│ │ ├── .github/
│ │ │ ├── dependabot.yml
│ │ │ └── workflows/
│ │ │ ├── CI.yml
│ │ │ └── TagBot.yml
│ │ ├── .gitignore
│ │ ├── .travis.yml
│ │ ├── LICENSE
│ │ ├── Project.toml
│ │ ├── README.md
│ │ ├── docs/
│ │ │ ├── Manifest.toml
│ │ │ ├── Project.toml
│ │ │ ├── make.jl
│ │ │ └── src/
│ │ │ └── index.md
│ │ ├── src/
│ │ │ └── DocumenterTravis.jl
│ │ └── test/
│ │ └── runtests.jl
│ ├── WackyOptions/
│ │ ├── .JuliaFormatter.toml
│ │ ├── .appveyor.yml
│ │ ├── .cirrus.yml
│ │ ├── .codecov.yml
│ │ ├── .coveralls.yml
│ │ ├── .drone.star
│ │ ├── .github/
│ │ │ ├── dependabot.yml
│ │ │ └── workflows/
│ │ │ ├── CI.yml
│ │ │ ├── CompatHelper.yml
│ │ │ ├── Register.yml
│ │ │ └── TagBot.yml
│ │ ├── .gitignore
│ │ ├── .gitlab-ci.yml
│ │ ├── .travis.yml
│ │ ├── CITATION.bib
│ │ ├── CODEOWNERS
│ │ ├── LICENSE
│ │ ├── Manifest.toml
│ │ ├── Project.toml
│ │ ├── README.md
│ │ ├── docs/
│ │ │ ├── Manifest.toml
│ │ │ ├── Project.toml
│ │ │ ├── make.jl
│ │ │ └── src/
│ │ │ ├── assets/
│ │ │ │ └── static.txt
│ │ │ └── index.md
│ │ ├── src/
│ │ │ └── WackyOptions.jl
│ │ └── test/
│ │ ├── Project.toml
│ │ └── runtests.jl
│ └── static.txt
├── git.jl
├── interactive.jl
├── plugin.jl
├── reference.jl
├── runtests.jl
├── show.jl
└── template.jl
Condensed preview — 182 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (444K chars).
[
{
"path": ".gitattributes",
"chars": 21,
"preview": "* eol=lf\n*.png -text\n"
},
{
"path": ".github/dependabot.yml",
"chars": 682,
"preview": "# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates\nversion: 2\nupda"
},
{
"path": ".github/workflows/CI.yml",
"chars": 3387,
"preview": "name: CI\n# Run on master, tags, or any pull request\non:\n schedule:\n - cron: '0 2 * * *' # Daily at 2 AM UTC (8 PM C"
},
{
"path": ".github/workflows/JuliaNightly.yml",
"chars": 982,
"preview": "name: JuliaNightly\n# Nightly Scheduled Julia Nightly Run\non:\n schedule:\n - cron: '0 2 * * *' # Daily at 2 AM UTC (8"
},
{
"path": ".github/workflows/TagBot.yml",
"chars": 362,
"preview": "name: TagBot\non:\n issue_comment:\n types:\n - created\n workflow_dispatch:\njobs:\n TagBot:\n if: github.event_n"
},
{
"path": ".gitignore",
"chars": 116,
"preview": "/docs/build/\n*.jl.*.cov\n*.jl.cov\n*.jl.mem\n/Manifest*.toml\n/test/fixtures/*/test/Manifest*.toml\n/docs/Manifest*.toml\n"
},
{
"path": "LICENSE",
"chars": 1117,
"preview": "MIT License\n\nCopyright (c) 2017-2020 Chris de Graaf, Invenia Technical Computing Corporation\n\nPermission is hereby grant"
},
{
"path": "Project.toml",
"chars": 1089,
"preview": "name = \"PkgTemplates\"\nuuid = \"14b8a8f1-9102-5b29-a752-f990bacb7fe1\"\nauthors = [\"Chris de Graaf\", \"Invenia Technical Comp"
},
{
"path": "README.md",
"chars": 2821,
"preview": "# PkgTemplates\n\n[](https://juliaci.github.io/PkgTemplates.jl"
},
{
"path": "docs/Project.toml",
"chars": 140,
"preview": "[deps]\nDocumenter = \"e30172f5-a6a5-5a46-863b-614d45cd2de4\"\nPkgTemplates = \"14b8a8f1-9102-5b29-a752-f990bacb7fe1\"\n\n[compa"
},
{
"path": "docs/make.jl",
"chars": 668,
"preview": "using Documenter: Documenter, makedocs, deploydocs\nusing PkgTemplates: PkgTemplates\n\nmakedocs(;\n modules=[PkgTemplate"
},
{
"path": "docs/src/developer.md",
"chars": 14424,
"preview": "```@meta\nCurrentModule = PkgTemplates\n```\n\n# PkgTemplates Developer Guide\n\n```@contents\nPages = [\"developer.md\"]\n```\n\nIs"
},
{
"path": "docs/src/index.md",
"chars": 549,
"preview": "```@meta\nCurrentModule = PkgTemplates\n```\n\n# PkgTemplates\n\n**[PkgTemplates](https://github.com/JuliaCI/PkgTemplates.jl/)"
},
{
"path": "docs/src/migrating.md",
"chars": 2879,
"preview": "```@meta\nCurrentModule = PkgTemplates\n```\n\n# Migrating To PkgTemplates 0.7+\n\nPkgTemplates 0.7 is a ground-up rewrite of "
},
{
"path": "docs/src/user.md",
"chars": 7992,
"preview": "```@meta\nCurrentModule = PkgTemplates\n```\n\n# PkgTemplates User Guide\n\n```@contents\nPages = [\"user.md\"]\n```\n\nUsing [PkgTe"
},
{
"path": "src/PkgTemplates.jl",
"chars": 1614,
"preview": "@doc read(joinpath(dirname(@__DIR__), \"README.md\"), String)\nmodule PkgTemplates\n\nusing Base: active_project, contractuse"
},
{
"path": "src/deprecated.jl",
"chars": 412,
"preview": "@deprecate generate(t::Template, pkg::AbstractString) t(pkg)\n@deprecate generate(pkg::AbstractString, t::Template) t(pkg"
},
{
"path": "src/interactive.jl",
"chars": 7142,
"preview": "\"\"\"\n generate([pkg::AbstractString]) -> Template\n\nShortcut for `Template(; interactive=true)(pkg)`.\nIf no package nam"
},
{
"path": "src/plugin.jl",
"chars": 12712,
"preview": "const DEFAULT_PRIORITY = 1000\nconst DEFAULT_TEMPLATE_DIR = Ref{String}(joinpath(dirname(dirname(pathof(PkgTemplates))), "
},
{
"path": "src/plugins/badges.jl",
"chars": 1586,
"preview": "\"\"\"\nA [`Plugin`](@ref) that only adds a [`Badge`](@ref) to the [`Readme`](@ref) file.\n\nConcrete subtypes only need to im"
},
{
"path": "src/plugins/ci.jl",
"chars": 14903,
"preview": "\"\"\"\n format_version(v::Union{VersionNumber, AbstractString}) -> String\n\nStrip everything but the major and minor rele"
},
{
"path": "src/plugins/citation.jl",
"chars": 886,
"preview": "\"\"\"\n Citation(; file=\"$(contractuser(default_file(\"CITATION.bib\")))\", readme=false)\n\nCreates a `CITATION.bib` file fo"
},
{
"path": "src/plugins/codeowners.jl",
"chars": 1497,
"preview": "\"\"\"\n CodeOwners <: Plugin\n CodeOwners(; owners)\n\nA plugin which created GitLab/GitHub compatible CODEOWNERS files."
},
{
"path": "src/plugins/compat_helper.jl",
"chars": 1388,
"preview": "\"\"\"\n CompatHelper(;\n file=\"$(contractuser(default_file(\"github\", \"workflows\", \"CompatHelper.yml\")))\",\n "
},
{
"path": "src/plugins/coverage.jl",
"chars": 1858,
"preview": "const COVERAGE_GITIGNORE = [\"*.jl.cov\", \"*.jl.*.cov\", \"*.jl.mem\"]\n\n\"\"\"\n Codecov(; file=nothing)\n\nSets up code coverag"
},
{
"path": "src/plugins/dependabot.jl",
"chars": 1269,
"preview": "\"\"\"\n Dependabot(; file=\"$(contractuser(default_file(\"github\", \"dependabot.yml\")))\")\n\nSets up Dependabot to create PRs"
},
{
"path": "src/plugins/develop.jl",
"chars": 368,
"preview": "\"\"\"\n Develop()\n\nAdds generated packages to the current environment by `dev`ing them.\nSee the Pkg documentation\n[here]"
},
{
"path": "src/plugins/documenter.jl",
"chars": 9436,
"preview": "const DOCUMENTER_DEP = PackageSpec(;\n name=\"Documenter\",\n uuid=\"e30172f5-a6a5-5a46-863b-614d45cd2de4\",\n)\n\nstruct N"
},
{
"path": "src/plugins/formatter.jl",
"chars": 1967,
"preview": "\"\"\"\n Formatter(;\n file=\"$(contractuser(default_file(\".JuliaFormatter.toml\")))\",\n style=\"nostyle\"\n )\n"
},
{
"path": "src/plugins/git.jl",
"chars": 4917,
"preview": "const DEFAULT_DEFAULT_BRANCH = \"main\"\n\n\"\"\"\n Git(;\n ignore=String[],\n name=nothing,\n email=nothin"
},
{
"path": "src/plugins/license.jl",
"chars": 2416,
"preview": "\"\"\"\n License(; name=\"MIT\", path=nothing, destination=\"LICENSE\")\n\nCreates a license file.\n\n## Keyword Arguments\n- `nam"
},
{
"path": "src/plugins/pkgbenchmark.jl",
"chars": 847,
"preview": "\"\"\"\n PkgBenchmark(; file=\"$(contractuser(default_file(\"benchmark\", \"benchmarks.jlt\")))\")\n\nSets up a [PkgBenchmark.jl]"
},
{
"path": "src/plugins/project_file.jl",
"chars": 1614,
"preview": "\"\"\"\n ProjectFile(; version=v\"1.0.0-DEV\")\n\nCreates a `Project.toml`.\n\n## Keyword Arguments\n- `version::VersionNumber`:"
},
{
"path": "src/plugins/readme.jl",
"chars": 2110,
"preview": "\"\"\"\n Readme(;\n file=\"$(contractuser(default_file(\"README.md\")))\",\n destination=\"README.md\",\n inl"
},
{
"path": "src/plugins/register.jl",
"chars": 1109,
"preview": "\"\"\"\n RegisterAction(;\n file=\"$(contractuser(default_file(\"github\", \"workflows\", \"Register.yml\")))\",\n de"
},
{
"path": "src/plugins/src_dir.jl",
"chars": 993,
"preview": "\"\"\"\n SrcDir(; file=\"$(contractuser(default_file(\"src\", \"module.jlt\")))\")\n\nCreates a module entrypoint.\n\n## Keyword Ar"
},
{
"path": "src/plugins/tagbot.jl",
"chars": 3375,
"preview": "\"\"\"\n TagBot(;\n file=\"$(contractuser(default_file(\"github\", \"workflows\", \"TagBot.yml\")))\",\n destination="
},
{
"path": "src/plugins/tests.jl",
"chars": 5297,
"preview": "const TEST_UUID = \"8dfed614-e22c-5e08-85e1-65c5234f0b40\"\nconst TEST_DEP = PackageSpec(; name=\"Test\", uuid=TEST_UUID)\n\nco"
},
{
"path": "src/show.jl",
"chars": 1030,
"preview": "function Base.show(io::IO, m::MIME\"text/plain\", t::Template)\n println(io, \"Template:\")\n foreach(fieldnames(Templat"
},
{
"path": "src/template.jl",
"chars": 10048,
"preview": "default_user() = LibGit2.getconfig(\"github.user\", \"\")\ndefault_version() = v\"1.10.10\" # LTS as of June 2025, see https:/"
},
{
"path": "templates/.JuliaFormatter.toml",
"chars": 92,
"preview": "# See https://domluna.github.io/JuliaFormatter.jl/stable/ for a list of options\n{{{STYLE}}}\n"
},
{
"path": "templates/CITATION.bib",
"chars": 172,
"preview": "@misc{<<&PKG>>.jl,\n\tauthor = {<<&AUTHORS>>},\n\ttitle = {<<&PKG>>.jl},\n\turl = {<<&URL>>},\n\tversion = {<<&VERSION>>}"
},
{
"path": "templates/README.md",
"chars": 280,
"preview": "# {{{PKG}}}{{#HAS_INLINE_BADGES}} {{#BADGES}}{{{.}}} {{/BADGES}}{{/HAS_INLINE_BADGES}}\n{{^HAS_INLINE_BADGES}}\n\n{{#BADGES"
},
{
"path": "templates/appveyor.yml",
"chars": 1005,
"preview": "# Documentation: https://github.com/JuliaCI/Appveyor.jl\nenvironment:\n matrix:\n{{#VERSIONS}}\n - julia_version: {{{.}}"
},
{
"path": "templates/benchmark/benchmarks.jlt",
"chars": 134,
"preview": "using {{{PKG}}}\nusing BenchmarkTools\n\nSUITE = BenchmarkGroup()\nSUITE[\"rand\"] = @benchmarkable rand(10)\n\n# Write your ben"
},
{
"path": "templates/cirrus.yml",
"chars": 533,
"preview": "freebsd_instance:\n image: {{{IMAGE}}}\ntask:\n name: FreeBSD\n artifacts_cache:\n folder: ~/.julia/artifacts\n env:\n{{"
},
{
"path": "templates/docs/make.jlt",
"chars": 809,
"preview": "using {{{PKG}}}\nusing Documenter\n\nDocMeta.setdocmeta!({{{PKG}}}, :DocTestSetup, :(using {{{PKG}}}); recursive=true)\n\nmak"
},
{
"path": "templates/docs/src/index.md",
"chars": 159,
"preview": "```@meta\nCurrentModule = {{{PKG}}}\n```\n\n# {{{PKG}}}\n\nDocumentation for [{{{PKG}}}](https://{{{REPO}}}).\n\n```@index\n```\n\n"
},
{
"path": "templates/drone.star",
"chars": 649,
"preview": "def main(ctx):\n pipelines = []\n for arch in [{{{ARCHES}}}]:\n for julia in [{{{VERSIONS}}}]:\n pipelines.append("
},
{
"path": "templates/github/dependabot.yml",
"chars": 682,
"preview": "# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates\nversion: 2\nupda"
},
{
"path": "templates/github/workflows/CI.yml",
"chars": 3103,
"preview": "name: CI\non:\n push:\n branches:\n <<#BRANCH>>\n - <<BRANCH>>\n <</BRANCH>>\n tags: ['*']\n pull_request:\n "
},
{
"path": "templates/github/workflows/CompatHelper.yml",
"chars": 503,
"preview": "name: CompatHelper\non:\n schedule:\n - cron: <<&CRON>>\n workflow_dispatch:\njobs:\n CompatHelper:\n runs-on: ubuntu-"
},
{
"path": "templates/github/workflows/Register.yml",
"chars": 337,
"preview": "name: Register Package\non:\n workflow_dispatch:\n inputs:\n version:\n description: <<&PROMPT>>\n requ"
},
{
"path": "templates/github/workflows/TagBot.yml",
"chars": 1512,
"preview": "name: TagBot\non:\n issue_comment:\n types:\n - created\n workflow_dispatch:\njobs:\n TagBot:\n if: github.event_n"
},
{
"path": "templates/gitlab-ci.yml",
"chars": 1087,
"preview": ".script:\n script:\n - |\n julia --project=@. -e '\n using Pkg\n Pkg.build()\n Pkg.test({{#HAS_C"
},
{
"path": "templates/licenses/AGPL-3.0-or-later",
"chars": 35199,
"preview": "Copyright (C) {{{YEAR}}} {{{AUTHORS}}}\n\nThis program is free software: you can redistribute it and/or modify\nit under th"
},
{
"path": "templates/licenses/Apache-2.0",
"chars": 11357,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "templates/licenses/BSD-2-Clause",
"chars": 1329,
"preview": "BSD 2-Clause License\n\nCopyright (c) {{{YEAR}}}, {{{AUTHORS}}}\nAll rights reserved.\n\nRedistribution and use in source and"
},
{
"path": "templates/licenses/BSD-3-Clause",
"chars": 1527,
"preview": "BSD 3-Clause License\n\nCopyright (c) {{{YEAR}}}, {{{AUTHORS}}}\nAll rights reserved.\n\nRedistribution and use in source and"
},
{
"path": "templates/licenses/EUPL-1.2",
"chars": 13699,
"preview": "European Union Public Licence\nV. 1.2\n\nEUPL © the European Union 2007, 2016\n\nThis European Union Public Licence (the ‘EUP"
},
{
"path": "templates/licenses/GPL-2.0-or-later",
"chars": 18814,
"preview": "Copyright (C) {{{YEAR}}} {{{AUTHORS}}}\n\nThis program is free software; you can redistribute it and/or modify\nit under th"
},
{
"path": "templates/licenses/GPL-3.0-or-later",
"chars": 35804,
"preview": "Copyright (C) {{{YEAR}}} {{{AUTHORS}}}\n\nThis program is free software: you can redistribute it and/or modify\nit under th"
},
{
"path": "templates/licenses/ISC",
"chars": 751,
"preview": "ISC License\n\nCopyright (c) {{{YEAR}}}, {{{AUTHORS}}}\n\nPermission to use, copy, modify, and/or distribute this software f"
},
{
"path": "templates/licenses/LGPL-2.1-or-later",
"chars": 27271,
"preview": "Copyright (C) {{{YEAR}}} {{{AUTHORS}}}\n\nThis library is free software; you can redistribute it and/or\nmodify it under th"
},
{
"path": "templates/licenses/LGPL-3.0-or-later",
"chars": 8321,
"preview": "Copyright (C) {{{YEAR}}} {{{AUTHORS}}}\n\nThis program is free software: you can redistribute it and/or modify\nit under th"
},
{
"path": "templates/licenses/MIT",
"chars": 1076,
"preview": "MIT License\n\nCopyright (c) {{{YEAR}}} {{{AUTHORS}}}\n\nPermission is hereby granted, free of charge, to any person obtaini"
},
{
"path": "templates/licenses/MPL-2.0",
"chars": 16725,
"preview": "Mozilla Public License Version 2.0\n==================================\n\n1. Definitions\n--------------\n\n1.1. \"Contributor\""
},
{
"path": "templates/src/module.jlt",
"chars": 55,
"preview": "module {{{PKG}}}\n\n# Write your package code here.\n\nend\n"
},
{
"path": "templates/test/runtests.jlt",
"chars": 159,
"preview": "using {{{PKG}}}\nusing Test{{{AQUA_IMPORT}}}{{{JET_IMPORT}}}\n\n@testset \"{{{PKG}}}.jl\" begin\n {{{AQUA_TESTSET}}}{{{JET_"
},
{
"path": "templates/travis.yml",
"chars": 1657,
"preview": "# Documentation: http://docs.travis-ci.com/user/languages/julia\nlanguage: julia\nnotifications:\n email: false\njulia:\n{{#"
},
{
"path": "test/fixtures/AllPlugins/.JuliaFormatter.toml",
"chars": 80,
"preview": "# See https://domluna.github.io/JuliaFormatter.jl/stable/ for a list of options\n"
},
{
"path": "test/fixtures/AllPlugins/.appveyor.yml",
"chars": 839,
"preview": "# Documentation: https://github.com/JuliaCI/Appveyor.jl\nenvironment:\n matrix:\n - julia_version: 1.10\n - julia_ver"
},
{
"path": "test/fixtures/AllPlugins/.cirrus.yml",
"chars": 440,
"preview": "freebsd_instance:\n image: freebsd-12-0-release-amd64\ntask:\n name: FreeBSD\n artifacts_cache:\n folder: ~/.julia/arti"
},
{
"path": "test/fixtures/AllPlugins/.drone.star",
"chars": 636,
"preview": "def main(ctx):\n pipelines = []\n for arch in [\"amd64\"]:\n for julia in [\"1.10\"]:\n pipelines.append(pipeline(arch"
},
{
"path": "test/fixtures/AllPlugins/.github/dependabot.yml",
"chars": 682,
"preview": "# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates\nversion: 2\nupda"
},
{
"path": "test/fixtures/AllPlugins/.github/workflows/CI.yml",
"chars": 1636,
"preview": "name: CI\non:\n push:\n branches:\n - main\n tags: ['*']\n pull_request:\n workflow_dispatch:\nconcurrency:\n # Sk"
},
{
"path": "test/fixtures/AllPlugins/.github/workflows/CompatHelper.yml",
"chars": 503,
"preview": "name: CompatHelper\non:\n schedule:\n - cron: 0 0 * * *\n workflow_dispatch:\njobs:\n CompatHelper:\n runs-on: ubuntu-"
},
{
"path": "test/fixtures/AllPlugins/.github/workflows/Register.yml",
"chars": 366,
"preview": "name: Register Package\non:\n workflow_dispatch:\n inputs:\n version:\n description: Version to register or c"
},
{
"path": "test/fixtures/AllPlugins/.github/workflows/TagBot.yml",
"chars": 689,
"preview": "name: TagBot\non:\n issue_comment:\n types:\n - created\n workflow_dispatch:\njobs:\n TagBot:\n if: github.event_n"
},
{
"path": "test/fixtures/AllPlugins/.gitignore",
"chars": 79,
"preview": "*.jl.*.cov\n*.jl.cov\n*.jl.mem\n/Manifest*.toml\n/docs/Manifest*.toml\n/docs/build/\n"
},
{
"path": "test/fixtures/AllPlugins/.gitlab-ci.yml",
"chars": 479,
"preview": ".script:\n script:\n - |\n julia --project=@. -e '\n using Pkg\n Pkg.build()\n Pkg.test(coverage"
},
{
"path": "test/fixtures/AllPlugins/.travis.yml",
"chars": 543,
"preview": "# Documentation: http://docs.travis-ci.com/user/languages/julia\nlanguage: julia\nnotifications:\n email: false\njulia:\n -"
},
{
"path": "test/fixtures/AllPlugins/CITATION.bib",
"chars": 185,
"preview": "@misc{AllPlugins.jl,\n\tauthor = {tester},\n\ttitle = {AllPlugins.jl},\n\turl = {https://github.com/tester/AllPlugins.j"
},
{
"path": "test/fixtures/AllPlugins/CODEOWNERS",
"chars": 1,
"preview": "\n"
},
{
"path": "test/fixtures/AllPlugins/LICENSE",
"chars": 1063,
"preview": "MIT License\n\nCopyright (c) 2019 tester\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof "
},
{
"path": "test/fixtures/AllPlugins/Manifest.toml",
"chars": 71,
"preview": "# This file is machine-generated - editing it directly is not advised\n\n"
},
{
"path": "test/fixtures/AllPlugins/Project.toml",
"chars": 220,
"preview": "name = \"AllPlugins\"\nuuid = \"c51a4d33-e9a4-4efb-a257-e0de888ecc28\"\nauthors = [\"tester\"]\nversion = \"1.0.0-DEV\"\n\n[compat]\nj"
},
{
"path": "test/fixtures/AllPlugins/README.md",
"chars": 1471,
"preview": "# AllPlugins\n\n[]("
},
{
"path": "test/fixtures/AllPlugins/benchmark/benchmarks.jl",
"chars": 135,
"preview": "using AllPlugins\nusing BenchmarkTools\n\nSUITE = BenchmarkGroup()\nSUITE[\"rand\"] = @benchmarkable rand(10)\n\n# Write your be"
},
{
"path": "test/fixtures/AllPlugins/docs/Manifest.toml",
"chars": 3994,
"preview": "# This file is machine-generated - editing it directly is not advised\n\njulia_version = \"1.7.2\"\nmanifest_format = \"2.0\"\n\n"
},
{
"path": "test/fixtures/AllPlugins/docs/Project.toml",
"chars": 59,
"preview": "[deps]\nDocumenter = \"e30172f5-a6a5-5a46-863b-614d45cd2de4\"\n"
},
{
"path": "test/fixtures/AllPlugins/docs/make.jl",
"chars": 347,
"preview": "using AllPlugins\nusing Documenter\n\nDocMeta.setdocmeta!(AllPlugins, :DocTestSetup, :(using AllPlugins); recursive=true)\n\n"
},
{
"path": "test/fixtures/AllPlugins/docs/src/index.md",
"chars": 184,
"preview": "```@meta\nCurrentModule = AllPlugins\n```\n\n# AllPlugins\n\nDocumentation for [AllPlugins](https://github.com/tester/AllPlugi"
},
{
"path": "test/fixtures/AllPlugins/src/AllPlugins.jl",
"chars": 56,
"preview": "module AllPlugins\n\n# Write your package code here.\n\nend\n"
},
{
"path": "test/fixtures/AllPlugins/test/runtests.jl",
"chars": 93,
"preview": "using AllPlugins\nusing Test\n\n@testset \"AllPlugins.jl\" begin\n # Write your tests here.\nend\n"
},
{
"path": "test/fixtures/Basic/.github/dependabot.yml",
"chars": 682,
"preview": "# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates\nversion: 2\nupda"
},
{
"path": "test/fixtures/Basic/.github/workflows/CI.yml",
"chars": 1111,
"preview": "name: CI\non:\n push:\n branches:\n - main\n tags: ['*']\n pull_request:\n workflow_dispatch:\nconcurrency:\n # Sk"
},
{
"path": "test/fixtures/Basic/.github/workflows/TagBot.yml",
"chars": 689,
"preview": "name: TagBot\non:\n issue_comment:\n types:\n - created\n workflow_dispatch:\njobs:\n TagBot:\n if: github.event_n"
},
{
"path": "test/fixtures/Basic/.gitignore",
"chars": 16,
"preview": "/Manifest*.toml\n"
},
{
"path": "test/fixtures/Basic/LICENSE",
"chars": 1063,
"preview": "MIT License\n\nCopyright (c) 2019 tester\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof "
},
{
"path": "test/fixtures/Basic/Manifest.toml",
"chars": 71,
"preview": "# This file is machine-generated - editing it directly is not advised\n\n"
},
{
"path": "test/fixtures/Basic/Project.toml",
"chars": 215,
"preview": "name = \"Basic\"\nuuid = \"c51a4d33-e9a4-4efb-a257-e0de888ecc28\"\nauthors = [\"tester\"]\nversion = \"1.0.0-DEV\"\n\n[compat]\njulia "
},
{
"path": "test/fixtures/Basic/README.md",
"chars": 191,
"preview": "# Basic\n\n[](https://gi"
},
{
"path": "test/fixtures/Basic/src/Basic.jl",
"chars": 51,
"preview": "module Basic\n\n# Write your package code here.\n\nend\n"
},
{
"path": "test/fixtures/Basic/test/runtests.jl",
"chars": 83,
"preview": "using Basic\nusing Test\n\n@testset \"Basic.jl\" begin\n # Write your tests here.\nend\n"
},
{
"path": "test/fixtures/DocumenterGitHubActions/.github/dependabot.yml",
"chars": 682,
"preview": "# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates\nversion: 2\nupda"
},
{
"path": "test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml",
"chars": 2061,
"preview": "name: CI\non:\n push:\n branches:\n - main\n tags: ['*']\n pull_request:\n workflow_dispatch:\nconcurrency:\n # Sk"
},
{
"path": "test/fixtures/DocumenterGitHubActions/.github/workflows/TagBot.yml",
"chars": 689,
"preview": "name: TagBot\non:\n issue_comment:\n types:\n - created\n workflow_dispatch:\njobs:\n TagBot:\n if: github.event_n"
},
{
"path": "test/fixtures/DocumenterGitHubActions/.gitignore",
"chars": 50,
"preview": "/Manifest*.toml\n/docs/Manifest*.toml\n/docs/build/\n"
},
{
"path": "test/fixtures/DocumenterGitHubActions/LICENSE",
"chars": 1063,
"preview": "MIT License\n\nCopyright (c) 2019 tester\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof "
},
{
"path": "test/fixtures/DocumenterGitHubActions/Project.toml",
"chars": 233,
"preview": "name = \"DocumenterGitHubActions\"\nuuid = \"c51a4d33-e9a4-4efb-a257-e0de888ecc28\"\nauthors = [\"tester\"]\nversion = \"1.0.0-DEV"
},
{
"path": "test/fixtures/DocumenterGitHubActions/README.md",
"chars": 484,
"preview": "# DocumenterGitHubActions\n\n[](https://tester.github.io/Docum"
},
{
"path": "test/fixtures/DocumenterGitHubActions/docs/Manifest.toml",
"chars": 4007,
"preview": "# This file is machine-generated - editing it directly is not advised\n\njulia_version = \"1.7.2\"\nmanifest_format = \"2.0\"\n\n"
},
{
"path": "test/fixtures/DocumenterGitHubActions/docs/Project.toml",
"chars": 59,
"preview": "[deps]\nDocumenter = \"e30172f5-a6a5-5a46-863b-614d45cd2de4\"\n"
},
{
"path": "test/fixtures/DocumenterGitHubActions/docs/make.jl",
"chars": 580,
"preview": "using DocumenterGitHubActions\nusing Documenter\n\nDocMeta.setdocmeta!(DocumenterGitHubActions, :DocTestSetup, :(using Docu"
},
{
"path": "test/fixtures/DocumenterGitHubActions/docs/src/index.md",
"chars": 249,
"preview": "```@meta\nCurrentModule = DocumenterGitHubActions\n```\n\n# DocumenterGitHubActions\n\nDocumentation for [DocumenterGitHubActi"
},
{
"path": "test/fixtures/DocumenterGitHubActions/src/DocumenterGitHubActions.jl",
"chars": 69,
"preview": "module DocumenterGitHubActions\n\n# Write your package code here.\n\nend\n"
},
{
"path": "test/fixtures/DocumenterGitHubActions/test/runtests.jl",
"chars": 119,
"preview": "using DocumenterGitHubActions\nusing Test\n\n@testset \"DocumenterGitHubActions.jl\" begin\n # Write your tests here.\nend\n"
},
{
"path": "test/fixtures/DocumenterGitLabCI/.github/dependabot.yml",
"chars": 682,
"preview": "# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates\nversion: 2\nupda"
},
{
"path": "test/fixtures/DocumenterGitLabCI/.github/workflows/CI.yml",
"chars": 1111,
"preview": "name: CI\non:\n push:\n branches:\n - main\n tags: ['*']\n pull_request:\n workflow_dispatch:\nconcurrency:\n # Sk"
},
{
"path": "test/fixtures/DocumenterGitLabCI/.github/workflows/TagBot.yml",
"chars": 689,
"preview": "name: TagBot\non:\n issue_comment:\n types:\n - created\n workflow_dispatch:\njobs:\n TagBot:\n if: github.event_n"
},
{
"path": "test/fixtures/DocumenterGitLabCI/.gitignore",
"chars": 79,
"preview": "*.jl.*.cov\n*.jl.cov\n*.jl.mem\n/Manifest*.toml\n/docs/Manifest*.toml\n/docs/build/\n"
},
{
"path": "test/fixtures/DocumenterGitLabCI/.gitlab-ci.yml",
"chars": 908,
"preview": ".script:\n script:\n - |\n julia --project=@. -e '\n using Pkg\n Pkg.build()\n Pkg.test(coverage"
},
{
"path": "test/fixtures/DocumenterGitLabCI/LICENSE",
"chars": 1063,
"preview": "MIT License\n\nCopyright (c) 2019 tester\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof "
},
{
"path": "test/fixtures/DocumenterGitLabCI/Project.toml",
"chars": 228,
"preview": "name = \"DocumenterGitLabCI\"\nuuid = \"c51a4d33-e9a4-4efb-a257-e0de888ecc28\"\nauthors = [\"tester\"]\nversion = \"1.0.0-DEV\"\n\n[c"
},
{
"path": "test/fixtures/DocumenterGitLabCI/README.md",
"chars": 640,
"preview": "# DocumenterGitLabCI\n\n[](https://tester.gitlab.io/DocumenterGitLab"
},
{
"path": "test/fixtures/DocumenterGitLabCI/docs/Manifest.toml",
"chars": 4002,
"preview": "# This file is machine-generated - editing it directly is not advised\n\njulia_version = \"1.7.2\"\nmanifest_format = \"2.0\"\n\n"
},
{
"path": "test/fixtures/DocumenterGitLabCI/docs/Project.toml",
"chars": 59,
"preview": "[deps]\nDocumenter = \"e30172f5-a6a5-5a46-863b-614d45cd2de4\"\n"
},
{
"path": "test/fixtures/DocumenterGitLabCI/docs/make.jl",
"chars": 455,
"preview": "using DocumenterGitLabCI\nusing Documenter\n\nDocMeta.setdocmeta!(DocumenterGitLabCI, :DocTestSetup, :(using DocumenterGitL"
},
{
"path": "test/fixtures/DocumenterGitLabCI/docs/src/index.md",
"chars": 224,
"preview": "```@meta\nCurrentModule = DocumenterGitLabCI\n```\n\n# DocumenterGitLabCI\n\nDocumentation for [DocumenterGitLabCI](https://gi"
},
{
"path": "test/fixtures/DocumenterGitLabCI/src/DocumenterGitLabCI.jl",
"chars": 64,
"preview": "module DocumenterGitLabCI\n\n# Write your package code here.\n\nend\n"
},
{
"path": "test/fixtures/DocumenterGitLabCI/test/runtests.jl",
"chars": 109,
"preview": "using DocumenterGitLabCI\nusing Test\n\n@testset \"DocumenterGitLabCI.jl\" begin\n # Write your tests here.\nend\n"
},
{
"path": "test/fixtures/DocumenterTravis/.github/dependabot.yml",
"chars": 682,
"preview": "# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates\nversion: 2\nupda"
},
{
"path": "test/fixtures/DocumenterTravis/.github/workflows/CI.yml",
"chars": 1111,
"preview": "name: CI\non:\n push:\n branches:\n - main\n tags: ['*']\n pull_request:\n workflow_dispatch:\nconcurrency:\n # Sk"
},
{
"path": "test/fixtures/DocumenterTravis/.github/workflows/TagBot.yml",
"chars": 689,
"preview": "name: TagBot\non:\n issue_comment:\n types:\n - created\n workflow_dispatch:\njobs:\n TagBot:\n if: github.event_n"
},
{
"path": "test/fixtures/DocumenterTravis/.gitignore",
"chars": 50,
"preview": "/Manifest*.toml\n/docs/Manifest*.toml\n/docs/build/\n"
},
{
"path": "test/fixtures/DocumenterTravis/.travis.yml",
"chars": 905,
"preview": "# Documentation: http://docs.travis-ci.com/user/languages/julia\nlanguage: julia\nnotifications:\n email: false\njulia:\n -"
},
{
"path": "test/fixtures/DocumenterTravis/LICENSE",
"chars": 1063,
"preview": "MIT License\n\nCopyright (c) 2019 tester\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof "
},
{
"path": "test/fixtures/DocumenterTravis/Project.toml",
"chars": 226,
"preview": "name = \"DocumenterTravis\"\nuuid = \"c51a4d33-e9a4-4efb-a257-e0de888ecc28\"\nauthors = [\"tester\"]\nversion = \"1.0.0-DEV\"\n\n[com"
},
{
"path": "test/fixtures/DocumenterTravis/README.md",
"chars": 591,
"preview": "# DocumenterTravis\n\n[](https://tester.github.io/DocumenterTr"
},
{
"path": "test/fixtures/DocumenterTravis/docs/Manifest.toml",
"chars": 4000,
"preview": "# This file is machine-generated - editing it directly is not advised\n\njulia_version = \"1.7.2\"\nmanifest_format = \"2.0\"\n\n"
},
{
"path": "test/fixtures/DocumenterTravis/docs/Project.toml",
"chars": 59,
"preview": "[deps]\nDocumenter = \"e30172f5-a6a5-5a46-863b-614d45cd2de4\"\n"
},
{
"path": "test/fixtures/DocumenterTravis/docs/make.jl",
"chars": 531,
"preview": "using DocumenterTravis\nusing Documenter\n\nDocMeta.setdocmeta!(DocumenterTravis, :DocTestSetup, :(using DocumenterTravis);"
},
{
"path": "test/fixtures/DocumenterTravis/docs/src/index.md",
"chars": 214,
"preview": "```@meta\nCurrentModule = DocumenterTravis\n```\n\n# DocumenterTravis\n\nDocumentation for [DocumenterTravis](https://github.c"
},
{
"path": "test/fixtures/DocumenterTravis/src/DocumenterTravis.jl",
"chars": 62,
"preview": "module DocumenterTravis\n\n# Write your package code here.\n\nend\n"
},
{
"path": "test/fixtures/DocumenterTravis/test/runtests.jl",
"chars": 105,
"preview": "using DocumenterTravis\nusing Test\n\n@testset \"DocumenterTravis.jl\" begin\n # Write your tests here.\nend\n"
},
{
"path": "test/fixtures/WackyOptions/.JuliaFormatter.toml",
"chars": 95,
"preview": "# See https://domluna.github.io/JuliaFormatter.jl/stable/ for a list of options\nstyle = \"blue\"\n"
},
{
"path": "test/fixtures/WackyOptions/.appveyor.yml",
"chars": 770,
"preview": "# Documentation: https://github.com/JuliaCI/Appveyor.jl\nenvironment:\n matrix:\n - julia_version: 1.2\nplatform:\n - x6"
},
{
"path": "test/fixtures/WackyOptions/.cirrus.yml",
"chars": 359,
"preview": "freebsd_instance:\n image: freebsd-123\ntask:\n name: FreeBSD\n artifacts_cache:\n folder: ~/.julia/artifacts\n env:\n "
},
{
"path": "test/fixtures/WackyOptions/.codecov.yml",
"chars": 41,
"preview": "DO NOT CHANGE THE CONTENTS OF THIS FILE!\n"
},
{
"path": "test/fixtures/WackyOptions/.coveralls.yml",
"chars": 41,
"preview": "DO NOT CHANGE THE CONTENTS OF THIS FILE!\n"
},
{
"path": "test/fixtures/WackyOptions/.drone.star",
"chars": 649,
"preview": "def main(ctx):\n pipelines = []\n for arch in [\"arm\", \"arm64\"]:\n for julia in [\"1.2\", \"1.3\"]:\n pipelines.append("
},
{
"path": "test/fixtures/WackyOptions/.github/dependabot.yml",
"chars": 682,
"preview": "# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates\nversion: 2\nupda"
},
{
"path": "test/fixtures/WackyOptions/.github/workflows/CI.yml",
"chars": 2033,
"preview": "name: CI\non:\n push:\n branches:\n - whackybranch\n tags: ['*']\n pull_request:\n workflow_dispatch:\nconcurrency"
},
{
"path": "test/fixtures/WackyOptions/.github/workflows/CompatHelper.yml",
"chars": 505,
"preview": "name: CompatHelper\non:\n schedule:\n - cron: 0 0 */3 * *\n workflow_dispatch:\njobs:\n CompatHelper:\n runs-on: ubunt"
},
{
"path": "test/fixtures/WackyOptions/.github/workflows/Register.yml",
"chars": 339,
"preview": "name: Register Package\non:\n workflow_dispatch:\n inputs:\n version:\n description: gimme version\n re"
},
{
"path": "test/fixtures/WackyOptions/.github/workflows/TagBot.yml",
"chars": 1031,
"preview": "name: TagBot\non:\n issue_comment:\n types:\n - created\n workflow_dispatch:\njobs:\n TagBot:\n if: github.event_n"
},
{
"path": "test/fixtures/WackyOptions/.gitignore",
"chars": 69,
"preview": "*.jl.*.cov\n*.jl.cov\n*.jl.mem\n/docs/Manifest*.toml\n/docs/build/\na\nb\nc\n"
},
{
"path": "test/fixtures/WackyOptions/.gitlab-ci.yml",
"chars": 170,
"preview": ".script:\n script:\n - |\n julia --project=@. -e '\n using Pkg\n Pkg.build()\n Pkg.test()'\nJulia"
},
{
"path": "test/fixtures/WackyOptions/.travis.yml",
"chars": 244,
"preview": "# Documentation: http://docs.travis-ci.com/user/languages/julia\nlanguage: julia\nnotifications:\n email: false\njulia:\n -"
},
{
"path": "test/fixtures/WackyOptions/CITATION.bib",
"chars": 182,
"preview": "@misc{WackyOptions.jl,\n\tauthor = {tester},\n\ttitle = {WackyOptions.jl},\n\turl = {https://x.com/tester/WackyOptions."
},
{
"path": "test/fixtures/WackyOptions/CODEOWNERS",
"chars": 42,
"preview": "* @user\nREADME.md @group user@example.com\n"
},
{
"path": "test/fixtures/WackyOptions/LICENSE",
"chars": 738,
"preview": "ISC License\n\nCopyright (c) 2019, tester\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpos"
},
{
"path": "test/fixtures/WackyOptions/Manifest.toml",
"chars": 186,
"preview": "# This file is machine-generated - editing it directly is not advised\n\njulia_version = \"1.10.6\"\nmanifest_format = \"2.0\"\n"
},
{
"path": "test/fixtures/WackyOptions/Project.toml",
"chars": 131,
"preview": "name = \"WackyOptions\"\nuuid = \"c51a4d33-e9a4-4efb-a257-e0de888ecc28\"\nauthors = [\"tester\"]\nversion = \"1.0.0\"\n\n[compat]\njul"
},
{
"path": "test/fixtures/WackyOptions/README.md",
"chars": 1523,
"preview": "# WackyOptions [](https://tester.github.io/WackyOptions.jl/s"
},
{
"path": "test/fixtures/WackyOptions/docs/Manifest.toml",
"chars": 3992,
"preview": "# This file is machine-generated - editing it directly is not advised\n\njulia_version = \"1.7.2\"\nmanifest_format = \"2.0\"\n\n"
},
{
"path": "test/fixtures/WackyOptions/docs/Project.toml",
"chars": 59,
"preview": "[deps]\nDocumenter = \"e30172f5-a6a5-5a46-863b-614d45cd2de4\"\n"
},
{
"path": "test/fixtures/WackyOptions/docs/make.jl",
"chars": 545,
"preview": "using WackyOptions\nusing Documenter\n\nDocMeta.setdocmeta!(WackyOptions, :DocTestSetup, :(using WackyOptions); recursive=t"
},
{
"path": "test/fixtures/WackyOptions/docs/src/assets/static.txt",
"chars": 41,
"preview": "DO NOT CHANGE THE CONTENTS OF THIS FILE!\n"
},
{
"path": "test/fixtures/WackyOptions/docs/src/index.md",
"chars": 189,
"preview": "```@meta\nCurrentModule = WackyOptions\n```\n\n# WackyOptions\n\nDocumentation for [WackyOptions](https://x.com/tester/WackyOp"
},
{
"path": "test/fixtures/WackyOptions/src/WackyOptions.jl",
"chars": 58,
"preview": "module WackyOptions\n\n# Write your package code here.\n\nend\n"
},
{
"path": "test/fixtures/WackyOptions/test/Project.toml",
"chars": 144,
"preview": "[deps]\nAqua = \"4c88cf16-eb10-579e-8560-4a9242c79595\"\nJET = \"c3a54625-cd67-489e-a8e7-0a5a0ff4e31b\"\nTest = \"8dfed614-e22c-"
},
{
"path": "test/fixtures/WackyOptions/test/runtests.jl",
"chars": 369,
"preview": "using WackyOptions\nusing Test\nusing Aqua\nusing JET\n\n@testset \"WackyOptions.jl\" begin\n @testset \"Code quality (Aqua.jl"
},
{
"path": "test/fixtures/static.txt",
"chars": 41,
"preview": "DO NOT CHANGE THE CONTENTS OF THIS FILE!\n"
},
{
"path": "test/git.jl",
"chars": 2942,
"preview": "@info \"Running Git tests\"\n\n@testset \"Git repositories\" begin\n @testset \"Does not create Git repo\" begin\n t = t"
},
{
"path": "test/interactive.jl",
"chars": 9816,
"preview": "@info \"Running interactive tests\"\n\nusing PkgTemplates: @with_kw_noshow\n\nconst CR = \"\\r\"\nconst LF = \"\\n\"\nconst UP = \"\\eOA"
},
{
"path": "test/plugin.jl",
"chars": 4501,
"preview": "# Don't move this line from the top, please. {{X}} {{Y}} {{Z}}\n\n@info \"Running plugin tests\"\n\nusing Test: @test_deprecat"
},
{
"path": "test/reference.jl",
"chars": 7009,
"preview": "@info \"Running reference tests\"\n\nconst PROMPT = get(ENV, \"PT_INTERACTIVE\", \"false\") == \"true\" || !haskey(ENV, \"CI\")\ncons"
},
{
"path": "test/runtests.jl",
"chars": 4305,
"preview": "using Base: UUID, contractuser\nusing Base.Filesystem: path_separator\n\nusing LibGit2: LibGit2, GitCommit, GitRemote, GitR"
},
{
"path": "test/show.jl",
"chars": 4592,
"preview": "@info \"Running show tests\"\n\nconst TEMPLATES_DIR = contractuser(PT.default_file())\nconst LICENSES_DIR = joinpath(TEMPLATE"
},
{
"path": "test/template.jl",
"chars": 4221,
"preview": "@info \"Running template tests\"\n\n@testset \"Template\" begin\n @testset \"Template constructor\" begin\n @testset \"us"
}
]
About this extraction
This page contains the full source code of the JuliaCI/PkgTemplates.jl GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 182 files (405.7 KB), approximately 109.6k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.