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

Issue/165 #168

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Issue/165 #168

wants to merge 1 commit into from

Conversation

dekobon
Copy link
Collaborator

@dekobon dekobon commented Aug 17, 2023

This change adds support for building JSDoc docs using nodejs. It also improves the JSDoc annotations used in the njs source code.

The rationale for this change is that by improving JSDocs, you improve the static code analysis experience when using an IDE to work on njs code.

This change incorporates the following:

  • Adds package.json which references the TypeScript types for internal njs types, jsdoc, and jsdoc dependencies (taffydb)
  • Reworks and improves the existing JSDoc annotations so that they reference the TypeScript types
  • Adds a Makefile directive to execute jsdoc

@dekobon dekobon added the enhancement New feature or request label Aug 17, 2023
Copy link
Collaborator

@4141done 4141done 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 good to me. I have minor comments but nothing blocking other than the stray code from #167

I think we can provide some more affordances around the nodejs dependency such as the option of docker based runs for node-based tooling but since this is not a requirement I think it can be done in a later PR.

One caveat is that I don't use Typescript often and I don't use an editor that integrates with these annotations so I can't speak for the effectiveness/correctness of the actual editor stuff.

@@ -0,0 +1 @@
nodejs 20.5.1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes! Love to see node version management with asdf available

@@ -68,6 +68,7 @@ deployments/ contains files used for deployment technologies
docs/ contains documentation about the project
examples/ contains additional `Dockerfile` examples that extend the base
configuration
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are there any notes we should make about editor integration or docs generation? Do we need to add a note about the nodejs requirement?

@@ -22,3 +22,13 @@ help:
.PHONY: test
test: ## Run all tests
$Q $(CURDIR)/test.sh --type oss --unprivileged false --latest-njs false

out:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Two comments:

  1. You can probably use npx jsdoc -c rather than directly referencing the js file which could change out from under us.
  2. out seems like a rather generic name for building the docs. docs might be more intuitive?

@@ -33,10 +47,16 @@ const NOW = new Date();
const ECS_CREDENTIAL_BASE_URI = 'http://169.254.170.2';

/**
* URL to EC2 Instance Metadata Service (IMDS) token endpoint
* @see {@link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html| EC2 Instance Metadata Service}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Love the usage of @see

@@ -322,9 +358,9 @@ function redirectToS3(r) {

if (isDirectoryListing && (r.method === 'GET' || r.method === 'HEAD')) {
r.internalRedirect("@s3PreListing");
} else if ( PROVIDE_INDEX_PAGE == true ) {
} else if (PROVIDE_INDEX_PAGE === true) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

These changes seem like they are from this PR. Might want to remove them from or note that this PR is dependent on that one being merged first and a rebase on this one.

@ivanitskiy
Copy link

added some changes and tested in VSC. and submitted a PR dekobon#1 to share my findings

@4141done
Copy link
Collaborator

added some changes and tested in VSC. and submitted a PR dekobon#1 to share my findings

I would suggest that we add linting and formatting each as separate changes. I have opened a discussion on linting and formatting here if you have opinions.

Co-authored-by: Maxim Ivanitskiy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants