Skip to content
Snippets Groups Projects
Commit 8cce8332 authored by Xiao Gui's avatar Xiao Gui Committed by xgui3783
Browse files

feat: allow for custom endpoints for plugins

parent 74638fbf
No related branches found
No related tags found
No related merge requests found
......@@ -32,7 +32,11 @@ To develop plugins for the interactive viewer, run:
git clone https://github.com/HumanBrainProject/interactive-viewer
cd interactive-viewer
npm i
PLUGINDEV=true npm run dev-plugin
npm run dev-plugin
/* or define your own endpoint that returns string of manifests */
PLUGINDEV=http://mycustom.io/allPluginmanifest npm run dev-server
```
The contents inside the folder in `./src/plugin_examples` will be automatically fetched by the dev instance of the interactive-viewer on load.
......
......@@ -10,7 +10,8 @@
"build-aot": "GIT_HASH=`git rev-parse --short HEAD` webpack --config webpack.aot.js",
"build-min": "webpack --config webpack.prod.js",
"build": "webpack --config webpack.dev.js",
"dev-plugin": "PLUGINDEV=true npm run dev-server & node ./src/plugin_examples/server.js",
"dev-plugin": "PLUGINDEV=true npm run dev-server & npm run plugin-server",
"plugin-server": "node ./src/plugin_examples/server.js",
"dev-server": "webpack-dev-server --config webpack.dev.js --mode development",
"serve-plugins": "node src/plugin_examples/server.js",
"test": "karma start spec/karma.conf.js"
......
......@@ -16,7 +16,9 @@ export class AtlasViewerDataService implements OnDestroy{
public promiseFetchedPluginManifests : Promise<PluginManifest[]> = new Promise((resolve,reject)=>{
Promise.all([
PLUGINDEV
? fetch('http://localhost:10080/allPluginmanifests').then(res=>res.json())
? PLUGINDEV === 'true'
? fetch('http://localhost:10080/allPluginmanifests').then(res=>res.json())
: fetch(PLUGINDEV).then(res => res.json())
: Promise.resolve([]),
Promise.all(
BUNDLEDPLUGINS
......
......@@ -8,6 +8,6 @@ declare module '*.css' {
export = contents
}
declare var PLUGINDEV : boolean
declare var PLUGINDEV : string
declare var BUNDLEDPLUGINS : string[]
declare var VERSION : string
\ No newline at end of file
......@@ -41,7 +41,7 @@ module.exports = {
},
plugins : [
new webpack.DefinePlugin({
PLUGINDEV : process.env.PLUGINDEV ? true : false,
PLUGINDEV : JSON.stringify(process.env.PLUGINDEV),
BUNDLEDPLUGINS : process.env.BUNDLEDPLUGINS
? JSON.stringify(process.env.BUNDLEDPLUGINS.split(','))
: JSON.stringify([]),
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment