-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add codemod to set default outputs in turbo.json #2714
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
Add codemod to set default outputs in turbo.json #2714
Conversation
This behavior is frameworks-specific and unintuitive to new users. Specifically, this removes the confusion between omitting the outputs key and setting to an empty array. Additionally, this will allow us to more clearly define turbo.json composition, so locally-scoped turbo.json configs can override outputs, without rationalizing what happens to this implicit behavior.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Ignored Deployments
|
d3da1bd
to
8122a0f
Compare
1ff7964
to
b5b5110
Compare
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.
A couple of small things, mostly because the default behavior is more sensible now.
[taskName: string]: TaskDefinition; | ||
} | ||
|
||
export default function addDefaultOutputs(files: string[], flags: Flags) { |
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.
Naming thoughts:
- specify-default-outputs?
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 followed add-package-manager
, but maybe it should be more like like "fill-in-previously-implicit-defaults" 😆 . Ok with anything though if you have a mild or strong opinion; i have none!
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
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 only mention codemod naming because it's also dropping []
. If you have a better idea go for it, otherwise this is non-blocking.
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.
Good point. Renamed to set-default-outputs
Co-authored-by: Nathan Hammond <nathan.hammond@vercel.com>
🟢 CI successful 🟢Thanks |
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 a fix-ship!
packages/turbo-codemod/__tests__/__fixtures__/thingie/turbo.json
Outdated
Show resolved
Hide resolved
[taskName: string]: TaskDefinition; | ||
} | ||
|
||
export default function addDefaultOutputs(files: string[], flags: Flags) { |
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 only mention codemod naming because it's also dropping []
. If you have a better idea go for it, otherwise this is non-blocking.
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 new transform needs to be added to TRANSFORMER_INQUIRER_CHOICES
in src/index.ts
to make it available via the CLI
Co-authored-by: Nathan Hammond <nathan.hammond@vercel.com>
Co-authored-by: Nathan Hammond <nathan.hammond@vercel.com>
@tknickman nice catch!! updated |
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.
Two more nitpicks, but approving in the meantime!
packages/turbo-codemod/__tests__/set-default-ouptuts.test.ts
filename is misspelled (should beset-default-outputs.test.ts
)- All of the other codemods include a summary section:
console.log("All done.");
console.log("Results:");
console.log(chalk.red(`0 errors`));
console.log(chalk.yellow(`${skippedCount} skipped`));
console.log(chalk.yellow(`${unmodifiedCount} unmodified`));
console.log(chalk.green(`${modifiedCount} modified`));
I would recommend adding this for consistency (should be simple since we're only ever touching one file here)
Stacked PRs:
turbo@1.7