magento / pwa-studio

šŸ› Development tools to build, optimize and deploy Progressive Web Applications for Magento 2.
https://developer.adobe.com/commerce/pwa-studio/
Open Software License 3.0
1.06k stars 682 forks source link

[enhancement]: Create a staging server utility instead of a script in `venia-concept` #2407

Closed zetlen closed 4 years ago

zetlen commented 4 years ago

Improve the experience and performance of the staging server in Venia and other PWAs, as well as slimming down the install time and dependency size of PWA Studio itself.

Is your feature request related to a problem? Please describe. We don't have a coherent place for staging server scripts. NodeJS is one of our core supported technologies; we should have a more complete story for staging and running production servers in Node.

We haven't done this because we don't want to make any core features require NodeJS serving the PWA. That's the reason for UPWARD in the first place. But we can scope a staging server carefully so it doesn't insert any features the PWA requires. UPWARD is only part of this solution: the upward-js library is supposed to be general-purpose, so it's not the appropriate place to put a staging server specifically designed for PWA Studio. So we need a staging server command that uses upward-js internally. That way, we can take some of the staging server stuff scattered throughout the codebase and organize it in one place.

Describe the solution you'd like

A new built-in staging server

Reorganize other packages.

Describe alternatives you've considered A separate package like @magento/serve-pwa would be nice and light, but it depends on buildpack to load its environment, and buildpack would depend on it for its serve command. That might be workable if we split buildpack up into separate projects down the line, but that's not soon.

Additional context

Why now

This came up because in https://github.com/magento/pwa-studio/pull/2315 I noticed that the contributor had pushed an update to iltorb. It was good of him to do that, but we don't actually need iltorb anymore.

On removing shrink-ray-current

We should get rid of shrink-ray-current. It requires large native extensions iltorb and node-zopfli-es (those are what take so long to build when installing PWA Studio). And we don't need either of those! Node >=10 supports Brotli natively, so it doesn't need iltorb; and node-zopfli-es is unused in our project, because Zopfli compression should be done at build time by Webpack in the first place.

The only things about shrink-ray that we're using are its API and its ETag functionality. I've created a new package called https://github.com/magento-research/compression-middleware-modern which can replace shrink-ray-current when it's done. That package uses no binary deps.

Please let us know what packages this feature is in regards to:

awilcoxa commented 4 years ago

Created in Jira Backlog. Marked for community contribution.

Marked as P3S3

larsroettig commented 4 years ago

@magento I am working on this