Skip to content

Fix pnpm app package discovery and unify tokenizer creation - #480

Merged
ospfranco merged 4 commits into
mainfrom
fix/podspec-app-package-json-followups
Nov 5, 2026
Merged

ospfranco merged 4 commits into
mainfrom
fix/podspec-app-package-json-followups

Conversation

@ospfranco

@ospfranco ospfranco commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Follows up the work on #479

  • Simplified how the tokenizers generation works, instead of trying to make it automatic which SwiftPM just blocks now an extra command based on react-native.config.js is the only entrypoint to call the generation logic
  • In theory everything should work under pnpm repos which are a pain in the ass and if this doesn't work or people keep complaining or trying to add more and more logic to this, I might consider to just dropping support for it, it's just a never ending source of changes

rachitsrivastava07 and others added 4 commits November 4, 2026 18:13
The podspec walked up from its own folder to the first package.json. Under
pnpm that folder is in the store, so in a monorepo the walk ended at the
workspace root and ignored the app's "op-sqlite" config: a SQLCipher app
built plain SQLite. Android already reads the app's package.json.

The old lookup stays as it was. After it, when CocoaPods found a Podfile, the
podspec walks up from the app (the folder above the Podfile), no higher than
the folder the old lookup found, and uses the first package.json with an
"op-sqlite" key. A config in a monorepo root package.json still works, and
nothing above the workspace is read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The autolinker hands SwiftPM this package through a symlink inside the app,
and #filePath keeps that path. It is not inside node_modules, so isUserApp was
false and the manifest read example/package.json, which the published package
does not ship: the app's "op-sqlite" config was ignored. Search from the real
directory instead, then prefer the app's package.json as the podspec does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ftPM

Reading the app's config switched on tokenizer code that didn't work in consumer
apps: SwiftPM failed to compile, and CocoaPods under pnpm looked for c_sources
inside the store.

Lookup:
- Check the app's package.json first, then fall back to the old search, in both
  the podspec and Package.swift. This replaces the walk and its bound, and also
  fixes installs outside the app's folder.
- isUserApp in Package.swift now looks at the real directory.

Tokenizers:
- react-native.config.js is now the only place that generates tokenizers.h. The
  React Native CLI loads it, so `npx react-native config`, `use_native_modules!`,
  Gradle's autolinking and `spm add`/`update`/`sync` all run it. Remove
  generate_tokenizers_header_file.rb and the Gradle generator function.
- It also copies the app's c_sources into the package, so SwiftPM compiles them
  the same way the podspec does. Edits to c_sources need `spm update`.
- c_sources lives next to the package.json holding the config, and doesn't exist
  in a from-scratch app. The lifecycle is: set "tokenizers", run the command to
  generate the folder and header, fill in the sources, commit. All three build
  systems stop with a message naming the next step if something is missing, and
  SwiftPM leaves c_sources out of the build when tokenizers are off.

Docs:
- Add the tokenizer steps to the README and update the tokenizers page.
- Android reads only the app's package.json.
- SwiftPM's manifest cache ignores package.json edits. Document the command that
  clears it.
- Remove the comment saying SQLCipher is untested under SwiftPM; the
  ios-sqlcipher CI job covers it.
@ospfranco ospfranco changed the title Fix/podspec app package json followups Fix pnpm app package discovery and unify tokenizer creation Nov 5, 2026
@ospfranco
ospfranco merged commit f837927 into main Nov 5, 2026
10 checks passed
@ospfranco
ospfranco deleted the fix/podspec-app-package-json-followups branch November 5, 2026 15:59
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