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

Improve tooling #19

Merged
merged 2 commits into from
Jan 14, 2022
Merged

Improve tooling #19

merged 2 commits into from
Jan 14, 2022

Conversation

fire332
Copy link

@fire332 fire332 commented Jan 7, 2022

Check the first commit to see the actual changes.

  • Added vscode, prettier, and eslint configs.
  • Fixed eslint errors in the code.
  • Updated package-lock.json to new lock file version.
  • Made the deploy script multi OS compatible.
  • Improved production bundle size. 174 KiB userScript.js + 922 B index.js -> 137 KiB userScript.js + 10.7 KiB index.js.
  • Added pre-commit prettify hook.
  • Polyfill index.js.
  • Switched the spatial-navigation-polyfill to an NPM dependency.

Closes #16

@fire332
Copy link
Author

fire332 commented Jan 7, 2022

I just remembered, the domrect polyfill is also unnecessary if we check for and use ClientRect instead as appropriate. However, this needs testing to be sure. Obviously I can't test this as I own a LG C1 which uses Chromium 79.
image

@fire332
Copy link
Author

fire332 commented Jan 7, 2022

Whoops. @babel/runtime-corejs3 shouldn't be a dev dependency. Fixing now.

@Informatic
Copy link
Member

Informatic commented Jan 7, 2022 via email

@fire332
Copy link
Author

fire332 commented Jan 7, 2022

Ah ok, just saw your comment. You may want to make the changes more obvious as I couldn't tell from a quick glance. Reverting that portion now.

@fire332 fire332 force-pushed the improve-build branch 2 times, most recently from 095a9f3 to 06b8bc9 Compare January 7, 2022 18:04
@fire332
Copy link
Author

fire332 commented Jan 7, 2022

DomRect is used by spatial navigation polyfill.

I'm aware. What I'm saying is that, according to caniuse.com, DOMRect is available as ClientRect on Chrome version 4-60 so the DOMRect polyfill can be removed if ClientRect is tested to be working properly.

@Informatic
Copy link
Member

Informatic commented Jan 10, 2022

Hey, sorry for the delay.

Can you please check if SponsorBlock segments are properly rendered on the timeline on Your TV? I can consistently make them work on current main (on this video), but can't on this branch. No obvious

Oneliner:

git stash && git checkout main && npm install && npm run build && npm run package && npm run deploy && npm run launch -- -p '{"contentTarget":"v=ptnXLYYIQ9Y"}'

I see an undefined is not a function error occuring on this line:

m.removedNodes.forEach((n) => {

Indeed - on main NodeList.prototype.forEach is a properly shimmed native function, while it doesn't seem to be shimmed in this branch.

@fire332
Copy link
Author

fire332 commented Jan 11, 2022

Is it only that specific instance of NodeList missing the .forEach or is .forEach missing on the global NodeList's prototype?

@Informatic
Copy link
Member

That's on global NodeList prototype (NodeList.prototype.forEach I mentioned)

@fire332
Copy link
Author

fire332 commented Jan 11, 2022

Can you check to see if this works?

@Informatic
Copy link
Member

Tested on 9637280, sadly, still doesn't work :/

NodeList.prototype.forEach is still undefined, and the same Uncaught TypeError: undefined is not a function still occurs.

@fire332
Copy link
Author

fire332 commented Jan 11, 2022

Try again with polyfill-corejs3's method set to 'usage-global' instead of 'usage-pure'.

image

@Informatic
Copy link
Member

Ah, indeed. Now with usage-global and core-js-pure dependency replaced with core-js (otherwise it'd fail on missing core-js with that previous option changed) it works correctly now it seems. I'll do deeper testing in a couple of hours, but looks great so far. Thank you.

@fire332
Copy link
Author

fire332 commented Jan 12, 2022

Talked to the core-js dev. Seems like a Babel bug that NodeList.prototype.forEach is not pollyfilled in pure mode and looking at the Babel issue tracker, doesn't seem like this will be fixed any time soon. Better if we just migrate all usage of .forEach on NodeLists to use for...of syntax instead.

@fire332
Copy link
Author

fire332 commented Jan 12, 2022

Please test the follow commit. I'll rebase them all if this is good.

@Informatic
Copy link
Member

Works perfectly now. Thanks.

Copy link
Member

@Informatic Informatic left a comment

Choose a reason for hiding this comment

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

LGTM

@fire332
Copy link
Author

fire332 commented Jan 13, 2022

Please don't merge before I get around to rebasing, unless you truly don't mind having commits labeled test and test2 in the repository.

@Informatic
Copy link
Member

Informatic commented Jan 14, 2022 via email

@fire332
Copy link
Author

fire332 commented Jan 14, 2022

I recommend having a separate commit just for the prettify command as it touches almost every file, making the actual changes a pain to diff. Rebasing done. Good to merge.

@Informatic
Copy link
Member

Yeah that makes sense. I suspect you're going to need to rebase other PRs as well after we merge it in.

@Informatic Informatic merged commit 782891b into webosbrew:main Jan 14, 2022
@fire332 fire332 deleted the improve-build branch January 14, 2022 20:10
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.

Outdated dependencies and broken build config
2 participants