Skip to content

feat: add typescript definitions #8

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

Merged
merged 1 commit into from
Dec 6, 2020

Conversation

petermikitsh
Copy link
Contributor

Adds TypeScript definitions

The build process was already emitting types, however, types must be specified in package.json so the TypeScript Compiler can find them.

Also, I added "files": ["dist"] to package.json to only publish the necessary files to NPM. This reduces download size from 218.9 kB to 4.6 kB

Before:

$ npm publish --dry-run

> use-overflow@1.0.2 prepare .
> yarn run build

yarn run v1.22.5
$ rollup -c

src/index.tsx → dist/index.js, dist/index.es.js...
created dist/index.js, dist/index.es.js in 1.2s
✨  Done in 1.81s.
npm notice 
npm notice 📦  use-overflow@1.0.2
npm notice === Tarball Contents === 
npm notice 147B    .editorconfig               
npm notice 26B     .env                        
npm notice 26B     example/.env                
npm notice 1.1kB   LICENSE                     
npm notice 1.6kB   example/src/index.css       
npm notice 451B    example/public/index.html   
npm notice 3.0kB   example/src/App.js          
npm notice 4.5kB   dist/index.es.js            
npm notice 4.6kB   dist/index.js               
npm notice 164B    example/src/index.js        
npm notice 720B    rollup.config.js            
npm notice 180B    example/public/manifest.json
npm notice 584B    example/package.json        
npm notice 1.2kB   package.json                
npm notice 896B    tsconfig.json               
npm notice 87B     tsconfig.test.json          
npm notice 465.8kB example/yarn.lock           
npm notice 6.4kB   dist/index.es.js.map        
npm notice 6.5kB   dist/index.js.map           
npm notice 104.9kB example/README.md           
npm notice 1.1kB   README.md                   
npm notice 291B    dist/index.d.ts             
npm notice 40B     src/react-app-env.d.ts      
npm notice 137B    dist/useWindowSize.d.ts     
npm notice 911B    src/useWindowSize.ts        
npm notice 2.4kB   src/index.tsx               
npm notice 68B     .travis.yml                 
npm notice === Tarball Details === 
npm notice name:          use-overflow                            
npm notice version:       1.0.2                                   
npm notice package size:  218.9 kB                                
npm notice unpacked size: 607.8 kB                                
npm notice shasum:        a7126b38673f355af1e022d087f08007fdcf6c9b
npm notice integrity:     sha512-Pnno2GZ5YRuYg[...]xPr/BcvUMLgvg==
npm notice total files:   27                                      
npm notice 
+ use-overflow@1.0.2

After:

$ npm publish --dry-run

> use-overflow@1.0.2 prepare .
> yarn run build

yarn run v1.22.5
$ rollup -c

src/index.tsx → dist/index.js, dist/index.es.js...
created dist/index.js, dist/index.es.js in 1.2s
✨  Done in 1.81s.
npm notice 
npm notice 📦  use-overflow@1.0.2
npm notice === Tarball Contents === 
npm notice 1.1kB LICENSE                
npm notice 4.5kB dist/index.es.js       
npm notice 4.6kB dist/index.js          
npm notice 1.3kB package.json           
npm notice 6.4kB dist/index.es.js.map   
npm notice 6.5kB dist/index.js.map      
npm notice 1.1kB README.md              
npm notice 291B  dist/index.d.ts        
npm notice 137B  dist/useWindowSize.d.ts
npm notice === Tarball Details === 
npm notice name:          use-overflow                            
npm notice version:       1.0.2                                   
npm notice package size:  4.6 kB                                  
npm notice unpacked size: 25.8 kB                                 
npm notice shasum:        b9c908eee4208c7b54e6dd25009374bfdf8fd0b6
npm notice integrity:     sha512-Aeod2xWO1YBg5[...]FO5EjdAEDV8sQ==
npm notice total files:   9                                       
npm notice  notice total files:   9                                       
npm notice 
+ use-overflow@1.0.2

Copy link
Owner

@amorriscode amorriscode left a comment

Choose a reason for hiding this comment

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

Amazing! Thanks!

Closes #7

@amorriscode amorriscode merged commit 356d1e5 into amorriscode:master Dec 6, 2020
@amorriscode amorriscode mentioned this pull request Dec 6, 2020
@petermikitsh petermikitsh deleted the add-type-defs branch December 6, 2020 22:07
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.

2 participants