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

Use plain typedoc for generating nodejs docs #10964

Merged
merged 9 commits into from
Mar 23, 2024

Conversation

julienp
Copy link
Contributor

@julienp julienp commented Mar 7, 2024

Proposed changes

Fixes #10964

Our custom tsdocgen tool is heavily dependant on the typescript version used in pulumi/pulumi and changes to the version cause issues.

Similar to how we switched Python docs to use plain Sphinx, this moves to using plain typedoc to generate HTML (instead of our current 2 step process of typedoc generating JSON and then tsdocgen producing HTML from the).

Interesting changes are in 48e75a0

The URL structure for modules changed, there are redirects in 8601ac2

Docs for pulumi/pulumi http://www-production-pulumi-docs-origin-pr-10964-f74f2df6.s3-website.us-west-2.amazonaws.com/docs/reference/pkg/nodejs/pulumi/pulumi/

Unreleased product version (optional)

Related issues (optional)

pulumi/pulumi-hugo#4045

@julienp
Copy link
Contributor Author

julienp commented Mar 12, 2024

Somehow the link in the menu pointing to the SDK docs loses the href attribute and I have no idea why this is happening

Screenshot 2024-03-12 at 15 50 44

Copy link
Contributor

@cnunciato cnunciato left a comment

Choose a reason for hiding this comment

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

@julienp This looks great! Added a note to get the link to work correctly.

If I wanted to make any thematic changes, how would I do that? I don't think we necessarily need to block on it, but would be good to know where to look when the time comes.

config/_default/menus.yml Outdated Show resolved Hide resolved
@julienp
Copy link
Contributor Author

julienp commented Mar 13, 2024

@julienp This looks great! Added a note to get the link to work correctly.

If I wanted to make any thematic changes, how would I do that? I don't think we necessarily need to block on it, but would be good to know where to look when the time comes.

Thanks for the help on the link!

Regarding theming the docs I see two options, we can include a CSS file via --customCss when we run typedoc, or we could create a custom theme and include that. I'd be happy to help with that work.

@julienp julienp marked this pull request as ready for review March 13, 2024 10:20
@julienp
Copy link
Contributor Author

julienp commented Mar 13, 2024

The structure of the docs changed a bit, for example pulumi/automation becomes pulumi/modules/automation. Those are handled by hugo redirects.

What also changed is that the index pages for each module are just that, an index, with each export of a module on a separate page. pulumi/#Resource becomes pulumi/classes/Resource.html. @cnunciato how common do you think are these #anchor links, and should we get client side redirects in place for them?

@cnunciato
Copy link
Contributor

cnunciato commented Mar 13, 2024

@julienp There are a bunch, yeah, and from various places (see this GitHub code search), so if we could redirect client-side without too much effort, that'd be ideal. We did something similar here after splitting a giant docs page into several:

https://github.com/pulumi/pulumi-hugo/blob/master/themes/default/content/docs/concepts/resources/_index.md?plain=1#L16-L18

However I think this case might be a little different in that the new pages at /docs/reference/pkg/nodejs/pulumi/pulumi/* will be rendered by TypeDoc. Does the way we're using TypeDoc expose a way to inject a similar snippet of JS that'd let us catch and redirect, say, some set of known anchor strings? If not, we might just have to update these links in follow-up PRs.

@julienp
Copy link
Contributor Author

julienp commented Mar 14, 2024

I added client side #anchor redirects in 2ae4f61

The map redirects was gathered with a hacked up version of tscdocsgen.

@cnunciato
Copy link
Contributor

@julienp Almost there! Looks like we just need a few redirects:

The client-side stuff seems doable in `redirects.js. For the others, we can probably create a new text file for them here, which will generate proper 301s once this goes out: https://github.com/pulumi/docs/tree/master/scripts/redirects

Both should work in a PR preview as well. I'll see if I can spend a little time today setting some of this up for ya.

@cnunciato
Copy link
Contributor

cnunciato commented Mar 22, 2024

@julienp On second thought, the traffic to these pages probably doesn't warrant doing that much more work here. Looking at the data, I think it'd be fine if we just made sure these redirected to the right place:

/docs/reference/pkg/nodejs/pulumi/awsx/apigateway/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/autoscaling/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/classic/acmpca/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/classic/apigateway/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/classic/autoscaling/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/classic/billing/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/classic/cloudfront/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/classic/cloudtrail/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/classic/cloudwatch/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/classic/codebuild/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/classic/cognito/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/classic/dynamodb/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/classic/ebs/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/classic/ec2/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/classic/ecr/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/classic/ecs/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/classic/efs/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/classic/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/classic/lambda/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/classic/lb/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/classic/rds/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/classic/s3/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/classic/sns/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/classic/sqs/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/cloudtrail/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/ec2/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/ecr/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/ecs/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/lb/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/types/enums/ec2/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/types/enums/ecr/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/types/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/types/input/index.html
/docs/reference/pkg/nodejs/pulumi/awsx/types/output/index.html
/docs/reference/pkg/nodejs/pulumi/cloud/index.html
/docs/reference/pkg/nodejs/pulumi/kubernetesx/index.html
/docs/reference/pkg/nodejs/pulumi/policy/index.html
/docs/reference/pkg/nodejs/pulumi/terraform/index.html
/docs/reference/pkg/nodejs/pulumi/terraform/state/index.html

I'll push a PR that adds those of these that still need handling in a redirects file, and then we should be good to go. We can add the client-side redirects in a follow up, but I honestly wouldn't block on it. There's enough good here to roll forward with now IMO!

@cnunciato
Copy link
Contributor

cnunciato commented Mar 22, 2024

@julienp All right, 5995d84 adds a redirects file for the pages listed above, and replaces the redirect_to: pages you added with entries in that file. (I also noticed there doesn't seem to be a perfect new home for https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/pulumi/runtime/closure/index.html, so I chose what seemed like the best option. Let me know if there's a better one; we can easily change these by updating that redirects file if we need to.)

If the preview looks good, I'll go ahead and merge, and we can address the anchor links in a quick follow. Thanks for making this happen!

@cnunciato cnunciato enabled auto-merge (squash) March 23, 2024 00:04
@cnunciato cnunciato merged commit 33d1592 into master Mar 23, 2024
5 checks passed
@cnunciato cnunciato deleted the julienp/use-plain-typedoc branch March 23, 2024 00:12
github-merge-queue bot pushed a commit to pulumi/pulumi that referenced this pull request Mar 25, 2024
# Description

Noticed a couple warnings when building the docs using typedoc.

- Fix some typedoc `@param` tags
- Export automation.tag.TagMap type


Ref: pulumi/docs#10964

## Checklist

- [ ] I have run `make tidy` to update any new dependencies
- [ ] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants