From 95f6889c67f4896d24307ed006bdd5168ba6399d Mon Sep 17 00:00:00 2001 From: Michael Goerz Date: Tue, 13 Feb 2024 15:58:21 -0500 Subject: [PATCH] Add code to `make.jl` so it can run as a script --- src/Generator.jl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Generator.jl b/src/Generator.jl index 4667845..abfe9ac 100644 --- a/src/Generator.jl +++ b/src/Generator.jl @@ -36,6 +36,14 @@ function make(pkgname; format = :html) sitename = format !== :markdown ? "\n sitename = \"$(pkgname)\"," : "" """ + if abspath(PROGRAM_FILE) == @__FILE__ + # When running the `make.jl` file as a script, automatically activate the + # `docs` environment and dev-install the main package into that environment + import Pkg + Pkg.activate(@__DIR__) + Pkg.develop(path=joinpath(@__DIR__, "..")) + Pkg.instantiate() + end using Documenter$(fmtpkg) using $(pkgname)