Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions npm-postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,19 @@ const getConfig = cp.spawn('php', [
'useEEGBrowserVisualizationComponents',
], {});

let EEGVisEnabled = false;
getConfig.stdout.on('data', (data) => {
const EEGVisEnabled = JSON.parse(data);
try {
EEGVisEnabled = JSON.parse(data);
} catch (e) {
console.warn(
'\x1b[33m',
'WARNING: Unable to fetch DB config',
'useEEGBrowserVisualizationComponents',
'\x1b[0m',
);
}

if (EEGVisEnabled === 'true') {
console.info('\n ----- \n >> '
+ 'EEG Browser visualization components enabled '
Expand All @@ -99,10 +110,12 @@ getConfig.stdout.on('data', (data) => {
);

protoc.on('error', (error) => {
console.error('ERROR: '
+ 'Make sure that protoc '
+ '(https://github.com/protocolbuffers/protobuf/releases/) '
+ 'is installed on your system '
console.error(
'\x1b[31m',
'ERROR: Make sure that protoc',
'(https://github.com/protocolbuffers/protobuf/releases/)',
'is installed on your system',
'\x1b[0m',
);
console.error(error);
});
Expand Down
11 changes: 10 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,16 @@ if ('EEG_VIS_ENABLED' in process.env) {
'useEEGBrowserVisualizationComponents',
], {});

EEGVisEnabled = JSON.parse(getConfig.stdout);
try {
EEGVisEnabled = JSON.parse(getConfig.stdout);
} catch (e) {
console.warn(
'\x1b[33m',
'WARNING: Unable to fetch DB config',
'useEEGBrowserVisualizationComponents',
'\x1b[0m',
);
}
}

modulePlugins.push(
Expand Down