-
Notifications
You must be signed in to change notification settings - Fork 451
MDN description V2 #2171
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
base: main
Are you sure you want to change the base?
MDN description V2 #2171
Conversation
* The | ||
* setValueCurveAtTime() method of the | ||
* AudioParam interface schedules the parameter's value to change | ||
* following a curve defined by a list of values. |
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.
newline-to-space normalization seems to be needed.
src/build/mdn-comments.ts
Outdated
import fs from "fs/promises"; | ||
const basePath = new URL("../../inputfiles/mdn/files/en-us/", import.meta.url); | ||
import { readFile } from "fs/promises"; | ||
const inputFile = new URL("../../inputfiles/mdn/mdnData.json", import.meta.url); |
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.
Maybe just inputfiles/mdn.json
? And you can do import * as data from "(path)" with { type: "json" }
src/build/mdn-comments.ts
Outdated
import { readFile } from "fs/promises"; | ||
const inputFile = new URL("../../inputfiles/mdn/mdnData.json", import.meta.url); | ||
|
||
interface MetaDataEntry { |
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 don't think we should treat meta and data separately, let's do Metadata.
I have updated it @saschanaz, |
/** | ||
* The **`console.trace()`** static method outputs a stack trace to the console. | ||
* | ||
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static) | ||
*/ | ||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static) */ | ||
trace(...data: any[]): void; |
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.
Seems like these docs are missing?
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 think you reverted too early. The module error doesn't happen locally.
| (startswith("/en-us/docs/web/api/") or startswith("/en-us/docs/webassembly/reference/javascript_interface/"))) | ||
) | ||
| { mdn_url, pageType, summary } ] }' \ | ||
> mdn.json |
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.
Why do bash magic when we can filter it in the script instead?
The module error also occurs on my local machine (Ubuntu), @saschanaz. I used the bash magic because it significantly reduces the output size — most of the data isn’t needed. Current (filtered and formatted): 2.5 MB Original (unfiltered, unformatted): 28.7 MB That’s over 11× larger (28.7 MB vs 2.5 MB), so I think the extra shell step is worth it. |
I’ve added support for _static, so there is no missing comments now, @jakebailey. |
Are you seeing the exact same module error? Because that error says you don't have lib/build.js, which means typescript silently failed to compile anything at all. Can you check what's in lib/ in that case?
Hmm, fair. I think we should still fetch and filter in typescript instead, as bash usage would break on Windows. |
Or well, in JS, to save a build step. |
I don't think that this is an issue, since no one would actually run it, but sure, I will write a script to generate the file |
|
Can you check what's in lib/ in that case? |
I have removed the bash magic @saschanaz |
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.
Looks good, but this will need to update with the latest main branch.
# Example: https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1463 | ||
- run: npm i | ||
- name: Update MDN Data | ||
run: node scripts/generateMDN |
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 are not really generating but more fetching.
really not a fan of camelCasing on file paths though 🫠
I do recognize we have deploy/ which is mostly written by Orta than me, and we do have jsonc files that preexisted, but any new files have been hyphen-cased...
} | ||
} | ||
|
||
function extractSlug(slug: string): string[] { |
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.
Why reorder the function? Almost thought this is an entirely new function with the same name.. Keeping its position should help reducing the diff.
I have renamed it, and rebased it @saschanaz |
interface RTCRtpTransceiver { | ||
/** | ||
* The **`setCodecPreferences()`** method of the RTCRtpTransceiver interface is used to set the codecs that the transceiver allows for decoding _received_ data, in order of decreasing preference. | ||
* The setCodecPreferences() method of the RTCRtpTransceiver interface is used to set the codecs that the transceiver allows for decoding received data, in order of decreasing preference. |
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.
Are we just generally losing all markup?
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.
Yes, because the JSON doesn't have Markdown
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.
Yes, because the JSON doesn't have Markdown
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.
Yeah. We could hack around by matching the first occurrence of the name though...
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 PR is big as is, maybe a separate PR
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.
Technically hacking around would reduce the size of the PR.
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.
(You can open PR on my fork and then I can try it)
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.
Okay, I will hack it today
Migrate to be using the json API
closes #2151
closes #2086
closes #2078