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: populate Netlify global before customer code #1643

Closed Skn0tt closed 1 year ago

Skn0tt commented 1 year ago

Fixes https://linear.app/netlify/issue/COM-101/unable-to-use-netlifyenv-in-functions-v2.

github-actions[bot] commented 1 year ago

⏱ Benchmark results

Comparing with a01ecdb7e4b348d7fa71d576ae02f918b897a2df

largeDepsEsbuild: 2.7s

⬇️ 16.06% decrease vs. a01ecdb7e4b348d7fa71d576ae02f918b897a2df

^   3.3s                                            3.4s                                                  
│   ┌──┐    3.3s            3.2s            3.1s    ┌──┐                                    3.1s          
│   |  |    ┌──┐            ┌──┐            ┌──┐    |  |            3.1s                    ┌──┐          
│   |  |    |  |            |  |            |  |    |  |            ┌──┐                    |  |          
│ ──┼──┼────┼──┼────2.7s────┼──┼────────────┼──┼────┼──┼────────────┼──┼────2.7s────────────┼──┼────2.7s──
│   |  |    |  |    ┌──┐    |  |    2.5s    |  |    |  |    2.6s    |  |    ┌──┐    2.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 (9f3dab86ae7e3ba894abaffd527b532f6b395d92): 3.3s - T-29 (bf7a4acac64a9c50364703196061618e95244fd4): 2.7s - T-28 (cc8ad7cd1ccbeb3158c2dd6a2e688945141f71e6): 3.8s - T-27 (58c83442fd6e88b931c33c40309495b79560087f): 3.3s - T-26 (9efef2f12593f66a220bce9c2ce940d78b9e8229): 2.8s - T-25 (84ff0f8de591f283570b723928bb001764576c8d): 2.5s - T-24 (7eafe9537935bca0b8c3ed4f3a1f4d4e262e27e9): 2.5s - T-23 (57c38e3fee419f4b65c04e45094ed3212113ba63): 3.2s - T-22 (7898a4bbbf09989ceec19accdb835065ed0b5c25): 3.5s - T-21 (d15abd9ac2cc525bb32b97bf1d7b0c61dc6f3109): 3.5s - T-20 (efa8ddc3ce75b888d32e809617708bc9267f223b): 2.6s - T-19 (600dbf7c6f6c1d7673aeb03074f32dd21bd77a91): 3.1s - T-18 (6051e01ca1034de9382d759255df098645920fc5): 3s - T-17 (57d30ec0fe95cb5d5fcaf7a36c4cb08b192ca371): 3s - T-16 (28b658a20a8557549545e6b8ac2d1e38f52e80b7): 3.2s - T-15 (d7a0d5086725f7f390ae91ae8787869f28634744): 3.5s - T-14 (1618df80c56c91b8622992f0fd45edf4fea69962): 3.1s - T-13 (0297aa17ec1d9082450a13bac5c33840c9d1d22d): 2.7s - T-12 (3092e010ce7fc47cdd0bee843528d13291a40acf): 3.3s - T-11 (cb23207e0c520f207df84e6d6509f24eefc9680e): 3.3s - T-10 (070a7c95020e1730d327c8bb4ec69a51ef10cabc): 2.7s - T-9 (37bea386468e7aa67974eda9a1a8fbb87c8d48ec): 3.2s - T-8 (4b0f947b315ac43d126e652881467f619c323cd7): 2.5s - T-7 (a7b997238fc578a2c83b921cb2d4c1eab1f93325): 3.1s - T-6 (0381be519b6fff91a86bdcd19ac3a196a3480515): 3.4s - T-5 (af0e46cdbadd228d2cc4876e0cc861e8af14ebef): 2.6s - T-4 (b7fc0822d55c26daee4afbd7f4041ee0d034decb): 3.1s - T-3 (afaa4efdccf011d985f82719b4dc71ce7f051346): 2.7s - T-2 (390820e5a45277d4233cab6a3dae20079959421a): 2.5s - T-1 (a01ecdb7e4b348d7fa71d576ae02f918b897a2df): 3.1s - **T (current commit): 2.7s**

