Skip to content
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

refactor: taskfile/ast package #1450

Merged
merged 5 commits into from
Dec 29, 2023
Merged

refactor: taskfile/ast package #1450

merged 5 commits into from
Dec 29, 2023

Conversation

pd93
Copy link
Member

@pd93 pd93 commented Dec 29, 2023

I've always found it a little strange that the code that reads a Taskfile is in a read package. I'm used to domain-driven packages, so it feels more correct to me to have something like taskfile.Read(...) than read.Taskfile(...). This PR is a proposal to rearrange the API a little bit to something I think is a bit nicer.

Instead of the schema being taskfile.Taskfile, we have a taskfile/ast (Abstract Syntax Tree) package which hosts all the code for parsing and storing the Taskfile syntax. The taskfile package is then responsible for interfacing with Taskfiles (Read(...), Exists(...), Merge(...) etc).

Note: I based this branch on remove-v2-support (#1447), so that needs to be merged first.

Copy link
Member

@andreynering andreynering left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice refactor! 👏

ast could also have been called schema, but both options are more than fine!

Base automatically changed from remove-v2-support to main December 29, 2023 20:26
@pd93 pd93 merged commit 247c258 into main Dec 29, 2023
11 checks passed
@pd93 pd93 deleted the ast branch December 29, 2023 20:32
@pd93
Copy link
Member Author

pd93 commented Dec 29, 2023

ast could also have been called schema, but both options are more than fine!

I did consider schema, but I felt that ast was more accurate as the structures don't always directly correspond to the schema. Rather, they are an abstraction of it. It's also less characters for my lazy fingers to type 🤣

I don't feel strongly about this though if we want to change it before the next release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants