Skip to content

Instantly share code, notes, and snippets.

@AmirSa12
Created April 19, 2025 09:10
Show Gist options
  • Save AmirSa12/2eed810c8d30ed0dc51eda22acebc3e2 to your computer and use it in GitHub Desktop.
Save AmirSa12/2eed810c8d30ed0dc51eda22acebc3e2 to your computer and use it in GitHub Desktop.

The Story of pkg.pr.new: Development with Continuous Releases

What is pkg.pr.new?

pkg.pr.new, also known as "Continuous Releases," is an innovative tool that revolutionizes how developers access and test unreleased package features. At its core, pkg.pr.new automatically generates preview releases for each commit and pull request in your repository without publishing anything to NPM.

The concept is elegantly simple yet powerful: whenever a commit is pushed or a pull request is created, pkg.pr.new creates an instantly usable version of the package that can be installed directly from a unique URL. This allows users and contributors to test new features or bug fixes without waiting for the official release cycle or even having access to NPM publishing rights.

A typical installation command looks like this:

npm i https://pkg.pr.new/tinylibs/tinybench/tinybench@a832a55

The URL structure follows a pattern: npm i https://pkg.pr.new/${owner}/${repo}/${package}@{commit}, making it intuitive and easy to use.

How pkg.pr.new Helps Users

The tool addresses several key pain points in the modern development workflow:

1. Eliminating Release Cycle Delays

One of the most common frustrations in open-source development is captured in comments like: "This was fixed in #18. Can we release that fix?" With pkg.pr.new, users don't have to wait for maintainers to publish a new version. They can immediately install the specific commit containing the fix.

2. Simplified Testing for Contributors

Contributors can easily share their changes for testing before merging. This creates a smoother review process and helps identify potential issues earlier in the development cycle.

3. Accessible Features Without NPM Access

Not every contributor has publishing rights to NPM packages. pkg.pr.new democratizes access by allowing anyone with GitHub commit access to effectively create usable package versions without needing NPM credentials.

4. Frictionless GitHub Workflow Integration

Setting up pkg.pr.new requires minimal configuration - just installing the GitHub app and adding a single command to your workflows. It seamlessly integrates with GitHub Actions and provides helpful pull request comments that show exactly how to install the preview packages.

5. Template Support for Interactive Demos

Beyond just package previews, pkg.pr.new can generate interactive Stackblitz environments to showcase your packages in action. This is particularly valuable for demonstration and documentation purposes.

Current Usage

The adoption of pkg.pr.new has been remarkable, with impressive usage statistics demonstrating its value to the JavaScript ecosystem:

  • 955,305 templates generated: Developers are actively using interactive demos to showcase their packages
  • 1,084,402 packages built: Over a million preview packages have been created through the platform
  • 553 organizations have integrated pkg.pr.new into their workflows
  • 917 repositories are actively using the tool
  • 1,084,402 commits have triggered preview package builds
  • 33,101 PRs and branches have been associated with preview packages

These numbers reflect not just adoption but active, ongoing usage across the JavaScript ecosystem. Many prominent projects and companies have embraced pkg.pr.new, including Vue.js, Meta, Hugging Face, TanStack, Nuxt, Vite, Vitest, Qwik, Svelte, tRPC, and many others.

How We Use Cloudflare R2

A critical component of pkg.pr.new's architecture is Cloudflare R2, which provides the storage backbone for the service. R2 has been instrumental in making pkg.pr.new both performant and cost-effective.

Efficient Package Storage

Each preview package generated by pkg.pr.new is stored in R2 buckets. The system uses two separate buckets - a production bucket (PROD_CR_BUCKET) and a development/staging bucket (CR_BUCKET). This separation allows for robust testing and development without affecting production packages.

Intelligent Storage Management

The team implemented a sophisticated storage management system that monitors package usage patterns. Packages that haven't been downloaded in over a month and are at least one month old are automatically removed, while any package older than six months is removed regardless of download activity. This intelligent cleanup mechanism keeps storage costs manageable while ensuring packages remain available when needed.

Stream-Based Package Delivery

pkg.pr.new leverages R2's streaming capabilities for efficient package delivery. When a package is requested, the system streams it directly from R2 to the user, reducing memory overhead and providing a faster experience even for larger packages.

Multipart Upload Support

For larger packages, pkg.pr.new utilizes R2's multipart upload functionality, allowing the system to handle packages of any size efficiently by splitting them into manageable chunks during the upload process.

Reliable and Fast Global Access

Cloudflare's global network ensures that packages are delivered quickly regardless of where users are located. This global distribution is essential for a tool that serves the worldwide JavaScript community.

Conclusion

pkg.pr.new represents a significant advancement in JavaScript package development workflows. By eliminating the friction between creating a fix or feature and making it available to users, it accelerates the development process and improves collaboration.

The impressive adoption statistics speak to the real-world value it provides, and the efficient use of Cloudflare R2 storage demonstrates how modern cloud infrastructure can enable new developer experience improvements.

As more projects and companies adopt continuous releases through pkg.pr.new, we can expect to see faster iteration cycles, more responsive maintenance, and ultimately better software for everyone.

@Aslemammad
Copy link

title: Cloudflare is now the hosting partner of pkg.pr.new

I think the text is a bit too formal, I think we can simplify it and add more of a personal touch to it.

Let's avoid doing items, 1- 2- 3- ..., it's so chatgpt-ish

This intelligent cleanup mechanism keeps storage costs manageable while ensuring packages remain available when needed.

let's also say the reason for this, the fact that it'd help concentrating pkg.pr.new on temporary preview releases rather than permanent ones!

After all, this article is amazing but i think it can be simpler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment