-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Turbo Config refactor #1739
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
Turbo Config refactor #1739
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
// ReadTurboJSON reads turbo.json in to a struct | ||
func ReadTurboJSON(path AbsolutePath) (*TurboJSON, error) { | ||
// readTurboJSON reads the CONFIG_FILE in to a struct | ||
func readTurboJSON(path AbsolutePath) (*TurboJSON, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now a private function, because it is only used internally here
7a9d8b8
to
c6b73a3
Compare
// ReadTurboConfig toggles between reading from package.json or turbo.json to support early adopters. | ||
const CONFIG_FILE = "turbo.json" | ||
|
||
// ReadTurboConfig toggles between reading from package.json or the CONFIG_FILE to support early adopters. | ||
func ReadTurboConfig(rootPath AbsolutePath, rootPackageJSON *PackageJSON) (*TurboJSON, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to remove rootPackageJSON
and read package.json internally, but the parent function is also reading it, so we'd duplicate the read. If we only needed to read package.json
when turbo.json
was missing, I think it would be a good tradeoff, but we are always reading package.json
so we can log when turbo
key exists and should be removed.
I would like to remove it, so we don't have to reproduce it a package.json for every test case we write and pass it in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We always need to read every package.json
anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I was hoping to inline, but only if the double read would only apply in the fallback scenario (i.e. not very often). But since it's always used in this function, I can't make that tradeoff
794ac0a
to
ae2720c
Compare
// ReadTurboConfig toggles between reading from package.json or turbo.json to support early adopters. | ||
const CONFIG_FILE = "turbo.json" | ||
|
||
// ReadTurboConfig toggles between reading from package.json or the CONFIG_FILE to support early adopters. | ||
func ReadTurboConfig(rootPath AbsolutePath, rootPackageJSON *PackageJSON) (*TurboJSON, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We always need to read every package.json
anyways.
1831e42
to
62a19cf
Compare
53d733f
to
7eb9a5d
Compare
Patch to vercel#1739
I'm starting to work on updating where
env
vars are read from. As I started writing a test case,, I noticed that our unit test is against a function that we don't actually use, so I've updated the test case here.