Skip to content

Conversation

@mondoreale
Copy link
Contributor

@mondoreale mondoreale commented Jan 7, 2026

Note

Looks like #3332 is too much at once - lotta failing tests and what not. I will deal with each of them packages separately.

This pull request updates the build and packaging setup for the @streamr/cdn-location package. The main improvements are the introduction of a Rollup build process to generate both CommonJS and ES module outputs, refined output file structure, and enhancements to the development workflow.

Changes

Build system and packaging improvements:

  • Added a new rollup.config.mts file to configure Rollup to bundle the package into both ES module (exports.js) and CommonJS (exports.cjs) formats, as well as to generate type declarations (exports.d.ts). This setup also marks dependencies as external to avoid bundling them.
  • Updated package.json to point to the new output files, specify both main (CommonJS) and module (ESM) entry points, and restrict the published files to only the relevant outputs.
  • Added Rollup and related plugins (@rollup/plugin-node-resolve, rollup-plugin-dts, tsx) as dev dependencies, and introduced a postbuild script to run Rollup after TypeScript compilation. Also added a prebuild script to clean up build info files.
  • Updated tsconfig.json to use "module": "preserve" and "moduleResolution": "bundler" for better compatibility with the new bundling process.

Monorepo integration:

  • Included @streamr/cdn-location in the monorepo bootstrap process in the root Dockerfile.node, ensuring it is built alongside other packages.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the @streamr/cdn-location package to introduce a Rollup-based build process that generates both CommonJS and ES module outputs, aligning it with other bundled packages in the monorepo like @streamr/autocertifier-client and @streamr/utils.

Key Changes:

  • Introduced Rollup bundling configuration to produce ESM (exports.js) and CJS (exports.cjs) outputs with type declarations
  • Updated package entry points and build scripts to support the new bundled output structure
  • Added the package to the Docker build process to ensure proper monorepo integration

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/cdn-location/rollup.config.mts New Rollup configuration for bundling the package into ESM and CJS formats with type declarations, following the pattern used in autocertifier-client
packages/cdn-location/package.json Updated entry points (main, module, types), added Rollup-related dev dependencies, and introduced prebuild/postbuild scripts for the new build process
packages/cdn-location/tsconfig.json Added TypeScript compiler options (module: preserve, moduleResolution: bundler) to support the bundling workflow
package-lock.json Added dependency entries for Rollup, rimraf, tsx, and related packages required for the new build process
Dockerfile.node Included cdn-location in the Docker build sequence after its dependency (utils) and before packages that depend on it (dht)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mondoreale mondoreale marked this pull request as ready for review January 7, 2026 14:09
@mondoreale mondoreale merged commit 9f2d6f3 into bundles Jan 7, 2026
27 checks passed
@mondoreale mondoreale deleted the bundle-cdn-location branch January 7, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants