Skip to content

Commit

Permalink
Relax template package.yaml check to support packages in a subdirectory
Browse files Browse the repository at this point in the history
  • Loading branch information
jship committed Oct 13, 2023
1 parent 74a36d6 commit ff0dea8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Release notes:

* The hash used as a key for Stack's pre-compiled package cache has changed,
following the dropping of support for Cabal versions older than `1.24.0.0`.
* The check used in `stack new` now does a suffix match to find `package.yaml`
rather than an exact match. This supports defining templates with packages in
subdirectories.

**Changes since v2.13.1:**

Expand Down
2 changes: 1 addition & 1 deletion src/Stack/New.hs
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ applyTemplate project template nonceParams dir templateText = do
template
(flow "the template does not contain any files.")

let isPkgSpec f = ".cabal" `L.isSuffixOf` f || f == "package.yaml"
let isPkgSpec f = ".cabal" `L.isSuffixOf` f || "package.yaml" `L.isSuffixOf` f
unless (any isPkgSpec . M.keys $ files) $
prettyThrowM $ TemplateInvalid
template
Expand Down

0 comments on commit ff0dea8

Please sign in to comment.