Installation
There are five different installable packages:
@preemptive/jsdefender-core
: The core protection logic and public API of JSDefender. This is a dependency of all the other packages.@preemptive/jsdefender-cli
: A wrapper for JSDefender which allows you to run it from the command line.@preemptive/jsdefender-webpack-plugin
: A webpack plugin which allows you to hook into the webpack pipeline and protect the output chunks.@preemptive/jsdefender-metro-plugin
: A Metro plugin which hooks into the bundling process to protect the output bundle.@preemptive/jsdefender-rollup-plugin
: A Rollup plugin for running JSDefender on all chunks in a Rollup session. It uses a number of hooks to integrate JSDefender into the Rollup build process.
Each package has a README file where you can find more information.
Download the preemptive-jsdefender-*-{version}.tgz
(e.g. preemptive-jsdefender-core-2.0.0.tgz
) packages you want to install (where 'version' is the actual version you want) and put them outside of your project's directory (the best way is to place them next to your project's directory). After that install via your package manager:
npm install <package-directory>/preemptive-jsdefender-*-{version}.tgz --save-dev
OR
yarn add file:<package-directory>/preemptive-jsdefender-*-{version}.tgz --dev
@preemptive/jsdefender-core
manually in order to use most of the other packages because it is a peer dependency of those packages.
Updating
To install a new version of preemptive-jsdefender-*
in the form of a preemptive-jsdefender-*-{newVersion}.tgz
file, place it outside of your project's directory and run the install script again with the new package:
npm install <package-directory>/preemptive-jsdefender-*-{newVersion}.tgz --save-dev
OR
yarn add file:<package-directory>/preemptive-jsdefender-*-{newVersion}.tgz --dev
Installing from a Url
You can upload a JSDefender package to an online file store (e.g. Blob Storage) or to your own package registry.
npm install https://<package-url> --save-dev
OR
yarn add https://<package-url> --dev
Installing Globally
@preemptive/jsdefender-cli
also works as a system-wide/global CLI. To install it globally:
npm install <package-directory>/preemptive-jsdefender-core-{version}.tgz <package-directory>/preemptive-jsdefender-cli-{version}.tgz -g
OR
yarn global add <package-absolute-directory>/preemptive-jsdefender-core-{version}.tgz <package-absolute-directory>/preemptive-jsdefender-cli-{version}.tgz
yarn global bin
command to your path to be able to run global Yarn packages.
After that you can use the jsdefender
command everywhere in your system like you would use it as a local dev package.