Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const fs = require('fs-extra');
const ocClientBrowser = require('oc-client-browser');
const log = require('./logger');
const path = require('path');
const packageJson = require('../package');
const ocVersion = packageJson.version;
const clientComponentDir = '../src/components/oc-client/';
const ocClientPackageInfo = require(`${clientComponentDir}package.json`);
log['start']('Building client');
fs.emptyDirSync(path.join(__dirname, clientComponentDir, 'src'));
ocClientBrowser.getLib((err, libContent) => {
if (err) {
log['error'](err);
}
ocClientPackageInfo.version = ocVersion;
fs.writeJsonSync(
path.join(__dirname, clientComponentDir, 'package.json'),
ocClientPackageInfo,
{ spaces: 2 }
);
fs.writeFileSync(
path.join(__dirname, clientComponentDir, 'src/oc-client.min.js'),
libContent
);