feat: change to markdown and map html to markdown#688
feat: change to markdown and map html to markdown#688whilefoo wants to merge 7 commits intoubiquity:developmentfrom
Conversation
✅ Deploy Preview for ubiquibot-staging ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
src/helpers/comment.ts
Outdated
| // dynamic import of mdast | ||
| const { fromMarkdown } = await import("mdast-util-from-markdown"); | ||
| const { gfmFromMarkdown } = await import("mdast-util-gfm"); | ||
| const { gfm } = await import("micromark-extension-gfm"); |
There was a problem hiding this comment.
I tried importing normally at the top but I got the error:
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/whilefoo/ubiquity/ubiquibot/node_modules/mdast-util-from-markdown/index.js from /Users/whilefoo/ubiquity/ubiquibot/lib/src/helpers/comment.js not supported.
Instead change the require of index.js in /Users/whilefoo/ubiquity/ubiquibot/lib/src/helpers/comment.js to a dynamic import() which is available in all CommonJS modules.
After that I changed to dynamic import in the function but the error stays the same. I checked the compiled javascript and it's still require() - it seems every import is compiled to require.
@rndquu any ideas?
There was a problem hiding this comment.
it seems #377 was supposed to fix the issue but it doesn't - instead of throwing the error at startup, it throws the error when the function runs.
There was a problem hiding this comment.
So it throws the same error both when modules are imported at the top of the comment.ts file and in the parseComments() function, right?
There was a problem hiding this comment.
So it throws the same error both when modules are imported at the top of the
comment.tsfile and in theparseComments()function, right?
yes
There was a problem hiding this comment.
I tried changing Typescript settings to transpile to ESM and added "type": "module" to package.json, but I get a different error because Probot is using require() internally
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/whilefoo/ubiquity/ubiquibot/lib/src/index.js from /Users/whilefoo/ubiquity/ubiquibot/node_modules/probot/lib/helpers/resolve-app-function.js not supported.
Instead change the require of index.js in /Users/whilefoo/ubiquity/ubiquibot/node_modules/probot/lib/helpers/resolve-app-function.js to a dynamic import() which is available in all CommonJS modules.
node_modules/probot/lib/helpers/resolve-app-function.js is using require()
There was a problem hiding this comment.
Perhaps we could downgrade all 3 packages (mdast-util-from-markdown, mdast-util-gfm, micromark-extension-gfm) to their "pre ESM" versions
There was a problem hiding this comment.
I tried downgrading and I have an issue with mdast-util-gfm because that version didn't have any types so typescript is complaining. I will see if there's anything I can do
There was a problem hiding this comment.
https://github.com/ubiquity/ubiquibot/blob/incentive-based-on-comment/src/helpers/comment.ts#L23
Please take a look at the incentive-based-on-comment branch @whilefoo. It has been done with mdast library.
The blocker on that branch was the function timeout: 10s as of now.
I hope you can get reusable/helpful methods from that branch.
There was a problem hiding this comment.
Please take a look at the
incentive-based-on-commentbranch @whilefoo.
That is exactly how I've done it but it's not working, you can check the whole conversation for context
| [MarkdownItem.LinkReference]: HTMLItem.A, | ||
| [MarkdownItem.ImageReference]: HTMLItem.IMG, | ||
| [MarkdownItem.FootnoteReference]: HTMLItem.SUP, | ||
| [MarkdownItem.FootnoteDefinition]: HTMLItem.P, |
There was a problem hiding this comment.
I'm not sure how can we represent footnote reference and definition by HTML? @pavlovcik
Example of footnote1
Footnotes
-
Footnote 1 ↩
There was a problem hiding this comment.
Very cool. I didn't know about this but I guess we can just file an issue and kick the can down the road?
| [MarkdownItem.Link]: HTMLItem.A, | ||
| [MarkdownItem.Image]: HTMLItem.IMG, | ||
| [MarkdownItem.BlockQuote]: HTMLItem.BLOCKQUOTE, | ||
| [MarkdownItem.Code]: HTMLItem.PRE, |
There was a problem hiding this comment.
I'm not sure if it's gonna be clear to partners that <pre> refers to
code
and <code> refers to inline code
|
@pavlovcik can you clarify if task creator and task assignee are eligible for task conversation rewards? I'd guess not because task creator will make comments to clarify his task and task assignee will comment to explain his solution or ask questions to the task creator |
Oh, I actually thought that task creator is also eligible for task conversation rewards. Ok then, I will update the description for #704 |
That's a good observation. Here are all the roles that I see and if they should be eligible for comment incentives. What if we make them configurable? Something like: |
|
Updated roles: Issue
Review
Debating on if we should make a "reviewer" role which kicks in if you helped with the review. These are who need to be highly incentivized because review seems to be very burdensome. |
Resolves #673
QA: ubiquity-whilefoo#56