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

refactor: Add better typing support on AppUpdater as an event emitter #6825

Conversation

Nokel81
Copy link
Contributor

@Nokel81 Nokel81 commented Apr 28, 2022

  • Helps with not having to look up the specific types for the events
    that are emitted

Signed-off-by: Sebastian Malton sebastian@malton.name

- Helps with not having to look up the specific types for the events
  that are emitted

Signed-off-by: Sebastian Malton <sebastian@malton.name>
@changeset-bot
Copy link

changeset-bot bot commented Apr 28, 2022

🦋 Changeset detected

Latest commit: 91533c8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
electron-updater Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Apr 28, 2022

Deploy Preview for car-park-attendant-cleat-11576 ready!

Name Link
🔨 Latest commit 91533c8
🔍 Latest deploy log https://app.netlify.com/sites/car-park-attendant-cleat-11576/deploys/626a9a5d2dc3de0008f760f1
😎 Deploy Preview https://deploy-preview-6825--car-park-attendant-cleat-11576.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Signed-off-by: Sebastian Malton <sebastian@malton.name>
@Nokel81 Nokel81 changed the title Add better typing support on AppUpdater as an event emitter refactor: Add better typing support on AppUpdater as an event emitter Apr 28, 2022
Signed-off-by: Sebastian Malton <sebastian@malton.name>
@mmaietta mmaietta merged commit db07548 into electron-userland:master May 1, 2022
@Nokel81 Nokel81 deleted the typed-event-emitter-electron-updater branch May 1, 2022 23:51
@mmaietta
Copy link
Collaborator

mmaietta commented May 3, 2022

As much as I liked this addition, it breaks pnpm generate-docs, which is how we auto-deploy to our Documentation website. I'm working on finding a fix, but if none are found, then we'll need to revert this PR.

@Nokel81 If you're willing to help out, you can test locally with pnpm generate-docs

@Nokel81
Copy link
Contributor Author

Nokel81 commented May 3, 2022

I can give it a shot

@Nokel81
Copy link
Contributor Author

Nokel81 commented May 3, 2022

I don't know anything about carthasis or even the inner workings of handlebars but I think it is being tripped up by the first / of the string module:/Users/nokel81/repos/electron-builder/node_modules/.pnpm/typed-emitter@2.1.0/node_modules/typed-emitter/index.TypedEventEmitter which it is trying to parse as a type reference or something. Is this the first new packaged dependency in a while?

@mmaietta
Copy link
Collaborator

mmaietta commented May 3, 2022

Yeah, it's rare that a new dependency is added. I have renovatebot manage dependencies we already use

I did a search and found index.TypedEventEmitter referenced in scripts/jsdoc/out/updater/electron-updater.js after generate-docs

/**
 * @extends module:/Users/michaelmaietta/Development/electron-builder/node_modules/.pnpm/typed-emitter@2.1.0/node_modules/typed-emitter/index.TypedEventEmitter
...

Even the js intellisense is barfing on reading that line
Screen Shot 2022-05-03 at 1 25 58 PM

@Nokel81
Copy link
Contributor Author

Nokel81 commented May 3, 2022

Ah I see indeed. The project that I work on uses mkdocs instead so I don't have a lot of experience with packages this package use. I guess either we have to figure out how to get an {@link ...} to somewhere or I should rewrite the PR to not use that dependency.

@mmaietta
Copy link
Collaborator

mmaietta commented May 3, 2022

I wonder if we can edit it in helpers.js, as I see we already do that for various IDs

if (id === "internal:EventEmitter") {
return "[EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)"
}

if (id.endsWith(".RequestHeaders")) {
// don't want complicate docs, if someone need - just see source code
return "[key: string]: string"
}
console.warn(`Unresolved member (helpers.js) ${id}`)

@mmaietta
Copy link
Collaborator

mmaietta commented May 3, 2022

Changing this:

.map(it => tagOpen + link2(catharsis.parse(it, {jsdoc: true}), delimiter, root, isSkipNull) + tagClose)

to be catharsis.parse(it.replace(/.*node_modules\//, "module:") fixes the compilation issue, but I'm not sure of the impact on how that'd look on the docs. The updated .md file shows

<li><a href="#AppUpdater">.AppUpdater</a> ⇐ <code>module:typed-emitter@2.1.0/node_modules/typed-emitter/index.TypedEventEmitter</code>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants