Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const configStreamRaw: Stream = createReadStream(configPath, { encoding: 'utf8' });
let exportVariableName: string = 'urn:comunica:sparqlinit';
if (args.length > 1) {
exportVariableName = args[1];
}
// Hack our require path so that compilation in a monorepo dev environment always works properly
// Otherwise, Components.js will think that we are running inside the 'runner' package,
// and it will use its node_modules.
require.main.paths = [];
const pathParts = mainModulePath.split(sep);
for (let i = pathParts.length; i > 0; i--) {
require.main.paths.push(pathParts.slice(0, i).join(sep) + sep + 'node_modules');
}
compileConfig({ mainModulePath }, configPath, configStreamRaw, configResourceUri, exportVariableName)
.then(console.log).catch((e) => {
console.error(e);
process.exit(1);
});