-
Notifications
You must be signed in to change notification settings - Fork 215
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
doc: Rewrite README.md and move build and contribution details into a separate doc file #147
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another major incompatibility is the lack of support for callbacks instead of promises. Can you also document this?
The API promises to be a Promise-based API. However, promises are not supported for unrecognized APIs, and callbacks have to be used for them.
The CONTRIBUTING document lacks a description of the expected commit format in pull requests. This is already checked by our linter and CI, so if you want to keep the doc as short as possible, it's OK to omit these details.
CONTRIBUTING.md
Outdated
|
||
npm install | ||
|
||
npm run build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is redundant, because it will already be run at the npm install
call due to the prepublish
hook that calls build
.
Perhaps add a comment after npm install
:
# ^ installs the dependencies and runs "npm run build" to build the polyfill.
prepublish: Run BEFORE the package is packed and published, as well as on local npm install without any arguments. (See below)
CONTRIBUTING.md
Outdated
|
||
This will install all the npm dependencies and build both non-minified and minified versions | ||
of the final library, and output them to `dist/browser-polyfill.js` and `dist/browser-polyfill.min.js`, | ||
respectively, and finally executes the unit tests on the generated dist files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/execute/executes/
.
CONTRIBUTING.md
Outdated
|
||
This project provides two test suites: | ||
|
||
- unit tests (which only require nodejs to run) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/nodejs/Node.js/
.
CONTRIBUTING.md
Outdated
|
||
### Unit Tests | ||
|
||
The unit tests are executed into nodejs and use jsdom to create a browser-like environment in which the library is executed and tested. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/into/in/
(use in
for location, into
for movement).
s/nodejs/Node.js/
How about this:
The unit tests are run in Node.js with [Mocha](https://mochajs.org/), and use jsdom and [Sinon](http://sinonjs.org/) to mock a browser-like environment for testing the library.
CONTRIBUTING.md
Outdated
|
||
The unit tests are executed into nodejs and use jsdom to create a browser-like environment in which the library is executed and tested. | ||
|
||
The unit tests are useful to achieve an higher code coverage of the tests, and it is easier to inject spies and shims to make assertions on some of the behavior implemented internally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this paragraph/line can be removed. Increasing test coverage is obvious (first part), and spies/shims are also kind of obvious when one looks at existing code for examples.
For contributors, it would be more helpful if you describe the location of unit tests, i.e. test/test-*.js
.
README.md
Outdated
| Edge | *Not supported* (may become unofficially supported once #114 lands) | | ||
|
||
The polyfill is being tested explictly (with automated tests that run on every pull request) on the platforms that are | ||
**officially supported** last stable versions of Chrome and Firefox. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sentence does not flow well.
README.md
Outdated
The polyfill is being tested explictly (with automated tests that run on every pull request) on the platforms that are | ||
**officially supported** last stable versions of Chrome and Firefox. | ||
|
||
On Firefox, this library is actually acting as a NO-OP: it detects that is running on Firefox (where the Promise-based |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not detect that it is running in Firefox. How about:
It detects that the Promise-based APIs are provided (by Firefox) and does not replace the global `browser` object.
README.md
Outdated
@@ -84,6 +116,45 @@ browser.tabs.executeScript({file: "content.js"}).then(result => { | |||
}); | |||
``` | |||
|
|||
### Basic Setup with module bundlers | |||
|
|||
This library is built as an **UMD module** (Universal Module Definition), and so it can also be used with module bundlers (and explictly tested on both **webpack** and **browserify**) or AMD module loaders. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/an **UMD**/a **UMD**/
README.md
Outdated
"Firefox only" issues should be reported upstream on Bugzilla: | ||
- https://bugzilla.mozilla.org/enter_bug.cgi?product=WebExtensions&component=Untriaged | ||
|
||
### API methods or options that are only avaible when running in Firefox |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/avaible/available/
.
README.md
Outdated
|
||
This section aims to keep track of the most common issues that an extension may have. | ||
|
||
### Issues that happens only when running on Firefox |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/happens/happen/
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nits + one more thing (lack of support for callbacks, link to #102 ).
Another major incompatibility is the lack of support for callbacks instead of promises. Can you also document this?
CONTRIBUTING.md
Outdated
* `chore: Upgraded yargs to 3.x.x` | ||
|
||
If you want to use scopes then it would look more like: | ||
`test(integration): Added test extension for newAmozingAPI`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amozing -> Amazing?
README.md
Outdated
| Chrome | *Officially Supported* (with automated tests) | | ||
| Firefox | *Officially Supported as a NO-OP* (with automated tests for comparison with the behaviors on Chrome) | | ||
| Opera | *Unofficially Supported* as a Chrome-compatible target (but not explicitly tested in automation) | | ||
| Edge | *Not supported* (may become unofficially supported once #114 lands) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still not a link - please change it to [#114](https://github.com/mozilla/webextension-polyfill/pull/114)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, still there is a small nit. One that I mentioned before (executes -> execute):
https://github.com/mozilla/webextension-polyfill/pull/147/files/f70fa49f56d8cd5a50669a108c047fecea26f791#r201784084
and another one below.
Feel free to squash and merge after making those changes.
README.md
Outdated
@@ -272,6 +272,10 @@ This library tries to minimize the amount of "special handling" that a cross-bro | |||
|
|||
This section aims to keep track of the most common issues that an extension may have. | |||
|
|||
### No callback supported by the Promise-based APIs on Chrome | |||
|
|||
While Firefox some of the asynchronous API methods (the ones that return a promise) also support the callback parameter (mostly as a side effect of the backward compatibility with the callback-based APIs available on Chrome), the Promise-based APIs provided by this library do not support the callback parameter (See ["#102 Cannot call browser.storage.local.get with callback"][I-102]). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that you accidentally dropped an "in" here. I suggest to reword the start from
While Firefox some of the asynchronous API methods (...) also support
to
While some of the asynchronous API methods in Firefox
… separate doc file
This PR goals is to apply some changes to the README.md file to make it a bit more oriented to the kind of information that may be helpful to an extension developer that just wants to use the library instead of building it from its sources, and move the information about building, testing into a separate CONTRIBUTING.md file.
Here is a link to get a preview of how the README.md is going to look like: https://github.com/rpl/webextension-polyfill/blob/doc/rewrite-readme/README.md
TODO list:
README.md
CONTRIBUTING.md