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

Provides an option to remove the inessential version number from the generated models #18081

Open
wants to merge 1 commit into
base: v13/dev
Choose a base branch
from

Conversation

AndyButland
Copy link
Contributor

@AndyButland AndyButland commented Jan 23, 2025

Prerequisites

  • I have added steps to test this contribution in the description below

Fixes: #15597

Description

The linked issue started with a point raised on why we include the commit hash in the version number. This does no harm to keep. But the discussion continued to ask if it's necessary to output the version number at all and established that it's not essential, but could be useful for debugging.

The downside - and we found this when working on umbraco.com - is every Umbraco upgrade leads to a lot of changes to these files, which are seemingly unnecessary and can clutter pull requests.

To avoid a behavioural breaking change, even if a harmless one, I've added configuration option to allow you to switch off the inclusion of the version number.

We could consider making this option default to false in a future version, but it's probably OK as is and can be turned on for people that want to avoid the version writing behaviour.

To Test:

  • Configure models builder with source code manual:
"ModelsBuilder": {
  "ModelsMode": "SourceCodeManual",
}
  • Create or edit a document type and verify changes are written to the output folder (by default at \umbraco\models\), and that they include the version number in the [GeneratedCode] attribute.
  • Modify the configuration:
"ModelsBuilder": {
  "ModelsMode": "SourceCodeManual",
  "IncludeVersionNumberInGeneratedModels": false
}
  • Create or edit a document type and verify changes are written to the output folder (by default at \umbraco\models\), and that they don't include the version number.

@mjpraxis
Copy link
Contributor

@AndyButland is it the correct issue (#17998) this PR is fixing?

@AndyButland
Copy link
Contributor Author

is it the correct issue (#17998) this PR is fixing?

No, sorry, I tagged the wrong one. Have updated now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ModelsBuilder generated files use scientific notation for version number
2 participants