Skip to content

fix: stop publishing build output and local machine paths to npm - #85

Merged
tekinalper merged 1 commit into
developfrom
fix/npm-package-contents
Sep 3, 2026
Merged

tekinalper merged 1 commit into
developfrom
fix/npm-package-contents

Conversation

@tekinalper

@tekinalper tekinalper commented Sep 3, 2026 •

Copy link
Copy Markdown
Collaborator

What it does

The files allowlist in package.json included android/ wholesale. npm's allowlist takes precedence over .gitignore for explicitly included directories, so every local build artifact was published even though .gitignore already covers them and git doesn't track them.

The 1.9.2 tarball currently on npm ships 245 files (912 kB), of which 214 are junk:

  • android/build/ (166 files): compiled .class, .dex, Gradle transform caches
  • android/.gradle/ (31) and android/.idea/ (17): local tool state
  • android/local.properties: contains an absolute SDK path from the publisher's own machine (sdk.dir=/Users/<name>/Library/Android/sdk), in a file whose own header says it must not be checked in
  • ios/**/xcuserdata/: Xcode UI state including the publisher's username

Narrows files to the sources consumers actually build against, with explicit negations so this can't regress if the directory patterns are widened again. Also drops react-native.config.js from the list — no such file exists in the repo, and the gradle wrapper / settings.gradle, which build the library standalone and aren't used by consumers.

Result: 245 files / 912 kB → 24 files / 20.9 kB.

How to test it

  1. npm pack --dry-run (or npm publish --dry-run) from the repo root and confirm the file list is limited to src/, android/src/, android/build.gradle, android/gradle.properties, ios/ (minus xcuserdata/), index.js, index.d.ts, refiner-react-native.podspec, README.md, package.json.
  2. Install the repacked tarball into a fresh Expo app and run expo prebuild for both platforms — confirmed already (see below).

Acceptance criteria

  • Published tarball no longer contains android/build/, android/.gradle/, android/.idea/, local.properties, or ios/**/xcuserdata/.
  • No absolute local filesystem paths in the published package.
  • Consumer builds are unaffected — codegen regenerates the native spec from src/, so dropping the prebuilt android/build/ output costs nothing.

Link to ticket

No Trello card — found and fixed directly.

Verification (from the commit)

Installed the repacked tarball into a fresh Expo SDK 57 app (RN 0.86) and ran expo prebuild:

  • Android: BUILD SUCCESSFUL; RNRefinerPackage autolinked into PackageList; NativeRNRefinerSpec, RNRefinerTurboModule, RNRefinerPackage all present in the APK dex.
  • iOS: BUILD SUCCEEDED; pod resolved and linked from Podfile.lock.

Rebased onto current develop (post Dependabot-fix commit 92dc945) — same single-file diff, no conflicts.

🤖 Generated with Claude Code

The "files" allowlist included "android/" wholesale. npm's allowlist takes
precedence over .gitignore for explicitly included directories, so every
local build artifact was published even though .gitignore already covers
them and git does not track them.

The 1.9.2 tarball shipped 245 files (912 kB), of which 214 were junk:
- android/build/ (166 files): compiled .class, .dex, Gradle transform caches
- android/.gradle/ (31) and android/.idea/ (17): local tool state
- android/local.properties: contains an absolute SDK path from the
  publisher's machine (sdk.dir=/Users/<name>/Library/Android/sdk), in a
  file whose own header says it must not be checked in
- ios/**/xcuserdata/: Xcode UI state including the publisher's username

Narrow "files" to the sources consumers actually build against, and add
explicit negations so this cannot regress if the directory patterns are
widened again. Also drop react-native.config.js from the list; no such
file exists in the repo.

Result: 245 files / 912 kB -> 24 files / 20.9 kB.

The gradle wrapper and settings.gradle were also dropped: those build the
library standalone and are unused by consumers, which the verification
below confirms.

Verified by installing the repacked tarball into a fresh Expo SDK 57 app
(RN 0.86) and running expo prebuild:
- Android: BUILD SUCCESSFUL; RNRefinerPackage autolinked into PackageList;
  NativeRNRefinerSpec, RNRefinerTurboModule, RNRefinerPackage all present
  in the APK dex (codegen regenerates the spec from src/, so removing the
  prebuilt android/build/ output costs nothing)
- iOS: BUILD SUCCEEDED; pod resolved and linked from Podfile.lock

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@tekinalper

Copy link
Copy Markdown
Collaborator Author

Reviewed & verified

@tekinalper
tekinalper merged commit 82171d9 into develop Sep 3, 2026
2 checks passed
@tekinalper
tekinalper deleted the fix/npm-package-contents branch September 3, 2026 15:19
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.

1 participant