-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Correct template path resolution #25
Conversation
🦋 Changeset detectedLatest commit: 1f7d7f9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
8f5da13
to
4cf0240
Compare
4cf0240
to
79b7d11
Compare
Ops, sorry about that. Thanks for fixing, @damassi 🙏 I'll take a closer look and ship this fix later today. |
I made some improvements to path detection in general (so srtd can run from any directory in the project). I had to move your changes into #main, to fix some biome/formatting issues. Edit: Releases as 0.4.6, hopefully that works for you! Thanks again for contributing, @damassi 🙏 |
Thank you for the quick fix! This tool is seriously the tool that SQL has needed for a long time. The possibilities are 🤯 |
Also @t1mmen - sorry for missing the formatting fixes; the issue I ran into requiring the |
@damassi I'm slightly relieved this is the feedback I'm getting :D I sort of couldn't believe how ancient the DX around Postgres was in this day and age, compared to JS/TS-world. Surely I was missing something, I thought. Something like srtd had to exist, I figured... yet, I couldn't find it, hence this project :) As for simplifying contributions, I'll probably re-visit that if issues/PR's keep coming. I wasn't really expecting anyone to notice this/care to fix things, but glad to be proven wrong :) |
Yes, for example:
Would love to see this somehow integrated into the |
User description
Taking the lib for a spin, I noticed that it wasn't resolving the paths to my preexisting templates via the
register
command. It would come out like:And looking at the input paths this seemed indeed an issue:
so
process.cwd()
would append the dir and then the path.Looking closer, by the time templatePath is input, its already been resolved here: https://github.com/t1mmen/srtd/blob/main/src/lib/templateManager.ts#L82
So this simplifies things and fixes the issue, allowing me to register my templates.
PR Type
Bug fix
Description
Fixed incorrect template path resolution in
registerTemplate
.Removed redundant configuration-based path resolution logic.
Simplified path resolution to use
path.resolve
.Changes walkthrough 📝
registerTemplate.ts
Simplify and fix template path resolution logic
src/utils/registerTemplate.ts
getConfig
import and usage.path.resolve
for template path resolution.