netlify / zip-it-and-ship-it

Intelligently prepare Node.js Lambda functions for deployment
https://www.npmjs.com/package/@netlify/zip-it-and-ship-it
MIT License
316 stars 35 forks source link

fix: create symlink parent directory before creating symlink itself #1709

Closed Skn0tt closed 9 months ago

Skn0tt commented 9 months ago

πŸŽ‰ Thanks for submitting a pull request! πŸŽ‰

Summary

Fixes https://github.com/netlify/cli/issues/6106, https://linear.app/netlify/issue/COM-351/esm-dependencies-in-v2-functions-in-pnpm-repo-cause-crash-in-dev.

For includedFiles, we're recreating symlinks, sometimes in nested paths. Sometimes this breaks because the target directory doesn't exist. This PR fixes that by ensuring that a symlinks containing directory is created before the symlink itself is created.


For us to review and ship your PR efficiently, please perform the following steps:

A picture of a cute animal (not mandatory, but encouraged)

github-actions[bot] commented 9 months ago

⏱ Benchmark results

Comparing with 9e82c5a761d0a00fe92cb8221f7e48756f46d06e

largeDepsEsbuild: 1.5s

⬇️ 0.43% decrease vs. 9e82c5a761d0a00fe92cb8221f7e48756f46d06e

^           1.5s    1.5s            1.5s            1.5s                    1.5s                          
β”‚   1.4s    β”Œβ”€β”€β”    β”Œβ”€β”€β”    1.4s    β”Œβ”€β”€β”    1.4s    β”Œβ”€β”€β”    1.4s    1.4s    β”Œβ”€β”€β”    1.4s    1.5s    1.5s  
β”‚ β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€β”Όβ”€β”€β”Όβ”€β”€β”€β”€β”Όβ”€β”€β”Όβ”€β”€β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€β”Όβ”€β”€β”Όβ”€β”€β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€β”Όβ”€β”€β”Όβ”€β”€β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€β”Όβ”€β”€β”Όβ”€β”€β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€β”Œβ”€β”€β”β”€β”€
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    T-12    T-11    T-10    T-9     T-8     T-7     T-6     T-5     T-4     T-3     T-2     T-1      T    
Legend - T-30 (e1511343c1436e3d9ae2003783c6341870059830): 1.4s - T-29 (f5fb309109408d25544fe34bdee77f917ff679e7): 1.4s - T-28 (cff89556fe722407240151e802ab0e2b28d741ac): 1.5s - T-27 (be424b244ccea5bfb20f65ba127a32c24d345f27): 1.5s - T-26 (f146798369d6bac68820a3ffa10d3e6ea4a1587a): 1.4s - T-25 (c7901aa4aaa0e73c8bd78005df1cd3f1a2b53837): 1.4s - T-24 (bc7b0b8e2f42e3f52d677e8e6fb7b83f218b284b): 1.5s - T-23 (81e451b5f468d41ea19ff230a55ef7fc627d089a): 1.4s - T-22 (daa74ff3fffdebe0f5c115a12b1bdd8405487274): 1.4s - T-21 (128b059fcc5630a43812b1b2a34da5bde304661a): 1.4s - T-20 (f01af04b8a3c84e3c91041f97de118d3f07aa580): 1.5s - T-19 (44f2871b631b6090272fd6a34e696f0d3ab95ed9): 1.4s - T-18 (a176e523e66a20e97f13a744d8d5985aca1ebccd): 1.5s - T-17 (897284e0dc37bb37e35974dd7e18a5e67715ae44): 1.5s - T-16 (30703f84b3f63ac0b382f17345c59b8e74c7d194): 1.5s - T-15 (ec7bde9885672878e3e002026ffe4bad9e9c1f8c): 1.4s - T-14 (05b3c1a2a10c04728884c62a027b005871202091): 1.4s - T-13 (393b4900bee89e74f91e05c8c0179bf3f145cb02): 1.5s - T-12 (abcba24aae5b32a9bbde85ba910d1b76913ad31d): 1.4s - T-11 (1b10dd153a662aa9ac658624ab017d4c474f2f90): 1.5s - T-10 (46377da9cc9534cca5836258deeff4e51168985b): 1.5s - T-9 (1a06dacedb7198e969dfcdd3c1081ccce6b6c5c5): 1.4s - T-8 (8a3845d6e1500eba8d07c1e29b1176d5c9ca7d85): 1.5s - T-7 (8ebae9d293d3ffb37e5f82a24e8e6ef1d59fe450): 1.4s - T-6 (655f1a8bb37176c719861ba16a3a3d69308ace2f): 1.5s - T-5 (64ee032943234b2a4def58ab53b00a2f7ee47742): 1.4s - T-4 (f129ca1266824706fe42385f7b20ccade73dfe3d): 1.4s - T-3 (bd3bd46b53aa8bdfaa6a144611f9fb360ceae31e): 1.5s - T-2 (136119a4ffdbce38734e454f6a3f06360974eef1): 1.4s - T-1 (9e82c5a761d0a00fe92cb8221f7e48756f46d06e): 1.5s - **T (current commit): 1.5s**

