How to use the @haul-bundler/core.getNormalizedProjectConfigBuilder 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 / compiler / worker / runWebpackCompiler.js View on Github external
}) {
  const emitter = new EventEmitter();
  const { configPath, configOptions } = JSON.parse(options);

  const runtime = new Runtime();
  runtime.logger.proxy((level, ...args) => {
    setImmediate(() => {
      emitter.emit(Events.LOG, {
        message: runtime.logger.stringify(args).join(' '),
        level,
      });
    });
  });

  const outputPath = configOptions.assetsDest;
  const projectConfig = getNormalizedProjectConfigBuilder(runtime, configPath)(
    runtime,
    {
      ...configOptions,
      platform,
    }
  );

  const apps = [];
  const bundles = sortBundlesByDependencies(projectConfig);
  let totalProgress = 0;
  let bundlesBuilt = 0;

  for (const bundleName of bundles) {
    const bundleConfig = projectConfig.bundles[bundleName];
    if (bundleConfig.external) {
      const bundleFilename = getBundleFilename(
github callstack / haul / packages / haul-cli / src / commands / multiBundle.ts View on Github external
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 / start.ts View on Github external
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(
          projectConfig.server.port,
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,
  });