Sitecore / jss

Software development kit for JavaScript developers building web applications with Sitecore Experience Platform
https://jss.sitecore.com
Apache License 2.0
261 stars 272 forks source link

Allow config of templating util settings from app directly #1775

Closed philipbushnell-valtech closed 4 months ago

philipbushnell-valtech commented 5 months ago

What is the improvement or update you wish to see?

In sitecore-jss-dev-tools/src/templating/utils.ts there are settings for finer control over how items are retrieved yet these settings are not configurable beyond their internal usages (e.g. in sitecore-jss-dev-tools/src/templating/components.ts). It would be massively helpful if these could be configured from the application directly (e.g. via generateComponentBuilder).

Is there any context that might help us understand?

In our app, we have additional co-located files alongside our components (e.g. for testing) but without being able to change the fileFormat setting, it fails our build due to it outputting irrelevant files in the generated componentBuilder file (and things such as test globals like describe are not being explicitly imported so fail).

I've had to patch-package a regex setting change to work around this issue but it would be much better to just configure the settings directly in the app (i.e. in scripts/generate-component-builder/plugins/component-builder.ts) but I can't.

Does the docs page already exist? Please link to it.

No response

addy-pathania commented 4 months ago

@philipbushnell-valtech would you like us to provide appropriate documentation for this?

philipbushnell-valtech commented 4 months ago

@sc-addypathania possibly I've raised the wrong thing here - this is a tech improvement. I must have only read the "Update or Improvement" bit of "Docs Request for an Update or Improvement" and assumed that was what I needed to press. I can see the label doesn't really match the request; do I need to raise a new issue or can this be re-labelled as the correct thing?

philipbushnell-valtech commented 4 months ago

@sc-addypathania actually I can see that it needs to be a discussion - I'll close and move it over to there. 🙂

philipbushnell-valtech commented 4 months ago

See https://github.com/Sitecore/jss/discussions/1782