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

🚀 Feature: Allow overriding Knip entry #2147

Closed
2 tasks done
JoshuaKGoldberg opened this issue Apr 4, 2025 · 2 comments · Fixed by #2150
Closed
2 tasks done

🚀 Feature: Allow overriding Knip entry #2147

JoshuaKGoldberg opened this issue Apr 4, 2025 · 2 comments · Fixed by #2150
Assignees
Labels
status: accepting prs Please, send a pull request to resolve this! type: feature New enhancement or request

Comments

@JoshuaKGoldberg
Copy link
Owner

JoshuaKGoldberg commented Apr 4, 2025

Feature Request Checklist

Overview

Repos may need to customize their knip.json on top of what blockKnip currently allows. For example, https://github.com/JoshuaKGoldberg/refined-saved-replies switches its entry to src/content-script.ts rather than index.ts.

I'll make entry an Addon.

Additional Info

🎁

@JoshuaKGoldberg JoshuaKGoldberg added status: accepting prs Please, send a pull request to resolve this! type: feature New enhancement or request labels Apr 4, 2025
@JoshuaKGoldberg JoshuaKGoldberg self-assigned this Apr 4, 2025
@JoshuaKGoldberg JoshuaKGoldberg changed the title 🚀 Feature: Allow overriding Knip properties 🚀 Feature: Allow overriding Knip entry Apr 4, 2025
JoshuaKGoldberg added a commit that referenced this issue Apr 4, 2025
## PR Checklist

- [x] Addresses an existing open issue: fixes #2147
- [x] That issue was marked as [`status: accepting
prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
- [x] Steps in
[CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md)
were taken

## Overview

Goes a bit beyond #2147's original intended scope of `entry` by also
making `project` an Addon. This way, `blockTypeScript` and `blockVitest`
fully communicate all file globs to `blockKnip`.

Also expands `blockKnip`'s `intake` to read both of those new Addon
properties. This will allow customizations such as
https://github.com/JoshuaKGoldberg/refined-saved-replies's `entry:
["src/content-script.ts"]` to be inferred.

🎁
Copy link

github-actions bot commented Apr 4, 2025

🎉 This is included in version v2.29.0 🎉

The release is available on:

Cheers! 📦🚀

@webpro
Copy link
Contributor

webpro commented Apr 10, 2025

Repos may need to customize their knip.json on top of what blockKnip currently allows. For example, https://github.com/JoshuaKGoldberg/refined-saved-replies switches its entry to src/content-script.ts rather than index.ts.

I'll make entry an Addon.

Looking at https://github.com/JoshuaKGoldberg/refined-saved-replies/blob/9306079774dfb3e3294e9c8e87c5cc9c05a70ff0/package.json#L28

Wanted to let you know that Knip understands for quite a few of executables like esbuild that the first positional argument represents an entry file:

  • There's a "fallback resolver" for simple cases that don't have an actual plugin:
    • babel-node, esbuild, execa, vite-node, zx
    • source
  • Some plugins have a "Shell commands" section, e.g. the tsx plugin:

While this totally lacks documentation/discovery and might seem a bit of a random list of executables, just wanted to chime in and say what's currently available i.e. for aforementioned executables the entry files do not require to be modified cq added to the config (also obviously it does not hurt in any way to make it more explicit). Feel free to request additions if that's useful, I'm happy to expand on this idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepting prs Please, send a pull request to resolve this! type: feature New enhancement or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants