Closed Morgul closed 4 months ago
@Morgul I think some tests need to be updated. additionally, degit's issue with subgroups are supposed to be fixed now (?). should we still replace degit with tiged?
So, the issues with the tests are cause because I forked the project, so for this test, it's getting a different value:
I didn't think updating it made since, as it would break the main repo once it was merged. I'm happy to update the test, just not sure the best way to update. Maybe we just skip getting the repo owner as part of the test?
As for degit
: I still can't use tmplr with subgroups on gitlab, so I think the change is still needed. It hasn't had any commits in 3 years and I think most development is happening over at tiged
anyway.
So, the issues with the tests are cause because I forked the project, so for this test, it's getting a different value ... I'm happy to update the test, just not sure the best way to update. Maybe we just skip getting the repo owner as part of the test?
Well then we wouldn't be testing that functionality 😅 Yeah this is my bad because I didn't think of forks when writing this particular test. I suppose the cleanest solution would be to create a temporary folder (this is already done in the next test), clone a pre-designated repository inside it, and then create a git provider within that repository and check the values accordingly, so the test is not dependent on the current repository.
If fixing this issue is a hassle though, I suppose it is ok to ignore the test right now and issue a fix for it later, since it wouldn't fail for the actual build of the library.
Also would it be possible to add a test highlighting the issue you had? e.g. using node-fs
to clone a repository that couldn't have been cloned before?
If fixing this issue is a hassle though, I suppose it is ok to ignore the test right now and issue a fix for it later, since it wouldn't fail for the actual build of the library.
I'll give it a shot, I should be able to work that out. I was mainly trying to have as minimally invasive a set of changes as possible.
Also would it be possible to add a test highlighting the issue you had? e.g. using
node-fs
to clone a repository that couldn't have been cloned before?
...Ok, this one's my bad. I should have added a test for that! Probably won't be today, but I'll circle back around and get this updated.
I'll give it a shot, I should be able to work that out. I was mainly trying to have as minimally invasive a set of changes as possible.
Pushed a change that makes a temp directory and does a checkout. I went with the simplest option, which is just using child-process
to call git
; I wasn't sure if you'd rather add something like node-git
or how you'd want to handle it, but it seems to work well.
I'll work on writing the new test next, figured I'd get this change in first so you could look at it and give me feedback if you want changes.
I'll give it a shot, I should be able to work that out. I was mainly trying to have as minimally invasive a set of changes as possible.
Pushed a change that makes a temp directory and does a checkout. I went with the simplest option, which is just using
child-process
to callgit
; I wasn't sure if you'd rather add something likenode-git
or how you'd want to handle it, but it seems to work well.I'll work on writing the new test next, figured I'd get this change in first so you could look at it and give me feedback if you want changes.
the code looks good to me. I was wondering whether there the OS-dependent quirks of childProcess()
would affect the test in different environments but it appears not (as all tests are passing correctly in all envs).
@loreanvictor Sorry it's taken me a minute to finish this up.
I've got a test all worked up for the new functionality, but I've hit a snag I missed previously; it looks like you need to pass tiged
a subgroup: true
option to make it work correctly with subgroups. Doing that works well, but breaks anything not a subgroup.
Do you think it's worth adding support for setting tiged options through the fetch
function? Or maybe just adding a single optional subgroup
parameter to control the required tiged option?
@loreanvictor Sorry it's taken me a minute to finish this up.
I've got a test all worked up for the new functionality, but I've hit a snag I missed previously; it looks like you need to pass
tiged
asubgroup: true
option to make it work correctly with subgroups. Doing that works well, but breaks anything not a subgroup.Do you think it's worth adding support for setting tiged options through the
fetch
function? Or maybe just adding a single optionalsubgroup
parameter to control the required tiged option?
what are other tiged options? I suspect we could add an option for subgroups, up-propagating it to tmplr
CLI itself. it's not really neat, but it might be ok.
For now, I exposed the subgroup option. The other options seem like renamed versions of the degit
options, so it's probably not worth exposing all of them right now.
as a reminder for future, and to track progress, putting this on production requires:
filesystem
typesubgroup
option for degit
commandtmplr-core
tmplr-node
to use the new core, publish a new version of tmplr-node
tmplr-*
packages, publishing new versions when necessary.tmplr
proper to use the new packages. adding support for the new subgroup option to the corresponding recipe, and to the CLI args parser.Thanks for that checklist, it means (as I have time) I can work on the various parts of this to get it across the line!
This change switches to using
tiged
in place ofdegit
, to fix issues with cloning from gitlab.This should fix https://github.com/loreanvictor/tmplr/issues/28.
Added types from
@types/degit
, ported to matchtiged
's api. (Note: There's an open PR portingtiged
to TypeScript, so these types won't be required forever.)