wayfair / one-version

Implementation of Google’s One Version Rule for JS monorepos
https://www.npmjs.com/package/@wayfair/one-version
MIT License
24 stars 4 forks source link

Remove unnecessary files from published package #9

Closed finn-orsini closed 2 years ago

finn-orsini commented 2 years ago

What

Add an .npmignore or files config to remove extraneous files from the published package

Why

To have the published package be as small as possible

finn-orsini commented 2 years ago

In #15, added a files config which handles the majority of this issue. Resulting pack is:

npm notice === Tarball Contents === 
npm notice 1.1kB LICENSE                                 
npm notice 1.6kB src/check.js                            
npm notice 883B  src/pnpm/check.js                       
npm notice 615B  src/yarn/check.js                       
npm notice 402B  src/shared/constants.js                 
npm notice 1.3kB src/format-output.js                    
npm notice 387B  src/pnpm/get-workspaces.js              
npm notice 368B  src/yarn/get-workspaces.js              
npm notice 708B  src/index.js                            
npm notice 4.8kB src/shared/util.js                      
npm notice 868B  package.json                            
npm notice 228B  src/__fixtures__/mock-app-a/package.json
npm notice 228B  src/__fixtures__/mock-app-b/package.json
npm notice 228B  src/__fixtures__/mock-app-c/package.json
npm notice 188B  src/__fixtures__/mock-lib-a/package.json
npm notice 862B  CHANGELOG.md                            
npm notice 3.7kB README.md                               
npm notice === Tarball Details === 
npm notice name:          @wayfair/one-version                    
npm notice version:       0.1.2                                   
npm notice package size:  6.8 kB                                  
npm notice unpacked size: 18.3 kB                                 
+ @wayfair/one-version@0.1.2

Unfortunately still includes a couple extra files, i.e. __fixtures__/mock-app-a/package.json. These match the *.js glob pattern. I tried excluding .json specifically with no luck.

We may want to move the files around so tests / fixtures aren't at the same dir level as the package, so we can more easily allowlist just the lib contents 🤔