feat: new Total Metabolic Tumor Volume tmtv (#2866)
* fix: ptDisplaySet metadata problem * fix: typo in xhrHeader field * fix: temporary fix for crosshairs on reload data * fix hotkey bug for input fields * upgrade docusarusu to stable release * circle ci node upgrade * cypress node upgrade * bump node in netlify * bump node version * remove versioned docs * update resources * fix: webpack injection of plugins * fix meaningful label for panels * add reviews and fix cli for creation * copy over chunks if exists in the build * edit templates * edit templates * fix yarn lock * fix(plugin):Deploy on windows is broken Co-authored-by: Bill Wallace <wayfarer3130@gmail.com>
This commit is contained in:
1 parent
ae897c47e0
commit
10b4ed5f8c
41 files changed
+2020
-811
No files matched your search
@@ -1,5 +1,6 @@
|
||||
const pluginConfig = require('../pluginConfig.json');
|
||||
const fs = require('fs');
|
||||
const glob = require('glob');
|
||||
|
||||
const autogenerationDisclaimer = `
|
||||
// THIS FILE IS AUTOGENERATED AS PART OF THE EXTENSION AND MODE PLUGIN PROCESS.
|
||||
@@ -44,11 +45,12 @@ function getFormattedImportBlock(importLines) {
|
||||
}
|
||||
|
||||
function getFormattedWindowBlock(addToWindowLines) {
|
||||
let content = "const extensions = [];\n" +
|
||||
"const modes = [];\n" +
|
||||
"const modesFactory = [];\n" +
|
||||
"window.extensions = extensions;\n" +
|
||||
"window.modes = modes;\n\n";
|
||||
let content =
|
||||
'const extensions = [];\n' +
|
||||
'const modes = [];\n' +
|
||||
'const modesFactory = [];\n' +
|
||||
'window.extensions = extensions;\n' +
|
||||
'window.modes = modes;\n\n';
|
||||
|
||||
addToWindowLines.forEach(addToWindowLine => {
|
||||
content += addToWindowLine;
|
||||
@@ -58,34 +60,67 @@ function getFormattedWindowBlock(addToWindowLines) {
|
||||
}
|
||||
|
||||
function getRuntimeLoadModesExtensions() {
|
||||
return "\n\n// Add a dynamic runtime loader\n" +
|
||||
"export default async () => {\n" +
|
||||
" for(const modeFactory of modesFactory) {\n" +
|
||||
" const newModes = await modeFactory(modes,extensions);\n" +
|
||||
" newModes.forEach(newMode => modes.push(newMode));\n" +
|
||||
"}\n}\n";
|
||||
return (
|
||||
'\n\n// Add a dynamic runtime loader\n' +
|
||||
'export default async () => {\n' +
|
||||
' for(const modeFactory of modesFactory) {\n' +
|
||||
' const newModes = await modeFactory(modes,extensions);\n' +
|
||||
' newModes.forEach(newMode => modes.push(newMode));\n' +
|
||||
'}\n}\n'
|
||||
);
|
||||
}
|
||||
|
||||
const createCopyPluginFromExtensions = (SRC_DIR, DIST_DIR, plugins) => {
|
||||
const createCopyPluginToDistForLink = (
|
||||
SRC_DIR,
|
||||
DIST_DIR,
|
||||
plugins,
|
||||
folderName
|
||||
) => {
|
||||
return plugins
|
||||
.map(plugin => {
|
||||
const from = `${SRC_DIR}/../node_modules/${plugin.packageName}/${folderName}/`;
|
||||
const exists = fs.existsSync(from);
|
||||
return exists
|
||||
? {
|
||||
from,
|
||||
to: DIST_DIR,
|
||||
toType: 'dir',
|
||||
}
|
||||
: undefined;
|
||||
})
|
||||
.filter(x => !!x);
|
||||
};
|
||||
|
||||
return plugins.map(plugin => {
|
||||
const from = `${SRC_DIR}/../node_modules/${plugin.packageName}/public/`;
|
||||
const exists = fs.existsSync(from);
|
||||
return exists ? {
|
||||
from,
|
||||
to: DIST_DIR,
|
||||
toType: 'dir',
|
||||
} : undefined;
|
||||
}
|
||||
).filter(x => !!x);
|
||||
}
|
||||
const createCopyPluginToDistForBuild = (
|
||||
SRC_DIR,
|
||||
DIST_DIR,
|
||||
plugins,
|
||||
folderName
|
||||
) => {
|
||||
return plugins
|
||||
.map(plugin => {
|
||||
const from = `${SRC_DIR}/../../../node_modules/${plugin.packageName}/${folderName}/`;
|
||||
const exists = fs.existsSync(from);
|
||||
return exists
|
||||
? {
|
||||
from,
|
||||
to: DIST_DIR,
|
||||
toType: 'dir',
|
||||
}
|
||||
: undefined;
|
||||
})
|
||||
.filter(x => !!x);
|
||||
};
|
||||
|
||||
function writePluginImportsFile(SRC_DIR, DIST_DIR) {
|
||||
let pluginImportsJsContent = autogenerationDisclaimer;
|
||||
|
||||
const extensionLines = constructLines(pluginConfig.extensions, 'extensions');
|
||||
const modeLines = constructLines(pluginConfig.modes, 'modes');
|
||||
const modesFactoryLines = constructLines(pluginConfig.modesFactory, 'modesFactory');
|
||||
const modesFactoryLines = constructLines(
|
||||
pluginConfig.modesFactory,
|
||||
'modesFactory'
|
||||
);
|
||||
|
||||
pluginImportsJsContent += getFormattedImportBlock([
|
||||
...extensionLines.importLines,
|
||||
@@ -112,17 +147,71 @@ function writePluginImportsFile(SRC_DIR, DIST_DIR) {
|
||||
}
|
||||
);
|
||||
|
||||
const copyPluginFromExtensions = createCopyPluginFromExtensions(
|
||||
SRC_DIR, DIST_DIR,
|
||||
// Build packages using cli add-mode and add-extension
|
||||
// will get added to the root node_modules, but the linked packages
|
||||
// will be hosted at the viewer node_modules.
|
||||
|
||||
const copyPluginPublicToDistBuild = createCopyPluginToDistForBuild(
|
||||
SRC_DIR,
|
||||
DIST_DIR,
|
||||
[
|
||||
...pluginConfig.modesFactory,
|
||||
...pluginConfig.modes,
|
||||
...pluginConfig.extensions,
|
||||
...pluginConfig.umd,
|
||||
]
|
||||
)
|
||||
],
|
||||
'public'
|
||||
);
|
||||
|
||||
return copyPluginFromExtensions;
|
||||
const copyPluginPublicToDistLink = createCopyPluginToDistForLink(
|
||||
SRC_DIR,
|
||||
DIST_DIR,
|
||||
[
|
||||
...pluginConfig.modesFactory,
|
||||
...pluginConfig.modes,
|
||||
...pluginConfig.extensions,
|
||||
...pluginConfig.umd,
|
||||
],
|
||||
'public'
|
||||
);
|
||||
|
||||
// Temporary way to copy chunks from the dist folder so that the become
|
||||
// available
|
||||
const copyPluginDistToDistBuild = createCopyPluginToDistForBuild(
|
||||
SRC_DIR,
|
||||
DIST_DIR,
|
||||
[
|
||||
...pluginConfig.modesFactory,
|
||||
...pluginConfig.modes,
|
||||
...pluginConfig.extensions,
|
||||
...pluginConfig.umd,
|
||||
],
|
||||
'dist'
|
||||
);
|
||||
|
||||
const copyPluginDistToDistLink = createCopyPluginToDistForLink(
|
||||
SRC_DIR,
|
||||
DIST_DIR,
|
||||
[
|
||||
...pluginConfig.modesFactory,
|
||||
...pluginConfig.modes,
|
||||
...pluginConfig.extensions,
|
||||
...pluginConfig.umd,
|
||||
],
|
||||
'dist'
|
||||
);
|
||||
|
||||
console.log('copy plugins', [...copyPluginPublicToDistBuild,
|
||||
...copyPluginPublicToDistLink,
|
||||
...copyPluginDistToDistBuild,
|
||||
...copyPluginDistToDistLink,
|
||||
])
|
||||
return [
|
||||
...copyPluginPublicToDistBuild,
|
||||
...copyPluginPublicToDistLink,
|
||||
...copyPluginDistToDistBuild,
|
||||
...copyPluginDistToDistLink,
|
||||
];
|
||||
}
|
||||
|
||||
module.exports = writePluginImportsFile;
|
||||
Reference in new issue
Block a user