Skip to content

Conversation

@cbush
Copy link
Contributor

@cbush cbush commented Feb 7, 2019

  • Externalizes code examples in contrib/docs-examples/snippets.
  • Adds validator script. Not so much a unit test as just running
    eslint and the script itself to check that the script is formatted
    and the APIs are still valid, etc.
  • Adds two TypeDoc plugins: code-examples and tags-by-name
  • code-examples plugin pastes code examples from external files to
    the comment tags of a matching-named entity
  • tags-by-name reorders the TypeDoc tags of each entity to be more
    usable by the custom TypeDoc theme.
  • Updates the custom theme to use the new examples tags and also
    the "See also" tag.
  • Updates all code examples to use @example tag or remove (externalize) the example.
  • Updates comments to use @see instead of See Also.

Staged changes:

https://docs-mongodbcom-staging.corp.mongodb.com/stitch/bush/docsp-4283-code-example-validation/sdk/js/index.html

https://docs-mongodbcom-staging.corp.mongodb.com/stitch/bush/docsp-4283-code-example-validation/sdk/js-server/index.html

https://docs-mongodbcom-staging.corp.mongodb.com/stitch/bush/docsp-4283-code-example-validation/sdk/react-native/index.html

@coveralls
Copy link

Coverage Status

Coverage remained the same at 76.901% when pulling 06fa4ca on cbush:docsp-4283-code-example-validation into dba9283 on mongodb:master.

Copy link
Contributor

@adamchel adamchel left a comment

Choose a reason for hiding this comment

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

LGTM, this is really neat! One optional thing that you could do so we catch broken code examples before they get released is to add an evergreen task to validate the samples. If you don't know how to do that, DM me on slack and I can help.

@@ -1,5 +1,5 @@
{
"name": "stitch-js-sdk",
"name": "stitch-js-sdk",
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] I can't tell if these are tabs or spaces from the Github interface, but make sure it's consistent across the whole file.

"scripts": {
"docs": "npm run docs-theme && npm run docs-browser && npm run docs-server && npm run docs-react-native",
"docs-theme": "pushd typedoc-theme && npm run build",
"docs-theme": "pushd typedoc-theme && npm run build",
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. Good catch! But I think this change actually makes it consistent now.

Copy link

@nlarew nlarew left a comment

Choose a reason for hiding this comment

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

LGTM % One question / potentially missing piece

@@ -0,0 +1,35 @@

// ^^^ Paste example() definition ^^^
Copy link

Choose a reason for hiding this comment

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

Do we need to "bring our own" example function or should we add one in here? If the former, maybe add a couple sentences that explain the situation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Examples are pasted automatically by the validate.sh script. Will add note!

- Externalizes code examples in contrib/docs-examples/snippets.
- Adds validator script. Not so much a unit test as just running
eslint and the script itself to check that the script is formatted
and the APIs are still valid, etc.
- Adds two TypeDoc plugins: code-examples and tags-by-name
- code-examples plugin pastes code examples from external files to
the comment tags of a matching-named entity
- tags-by-name reorders the TypeDoc tags of each entity to be more
usable by the custom TypeDoc theme.
- Updates the custom theme to use the new examples tags and also
the "See also" tag.
- Updates all code examples to use @example tag or remove the example.
- Updates comments to use @see instead of See Also.
- Validator caveat: it actually runs in the 'server' context.
@cbush cbush force-pushed the docsp-4283-code-example-validation branch from 06fa4ca to 2736c0f Compare February 8, 2019 19:06
Copy link

@MongoCaleb MongoCaleb left a comment

Choose a reason for hiding this comment

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

woot woot! LGTM

@cbush cbush merged commit 8f121e1 into mongodb:master Feb 8, 2019
@cbush cbush deleted the docsp-4283-code-example-validation branch February 8, 2019 19:18
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.

5 participants