The generator

scripts/generate-packages.ts is the one piece of code that stitches feature siblings into the app shell. It reads tinycld.packages.ts, walks each linked package’s manifest, and produces a tree of thin re-exports, typed registrations, symlinks, and Go module directives - everything the app shell needs to find and load your package. The generator runs automatically before npm run dev and npm run build:web; you rarely invoke it directly.

What it does

Each run, the generator produces the following outputs. Every one of these files (and their parent directories, where relevant) is gitignored - they regenerate on every run.

Route re-exports

For each package with routes.directory, every .tsx/.ts/.jsx/.js file in that directory becomes a thin re-export under app/a/[orgSlug]/<slug>/:

export { default } from '@tinycld/mail/screens/index'

Nested folders and layout files are preserved. Non-route extensions (helpers, styles) are ignored.

For each package with publicRoutes.directory, files are re-exported under app/<relpath> directly - no org prefix. drive/public-screens/share/[token].tsx becomes app/share/[token].tsx. Cross-package path collisions cause the generator to throw with both package names listed.

Typed wiring under lib/generated/

Server-side outputs

The generator tracks every file and symlink it emits in .package-links.json. On the next run, it removes everything from the previous run before regenerating - cleanup is automatic.

When it runs

npm run dev           # dev.ts: packages:generate → expo + pocketbase + proxy
npm run start         # alias of dev
npm run build:web     # prebuild:web → packages:generate → expo export:web
npm run packages:link # runs generate at the end
npm run packages:unlink
npm run packages:generate  # manual re-run, sometimes useful after editing a manifest

If a package’s manifest or directory layout changes and you haven’t restarted dev, npm run packages:generate by hand picks up the new output.

Footguns

Reference

For the complete list of generated artifacts and where each lives, see Generated files. For the manifest fields that drive the generator, see Manifest schema.