function bundleWithRollup()

in scripts/build.js [107:138]


function bundleWithRollup(seriesPath, dirName) {
  const rollupPath = path.join(__dirname, '../node_modules/.bin/rollup');
  const configPath = path.join(seriesPath, 'rollup.config.js');
  const distPath = path.join(seriesPath, 'dist');

  // Create dist directory if it doesn't exist
  if (!fs.existsSync(distPath)) {
    fs.mkdirSync(distPath, { recursive: true });
  }

  try {
    const result = execSync(
      `${rollupPath} -c ${configPath} \
        --input ${seriesPath}/lib/index.js \
        --file ${seriesPath}/dist/index.js \
        --name ${dirName}CustomSeriesInstaller`,
      { encoding: 'utf8', stdio: 'pipe' }
    );

    console.log(`Rollup bundling completed for ${dirName}`);

    // Check if the output file was created
    if (!fs.existsSync(path.join(seriesPath, 'dist', 'index.js'))) {
      console.error(`Error: Output file not created for ${dirName}`);
    }
  } catch (e) {
    console.error(`Error bundling custom series ${dirName}:`);
    console.error(e.message);
    if (e.stdout) console.error('Rollup stdout:', e.stdout.toString());
    if (e.stderr) console.error('Rollup stderr:', e.stderr.toString());
  }
}