const path = require('path');

const rootDir = process.cwd();
const packageJson = require(path.resolve(rootDir, './package.json'));

const NODE_ENV = process.env.NODE_ENV || 'development';
const HMR = Number(process.env.HMR) === 1;
const TARGET = process.env.BROWSERSLIST_ENV || 'default';
const APP_VERSION = `${packageJson.name}/${packageJson.version}`;

const staticPath = '/static';

module.exports = {
  rootDir,
  staticPath,

  version: APP_VERSION,
  env: NODE_ENV,
  target: TARGET,
  hmr: HMR,

  isDevelopment: NODE_ENV === 'development',
  isProduction: NODE_ENV === 'production',

  packageJson,
};