largeDepsNft: 8.4s

⬇️ 15.57% decrease vs. a01ecdb7e4b348d7fa71d576ae02f918b897a2df

^  11.2s                                                                                                  
│   ┌──┐                                           10.7s                                                  
│   |  |   10.1s            10s             9.8s    ┌──┐                                    9.8s          
│   |  |    ┌──┐            ┌──┐            ┌──┐    |  |            9.5s                    ┌──┐          
│   |  |    |  |            |  |            |  |    |  |            ┌──┐                    |  |          
│ ──┼──┼────┼──┼────8.4s────┼──┼────────────┼──┼────┼──┼────────────┼──┼────8.5s────────────┼──┼────8.4s──
│   |  |    |  |    ┌──┐    |  |    7.6s    |  |    |  |    8.1s    |  |    ┌──┐            |  |    ┌──┐  
│   |  |    |  |    |  |    |  |    ┌──┐    |  |    |  |    ┌──┐    |  |    |  |    7.4s    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    ┌──┐    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    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 (9f3dab86ae7e3ba894abaffd527b532f6b395d92): 10s - T-29 (bf7a4acac64a9c50364703196061618e95244fd4): 8.1s - T-28 (cc8ad7cd1ccbeb3158c2dd6a2e688945141f71e6): 11.9s - T-27 (58c83442fd6e88b931c33c40309495b79560087f): 11s - T-26 (9efef2f12593f66a220bce9c2ce940d78b9e8229): 8.8s - T-25 (84ff0f8de591f283570b723928bb001764576c8d): 7.7s - T-24 (7eafe9537935bca0b8c3ed4f3a1f4d4e262e27e9): 7.6s - T-23 (57c38e3fee419f4b65c04e45094ed3212113ba63): 9.8s - T-22 (7898a4bbbf09989ceec19accdb835065ed0b5c25): 10.7s - T-21 (d15abd9ac2cc525bb32b97bf1d7b0c61dc6f3109): 11.3s - T-20 (efa8ddc3ce75b888d32e809617708bc9267f223b): 7.8s - T-19 (600dbf7c6f6c1d7673aeb03074f32dd21bd77a91): 10.4s - T-18 (6051e01ca1034de9382d759255df098645920fc5): 9.4s - T-17 (57d30ec0fe95cb5d5fcaf7a36c4cb08b192ca371): 9.3s - T-16 (28b658a20a8557549545e6b8ac2d1e38f52e80b7): 10.1s - T-15 (d7a0d5086725f7f390ae91ae8787869f28634744): 11.3s - T-14 (1618df80c56c91b8622992f0fd45edf4fea69962): 10.5s - T-13 (0297aa17ec1d9082450a13bac5c33840c9d1d22d): 8.3s - T-12 (3092e010ce7fc47cdd0bee843528d13291a40acf): 11.2s - T-11 (cb23207e0c520f207df84e6d6509f24eefc9680e): 10.1s - T-10 (070a7c95020e1730d327c8bb4ec69a51ef10cabc): 8.4s - T-9 (37bea386468e7aa67974eda9a1a8fbb87c8d48ec): 10s - T-8 (4b0f947b315ac43d126e652881467f619c323cd7): 7.6s - T-7 (a7b997238fc578a2c83b921cb2d4c1eab1f93325): 9.8s - T-6 (0381be519b6fff91a86bdcd19ac3a196a3480515): 10.7s - T-5 (af0e46cdbadd228d2cc4876e0cc861e8af14ebef): 8.1s - T-4 (b7fc0822d55c26daee4afbd7f4041ee0d034decb): 9.5s - T-3 (afaa4efdccf011d985f82719b4dc71ce7f051346): 8.5s - T-2 (390820e5a45277d4233cab6a3dae20079959421a): 7.4s - T-1 (a01ecdb7e4b348d7fa71d576ae02f918b897a2df): 9.8s - **T (current commit): 8.4s**

largeDepsZisi: 16.4s

