rgst-io / stencil

📒 A modern living-template engine for evolving repositories
https://stencil.rgst.io
Apache License 2.0
4 stars 1 forks source link

jaredallard/refactor/modules #80

Closed jaredallard closed 3 weeks ago

jaredallard commented 3 weeks ago

This PR contains a few different changes related to modules.

refactor: rename extensions to nativeext

Renames extensions to nativeext and starts cleaning up the module resolving logic to be less all over the place and to better integrate the native extensions code with the rest of the module resolving logic.

This also switches from go-git to running git commands directly to ease the system authentication story.

fix(slogext): export, use os.Stdout for plugin debugging

We need to export the logger if we want clients to be able to use it, so now we're doing that.

We default to os.Stdout instead of os.Stderr because otherwise log messages will not be plumbed through go-plugin (it only reads stdout for some reason).

refactor(modules): add module resolver

Adds a module resolver library for the purposes of replacing the current version resolver used by the modules package. This does not hook it up yet, but provides us a scalable foundation for resolving versions.

Future PR(s) will change stencil to default to using versions found in the lockfile, as well as adding a stencil upgrade command to upgrade them.

The underlying resolver introduced in this PR supports simple constraint functionality to allow flexibility in its usage in stencil, but there is currently no plans to expose this functionality. Tests have been added to ensure that the following behaviour is followed:

cloudflare-pages[bot] commented 3 weeks ago

Deploying stencil with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0dc741d
Status: ✅  Deploy successful!
Preview URL: https://36529a38.stencil-1wj.pages.dev
Branch Preview URL: https://jaredallard-refactor-modules.stencil-1wj.pages.dev

View logs

codecov[bot] commented 3 weeks ago

Codecov Report

Attention: Patch coverage is 72.19512% with 57 lines in your changes missing coverage. Please review. Files Patch % Lines
internal/modules/nativeext/nativeext.go 40.00% 18 Missing and 3 partials :warning:
internal/modules/resolver/resolver.go 82.64% 14 Missing and 7 partials :warning:
internal/git/git.go 68.96% 6 Missing and 3 partials :warning:
internal/modules/module.go 60.00% 3 Missing and 1 partial :warning:
internal/cmd/stencil/stencil.go 0.00% 1 Missing :warning:
internal/codegen/tpl.go 0.00% 0 Missing and 1 partial :warning:

:loudspeaker: Thoughts on this report? Let us know!

jaredallard commented 3 weeks ago

I'm going to use this as a long-running feature branch instead of one-merge PR. Closing.