PlasmoHQ / plasmo

🧩 The Browser Extension Framework
https://www.plasmo.com
MIT License
10.53k stars 366 forks source link

[RFC] Provide plasmo API to allow building from custom script #775

Open stevebeauge opened 1 year ago

stevebeauge commented 1 year ago

How do you envision this feature/change to look/work like?

Plasmo is great but lacks flexibility.

It would be nice to allow importing plasmo inside custom script and run from it.

Something like this:

import { plasmo } from 'plasmo';

plasmo.build({
  root : __dirname,
  target : 'msedge-v3', //  string or string[]
  tag : ['dev','prod'] // string or string[]
});

Alternatively (not exclusive), having the ability to pass multiple values to target and tag parameter may be very useful:

plasmo build --target=firefox-mv2,chrome-mv3 --tag=stating,prod

What is the purpose of this change/feature? Why?

Working on an extension which support X browser and Y tags leads to X*Y combination of build invocation (not mentioning companions scripts).

My actual package.json is today:

image

This is only for 2 browsers and 2 variants (more are planned).

This is not very maintainable.

(OPTIONAL) Example implementations

No response

(OPTIONAL) Contribution

Verify canary release

Code of Conduct

k1tikurisu commented 7 months ago

@louisgv May I work on it?

louisgv commented 7 months ago

@k1tikurisu please do :) - PR's very welcome

k1tikurisu commented 6 months ago

plasmo build --target=firefox-mv2,chrome-mv3 --tag=stating,prod

I thought this would be useful, but it is more difficult than expected to load the correct environment files for each. I think it would be safer to write shell scripts for each user. 🤔

raghav2122 commented 2 months ago

Are you still working on it? @k1tikurisu

k1tikurisu commented 2 months ago

@raghav2122 I'm no longer working on it, so please feel free to take over.