How to use the @haul-bundler/core.getProjectConfigPath function in @haul-bundler/core

To help you get started, we’ve selected a few @haul-bundler/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github callstack / haul / packages / haul-core-legacy / src / commands / bundle.js View on Github external
async function bundle(opts: *) {
  const directory = process.cwd();
  // Need to add @babel/register to support ES2015+ in config file.
  require('../babelRegister');
  const configPath = getProjectConfigPath(directory, opts.config);
  const projectConfig = getProjectConfig(configPath);
  const config = getWebpackConfig(
    new Runtime(),
    {
      platform: opts.platform,
      root: directory,
      dev: opts.dev,
      minify: opts.minify,
      bundle: true,
    },
    projectConfig
  );

  if (opts.assetsDest) {
    config.output.path = path.isAbsolute(opts.assetsDest)
      ? opts.assetsDest
github callstack / haul / packages / haul-core-legacy / src / commands / start.js View on Github external
await killProcess(opts.port);
      } catch (e) {
        logger.error(`Could not kill process! Reason: \n ${e.message}`);
        process.exit(1);
      }
      logger.info(`Successfully killed processes.`);
    } else {
      logger.error(
        `Could not spawn process! Reason: Port ${opts.port} already in use.`
      );
      process.exit(1);
    }
  }

  const directory = process.cwd();
  const configPath = getProjectConfigPath(directory, opts.config);

  let assetsDest;
  if (opts.assetsDest) {
    assetsDest = path.isAbsolute(opts.assetsDest)
      ? opts.assetsDest
      : path.join(directory, opts.assetsDest);
  } else {
    assetsDest = fs.mkdtempSync(path.join(os.tmpdir(), 'haul-start-'));
  }

  const configOptions = {
    root: directory,
    assetsDest,
    dev: opts.dev,
    minify: opts.minify,
    port: opts.port,
github callstack / haul / packages / haul-cli / src / commands / multiBundle.ts View on Github external
const {
          config,
          dev,
          minify,
          platform,
          assetsDest,
          bundleOutput,
          sourcemapOutput,
          progress,
          skipHostCheck,
        } = argv;

        process.env.HAUL_PLATFORM = platform;

        const directory = process.cwd();
        const configPath = getProjectConfigPath(directory, config);
        const normalizedProjectConfigBuilder = getNormalizedProjectConfigBuilder(
          runtime,
          configPath
        );
        const env: EnvOptions = {
          platform,
          root: directory,
          dev,
          bundleMode: 'multi-bundle',
          bundleTarget: 'file',
          bundleOutput,
          assetsDest,
          sourcemapOutput,
          minify: minify === undefined ? !dev : minify,
        };
        const projectConfig = normalizedProjectConfigBuilder(runtime, env);
github callstack / haul / packages / haul-cli / src / commands / shared / prepareWebpackConfig.ts View on Github external
export default function prepareWebpackConfig(
  runtime: Runtime,
  options: Options
): webpack.Configuration {
  const directory = process.cwd();
  const configPath = getProjectConfigPath(directory, options.config);
  const normalizedProjectConfigBuilder = getNormalizedProjectConfigBuilder(
    runtime,
    configPath
  );
  const projectConfig = normalizedProjectConfigBuilder(runtime, {
    platform: options.platform,
    root: directory,
    dev: options.dev,
    bundleType: options.bundleType,
    bundleMode: options.bundleMode,
    bundleTarget: 'file',
    assetsDest: options.assetsDest,
    bundleOutput: options.bundleOutput,
    sourcemapOutput: options.sourcemapOutput,
    minify: options.minify === undefined ? !options.dev : options.minify,
  });
github callstack / haul / packages / haul-cli / src / commands / start.ts View on Github external
} else {
        parsedEager = list;
      }

      const directory = process.cwd();

      let tempDir: string;
      if (argv.tempDir) {
        tempDir = path.isAbsolute(argv.tempDir)
          ? argv.tempDir
          : path.join(directory, argv.tempDir);
      } else {
        tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'haul-start-'));
      }

      const configPath = getProjectConfigPath(directory, argv.config);
      const projectConfig = getNormalizedProjectConfigBuilder(
        runtime,
        configPath
      )(runtime, {
        platform: '',
        root: directory,
        dev: argv.dev,
        port: argv.port,
        bundleMode: 'multi-bundle',
        bundleTarget: 'server',
        assetsDest: tempDir,
        minify: argv.minify === undefined ? !argv.dev : argv.minify,
      });

      try {
        const isTaken = await isPortTaken(