sungshon / PimpMyStremio

Local add-on manager for Stremio
MIT License
381 stars 51 forks source link

Support monorepos? #69

Closed sleeyax closed 4 years ago

sleeyax commented 4 years ago

I have one repository containing both local and remote addons. Example repo structure:

- local-addon-1
  - package.json
  - index.js
- local-addon-2
  - package.json
  - index.js
- remote-addon
 - ...

Is there a way to add both local-addon-1 & local-addon-2 as separate addons to addonsList.json?

sungshon commented 4 years ago

oh god, no... the level of complex logic that would come with this.. why not just make separate repos? they are free..

sleeyax commented 4 years ago

There are serveral reasons to prefer monorepos over separate repos. Mainly because I create a lot of addons, it's easier for me to manage them in one place.

However, I absolutely get that it's not easy to just 'add this' to PimpMyStremio's current implementation.

Still worth it to consider... in the future perhaps.

sungshon commented 4 years ago

I think I like this monorepo thing more as I think about it, as it adds scalability. And it might be easier to implement then initially presumed, an addon could be able to set entry: in addonsList.json with the relative path of the entry file. Then we could add that folder to the entry path of the bundler:

If you're willing to try implementing it, I'd accept a PR for it.

sungshon commented 4 years ago

I think we could use require('path').resolve() for this.

path.resolve('C:\\windows\\test', './foo/bar/index.js')
// C:\windows\test\foo\bar\index.js
path.resolve('/home/test', './foo/bar/index.js')
// /home/test/foo/bar/index.js

The default entry for an addon could just be ./index.js.

sungshon commented 4 years ago

I think I added support for monorepos, but I did not test this at all.. @sleeyax is there any chance you can test it?

sleeyax commented 4 years ago

I'm a bit busy at the moment, but thanks a lot! Will test it when I have some time to spare.

sleeyax commented 4 years ago

Looks like the monorepo works (tested locally). Once we get the babel/typescript transpiling repos done we can run more tests.

danamag commented 4 years ago

I've copied part of PMS's code (which includes the entry logic) for the babel/typescript logic, in all the tests I've done, setting custom entries worked for me too.

danamag commented 4 years ago

@sungshon maybe we should make a new release with the entry change, it shouldn't break anything.

sungshon commented 4 years ago

@danamag I think we could do that, it does seem to work, and there are other improvements too (like many themes)

sungshon commented 4 years ago

I've made a new release that includes the entry change, and a few more.

I will close this ticket for now, if you encounter any problems you can open it again.

danamag commented 4 years ago

@sungshon thank you!