Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

packaging: list files to be published to npm #889

Closed
wants to merge 1 commit into from

Conversation

lovell
Copy link
Contributor

@lovell lovell commented Jan 26, 2021

Hello, rather than exclude files to be published to npm via .npmignore, this PR switches to an inclusive approach via files.

As it stands, this change will no longer include the markdown docs in the npm-published tarball as generally people view these on the web rather than via a npm download. I'd be happy to add the docs back to the tarball if required (it's a one line addition).

If we're willing to go without the docs, the resultant tarball is around half its previous size. Given this module is currently downloaded from npm almost 6 times every second (~3.5m/week), this improvement will reduce bandwidth and therefore energy consumption.

Currently published to npm:

npm notice === Tarball Contents === 
npm notice 3.2kB   .clang-format                    
npm notice 130B    .editorconfig                    
npm notice 0       nothing.c                        
npm notice 7.9kB   benchmark/function_args.cc       
npm notice 2.6kB   benchmark/property_descriptor.cc 
npm notice 654B    benchmark/binding.gyp            
npm notice 132B    node_api.gyp                     
npm notice 762B    common.gypi                      
npm notice 381B    except.gypi                      
npm notice 386B    noexcept.gypi                    
npm notice 7.3kB   napi-inl.deprecated.h            
npm notice 186.1kB napi-inl.h                       
npm notice 109.8kB napi.h                           
npm notice 3.2kB   tools/check-napi.js              
npm notice 1.5kB   tools/clang-format.js            
npm notice 15.3kB  tools/conversion.js              
npm notice 2.1kB   benchmark/function_args.js       
npm notice 971B    benchmark/index.js               
npm notice 296B    index.js                         
npm notice 1.1kB   benchmark/property_descriptor.js 
npm notice 467B    package-support.json             
npm notice 7.8kB   package.json                     
npm notice 6.0kB   doc/addon.md                     
npm notice 4.6kB   doc/array_buffer.md              
npm notice 2.7kB   doc/array.md                     
npm notice 2.6kB   doc/async_context.md             
npm notice 1.4kB   doc/async_operations.md          
npm notice 20.6kB  doc/async_worker_variants.md     
npm notice 14.6kB  doc/async_worker.md              
npm notice 2.7kB   doc/bigint.md                    
npm notice 1.6kB   doc/boolean.md                   
npm notice 4.4kB   doc/buffer.md                    
npm notice 1.3kB   doc/callback_scope.md            
npm notice 2.5kB   doc/callbackinfo.md              
npm notice 56.9kB  CHANGELOG.md                     
npm notice 1.0kB   doc/checker-tool.md              
npm notice 3.3kB   doc/class_property_descriptor.md 
npm notice 3.0kB   doc/cmake-js.md                  
npm notice 159B    CODE_OF_CONDUCT.md               
npm notice 3.2kB   CONTRIBUTING.md                  
npm notice 643B    doc/conversion-tool.md           
npm notice 2.2kB   doc/creating_a_release.md        
npm notice 6.7kB   doc/dataview.md                  
npm notice 1.6kB   doc/date.md                      
npm notice 3.9kB   doc/env.md                       
npm notice 7.2kB   doc/error_handling.md            
npm notice 3.3kB   doc/error.md                     
npm notice 2.6kB   doc/escapable_handle_scope.md    
npm notice 2.4kB   doc/external.md                  
npm notice 8.1kB   doc/function_reference.md        
npm notice 13.0kB  doc/function.md                  
npm notice 578B    doc/generator.md                 
npm notice 1.9kB   doc/handle_scope.md              
npm notice 3.8kB   doc/hierarchy.md                 
npm notice 15.2kB  doc/instance_wrap.md             
npm notice 1.2kB   LICENSE.md                       
npm notice 1.1kB   doc/memory_management.md         
npm notice 657B    doc/name.md                      
npm notice 3.0kB   doc/node-gyp.md                  
npm notice 3.6kB   doc/number.md                    
npm notice 3.9kB   doc/object_lifetime_management.md
npm notice 3.4kB   doc/object_reference.md          
npm notice 21.1kB  doc/object_wrap.md               
npm notice 7.8kB   doc/object.md                    
npm notice 869B    doc/prebuild_tools.md            
npm notice 2.1kB   doc/promises.md                  
npm notice 9.7kB   doc/property_descriptor.md       
npm notice 1.7kB   doc/range_error.md               
npm notice 1.5kB   benchmark/README.md              
npm notice 12.1kB  README.md                        
npm notice 3.2kB   tools/README.md                  
npm notice 3.0kB   doc/reference.md                 
npm notice 2.2kB   doc/setup.md                     
npm notice 2.6kB   doc/string.md                    
npm notice 1.5kB   doc/symbol.md                    
npm notice 10.1kB  doc/threadsafe_function.md       
npm notice 6.9kB   doc/threadsafe.md                
npm notice 1.7kB   doc/type_error.md                
npm notice 3.9kB   doc/typed_array_of.md            
npm notice 1.5kB   doc/typed_array.md               
npm notice 10.8kB  doc/typed_threadsafe_function.md 
npm notice 7.7kB   doc/value.md                     
npm notice 1.2kB   doc/version_management.md        
npm notice 1.5kB   .travis.yml                      
npm notice 708B    appveyor.yml                     
npm notice 1.7kB   .github/workflows/ci.yml         
npm notice 571B    .github/workflows/linter.yml     
npm notice 529B    .github/workflows/stale.yml      
npm notice === Tarball Details === 
npm notice name:          node-addon-api                          
npm notice version:       3.1.0                                   
npm notice filename:      node-addon-api-3.1.0.tgz                
npm notice package size:  122.3 kB                                
npm notice unpacked size: 692.8 kB                                
npm notice shasum:        ec4cf1fb4c5160cba394d6b3b5d05042290f32af
npm notice integrity:     sha512-m/9HcGzaaOcEO[...]WWMrTobkFXiUA==
npm notice total files:   88                                      

