'use strict';

const tools = require('../../scripts/utils/tools');
const configUtils = require('../../scripts/csdr/config/config-utils');
const buildPackageUtils = require('../../scripts/utils/build/package/build-package-utils');

Promise.resolve()
  .then(() => {
    const pkg = configUtils.packages.getPackage();
    return buildPackageUtils.build(pkg);
  })
  .then(() => {
    tools.logSuccess();
  })
  .catch((e) => {
    tools.logError('ERROR detected during build process');
    console.error(e);
    process.exit(1);
  });

