Skip to content

Windscribe/browser-extension-mv3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Windscribe MV3 Extension

Installing and Running

Procedures:

  1. Check if your Node.js version is >= 14.
  2. Update the environment file
  3. Run yarn install to install the dependencies.
  4. Run git submodule update --init --recursive
  5. Run yarn start
  6. Load your extension on Chrome following:
    1. Access chrome://extensions/
    2. Check Developer mode
    3. Click on Load unpacked extension
    4. Select the build folder.

Structure

All your extension's code must be placed in the src folder.

The boilerplate is already prepared to have a popup, an options page, a background page.

Environment

Some variables needed for building extension are bundled in the env file. Two of them you will need to produce, signup on windscribe with an account and use the credentials from that account here for the build password and username. This is needed to fetch locations at build time and embed generated content scripts.

REACT_APP_REDUX_PORT=WS_BROWSER_EXTENSION_STORE
BROWSER=Chrome
API_URL=windscribe.com
BACKUP_API_URL=totallyacdn.com
NODE_ENV=production
BUILD_USER_NAME=
BUILD_USER_PASSWORD=

Content Scripts

Although this boilerplate uses the webpack dev server, it's also prepared to write all your bundles files on the disk at every code change, so you can point, on your extension manifest, to your bundles that you want to use as content scripts, but you need to exclude these entry points from hot reloading (why?). To do so you need to expose which entry points are content scripts on the webpack.config.js using the chromeExtensionBoilerplate -> notHotReload config. Look the example below.

Let's say that you want use the myContentScript entry point as content script, so on your webpack.config.js you will configure the entry point and exclude it from hot reloading, like this:

{
  
  entry: {
    myContentScript: "./src/js/myContentScript.js"
  },
  chromeExtensionBoilerplate: {
    notHotReload: ["myContentScript"]
  }
  
}

and on your src/manifest.json:

{
  "content_scripts": [
    {
      "matches": ["https://www.google.com/*"],
      "js": ["myContentScript.bundle.js"]
    }
  ]
}

Intelligent Code Completion

Thanks to @hudidit's kind suggestions, this boilerplate supports chrome-specific intelligent code completion using @types/chrome.

Packing

After the development of your extension run the command

$ NODE_ENV=production npm run build

Now, the content of build folder will be the extension ready to be submitted to the Chrome Web Store. Just take a look at the official guide to more infos about publishing.

Resources:


Test

To run e2e tests locally you need:

  1. Got to https://www-staging.windscribe.com/signup and create your test user on staging environment
  2. Save your Username and Password
  3. Ask guys in qa or web-team channel to upgrade your test user to Pro
  4. Create .env.local file in a root of the project and paste environment variables in it:
REACT_APP_REDUX_PORT=WS_BROWSER_EXTENSION_STORE
BROWSER=Chrome
API_URL=staging.windscribe.com
TEST_USER_NAME=your_username
TEST_USER_PASSWORD=your_password
BUILD_USER_NAME=
BUILD_USER_PASSWORD=
  1. Run tests by
$ yarn run test:local

It opens a browser window, makes stuff, and closes it automatically. Please, don't interrupt test scenarios by pressing keys or clicking or whatever.

About

Source code of the windscribe MV3 browser extensions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 3

  •  
  •  
  •