refactor: Bundle cdn-location
#3335
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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-locationpackage. 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:
rollup.config.mtsfile 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.package.jsonto point to the new output files, specify bothmain(CommonJS) andmodule(ESM) entry points, and restrict the published files to only the relevant outputs.@rollup/plugin-node-resolve,rollup-plugin-dts,tsx) as dev dependencies, and introduced apostbuildscript to run Rollup after TypeScript compilation. Also added aprebuildscript to clean up build info files.tsconfig.jsonto use"module": "preserve"and"moduleResolution": "bundler"for better compatibility with the new bundling process.Monorepo integration:
@streamr/cdn-locationin the monorepo bootstrap process in the rootDockerfile.node, ensuring it is built alongside other packages.