这是indexloc提供的服务,不要输入任何密码
Skip to content

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

Merged
merged 23 commits into from
Nov 16, 2022

Conversation

mehulkar
Copy link
Contributor

@mehulkar mehulkar commented Nov 15, 2022

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.
@vercel
Copy link

vercel bot commented Nov 15, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
examples-basic-web 🔄 Building (Inspect) Nov 16, 2022 at 9:06PM (UTC)
examples-designsystem-docs 🔄 Building (Inspect) Nov 16, 2022 at 9:06PM (UTC)
examples-native-web 🔄 Building (Inspect) Nov 16, 2022 at 9:06PM (UTC)
examples-nonmonorepo 🔄 Building (Inspect) Nov 16, 2022 at 9:06PM (UTC)
3 Ignored Deployments
Name Status Preview Comments Updated
examples-kitchensink-blog ⬜️ Ignored (Inspect) Nov 16, 2022 at 9:06PM (UTC)
examples-svelte-web ⬜️ Ignored (Inspect) Nov 16, 2022 at 9:06PM (UTC)
turbo-site ⬜️ Ignored (Inspect) Visit Preview Nov 16, 2022 at 9:06PM (UTC)

@mehulkar mehulkar force-pushed the mehulkar/turbo-550-codemod-for-default-outputs branch from 1ff7964 to b5b5110 Compare November 15, 2022 22:06
@mehulkar mehulkar marked this pull request as ready for review November 16, 2022 00:27
@mehulkar mehulkar requested review from a team as code owners November 16, 2022 00:27
@mehulkar mehulkar requested review from tknickman and chris-olszewski and removed request for a team November 16, 2022 00:27
Copy link
Contributor

@nathanhammond nathanhammond left a 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) {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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

mehulkar and others added 2 commits November 15, 2022 23:59
Co-authored-by: Nathan Hammond <nathan.hammond@vercel.com>
Base automatically changed from mehulkar/turbo-549-remove-default-outputs-behavior to main November 16, 2022 08:07
@github-actions
Copy link
Contributor

github-actions bot commented Nov 16, 2022

🟢 CI successful 🟢

Thanks

Copy link
Contributor

@nathanhammond nathanhammond left a 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!

[taskName: string]: TaskDefinition;
}

export default function addDefaultOutputs(files: string[], flags: Flags) {
Copy link
Contributor

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.

@nathanhammond nathanhammond added the pr: fixship A PR which is approved with notes and does not require re-review. label Nov 16, 2022
Copy link
Member

@tknickman tknickman left a 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

@mehulkar
Copy link
Contributor Author

@tknickman nice catch!! updated

Copy link
Member

@tknickman tknickman left a 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!

  1. packages/turbo-codemod/__tests__/set-default-ouptuts.test.ts filename is misspelled (should be set-default-outputs.test.ts)
  2. 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)

@mehulkar mehulkar changed the title Add codemod to add default outputs when outputs is omitted Add codemod to set default outputs in turbo.json Nov 16, 2022
@mehulkar mehulkar merged commit 0492236 into main Nov 16, 2022
@mehulkar mehulkar deleted the mehulkar/turbo-550-codemod-for-default-outputs branch November 16, 2022 21:28
tknickman pushed a commit that referenced this pull request Jan 10, 2023
Stacked PRs:
- #2712 
- #2714
- Release `turbo@1.7`
- **(This one)** #2713
- #2738
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: fixship A PR which is approved with notes and does not require re-review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants