-
Notifications
You must be signed in to change notification settings - Fork 28
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
replace grunt with web-ext #37
Open
shinenelson
wants to merge
9
commits into
williambelle:master
Choose a base branch
from
shinenelson:web-ext-integration
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
migrate the `grunt test` task to package.json. `npm test` is the new alternative command. this is the first ( and easiest ) step to eliminating `grunt` as a dependency for the project.
There were 2 divergences in the `manifest.json` files : - `"applications"` block in the firefox manifest which specified the minimum supported version of the extension in the browser - different icon sizes in the default `manifest.json` This divergence seemed trivial to be maintained separately. Merging and running the extension from the merged `manifest.json` file did not throw any major errors in the running of the extension on Firefox as well as Chromium. It does not seem sensible to maintain 2 separate `manifest.json` files for the extension unless there are other chromium-based browsers who use the `"applications"` block specifically for something else or some other browser that accepts only one icon in the manifest.
Now that the only minor divergence in the source code have been merged, the `src` directory can be used as the single source of truth for both source code as well as distribution code. There is nothing that needs to be compiled or transpiled that would require a separate dedicated distribution directory.
because web-ext run already watches, live reloads and also serves the web extension to the desired browser described by `npm run -- serve:firefox` or `npm run -- serve:chromium`
`npm` has a built-in `pack` command that can compress the repository ( or specific `files` in the repository ) and generate a tarball. Additionally, it also adds some default files like the README, LICENSE and CHANGELOG for posterity. The output tarball is also aptly named in the format `<project-name>-<version-string>.tgz` reference : https://stackoverflow.com/a/55220535 While the tarball can be generated by running the `npm pack` command, for sake of backward-compatibility of existing `npm` scripts, it has been assigned to the `package` script replacing the `grunt package` alias.
remove all remaining traces of grunt from the project
`a0bc2c0` blindly migrated the `grunt` alias `test` without looking at the script's semantics.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
web-ext is a tool that is designed specifically for the development
of web extensions. It provides functionality like auto-loading the web
extension in the browser and watching the source file for changes and
automatically reloading the web extension in the browser.
This supersedes the dependency on
grunt
becausegrunt
cannothandle the automatic loading of the web-extension into the browser.
And that is obviously because
grunt
is a generic tool.When there is a tool that is designed specifically for the purpose of
development of web extensions that provides better functionality, we
should migrate to it.
web-ext
has additional features that can be utilized, but I was onlytargeting existing feature-parity.
For example, it has an option where the path to a browser binary can
be provided and the tool will attempt to open the web extension with
that binary. This could be useful when one wants to test on other
chromium-based browsers like Opera, Edge Chromium, Brave, Vivaldi,
etc. I think using the
chromiumBinary
option would probably work,but I have not tested it ( that is also why I have not changed the
Opera and Edge Chromium sections in the CONTRIBUTING document )