Skip to content
Lucent
SEARCH LUCENT

Search guides, APIs, and examples.

GitHub

Very early and experimental. The language, the generated native code and every package API change without notice. Do not use Lucent in production.

Publish a Lucent library

An npm package with a lucent field in package.json, its modules as source, and a lucent.json for its native needs.

trip-tracker/package.json
{
"name": "trip-tracker",
"version": "1.0.0",
"files": [
"index.ts",
"src",
"lucent.json"
],
"main": "index.ts",
"lucent": {
"sources": "src",
"compatible": ">=0.0.3"
}
}
  • lucent.sources is the folder with the package's modules. lucent.compatible is the range of Lucent versions it supports; an app outside it fails to build, naming the package.
  • main re-exports the modules. Metro swaps each for its proxy in the app.
  • The package ships sources only. The app compiles them with its own modules, with its own Lucent, into its one native package.
  • lucent.json lists what the modules need from the app: pods, Gradle dependencies, permissions, Info.plist entries. The app's build merges them, and fails if two packages' needs cannot both hold. See lucent.json.
  • Modules are named <package>/<module>, so two packages can each have a storage module.
terminal
npm publish

This is the tutorial's package, which step 8 makes. examples/lucent-haptics is another.