Sha256: 9599b42f4b5f486dfce9414fdffefd600273b7fa6b266ed94c1290e9a1ad3829

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

// @flow

import * as utils from './utils';

function getProjectConfig(env: string): ProjectConfig {
  const projectConfigFactory = require(utils.railsPath('~config/hauler.js'));
  return projectConfigFactory(env);
}

function getProjectDefaults(env: string): ProjectConfig {
  const projectDefaultsFactory = require('./defaults/project_config_factory');
  return projectDefaultsFactory.default(env);
}

function getConfigFactory(): ProjectConfigFactory {
  return (env: string) => {
    const projectDefaults = getProjectDefaults(env);
    const projectConfig = getProjectConfig(env);
    const config = utils.mergeProjectConfig(projectDefaults, projectConfig);
    return config;
  };
}

export function getConfig(env: string, railsRoot?: string) {
  if (railsRoot != null) {
    utils.setRailsRoot(railsRoot);
  }

  const configFactory = getConfigFactory();
  return configFactory(env);
}

export function getDevServerConfig(env: string, railsRoot?: string): WebpackDevServerConfig {
  const config = getConfig(env, railsRoot);
  return utils.extractDevServerConfig(config);
}

export function getCompilerConfig(env: string, railsRoot?: string): WebpackConfig {
  const config = getConfig(env, railsRoot);
  return utils.extractCompilerConfig(config);
}

export { getEnvName } from './utils';

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hauler-0.2.0 src/index.js