Hi all,
I want to ask the community if they're using the docc process-archive transform-for-static-hosting subcommand (and if so; how and why) and very informally float the idea of deprecating this subcommand.
The history of this subcommand
The Swift-DocC output—a '.doccarchive' directory—is a single page web application that contains a per-page JSON file which Swift-DocC Render turns into rich documentation web pages using JavaScript. The very first version of this output required custom routing rules on the web server and was incompatible with static hosting environments, like GitHub Pages.
Back in 2021, DocC added both a --transform-for-static-hosting flag to the main docc convert command—to add an identical per-page copy of the render template's "index.html" file—and a dedicated transform-for-static-hosting subcommand to make the same identical per-page copy of the render template's "index.html" file. Later in 2022, this transformation was enabled by default for docc convert, making DocC's output compatible with static hosting environments unless the developer explicitly opted out by passing --no-transform-for-static-hosting. At this point, the usefulness of the subcommand was severely diminished.
Ever since the introduction of this subcommand in 2021, it has been incompatible with DocC's support for custom page headers and page footers (--experimental-enable-custom-templates available since DocC's introductory release). This meant that if a developer built documentation with custom header and footer elements and then ran the transform-for-static-hosting subcommand it would destructively lose the custom header and footer information. More recently, DocC added minimal static content in each per-page HTML file, which the transform-for-static-hosting subcommand also doesn't support—destructively losing this content when run.
Since then, both of these issues have been reported (1, 2) and I was surprised to hear that anyone was still using this subcommand for anything at all.
Are people still using this subcommand?
It's at this point where I would like to ask people if they are still using this subcommand and—more importantly—what workflows they need this subcommand for and why the default version of these per-page HTML files (with custom footers and static content) isn't sufficient.
Possible futures of this subcommand?
Talking through this, thinking out loud. Given the context that there is an ongoing effort (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...) to build on the already shipping feature to add static content to each page and use it to make DocC output fully static HTML pages as an alternative to the single page web application, I can't help but wonder if this subcommand has a future and if it's worth spending any time and effort to improve it.
I believe that when we get there, this subcommand will ultimately be useless. It will certainly be completely incompatible with the static HTML output but even for the single page web application output, I fail to imagine a use case for running the transform-for-static-hosting subcommand that wouldn't be better served with using the static HTML output from the beginning instead.
The transform-for-static-hosting subcommand has since the beginning been implemented as a basic file copying operation that takes a render template "index.html" file as input and makes identical copies of it for each page. This render template file could be different from what's already in the single page web application output. Redefining this subcommand to instead parse and individually merge the provided render template file with any existing per-page file would be some amount of work that has an opportunity cost to it—we could work on other things instead.
If we haven't done this redefining of this subcommand by the time that static HTML output is an option I don't think we would ever find it worthwhile. In the meantime, I'm still wondering if the opportunity cost is worth it.
Over the coming few years I'm picturing three different futures for this subcommand:
- We can leave it as-is; a mildly destructive operation that loses custom headers/footers and loses static content. When static HTML output becomes an option we may update it to detect and warn about the complete loss of data if passed static HTML output as its input. We may alternatively choose to remove the subcommand.
- We can redefine to individually merge and parse files if there is some strong use case that would make this a priority. When static HTML output becomes an option, those (currently unknown) use cases may no longer need this subcommand. At this point we may still consider the subcommand too useless to keep around.
- We can deprecate the subcommand and communicate its upcoming removal, which could possibly be before static HTML output becomes an option considering that the default per-page template files already have more features/information.
Regardless of what we do in the short term, I personally have a hard time seeing a reason to keep this subcommand around for more than a couple of years. This leads me to wonder if it's better to deprecate it up front; to signal that it won't be further developed and to communicate its future removal. Depending on if there are workflows or use cases—that I'm not currently aware of—that aren't covered by the default per-page template files, that future removal could be anywhere from one or two minor releases (after 6.5 or 6.6) to some number of minor releases after static HTML output becomes an option.