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 docs/source/api to docs/source/index filemap AND add better versioning support #13222

Merged
merged 23 commits into from Apr 5, 2023

Conversation

hasezoey
Copy link
Collaborator

Summary

This PR consists of 2 parts:

part 1:

  • add dos/source/api to the docs/source/index filemap
  • move code from docs/source/splitApiDocs.js to /scripts/website.js
  • add jsdoc types for docs/source/api out (/ module.exports.docs / data)
  • rename api property name to title to match docs/source/index scheme
  • only promisify pug.render once
  • remove docs/source/splitApiDocs.js
  • add watchers for all of documented lib/* files
  • add watcher for docs/api_split.pug (reload all api files)
  • update scripts/generateSearch for the changes made
  • update scripts/generateSearch to use the already generated url instead of re-doing it
  • add a log of how many files will be processed when running docs:generate

part 2:

  • add better versioning support by making the process more automatic
  • refactor how versions are parsed and from where (previously it was from CHANGELOG, but now its from git tag)
  • add ability to deploy to sub-directy (like in gh-pages) directly like docs/6.x
  • add dev-dependency fs-extra to copy the full directories (not using ncp because it is old and nodejs does not have a native way, would replace ncp later)

fixes #13148


Notes on the new versioning:
the new version in made so that without environment variable DOCS_DEPLOY=true it will behave as if no versioning is present (not outputting any new sub-directories or adding things to urls), but once the environment variable is set, it will:

  • if the latest version is detected, or as fallback; it will deploy to docs/ like always
  • if a older version is detected, it will deploy to something like docs/6.x, including all files that are required (like js, css, and even <root>/index.pug)

this change makes it so that versioned docs can still be locally run without screwing up static paths (like js and css) but also easy to deploy to gh-pages (hopefully)

should i add a package.json script for deploying with DOCS_DEPLOY=true?

because it is now handled by "website"
and dont import "api.js" directly
@hasezoey hasezoey added the docs This issue is due to a mistake or omission in the mongoosejs.com documentation label Mar 29, 2023
@hasezoey hasezoey added this to the 7.1.0 milestone Mar 29, 2023
Copy link
Collaborator

@vkarpov15 vkarpov15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great 👍 I was just having some trouble testing docs generation on 6.x branch, looks like this might help with that.

@vkarpov15 vkarpov15 removed this from the 7.1.0 milestone Apr 5, 2023
@vkarpov15 vkarpov15 added this to the 7.0.4 milestone Apr 5, 2023
@vkarpov15 vkarpov15 merged commit 6e7ae65 into Automattic:master Apr 5, 2023
20 checks passed
@hasezoey
Copy link
Collaborator Author

hasezoey commented Apr 6, 2023

@vkarpov15 would you want a backport of this PR to the 6.x branch?

@vkarpov15
Copy link
Collaborator

Yeah backport would be nice. Merge conflicts will be a bit messy, but hopefully not too bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This issue is due to a mistake or omission in the mongoosejs.com documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Docs] Rework scripts to allow easier setting of current and past versions
2 participants