⬇️ 21.78% decrease vs. a01ecdb7e4b348d7fa71d576ae02f918b897a2df

^  20.9s                                           21.1s                                                  
│   ┌──┐   19.9s           19.7s           20.1s    ┌──┐                                    20s           
│   |  |    ┌──┐            ┌──┐            ┌──┐    |  |           19.4s                    ┌──┐          
│   |  |    |  |            |  |            |  |    |  |            ┌──┐                    |  |          
│ ──┼──┼────┼──┼───16.5s────┼──┼────────────┼──┼────┼──┼────────────┼──┼────────────────────┼──┼───16.4s──
│   |  |    |  |    ┌──┐    |  |            |  |    |  |   16.1s    |  |   16.2s            |  |    ┌──┐  
│   |  |    |  |    |  |    |  |   15.1s    |  |    |  |    ┌──┐    |  |    ┌──┐   15.1s    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    ┌──┐    |  |    |  |    |  |    |  |    |  |    ┌──┐    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    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 (9f3dab86ae7e3ba894abaffd527b532f6b395d92): 20s - T-29 (bf7a4acac64a9c50364703196061618e95244fd4): 16s - T-28 (cc8ad7cd1ccbeb3158c2dd6a2e688945141f71e6): 23.4s - T-27 (58c83442fd6e88b931c33c40309495b79560087f): 20.7s - T-26 (9efef2f12593f66a220bce9c2ce940d78b9e8229): 16.9s - T-25 (84ff0f8de591f283570b723928bb001764576c8d): 15.2s - T-24 (7eafe9537935bca0b8c3ed4f3a1f4d4e262e27e9): 15.2s - T-23 (57c38e3fee419f4b65c04e45094ed3212113ba63): 19.6s - T-22 (7898a4bbbf09989ceec19accdb835065ed0b5c25): 21.5s - T-21 (d15abd9ac2cc525bb32b97bf1d7b0c61dc6f3109): 22.1s - T-20 (efa8ddc3ce75b888d32e809617708bc9267f223b): 16s - T-19 (600dbf7c6f6c1d7673aeb03074f32dd21bd77a91): 20.6s - T-18 (6051e01ca1034de9382d759255df098645920fc5): 18.8s - T-17 (57d30ec0fe95cb5d5fcaf7a36c4cb08b192ca371): 19.2s - T-16 (28b658a20a8557549545e6b8ac2d1e38f52e80b7): 19.2s - T-15 (d7a0d5086725f7f390ae91ae8787869f28634744): 21.4s - T-14 (1618df80c56c91b8622992f0fd45edf4fea69962): 20.6s - T-13 (0297aa17ec1d9082450a13bac5c33840c9d1d22d): 16.3s - T-12 (3092e010ce7fc47cdd0bee843528d13291a40acf): 20.9s - T-11 (cb23207e0c520f207df84e6d6509f24eefc9680e): 19.9s - T-10 (070a7c95020e1730d327c8bb4ec69a51ef10cabc): 16.5s - T-9 (37bea386468e7aa67974eda9a1a8fbb87c8d48ec): 19.7s - T-8 (4b0f947b315ac43d126e652881467f619c323cd7): 15.1s - T-7 (a7b997238fc578a2c83b921cb2d4c1eab1f93325): 20.1s - T-6 (0381be519b6fff91a86bdcd19ac3a196a3480515): 21.1s - T-5 (af0e46cdbadd228d2cc4876e0cc861e8af14ebef): 16.1s - T-4 (b7fc0822d55c26daee4afbd7f4041ee0d034decb): 19.4s - T-3 (afaa4efdccf011d985f82719b4dc71ce7f051346): 16.2s - T-2 (390820e5a45277d4233cab6a3dae20079959421a): 15.1s - T-1 (a01ecdb7e4b348d7fa71d576ae02f918b897a2df): 20s - **T (current commit): 16.4s**
Skn0tt commented 1 year ago

Hmm, GitHub Actions seems to be having troubles 🤔 Screenshot 2023-11-02 at 17 46 47