largeDepsNft: 5.8s

⬆️ 2.58% increase vs. 9e82c5a761d0a00fe92cb8221f7e48756f46d06e

^           5.8s    5.8s                                    5.7s            5.7s                    5.8s  
β”‚   5.5s    β”Œβ”€β”€β”    β”Œβ”€β”€β”    5.6s            5.6s    5.5s    β”Œβ”€β”€β”    5.5s    β”Œβ”€β”€β”    5.4s    5.6s    β”Œβ”€β”€β”  
β”‚ β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€β”Όβ”€β”€β”Όβ”€β”€β”€β”€β”Όβ”€β”€β”Όβ”€β”€β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€5.3sβ”€β”€β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€β”Όβ”€β”€β”Όβ”€β”€β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€β”Όβ”€β”€β”Όβ”€β”€β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€|β–’β–’|──
β”‚   |  |    |  |    |  |    |  |    β”Œβ”€β”€β”    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    T-12    T-11    T-10    T-9     T-8     T-7     T-6     T-5     T-4     T-3     T-2     T-1      T    
Legend - T-30 (e1511343c1436e3d9ae2003783c6341870059830): 5.4s - T-29 (f5fb309109408d25544fe34bdee77f917ff679e7): 5.4s - T-28 (cff89556fe722407240151e802ab0e2b28d741ac): 5.5s - T-27 (be424b244ccea5bfb20f65ba127a32c24d345f27): 5.8s - T-26 (f146798369d6bac68820a3ffa10d3e6ea4a1587a): 5.5s - T-25 (c7901aa4aaa0e73c8bd78005df1cd3f1a2b53837): 5.5s - T-24 (bc7b0b8e2f42e3f52d677e8e6fb7b83f218b284b): 5.6s - T-23 (81e451b5f468d41ea19ff230a55ef7fc627d089a): 5.5s - T-22 (daa74ff3fffdebe0f5c115a12b1bdd8405487274): 5.4s - T-21 (128b059fcc5630a43812b1b2a34da5bde304661a): 5.7s - T-20 (f01af04b8a3c84e3c91041f97de118d3f07aa580): 5.5s - T-19 (44f2871b631b6090272fd6a34e696f0d3ab95ed9): 5.6s - T-18 (a176e523e66a20e97f13a744d8d5985aca1ebccd): 5.8s - T-17 (897284e0dc37bb37e35974dd7e18a5e67715ae44): 5.5s - T-16 (30703f84b3f63ac0b382f17345c59b8e74c7d194): 5.5s - T-15 (ec7bde9885672878e3e002026ffe4bad9e9c1f8c): 5.5s - T-14 (05b3c1a2a10c04728884c62a027b005871202091): 5.5s - T-13 (393b4900bee89e74f91e05c8c0179bf3f145cb02): 5.6s - T-12 (abcba24aae5b32a9bbde85ba910d1b76913ad31d): 5.5s - T-11 (1b10dd153a662aa9ac658624ab017d4c474f2f90): 5.8s - T-10 (46377da9cc9534cca5836258deeff4e51168985b): 5.8s - T-9 (1a06dacedb7198e969dfcdd3c1081ccce6b6c5c5): 5.6s - T-8 (8a3845d6e1500eba8d07c1e29b1176d5c9ca7d85): 5.3s - T-7 (8ebae9d293d3ffb37e5f82a24e8e6ef1d59fe450): 5.6s - T-6 (655f1a8bb37176c719861ba16a3a3d69308ace2f): 5.5s - T-5 (64ee032943234b2a4def58ab53b00a2f7ee47742): 5.7s - T-4 (f129ca1266824706fe42385f7b20ccade73dfe3d): 5.5s - T-3 (bd3bd46b53aa8bdfaa6a144611f9fb360ceae31e): 5.7s - T-2 (136119a4ffdbce38734e454f6a3f06360974eef1): 5.4s - T-1 (9e82c5a761d0a00fe92cb8221f7e48756f46d06e): 5.6s - **T (current commit): 5.8s**

