StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.3 KiB
41 lines
1.3 KiB
var fs = require('fs');
|
|
var path = require('path');
|
|
|
|
var minify = require('minify-stream');
|
|
var intoStream = require('into-stream');
|
|
|
|
var constants = require('./constants');
|
|
|
|
var prefix = 'var locale=';
|
|
var suffix = ';if(typeof Plotly === \'undefined\') {window.PlotlyLocales = window.PlotlyLocales || []; window.PlotlyLocales.push(locale);} else {Plotly.register(locale);}';
|
|
|
|
var moduleMarker = 'module.exports = ';
|
|
|
|
/** Wrap a locale json file into a standalone js file
|
|
*
|
|
* @param {string} pathToInput path to the locale json file
|
|
* @param {string} pathToOutput path to destination file
|
|
*
|
|
* Logs basename of bundle when completed.
|
|
*/
|
|
module.exports = function wrapLocale(pathToInput, pathToOutput) {
|
|
fs.readFile(pathToInput, 'utf8', function(err, data) {
|
|
var moduleStart = data.indexOf(moduleMarker) + moduleMarker.length;
|
|
var moduleEnd = data.indexOf(';', moduleStart);
|
|
|
|
var rawOut = prefix + data.substr(moduleStart, moduleEnd - moduleStart) + suffix;
|
|
|
|
intoStream(rawOut)
|
|
.pipe(minify(constants.uglifyOptions))
|
|
.pipe(fs.createWriteStream(pathToOutput))
|
|
.on('finish', function() {
|
|
logger(pathToOutput);
|
|
});
|
|
});
|
|
};
|
|
|
|
function logger(pathToOutput) {
|
|
var log = 'ok ' + path.basename(pathToOutput);
|
|
|
|
console.log(log);
|
|
}
|
|
|