Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
log.info('============================================== SCSS BUNDLE ==============================================');
log.info(`= Source: ${src}`);
log.info(`= Dest: ${dest}`);
log.info(`=`);
const { found, bundledContent, imports } = await new Bundler(undefined, root).Bundle(src, ["./!(dist|node_modules)/**/*.scss"], undefined, ["^~"]);
if (imports) {
const filesNotFound = imports
.filter(x => !x.found && !x.ignored)
.map(x => x.filePath);
if (filesNotFound.length) {
log.error(`= Error: SCSS imports failed`);
log.error('= ' + filesNotFound.join('\n= '));
log.info('=========================================================================================================');
throw new Error('One or more SCSS imports failed');
}
}
if (found) {
await writeFile(dest, bundledContent);
log.success(`= Bundle OK`);
log.info('=========================================================================================================');
}
}async function bundleScss(root: string, src: string, dest: string) {
log.info('============================================== SCSS BUNDLE ==============================================');
log.info(`= Source: ${src}`);
log.info(`= Dest: ${dest}`);
log.info(`=`);
const { found, bundledContent, imports } = await new Bundler(undefined, root).Bundle(src, ["./!(dist|node_modules)/**/*.scss"], undefined, ["^~"]);
if (imports) {
const filesNotFound = imports
.filter(x => !x.found && !x.ignored)
.map(x => x.filePath);
if (filesNotFound.length) {
log.error(`= Error: SCSS imports failed`);
log.error('= ' + filesNotFound.join('\n= '));
log.info('=========================================================================================================');
throw new Error('One or more SCSS imports failed');
}
}
if (found) {
await writeFile(dest, bundledContent);
log.success(`= Bundle OK`);
log.info('=========================================================================================================');
}
}if (!fs.existsSync(p)) {
fs.mkdirSync(p);
}
return p;
}, '');
fs.copyFileSync(entry, to);
log.success(` - from: ${entry}`);
log.success(` - to: ${to}`);
});
});
});
return Promise.all(copyPromises);
} catch (e) {
log.error(e.message);
return Promise.resolve();
}
}