largeDepsZisi: 10.7s

⬆️ 1.06% increase vs. 9e82c5a761d0a00fe92cb8221f7e48756f46d06e

^          10.7s                                                           10.9s                   10.7s  
β”‚  10.1s    β”Œβ”€β”€β”   10.6s   10.5s   10.5s   10.3s   10.4s   10.6s   10.4s    β”Œβ”€β”€β”   10.2s   10.6s    β”Œβ”€β”€β”  
β”‚ β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€β”Όβ”€β”€β”Όβ”€β”€β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€β”Όβ”€β”€β”Όβ”€β”€β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€β”Œβ”€β”€β”β”€β”€β”€β”€|β–’β–’|──
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
β”‚   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |β–’β–’|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    T-12    T-11    T-10    T-9     T-8     T-7     T-6     T-5     T-4     T-3     T-2     T-1      T    
Legend - T-30 (e1511343c1436e3d9ae2003783c6341870059830): 10.3s - T-29 (f5fb309109408d25544fe34bdee77f917ff679e7): 10.4s - T-28 (cff89556fe722407240151e802ab0e2b28d741ac): 10.5s - T-27 (be424b244ccea5bfb20f65ba127a32c24d345f27): 10.6s - T-26 (f146798369d6bac68820a3ffa10d3e6ea4a1587a): 10.4s - T-25 (c7901aa4aaa0e73c8bd78005df1cd3f1a2b53837): 10.5s - T-24 (bc7b0b8e2f42e3f52d677e8e6fb7b83f218b284b): 10.5s - T-23 (81e451b5f468d41ea19ff230a55ef7fc627d089a): 9.9s - T-22 (daa74ff3fffdebe0f5c115a12b1bdd8405487274): 10.3s - T-21 (128b059fcc5630a43812b1b2a34da5bde304661a): 10.7s - T-20 (f01af04b8a3c84e3c91041f97de118d3f07aa580): 10.4s - T-19 (44f2871b631b6090272fd6a34e696f0d3ab95ed9): 10.1s - T-18 (a176e523e66a20e97f13a744d8d5985aca1ebccd): 10.4s - T-17 (897284e0dc37bb37e35974dd7e18a5e67715ae44): 10s - T-16 (30703f84b3f63ac0b382f17345c59b8e74c7d194): 10.2s - T-15 (ec7bde9885672878e3e002026ffe4bad9e9c1f8c): 10.4s - T-14 (05b3c1a2a10c04728884c62a027b005871202091): 10.5s - T-13 (393b4900bee89e74f91e05c8c0179bf3f145cb02): 10.6s - T-12 (abcba24aae5b32a9bbde85ba910d1b76913ad31d): 10.1s - T-11 (1b10dd153a662aa9ac658624ab017d4c474f2f90): 10.7s - T-10 (46377da9cc9534cca5836258deeff4e51168985b): 10.6s - T-9 (1a06dacedb7198e969dfcdd3c1081ccce6b6c5c5): 10.5s - T-8 (8a3845d6e1500eba8d07c1e29b1176d5c9ca7d85): 10.5s - T-7 (8ebae9d293d3ffb37e5f82a24e8e6ef1d59fe450): 10.3s - T-6 (655f1a8bb37176c719861ba16a3a3d69308ace2f): 10.4s - T-5 (64ee032943234b2a4def58ab53b00a2f7ee47742): 10.6s - T-4 (f129ca1266824706fe42385f7b20ccade73dfe3d): 10.4s - T-3 (bd3bd46b53aa8bdfaa6a144611f9fb360ceae31e): 10.9s - T-2 (136119a4ffdbce38734e454f6a3f06360974eef1): 10.2s - T-1 (9e82c5a761d0a00fe92cb8221f7e48756f46d06e): 10.6s - **T (current commit): 10.7s**