Hi! :wave: The current tailor implementation for t...
# development
e
Hi! 👋 The current tailor implementation for the javascript, typescript, and tsx target types have hardcoded file patterns that cannot be overridden. I'd like to send a PR to enhance this by allowing folks to configure this for different naming conventions, particularly around test file naming (e.g.
*-test.js
). What route would be preferable here? Subsystem options? Something else?
c
Thank you for taking a stab at it! I'm not familiar with the js and friends backends, but I'd suggest taking a look at the prior art like https://www.pantsbuild.org/stable/reference/targets/python_test_utils#sources
e
unless I'm mistaken, that sources field is only going to be useful after the targets are tailored. if my existing files don't match the tailor's expected file globs, the targets won't be created. I have a large repo and I do not want to create these targets by hand.
fwiw, the js and friends implement this in a similar way to the python tailor code.
wrt to the python impl, there's room for the same improvements there imo, although i think there is a fair bit more naming convention variability in js-land.
and in terms of prior art, the PythonSetup Subsystem already contains options that control tailor behavior. to me, that (and analogous subsystems for js and friends) seems like a good place to introduce my desired configurability.
c
Ah, I think the way I've backed into a solution was that the alternative sources were attached to a macro, which then had an
[tailor.alias_mapping]
e
I'm not sure I follow your last comment. Do you think it's not worth making a change like I've suggested? (Sending to the channel for visibility for any other opinions as well)
I do follow now that I re-read what you wrote. IMO, I'd rather not maintain a macro just for this. I do still think that adding functionality to change the default during
tailor
controlled by a subsystem option while maintaining the current default behavior would be valuable to lots of users.
c
Sure if you think it is an improvement I don't want to discourage you. My hope was merely that I could do some helpful dot connecting.
e
for visibility, i opened this gh issue to track https://github.com/pantsbuild/pants/issues/22067
👍 1
🙏 1