sungshon/PimpMyStremio

Support monorepos?

sleeyax opened this issue · 12 comments

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?

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

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.

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.

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.

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

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

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

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.

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

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

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.

@sungshon thank you!