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

Enable specifying multiple manifests for different target browsers #13

Closed
nkrusch opened this issue Nov 15, 2020 · 4 comments
Closed

Enable specifying multiple manifests for different target browsers #13

nkrusch opened this issue Nov 15, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@nkrusch
Copy link
Contributor

nkrusch commented Nov 15, 2020

Is your feature request related to a problem? Please describe.

The use case is this: I have some extension source, and I want to compile it for different browsers. The core src should be the same but perhaps some configs change between builds. This is especially the case with chrome and edge.

Current workaround is have browser specific build config file for each target

Describe the solution you'd like

I would like to be able to do this in the project root directory instead, and configure different builds, e.g. npm run build:chrome, npm run build:edge and then specify which files need to go in each bundle.

@nkrusch nkrusch changed the title Enable configuring multiple builds Enable configuring multiple builds for different target browsers Dec 15, 2020
@nkrusch nkrusch changed the title Enable configuring multiple builds for different target browsers Enable configuring builds for different target browsers Dec 15, 2020
@nkrusch
Copy link
Contributor Author

nkrusch commented Jan 6, 2021

especially support different manifest for different browser

@nkrusch
Copy link
Contributor Author

nkrusch commented Jan 14, 2021

Also version this feature to support v2 and v3 manifest for chrome

@nkrusch nkrusch added the enhancement New feature or request label Jan 30, 2021
@nkrusch
Copy link
Contributor Author

nkrusch commented Feb 22, 2021

Regarding the manifests, allow specifying multiple build commands such that part of the build configuration is explicit path to manifest (it is there already but you can only have 1 build config in package.json). If the manifest is not specified, then use default. Then it would be possible to do, e.g. npm run build:chrome, npm run build:edge etc.

Possible strategy: add a flag to the build command so under the hood npm run build:chrome does xt-build -e prod -t chrome where -t is the build target browser. Specifying this flag would look for manifest in browser specific path. This is actually probably already doable by adding custom path to config using -c flag (but not if these configs are in package.json where you can only have one config). Ideally here just specifying the -t flag would know where to look for the manifest with fallback being the default manifest path. Could add browser specific configs and enable this in the package.json.

This should be a backwards compatible implementation, first introduced in the build, then added to the create command for new extensions.

For new extensions would make sense to create manifest directory either at src/manifests at root ./manifests. At the moment preferring root option, since manifest is for configuration, not so much "source".

Part of this change is also enabling specifying different configuration options for target browsers. For example firefox uses browser.runtime and others use chrome.runtime. Another example: linking to the store is always browser specific, so I would like to be able to have e.g. const storeURL = '...'; and then depending on my build target it resolves the correct value to use. Maybe a config directory? This may need to be done separately from manifests (see #7 which is related). There is additional consideration which is that if you import config the path matters. With extension manifest this is not an issue.

Moving the configuration per target to #7. This issue should be just about manifests. Scope is chrome, ff, opera, edge.

@nkrusch nkrusch changed the title Enable configuring builds for different target browsers Enable specifying multiple manifests for different target browsers Feb 22, 2021
@nkrusch
Copy link
Contributor Author

nkrusch commented Jul 19, 2021

I am closing this because there are two working strategies to handle this:

  1. create multiple manifest files and separate build config file per target browser that needs different manifest
  2. use platform target key in manifest (chrome or firefox) and specify platform specific keys this way

It is my experience the primary need is to customize the manifest between firefox vs. all the others; not every single target browser so the listed strategies are sufficient.

@nkrusch nkrusch closed this as completed Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

1 participant