audio-only-youtube icon indicating copy to clipboard operation
audio-only-youtube copied to clipboard

refactor: wip

Open Kompwu opened this issue 6 years ago • 19 comments

ts-ify & new boilerplate

Todo:

  • [x] new boilerplate
  • [x] ts-ify
  • [x] fix errors in options.ts
  • [x] Remove all Any types to be more specific.
  • [x] Parcel vs FuseBox.
  • [x] Migrate to Parcel.
  • [x] Fix bugs
  • [x] Script for packing up the extension.
  • [x] Remove ytp-right-controls.
  • [x] Fix #5 & #34
  • [ ] Backport: https://github.com/Ashish-Bansal/audio-only-youtube/pull/18
  • [x] Backport: https://github.com/Ashish-Bansal/audio-only-youtube/issues/20
  • [ ] Fix livestreaming #14

I've also added some githooks to automate some shit & lint commit.

@Ashish-Bansal What do you think? 🤔

Kompwu avatar Jul 17 '18 13:07 Kompwu

@Kompwu I don't have any experience with ts. Earlier I only had heard about it. Now I see its various features. Looks good to me! 👍

Sorry for the late reply!

Ashish-Bansal avatar Jul 26 '18 17:07 Ashish-Bansal

Also I saw you removed yarn.lock. Any specific reason for that ?

Ashish-Bansal avatar Jul 26 '18 17:07 Ashish-Bansal

@Ashish-Bansal I'm gonna add a new one soon. Edit: Can you help me ?

Kompwu avatar Jul 26 '18 17:07 Kompwu

@Ashish-Bansal I'm gonna add a new one soon. Edit: Can you help me ?

@Kompwu Sure, how can I help you out ?

Ashish-Bansal avatar Jul 26 '18 17:07 Ashish-Bansal

@Ashish-Bansal ~~Backport: #18~~ pls :) Edit: I'm sorry i mean #20

Kompwu avatar Jul 26 '18 17:07 Kompwu

@Kompwu

Back porting ? I don't get why we would like to backport something to #18 and which feature ?

Or did you mean porting individual toggle per tab feature to this branch ?

Ashish-Bansal avatar Jul 26 '18 17:07 Ashish-Bansal

@Ashish-Bansal Almost done :) Now... FuseBox or Parcel ?

Kompwu avatar Jul 31 '18 13:07 Kompwu

@Ashish-Bansal Almost done :)

Awesome! :D

Now... FuseBox or Parcel ?

Parcel seems to be more flexible than fusebox and requires less configuration boilerplate code than webpack, providing a nice middle ground. So, I would say let's try out Parcel.

Ashish-Bansal avatar Jul 31 '18 14:07 Ashish-Bansal

@Ashish-Bansal The problem is that with Parcel we can't configure anything, so to manage the manifest.json we'll have to handle it by hand. But, I think with a "hook", we can easily get the hell through. Something like that:

const fs = require('fs');
const manifest = require("./src/manifest.json");
const pkg = require("./package.json");

manifest["name"] = pkg["displayName"]
manifest["version"] = pkg["version"]
manifest['description'] = pkg['description'];
fs.writeFile('dist/manifest.json', JSON.stringify(manifest));

And we run it at the same time as Parcel. ~~But we'll have another problem, no hot reloading on manifest.json... I don't really know how to do this, I guess there must be a library out there to do this easily. I'll see what I can find out.~~ Edit: Okay, we can handle it with fs.watchFile. Time to configure Parcel.

Kompwu avatar Jul 31 '18 18:07 Kompwu

@Kompwu wow, parcel configuration is quite cleaner compared to webpack. Nice 👍

By the way, since we removed crx-webpack-plugin , can you please add npm script for packing up the extension ?

May be https://github.com/oncletom/crx would help.

Ashish-Bansal avatar Aug 05 '18 02:08 Ashish-Bansal

@Ashish-Bansal I'll see what I can do. BTW, can you start backporting #20 ?

Kompwu avatar Aug 05 '18 02:08 Kompwu

Sure.

Ashish-Bansal avatar Aug 05 '18 02:08 Ashish-Bansal

@Kompwu Did you try loading extension in the browser ? I can see the paths are wrong in the manifest.json due to which it fails to load.

Ashish-Bansal avatar Aug 05 '18 03:08 Ashish-Bansal

@Ashish-Bansal Are you talking about the path for js ? Just change it to ts. I forgot to push the commit to fix that.

Kompwu avatar Aug 05 '18 03:08 Kompwu

@Ashish-Bansal Are you talking about the path for js ?

Yeah. Also, icons doesn't seem to load due to some reason. Though I haven't checked the reason for that yet.

Ashish-Bansal avatar Aug 05 '18 03:08 Ashish-Bansal

@Ashish-Bansal Apart from that, everything works for you?

I've also made some performance improvements ;) Edit: Do you have Discord?

Kompwu avatar Aug 05 '18 03:08 Kompwu

@Kompwu No, it's throwing errors in background script.

Edit: Do you have Discord?

Just did setup. Please share your username.

Edit: Discord Channel link: https://discord.gg/Mm52n3Y

Ashish-Bansal avatar Aug 05 '18 03:08 Ashish-Bansal

@Ashish-Bansal Okay, i'm close. There's definition matching issue on: https://github.com/Kompwu/audio-only-youtube/blob/90dadaf0dfe84fa3a9b9d3946ca3c3c2e36f71f0/src/ts/background.ts#L94 Error in event handler for webRequest.onBeforeRequest/1: Error: Invocation of form webRequestInternal.eventHandled(string, string, string, function) doesn't match definition webRequestInternal.eventHandled(string eventName, string subEventName, string requestId, optional object response) looks like it's passing a function to a function argument that expects an object... I'm so sleepy, I'll keep going after I sleep!

Kompwu avatar Aug 05 '18 05:08 Kompwu

@Ashish-Bansal What about #14?

Kompwu avatar Nov 04 '18 01:11 Kompwu