Open marc-medley opened 1 year ago
@marc-medley the issue is that the bare template is auto generated and doesn't have any of the information needed to be able to switch it out. See https://github.com/vapor/template/blob/main/manifest.yml and https://github.com/vapor/template/blob/main/Package.swift#L5
Updating the package manifest for INSERT_SOME_URL
here is difficult because there's not a good library for parsing and manipulating it and there are a load of edge cases we'd have to take into account. Essentially the --template
flag is only designed to work with repos that have a manifest and variables we can replace
… information needed to be able to switch [name] out …
In particular, the information appears to variables which use Mustache syntax. (TemplateScaffolder.swift)
import PackageDescription
let package = Package(
name: "{{name}}",
dependencies: [
.package(url: "https://github.com/vapor/vapor.git", from: "4.83.1"),{{#fluent}}
.package(url: "https://github.com/vapor/fluent-{{fluent.db.url}}-driver.git", from: "{{fluent.db.version}}"),{{/fluent}}{{#leaf}}
Essentially the
--template flag
is only designed to work with repos that have a manifest and variables we can replace
If the forward looking roadmap is to generally support Mustache-based Vapor Repository Templates (or some alternative), then it would be helpful to have documentation about the process.
Some areas of potential confusion:
The current Vapor toolbox is operational with either a static-can-use-as-is-repo or a variable-based-repo. The .git/
is set up in both cases.
vapor new VaporHello --template https://github.com/vapor/template-bare
# Cloning template...
# Creating git repository
# Adding first commit
The "a Git repository to use as a template." is appropriate as minimal information. As the items listed above are addressed, then the --help
information could possibly be amplified with some "See [docs|man|help] for more info on static vs variable-based Vapor template repositories."
vapor new --help
# <name> [--template,-T] [--branch] [--output,-o] [--no-commit] [--no-git]
#
# Options:
# template The URL of a Git repository to use as a template.
@marc-medley what's the specific request here?
Describe the bug
vapor new ProjectName --template github/some/url
does not set Package.swiftname:
to the ProjectName.To Reproduce
Steps to reproduce the behavior:
Package.swift
:Expected behavior
I had expected the project name to be handled similar to
vapor new VaporHello -n
command.Package.swift
Environment
Additional context
Comment: Updating the Package.swift
name:
seemed like a reasonable action for the vapor toolbox. If one wants the vapor templateas-is
then a git clone or a zip download could be solid alternatives. That said, there may be other considerations that I'm not aware of.