Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise((resolve, reject) => {
const log = this.log;
const demoConfig = {
dist: true,
demoFilter: options.demoName,
cwd: installation.getComponentDir(options.moduleName),
brand: options.brand
};
log.trace(demoConfig, 'Starting OBT Demo build');
const demoStream = obt.demo(gulp, demoConfig);
const filesGenerated = [];
demoStream.on('data', function(file) {
log.trace('OBT demo compiling');
filesGenerated.push(file);
});
demoStream.on('end', () => {
if (filesGenerated.length > 0) {
log.trace(demoConfig, 'OBT Demo build complete');
const html = filesGenerated[0].contents.toString('utf8');
const versionLockedContent = this.fileProxy.versionLockBuildserviceUrls(html, options.moduleName, options.moduleVersion, 'https://' + hostnames.preferred + options.reqUrl);
resolve(new Buffer(versionLockedContent));
} else {
reject(new CompileError('No file were generated running obt.demo'));