When you create a plugin or application it is common to use additional Phovea modules or external libraries to avoid re-inventing the wheel again. There are slightly different ways how to add dependencies for the client-side and the server-side.
A client-side dependency can be another Phovea module or a JavaScript library available on the npm registry.
yo phovea:add-dependency
Follow theses steps only, if you cannot find the library in the known libraries by the Phovea framework (using the Phovea generator in the step above).
"dependencies": {
"@types/d3": "3.5.36",
"d3": "3.5.17"
},
Most of the Phovea repositories (e.g., phovea_vis and phovea_clue) use D3 v3. If you want to use code that uses D3 v4 add the specific D3 module (e.g., d3-selection) and the @type dependency (as described above) to the package.json.
"dependencies": {
"@types/d3-scale": "^1.0.4",
"d3-scale": "^1.0.3"
},
Note, that you must import the specific D3 v4 modules to your TypeScript file as follows to avoid conflicts with the D3 v3 library:
import {scaleLinear} from 'd3-scale';
Import a jQuery UI widget, here Sortable, as follows:
npm install -save jquery-ui
in the plugin directoryimport * as $ from 'jquery';
import 'jquery-ui/ui/widgets/sortable'; // specify the widget here
import 'style-loader!css-loader!jquery-ui/themes/base/all.css'; // use Webpack CSS loader to import base style for all widgets
Important: Make sure you specified the particular widget and use the style loader in the import
statements.
A server-side dependency can be another Phovea module or pip package available on PyPI Python Package Index.
yo phovea:add-dependency
Follow theses steps only, if you cannot find a suitable Phovea plugin (using the Phovea generator in the step above).
ujson==1.33
enum==0.4.6
NOTE: A bug (addressed here) in the Phovea generator is overriding changes made to the requirements.txt when running yo phovea:update
. You have to restore the modifications manually until the bug is fixed.
yo phovea:workspace
to merge the dependencies of all cloned repos in the workspace directorydocker-compose build
for server-side changesnpm install
for client-side changesnpm install
to install new npm dependencies