cli icon indicating copy to clipboard operation
cli copied to clipboard

chore(deps): remove usage of the static-server dependency

Open erezrokah opened this issue 2 years ago • 7 comments

We use static-server to simulate a static server a part of the ntl dev command.

About 2 months ago it was deprecated and repo archived, see https://github.com/nbluis/static-server/blob/84999917193f664c205efd587934bc6ea361fa78/README.md.

~~We should replace it with another package, possible https://expressjs.com/en/starter/static-files.html as we already have express as a dependency.~~

See comment: https://github.com/netlify/cli/issues/4511#issuecomment-1087635077

erezrokah avatar Apr 04 '22 13:04 erezrokah

@erezrokah hey! Can I work on that?

simonepelosi avatar Apr 04 '22 14:04 simonepelosi

Instead of express use fastify as it is even faster than node native http (it performs some optimizations).

There is the fastify static plugin as well should be relatively straight forward: https://github.com/fastify/fastify-static

lukasholzer avatar Apr 04 '22 14:04 lukasholzer

@simonepelosi for sure you can work on that! If you need some guidance regarding testing or something else please don't hesitate to reach out to us!

lukasholzer avatar Apr 04 '22 14:04 lukasholzer

@lukasholzer thank you!

simonepelosi avatar Apr 04 '22 14:04 simonepelosi

Sure thing @simonepelosi! Thank you 🥳

https://github.com/netlify/cli/blob/3df8f95a1f92fef41dc5c43d79b99551cf6f2bad/src/commands/dev/dev.js#L10 is a good place to start

erezrokah avatar Apr 04 '22 14:04 erezrokah

Thank you @erezrokah !

simonepelosi avatar Apr 04 '22 15:04 simonepelosi

@lukasholzer How can I test my changes?

P.S. I'm running tests with npm run test:dev and I got some problems with the 404 redirect with Fastify Schermata 2022-04-04 alle 18 58 49

simonepelosi avatar Apr 04 '22 15:04 simonepelosi

@lukasholzer @simonepelosi - any progress on this? Noticed this is a security issue, and we try to make sure those don't go dormant. Cheers

AndyTurnerNetlify avatar Sep 26 '22 17:09 AndyTurnerNetlify

Instead of express use fastify as it is even faster than node native http (it performs some optimizations).

@lukasholzer I was thinking of picking this issue up but I'm slightly opposed to using fastify instead of express because it would require adding 2 more dependencies (fastify & fastify/static) to the repository when express is already a dependency in the repo. WDYT?

tinfoil-knight avatar Dec 17 '22 17:12 tinfoil-knight

@tinfoil-knight I meant replacing express with fastify so we should get rid of express

lukasholzer avatar Dec 20 '22 14:12 lukasholzer