kilork / actix-web-static-files

actix-web static files as resources support
The Unlicense
75 stars 18 forks source link

Allow users to set their own npm-like executables such as `yarn` #13

Closed 0xADD1E closed 4 years ago

0xADD1E commented 4 years ago

Due to the many inefficiencies of npm, a lot of projects out there prefer to use other package managers such as yarn. This adds a builder option that allows you to set your preferred executable to invoke (assuming it responds to the standard npm-like commands)

Some fun hyperfine benchmarks I ran on a personal project:

Benchmark #1: cargo build (using npm)                                                                                                                                                                                
Time (mean ± σ):     29.870 s ±  0.193 s    [User: 33.465 s, System: 6.722 s]                                                                                                                                        
Range (min … max):   29.541 s … 30.207 s    10 runs                                                                                                                                                                  

Benchmark #1: cargo build (using yarn)                                                                                                                                                                               
  Time (mean ± σ):     16.283 s ±  0.125 s    [User: 18.931 s, System: 5.503 s]                                                                                                                                      
  Range (min … max):   15.941 s … 16.369 s    10 runs
kilork commented 4 years ago

Thank you @0xADD1E . Yes, we should not stick to single tool. Not sure we should mix all tools to single struct.

But in case of yarn (I am not really familiar with it so far) looks like it can be just drop in replacement.

Will try to merge to new minor version today.

kilork commented 4 years ago

I want to add one more extra use case in README, yarn in the npm use case confuses me.

Should I do this in this PR, or better to not mix, what do you think? @0xADD1E

0xADD1E commented 4 years ago

I mean I'm fine with any changes.

For my workflow, it's basically using yarn as a drop-in replacement for npm, and the example was just meant to highlight all the possible options. Splitting it up into multiple example usecases might make sense for people not quite as familiar with all the tools though

kilork commented 4 years ago

@0xADD1E Can you please check my commit with the use case for yarn? If everything fine, I want to merge this, just waiting for your approval.

0xADD1E commented 4 years ago

Yep, that looks exactly like how I'm using it for my use case. Good to merge!

kilork commented 4 years ago

Ok, thank you!