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

Add option to let Documenter clear target folder before rendering documentation #644

Closed
ciberkleid opened this issue May 24, 2024 · 2 comments
Assignees
Labels
in: documentation support Documentation generation type: enhancement Major enhanvements, new features
Milestone

Comments

@ciberkleid
Copy link
Contributor

Request for a Documenter option that clears the target output directory before writing documentaiton.

Reasoning:
If a module is renamed or deleted, any existing documentation will remain in the target output directory until the user runs a mvn clean. This can be misleading as the documentation will include modules that don't exist.

@odrotbohm odrotbohm added in: documentation support Documentation generation type: enhancement Major enhanvements, new features labels May 24, 2024
@tobHai
Copy link
Contributor

tobHai commented Jun 18, 2024

I would like to contribute this functionality.
Currently, I have two options in my mind for the API of this feature.

Option 1:
Add a new boolean parameter to the constructor of Documenter.
Upon the first call of writeXYZ the given output directory is cleared if clearing is enabled for the Documenter instance.
Subsequent calls won't clear the output directory again.

Option 2:
Add a new method to the Documenter which clears the output directory and returns the Documenter instance to allow method chaining with the writeXYZ methods.

@ciberkleid, @odrotbohm what do you think about my suggestions? Do you have a different API in mind for this feature?

@odrotbohm
Copy link
Member

Cora and me had a brief hacking session recently and we went down introducing an Options type similar to what the diagrams and canvas creations already take defaulting to an auto-clean. Find that – highly incomplete – code as a draft here. Feel free to take it from there.

@odrotbohm odrotbohm changed the title Add option to clear target/spring-modulith-docs directory to avoid misleading documentation Add option to let Documenter clear target folder before rendering documentation Jun 19, 2024
tobHai added a commit to tobHai/spring-modulith that referenced this issue Jun 22, 2024
tobHai added a commit to tobHai/spring-modulith that referenced this issue Jun 22, 2024
tobHai added a commit to tobHai/spring-modulith that referenced this issue Jun 22, 2024
tobHai added a commit to tobHai/spring-modulith that referenced this issue Jul 14, 2024
tobHai added a commit to tobHai/spring-modulith that referenced this issue Jul 14, 2024
odrotbohm added a commit that referenced this issue Jul 16, 2024
odrotbohm added a commit that referenced this issue Jul 16, 2024
Documenter now remembers whether it has cleared the output directory so that multiple attempts to clear on one Documenter instance will not wipe the content previously generated on the same instance. All methods ultimately creating files trigger the one-time target folder wipe now.

Moved file system operations into the OutputFolder abstraction.

A couple of parameter renames for consistency.
@odrotbohm odrotbohm added this to the 1.3 M1 milestone Jul 16, 2024
@odrotbohm odrotbohm linked a pull request Jul 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: documentation support Documentation generation type: enhancement Major enhanvements, new features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants