Skip to content

Include wasm files in package: manually remove .gitignore file generated by wasm-pack#273

Merged
thesayyn merged 1 commit intothesayyn:mainfrom
treebirg:main
Aug 3, 2025
Merged

Include wasm files in package: manually remove .gitignore file generated by wasm-pack#273
thesayyn merged 1 commit intothesayyn:mainfrom
treebirg:main

Conversation

@treebirg
Copy link
Contributor

@treebirg treebirg commented Aug 3, 2025

#272 did not have the desired result: .gitignore files in subdirectories take precedence over the files field in package.json so the wasm files are still ignored.

This change manually removes the .gitignore file generated by wasm-pack before publishing.

Below is the output of npm pack before and after removing the .gitignore file. Showing that the package should now include the required files.

~/treebirg/protoc-gen-ts/js/plugin main
❯ npm pack --dry-run  
npm notice 
npm notice 📦  protoc-gen-ts@0.0.0
npm notice === Tarball Contents === 
npm notice 282B main.js     
npm notice 621B package.json
npm notice === Tarball Details === 
npm notice name:          protoc-gen-ts                           
npm notice version:       0.0.0                                   
npm notice filename:      protoc-gen-ts-0.0.0.tgz                 
npm notice package size:  539 B                                   
npm notice unpacked size: 903 B                                   
npm notice shasum:        b6ccc135697cc68b8f658264f757ba42725c4cbe
npm notice integrity:     sha512-hRiW1cnyJf+xP[...]RApRkvk4KCyow==
npm notice total files:   2                                       
npm notice 
protoc-gen-ts-0.0.0.tgz

after removing .gitignore

~/treebirg/protoc-gen-ts/js/plugin main
❯ rm dist/.gitignore 

~/treebirg/protoc-gen-ts/js/plugin main*
❯ npm pack --dry-run
npm notice 
npm notice 📦  protoc-gen-ts@0.0.0
npm notice === Tarball Contents === 
npm notice 2.0MB dist/plugin_bg.wasm     
npm notice 436B  dist/plugin_bg.wasm.d.ts
npm notice 153B  dist/plugin.d.ts        
npm notice 4.9kB dist/plugin.js          
npm notice 282B  main.js                 
npm notice 621B  package.json            
npm notice === Tarball Details === 
npm notice name:          protoc-gen-ts                           
npm notice version:       0.0.0                                   
npm notice filename:      protoc-gen-ts-0.0.0.tgz                 
npm notice package size:  637.6 kB                                
npm notice unpacked size: 2.0 MB                                  
npm notice shasum:        56f34930274e569d900ffcbb020a470e039a91e2
npm notice integrity:     sha512-ezmgACtEfIMhQ[...]FoR7DbKcWucKQ==
npm notice total files:   6                                       
npm notice 
protoc-gen-ts-0.0.0.tgz

See also: Don't create .gitignore in pkg directory #1408

@treebirg treebirg changed the title Include wasm files in package, part II: manually remove .gitignore file generated by wasm-pack Include wasm files in package: manually remove .gitignore file generated by wasm-pack Aug 3, 2025
@thesayyn thesayyn merged commit 052235f into thesayyn:main Aug 3, 2025
1 check passed
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