Skip to content

Latest commit

 

History

History
103 lines (63 loc) · 3.25 KB

README.md

File metadata and controls

103 lines (63 loc) · 3.25 KB

MetaDefender browser extension

metadefender-browser-extension

Intro

OPSWAT File Security for Chrome, provides the ability to quickly scan a file for malware prior to download directly from the browser. At the moment this only works with google chrome, but can be extended to any other browser.

Using mocli

mocli is a command line tool that helps performing project setup and some development task automation. You can find the source code in ./mocli.sh file.

For proper usage we suggest installing autoenv to execute the ./.env file. As an alternative you can run the env file source ./.env manually. Once executed, the mocli command will be available inside the project folder. Run mocli help to get a list of available commands.

Project Setup

Install dependencies and configure environment:

mocli developer

Development

# Start livereload and watches all assets
mocli watch

# Start release branch and create a qa distribution
mocli release start <version>

# Close release branch and create a prod distribution
mocli release finish <version>

After running mocli watch load the extension in your browser from the dist/<vendor> directory.

Folder structure

./config/ environment configuration files. common.json is the main config file. /scripts/common/config.js file is generated by overwriting common.json with an env specific json file.

./src/_locales/ extension translation files.

./src/assets/fonts/ extension font files.

./src/assets/images/ extension assets.

./src/components extension common components used in multiple places.

./src/constants extension constants variables.

./src/hooks extension react hooks file with his own test file.

./src/pages/ extension folders with each page code (js, css and test) files.

.src/services/ extension javascript files with the logic.

Globals

The build tool creates a config file in ./config/config.js from ./config/[env].json, where env can be dev, local, qa or prod

Testing

We use jest with enzyme for unit testing. Workflow: for each file that needs to be tested create a test file next to it. Example: for browser-extension.js create a browser-extension.test.js file.

Running tests

# run unit tests on your local environment
mocli test

# run tests with coverage
mocli coverage

To rebuild the docker image run:

IMG=opswat/metadefender-browser-extension && VER=2.0
docker build -f Dockerfile . -t ${IMG}:${VER} -t ${IMG}:latest
docker push ${IMG}:${VER}
docker push ${IMG}:latest

Contributing

See contributing.

Opening Issues

If you encounter a bug we would like to hear about it. Please use Github Issues to open new issues or search for existing ones.

Code of conduct

See code of conduct.

Release notes

See releases.