What will be published with this change:

npm notice === Tarball Contents === 
npm notice 0       nothing.c            
npm notice 132B    node_api.gyp         
npm notice 762B    common.gypi          
npm notice 381B    except.gypi          
npm notice 386B    noexcept.gypi        
npm notice 7.3kB   napi-inl.deprecated.h
npm notice 186.1kB napi-inl.h           
npm notice 109.8kB napi.h               
npm notice 3.2kB   tools/check-napi.js  
npm notice 1.5kB   tools/clang-format.js
npm notice 15.3kB  tools/conversion.js  
npm notice 296B    index.js             
npm notice 467B    package-support.json 
npm notice 7.9kB   package.json         
npm notice 56.9kB  CHANGELOG.md         
npm notice 1.2kB   LICENSE.md           
npm notice 12.1kB  README.md            
npm notice 3.2kB   tools/README.md      
npm notice === Tarball Details === 
npm notice name:          node-addon-api                          
npm notice version:       3.1.0                                   
npm notice filename:      node-addon-api-3.1.0.tgz                
npm notice package size:  64.7 kB                                 
npm notice unpacked size: 406.8 kB                                
npm notice shasum:        eb97120df340bea2ffac8907bd86a0525baea63d
npm notice integrity:     sha512-gCYIFC9Rh4QqL[...]sgbinf/uHsKxw==
npm notice total files:   18                                      

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. @nodejs/addon-api any concerns?

Base automatically changed from master to main January 26, 2021 22:43
@gengjiawen
Copy link
Member

LGTM. @nodejs/addon-api any concerns?

TBH, I like the old way better. Npm packages shouldn't target minimum. .clang-format and docs are nice to have for me.

@mhdawson
Copy link
Member

mhdawson commented Feb 5, 2021

We discussed in the NODE-API meeting and we agreed to give this a try and then see if we get complaints/concerns about the docs not being there. They will still be available through a clone of the github repo.

mhdawson pushed a commit that referenced this pull request Feb 12, 2021
@mhdawson
Copy link
Member

Landed as 458d895

@mhdawson mhdawson closed this Feb 12, 2021
@lovell lovell deleted the npm-pack-list-of-files branch February 12, 2021 22:10
kevindavies8 added a commit to kevindavies8/node-addon-api-Develop that referenced this pull request Aug 24, 2022
Marlyfleitas added a commit to Marlyfleitas/node-api-addon-Development that referenced this pull request Aug 26, 2022
wroy7860 added a commit to wroy7860/addon-api-benchmark-node that referenced this pull request Sep 19, 2022
johnfrench3 pushed a commit to johnfrench3/node-addon-api-git that referenced this pull request Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants