diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bb70059a..9578c0d7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,11 +18,65 @@ again. ## Code reviews All submissions, including submissions by project members, require review. We -use GitHub pull requests for this purpose. Consult -[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more +use GitHub pull requests for this purpose. Consult [GitHub +Help](https://help.github.com/articles/about-pull-requests/) for more information on using pull requests. ## Community Guidelines This project follows [Google's Open Source Community Guidelines](https://opensource.google.com/conduct/). + +## Debugging Quicklink + +The [test +folder](https://github.com/GoogleChromeLabs/quicklink/tree/master/test) contains +several test cases. Make sure to create a new test when building a new feature. + +Here's an example of how to debug the library by using one of these tests: +[test/test-basic-usage.html](https://github.com/GoogleChromeLabs/quicklink/blob/master/test/test-basic-usage.html). + +1. Comment the following block of code at `test/test-basic-usage.html`: + +```javascript + + +``` + +2. Add the following snippet in its place, to import the module from its + source file: + +```javascript + +``` + +3. Open + [src/index.mjs](https://github.com/GoogleChromeLabs/quicklink/blob/master/src/index.mjs) + for edit and replace the following line: + +```javascript +import throttle from 'throttles'; +``` + +By: + +```javascript +import throttle from '../node_modules/throttles/dist/index.mjs' +``` + +4. Build the project: `npm run build`. + +5. Start a local server: `npm run start`. By default, this will start the local server at `https://localhost:8080`. + +6. Open the file where the modifications where made: + `http://localhost:8080/test/test-basic-usage.html`. + +7. Open Chrome DevTools and go the **Sources** tab. + +8. Under `localhost:8080/src` you can find the unminified versions of the `Quicklink` files. + Now you can use breakpoints and inspect variables to debug the library.