-
Notifications
You must be signed in to change notification settings - Fork 114
initial API compare tool #28
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
|
||
| module.exports = { | ||
| ...require('@hashicorp/platform-cli/config/prettier.config'), | ||
| // ...require('@hashicorp/platform-cli/config/prettier.config'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we just remove this rather than commenting it out?
scripts/api-compare/api-compare.mjs
Outdated
| } | ||
|
|
||
| for (const [product, versions] of Object.entries(versionMetadata)) { | ||
| if (options.product && options.product !== product) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we could use optional chaining here to avoid the need for that nullcheck?
| if (options.product && options.product !== product) { | |
| if (options?.product !== product) { |
scripts/api-compare/api-compare.mjs
Outdated
| diffOptions | ||
| ) | ||
|
|
||
| const outputString = `Testing API URL:\n${newApiURL}\n${difference}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might suggest os.EOL here instead of \n for clients on different OSes (Windows in particular I believe uses \r\n instead \n - though if our content authors use WSL that probably won't affect them as they'll be using a linux shell via WSL, right?).
|
@RubenSandwich Is this PR safe to close? |
| .option('-r, --drop-keys <keys>', 'Result keys to drop', (value) => | ||
| value.split(',').map((key) => key.trim()) | ||
| ) | ||
| .option('-t, --num-of-tests <number>', 'Number of tests', parseInt, 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's remove -t and just test every route in a version and product that they give us.
| waypoint: 'content', | ||
| } | ||
|
|
||
| function getAllContentApiPaths(directory) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer need this because of app/api/docsPathsAllVersions.json.
|
|
||
| const mainContentDirectory = './content' | ||
|
|
||
| const contentDirMap = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need this as it should now be in app/utils/productConfig.mjs
| 'API type: "content", "nav-data", "version-metadata", or "content-versions"', | ||
| 'content' | ||
| ) | ||
| .option( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-d only makes sense for the /docs api route, so leave it out for now.
| 'Diff type for API type "content": "metadata", "markdown", or "everything"', | ||
| 'markdown' | ||
| ) | ||
| .option('-r, --drop-keys <keys>', 'Result keys to drop', (value) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-r only makes sense for the /docs api route, so leave it out for now.
| Math.min(options.numOfTests, apiPaths.length) || 1 | ||
|
|
||
| // let apiPathsLeft = [...apiPaths]; | ||
| while (randomIndexes.length < numOfRandomIndexes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the "fuzzy" part where it randomly tests /doc routes, I don't think this is necessary anymore.
No description provided.