Save to Pocket is a browser extension that is used to save pages to a connected Pocket account when clicking a toolbar button, selecting a context menu item, or pressing keyboard shortcut. When a page is saved, a “Page Saved!” notification appears and offers additional actions, including:
- Add Tags (with support for Suggested Tags for Pocket Premium subscribers)
- Archive Page
- Remove Page
- View List
- Settings
Save to Pocket also includes article Recommendations. These recommendations are displayed below the “Page Saved!” notification and are related to the item that was just saved.
In addition, when the extension is installed, Save buttons will be injected on Twitter, Hacker News, and Reddit so links posted to these sites can be saved in one click.
This is the skeleton structure for the Save to Pocket extension codebase.
It leverages an external build script (to be moved to an official repo) to keep things simple when working with the operational code.
At this time it is set up to use the following:
- React
- Redux
- Jest for testing
- Eslint for JS linting
- Babel for ES6/7
- Stylelint for Style linting
- SASS
- CSS modules
- Webpack for compiling
React is a view library developed by Facebook to create declarative, component based UI. It will automatically update the UI based on the state of the application using a virtual dom.
Redux is a library used to create a predictable state container.
React Chrome Redux allows us to build react/redux seamlessly with the background messaging convention in extensions. The background page holds the Redux store, while Popovers and Content-Scripts act as UI Components, passing actions and state updates between themselves and the background store.
- Prepare your project
- Install dependencies
- Create a development/production build
- Load the extension into your browser
Before you get started you will need to do the following:
- Register an API key from https://getpocket.com/developer/
- Create a keys.json file in the root directory of the project with the folowing format:
{
"browserName": "key"
}
- You are able to add multiple browsers and keys. During the build process it will create a seperate folder for each browser defined.
The app is bundled with webpack via node. You may use Yarn or NPM to run the build/start/test scripts.
yarn install
OR npm install
Run yarn start
OR npm run start
This will create a generic build using the first key in your keys.json
and
place it in _build/_dev
at the root directory. This will watch for changes and
automatically reload the extension. It is important to note that you will need
to refresh the individual pages the extension is active in after a change is made.
Run yarn build
OR npm run build
This will create an optimized build and place it inside _build
at the root
directory. There will be a folder for each browser defined in
your keys.json.
To load the extension:
- Open chrome and navigate to chrome://extensions
- Check the
Developer mode
in the upper right - Select
Load unpacked extension...
- Select the browser folder inside the
_build
folder when prompted. (Note: During the development process a single folder (_dev
) be generated.)
TBD
- autosize-input - MIT License - Copyright (c) 2017 Jed Watson.
- blueimp-md5 - MIT License - Copyright (c) 2011 Sebastian Tschan
- classnames - MIT License - Copyright (c) 2016 Jed Watson.
- prop-types - MIT License - Copyright (c) 2013-present, Facebook, Inc.
- react - MIT License - Copyright (c) 2013-present, Facebook, Inc.
- react-chrome-redux - MIT License - Copyright (c) 2016 Tyler Shaddix
- react-dom - MIT License - Copyright (c) 2013-present, Facebook, Inc.
- react-motion - MIT License - Copyright (c) 2015 React Motion authors
- react-onclickoutside - MIT License
- react-redux - MIT License - Copyright (c) 2015-present Dan Abramov
- redux - MIT License - Copyright (c) 2015-present Dan Abramov
- redux-saga - MIT License - Copyright (c) 2015 Yassine Elouafi
- semver - ISC License - Copyright (c) Isaac Z. Schlueter and Contributors