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

Use .npmignore instead of files field #154

Merged
merged 1 commit into from
Jun 28, 2020
Merged

Use .npmignore instead of files field #154

merged 1 commit into from
Jun 28, 2020

Conversation

sonicdoe
Copy link
Contributor

@sonicdoe sonicdoe commented Jun 2, 2020

Fixes publication of extraneous files when using Yarn. See yarnpkg/yarn#685 (comment).

You can compare npm’s and Yarn’s final packages by running npm pack and yarn pack. Don’t be surprised about some shallow differences as Yarn generates the package in a slightly different way.

Fixes #143.

With Yarn, the files field always overrides .npmignore files. See yarnpkg/yarn#685 (comment).
@cooperka
Copy link
Owner

Love it, thanks! I may use this for other projects since it keeps things simple.

Comparison, for posterity:

# tree npm.tgz

package
├── LICENSE
├── README.md
├── RNSnackbar.podspec
├── android
│   ├── build.gradle
│   ├── gradle
│   │   └── wrapper
│   │       ├── gradle-wrapper.jar
│   │       └── gradle-wrapper.properties
│   ├── gradle.properties
│   ├── gradlew
│   ├── gradlew.bat
│   ├── proguard-rules.pro
│   └── src
│       └── main
│           ├── AndroidManifest.xml
│           └── java
│               └── com
│                   └── azendoo
│                       └── reactnativesnackbar
│                           ├── SnackbarModule.java
│                           └── SnackbarPackage.java
├── ios
│   ├── RNSnackBarView.h
│   ├── RNSnackBarView.m
│   ├── RNSnackbar.h
│   ├── RNSnackbar.m
│   └── RNSnackbar.xcodeproj
│       ├── project.pbxproj
│       └── project.xcworkspace
│           ├── contents.xcworkspacedata
│           └── xcshareddata
│               └── IDEWorkspaceChecks.plist
├── lib
│   └── index.js
├── package.json
└── src
    ├── index.d.ts
    └── index.js

15 directories, 24 files
# tree yarn.tgz

├── LICENSE
├── README.md
├── RNSnackbar.podspec
├── android
│   ├── build.gradle
│   ├── gradle
│   │   └── wrapper
│   │       ├── gradle-wrapper.jar
│   │       └── gradle-wrapper.properties
│   ├── gradle.properties
│   ├── gradlew
│   ├── gradlew.bat
│   ├── proguard-rules.pro
│   └── src
│       └── main
│           ├── AndroidManifest.xml
│           └── java
│               └── com
│                   └── azendoo
│                       └── reactnativesnackbar
│                           ├── SnackbarModule.java
│                           └── SnackbarPackage.java
├── ios
│   ├── RNSnackBarView.h
│   ├── RNSnackBarView.m
│   ├── RNSnackbar.h
│   ├── RNSnackbar.m
│   └── RNSnackbar.xcodeproj
│       ├── project.pbxproj
│       ├── project.xcworkspace
│       │   ├── contents.xcworkspacedata
│       │   ├── xcshareddata
│       │   │   └── IDEWorkspaceChecks.plist
│       │   └── xcuserdata
│       │       └── klap-hotel.xcuserdatad
│       │           └── UserInterfaceState.xcuserstate
│       └── xcuserdata
│           └── klap-hotel.xcuserdatad
│               ├── xcdebugger
│               │   └── Breakpoints_v2.xcbkptlist
│               └── xcschemes
│                   ├── RNSnackbar.xcscheme
│                   └── xcschememanagement.plist
├── lib
│   └── index.js
├── package.json
└── src
    ├── index.d.ts
    └── index.js

21 directories, 28 files

@cooperka cooperka merged commit 7135230 into cooperka:master Jun 28, 2020
@sonicdoe sonicdoe deleted the npmignore branch June 30, 2020 08:32
@sonicdoe
Copy link
Contributor Author

Interesting, so Yarn still includes xcuserdata. Since most of the extraneous files are now gone, I’ll leave it be. Perhaps this will be improved in a future version of Yarn 🙂

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.

Reduce size of npm package (when published via Yarn)
2 participants