Home >Web Front-end >JS Tutorial >Announcing Pylon with Multiple Runtime Support

Announcing Pylon with Multiple Runtime Support

DDD
DDDOriginal
2024-09-19 06:29:07320browse

Announcing Pylon  with Multiple Runtime Support

Welcome to @getcronit/pylon@2.0.0 release (September 2024)!

Pylon v2 introduces the support for different runtimes, a new create command, and an improved development server.
The official supported runtimes by the npm create pylon command are Bun, Node.js and Cloudflare Workers. Other runtimes are also supported but require manual setup.
We’ve tried to make migration smooth. Please refer to the migration guide and let us know if you encounter any issues when migrating.

Key highlights of this release:

  • New Runtimes: Pylon now supports multiple runtimes, including Bun, Node.js and Cloudflare Workers.
  • Unified Create Command: The new npm create pylon command provides a consistent way to create new Pylon projects.
  • Improved Development Server: The new pylon dev command provides a unified development experience across different runtimes.
  • Drop of pylon-cli and pylon-server: The @getcronit/pylon-cli and @getcronit/pylon-server packages are no longer required and replaced by the @getcronit/pylon-dev package.

Breaking Changes

If you’re looking for an overview of all breaking changes and how to migrate, please see the migrating from v1 to v2 guide.

If you have any questions or need help, please don’t hesitate to reach out to us on Discord. We’re happy to assist you with the migration process.

Overview Video

Watch how we use the new npm create pylon command to create a new Pylon project and deploy it to Cloudflare Workers in less than 1 minute:

pylon.cronit.io

New Runtimes

Pylon now supports multiple runtimes, including Bun, Node.js and Cloudflare Workers. You can choose the runtime that best fits your use case and deploy your service with ease.

To create a new Pylon project with a specific runtime, use the npm create pylon command:

npm create pylon --runtime cf-workers

This command creates a new Pylon project with the Cloudflare Workers runtime. You can also specify other runtimes, such as Node.js or Cloudflare Workers, by passing the --runtime flag.

Pylon also supports various other runtimes:

Be aware that those runtimes require manual setup and configuration.

  • Cloudflare Pages
  • Deno
  • Fastly Compute
  • Vercel
  • Netlify
  • AWS Lambda
  • Lambda@Edge
  • Azure Functions
  • Supabase Functions
  • Ali Function Compute
  • Service Worker

Unified Create Command

The new npm create pylon command provides a consistent way to create new Pylon projects with different runtimes, templates, client generation and more.
This command streamlines the project creation process and ensures that you have everything you need to get started with Pylon.

To create a new Pylon project, run the following command:

npm create pylon

This command will prompt you to select the runtime, template, and other options for your project. Once you’ve made your selections, the command will create a new Pylon project in the specified directory.

Improved Development Server

Pylon v2 introduces a new pylon dev command that provides a unified development experience across different runtimes.

The pylon dev command starts the development server and automatically reloads your service when you make changes to your code. This command is designed to streamline the development process and make it easier to build and test your services.
To support different runtimes, you can specify the runtime-specific start command using the -c flag:

pylon dev -c 'bun run .pylon/index.js'

This command starts the development server with the specified start command for the Bun runtime. You can replace the command with the appropriate start command for your chosen runtime.

For example, if you’re using Cloudflare Workers, you can start the development server with the following command:

pylon dev -c 'wrangler dev'

This command starts the development server with the wrangler dev command, which is the recommended way to run Cloudflare Workers locally.

Drop of pylon-cli and pylon-server

The @getcronit/pylon-cli and @getcronit/pylon-server packages are no longer required and have been replaced by the @getcronit/pylon-dev package.

Why was the pylon-cli dropped?

The pylon-cli package was used to create new Pylon projects and manage the development server. With the introduction of the npm create pylon command and the pylon dev command, the functionality provided by the pylon-cli package is now handled by the create-pylon package and the pylon-dev package.

Why was the pylon-server dropped?

The pylon-server had only one purpose: to start the server using Bun. With the introduction of multiple runtimes, the pylon-server package became obsolete. The pylon-dev package now handles the development server for all runtimes.
For production, you can now directly execute .pylon/index.js with your runtime-specific command (e.g. bun run .pylon/index.js or node .pylon/index.js). This flexible approach allows you to choose the best deployment strategy for your use case.

Acknowledgements

A big thank you to all who helped with this release ?

  • @kleberbaum for his dream that we’ll support Cloudflare Workers, and now we do!
  • @dave-calleja for the initial request for multiple runtime support, that led us realise that this is crucial for the future of Pylon.
  • @schettn for coding all of this ;)

The above is the detailed content of Announcing Pylon with Multiple Runtime Support. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:React Basics Part 2Next article:React Basics Part 2